Bug 687441 - Make iframes not cause a FOUC on parent document. r=bzbarsky
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 04 Dec 2019 22:33:32 +0000
changeset 505558 bd5c387d7822ca3f02ad39ad9741f1e0c722c3c4
parent 505557 ebc95c785899006c401fd36b5eae32b9b55eeae2
child 505559 ff6b73da39feca7fefc672fcfa9267ff4948a5df
push id102341
push userealvarez@mozilla.com
push dateWed, 04 Dec 2019 22:34:04 +0000
treeherderautoland@bd5c387d7822 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs687441
milestone73.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 687441 - Make iframes not cause a FOUC on parent document. r=bzbarsky This makes subframes not start layout on the parent document when flushing, which fixes the FOUC issue. It does mean that some resource loads triggered by viewport-dependent media queries might not block onload of the frame, but other style-triggered loads, fonts, and such would. This makes same-origin frames act the same way as cross-origin iframes in this regard if there are stylesheet loads present. I think the trade-off is worth it here, and this is green on try. Differential Revision: https://phabricator.services.mozilla.com/D55860
dom/base/Document.cpp
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -9788,17 +9788,17 @@ void Document::FlushPendingNotifications
   // flush ourselves, then don't flush the parent, since that can cause things
   // like resizes of our frame's widget, which we can't handle while flushing
   // is unsafe.
   // Since media queries mean that a size change of our container can
   // affect style, we need to promote a style flush on ourself to a
   // layout flush on our parent, since we need our container to be the
   // correct size to determine the correct style.
   if (StyleOrLayoutObservablyDependsOnParentDocumentLayout() &&
-      IsSafeToFlush()) {
+      mParentDocument->MayStartLayout() && IsSafeToFlush()) {
     mozilla::ChangesToFlush parentFlush = aFlush;
     if (flushType >= FlushType::Style) {
       parentFlush.mFlushType = std::max(FlushType::Layout, flushType);
     }
     mParentDocument->FlushPendingNotifications(parentFlush);
   }
 
   if (RefPtr<PresShell> presShell = GetPresShell()) {