Open Bug 997255 Opened 6 years ago Updated 2 years ago

Try to not flush layout after hiding an iframe


(Core :: Layout, defect, P3)





(Reporter: smaug, Unassigned)



(Keywords: perf, Whiteboard: [c= p= s= u=]) flushes, and
that shows up in profiles.
There is a case when 'Sheet app 1' during refresh driver tick does
several flushes because
has listener for transitionend which is dispatched during tick and the event listener
removes element from doc.

I don't quite see why we need that explicit flush.
note, the explicit flush is 9% in the profile I'm looking at.
I assume if that flush was removed, some more flushing would be done later during refresh driver tick.
Blocks: 775965
Blocks: 997160
Keywords: perf
Priority: -- → P3
Whiteboard: [c= p= s= u=]
That code is nsSubdocumentFrame trying to distinguish "<iframe> set to display:none (or removed from document)" from "<iframe> is reframed". When an nsSubdocumentFrame is destroyed, it schedules an nsHideViewer as a scriptrunnable. nsHideViewer checks to see if the element has a frame; if it does, then the element was just reframed or moved in the document and we should not tear down the presentation. Otherwise the element has been removed from the document or set to display:none and we should tear down the presentation. Of course, we need to flush out style/frame construction to check whether the element has a frame.

If an <iframe> is being hidden by removing it from the document, we could make nsHideViewer check whether the element is in the document; if it's not, then we know without flushing style that the element won't have a frame and we can tear down the presentation. But if the <iframe> is being hidden by setting it to "display:none", we need to tear down its presentation here.

I suppose we might be able to delay tearing down the presentation until the next style flush, whenever that is triggered, and not trigger one ourselves ever, but that would create weird observable side effects dependent on the timing of style flushes.
See Also: → 522352
See Also: 522352
See Also: → 1368852
You need to log in before you can comment on or make changes to this bug.