-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iframe flickering #7868
Comments
In some other logs, I see a lot of:
…when there's not resize. |
Adding a requestAnimationFrame loop makes the flickering obvious. I've updated the example. |
From the logs, I see:
That looks suspicious to me. Where is the code that checks that the iframe frame did indeed change? |
Trying to figuring out what's going on. Struggling between the logs, lldb and some random println, I'm slowly starting to have a better picture of the situation. Compositing ticks animations ( I guess this is what makes the page flicker. So somewhere in there we should have figured that the iframe size hasn't change, and never send the The code I use to debug this: <style>
div {
width: 100px;
height: 100px;
background: red;
}
iframe {
}
</style>
<div style=""></div>
<iframe src='http://example.com'></iframe>
<script>
document.documentElement.addEventListener('keyup', () => {
requestAnimationFrame(() => {});
});
</script> |
If anyone could tell me if I'm on the right track and give me a hint to where to look next, that would be very nice :) |
If we want to short-circuit resize messages, the place to do so would be either |
On the other hand, perhaps we could short-circuit in |
This could be a straightforward incremental reflow "jumpiness" bug and not iframe-specific, BTW. |
Not to self: when RAF is called, the compositor gets a |
Like @jdm said, the 2 options are |
In |
I was wrong. In there, we don't have to send the DOM event. |
The display list doesn't include the iframe content when the This is a trace of what happens between the
Display list when the reflow happens:
Display list when the reflow in the iframe is skipped because its size hasn't changed:
|
Trying to summarize the situation: On The iframe document is forced to reflow on This forced reflow should not happen. And that's probably related to the flickering (the cause or a sign that something is not behaving the way it should). So I tried to prevent this forced reflow: master...paulrouget:flickeringIframe But then, after a Dumping the display lists (see previous comment), I see that the one for the iframe is not present. My guess is that the reflow of the iframe document was building a new display list, and because this reflow is not happening anymore, the display list is just … empty? Not built? Is there some DLBI happening that would eventually clear the iframe? What would be the right way to re-use the old display list? There are some other things I don't understand here:
Any help would be appreciated :) |
Perhaps @glennw can answer some of these questions :) |
Sorry, meant to look at this today and got distracted - will follow up soon. |
It does seem like we're doing a paint after rAF even when not necessary. It looks like it updates the styles for any animations, and assumes that it will need to do a new display list generation and paint. But in the case of a rAF with no actual animations or node changes, this isn't the case. @pcwalton Is it easy to detect this case (no animations changed) and avoid the unnecessary paint? A display list is built for each layout, and then handed off to the paint task. The paint task replaces the existing display list each time it receives a new display list from the layout task. @paulrouget What happens if you early out from update_subpage_size_if_necessary() if the frame size is the same as the existing frame size? I haven't looked into it too deeply, but this seems like the right place to avoid spurious iframe reflows. |
Is the problem that the animation state is either AnimationsPresent, AnimationCallbacksPresent, NoAnimationsPresent or NoAnimationCallbacksPresent, and there's no way to know if a callback is present and no animation is running?
I don't know if it's possible to actually do it in |
I think you should be able to avoid calling update_subpage_size_if_necessary() by passing a result back from update_layer_if_exists() that says whether the size of rect was different (see the update_layer method in CompositorLayer). |
It works. But iframe is cleared as well. |
OK, thanks for checking. I will debug with your repro in the morning and let you know what I find. I did briefly try your test case above on webrender and there is no flickering - although it doesn't clip the iframe correctly yet. |
I can see the problem. It's not clear to me what the best fix is yet - @pcwalton may have some thoughts, since he's been working on this stuff lately. If not, I'll dig into it again tomorrow. The iframe has a normal root layer and also a layer for the scrolling region. However, the scrolling layer doesn't have any subpage info associated with it so when the root pipeline supplies a new set of layers, the collect_old_layers functionality removes the scroll layer from the compositor. Possible solutions might be (a) storing the subpage info in sub-layers so they aren't collected (b) passing some kind of "current owner" during recursion in collect_old_layers to avoid collecting sub-layers (c) perhaps collecting old layers should stop recursing once it gets to a subpage of the pipeline being considered? I'm not sure if those options would have side effects or which would be preferable? |
I filed an issue for the rAF bug: #8075 |
@paulrouget Now that #8089 has landed, could you confirm that it fixes this issue, and check if it fixes the scroll issue you referenced above? (I believe it will also fix the iframe navigation regression issue you reported). |
In browser.html, moving the mouse outside of the iframe makes the iframe flicker a lot.
This minimal test case shows some flickering. Load the page, then move the mouse over the red element (not the iframe). The iframe flickers once in a while. It's not as obvious as in browser.html, but still easy to see.
See these logs. Passed the initial load, the only thing that happens is the mouse hovering some text outside of the iframe. But I see layout/reflow operations, for both documents. Not sure if that suppose to happen. The flickering happens somewhere in the 2 last seconds.
Edit: Adding a
requestAnimationFrame
loop makes the flickering obvious. I've updated the example.The text was updated successfully, but these errors were encountered: