Bug 712130 - Back out new flush type introduced in c15a167e6e89 for Bug 1377447. r?bz, r?smaug draft
authordecltype <mozilla@decltype.org>
Mon, 08 Jan 2018 22:52:16 +0100
changeset 717428 6ab11794b4d2bb4ae900809210483916f60a7d1e
parent 717427 92ccfb8aa667d3e7d30de1a1675326caea849879
child 745246 0a6f3440f42bde41fd4fdc4910790fd563b46fc4
push id94666
push userbmo:mozilla@decltype.org
push dateMon, 08 Jan 2018 22:54:45 +0000
reviewersbz, smaug
bugs712130, 1377447
milestone59.0a1
Bug 712130 - Back out new flush type introduced in c15a167e6e89 for Bug 1377447. r?bz, r?smaug The flush type EnsurePresShellInitAndFrames is now unnecessary because autofocus processing is deferred until the document has loaded. We keep the tests introduced in c15a167e6e89. MozReview-Commit-ID: DDE2MLnnkOq
dom/base/FlushType.h
dom/base/nsFocusManager.cpp
dom/html/nsHTMLContentSink.cpp
dom/xml/nsXMLContentSink.cpp
layout/base/PresShell.cpp
parser/html/nsHtml5TreeOpExecutor.cpp
--- a/dom/base/FlushType.h
+++ b/dom/base/FlushType.h
@@ -23,23 +23,22 @@ enum class FlushType : uint8_t {
   None             = 0, /* Actually don't flush anything */
   Event            = 1, /* Flush pending events before notify other observers */
   Content          = 2, /* flush the content model construction */
   ContentAndNotify = 3, /* As above, plus flush the frame model
                            construction and other nsIMutationObserver
                            notifications. */
   Style            = 4, /* As above, plus flush style reresolution */
   Frames           = Style,
-  EnsurePresShellInitAndFrames = 5, /* As above, plus ensure the pres shell is alive */
-  InterruptibleLayout = 6, /* As above, plus flush reflow,
+  InterruptibleLayout = 5, /* As above, plus flush reflow,
                               but allow it to be interrupted (so
                               an incomplete layout may result) */
-  Layout           = 7, /* As above, but layout must run to
+  Layout           = 6, /* As above, but layout must run to
                            completion */
-  Display          = 8, /* As above, plus flush painting */
+  Display          = 7, /* As above, plus flush painting */
   Count
 };
 
 /**
  * This is the enum used by nsIDocument::FlushPendingNotifications to decide
  * whether the current document is skippable.
  */
 enum class FlushTarget : uint8_t {
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -1593,20 +1593,19 @@ nsFocusManager::CheckIfFocusable(nsICont
 
   nsCOMPtr<nsIDocument> doc = aContent->GetComposedDoc();
   // can't focus elements that are not in documents
   if (!doc) {
     LOGCONTENT("Cannot focus %s because content not in document", aContent)
     return nullptr;
   }
 
-  // Make sure that our frames are up to date while ensuring the presshell is
-  // also initialized in case we come from an autofocus event.
+  // Make sure that our frames are up to date
   mEventHandlingNeedsFlush = false;
-  doc->FlushPendingNotifications(FlushType::EnsurePresShellInitAndFrames);
+  doc->FlushPendingNotifications(FlushType::Frames);
 
   nsIPresShell *shell = doc->GetShell();
   if (!shell)
     return nullptr;
 
   // the root content can always be focused,
   // except in userfocusignored context.
   if (aContent == doc->GetRootElement())
--- a/dom/html/nsHTMLContentSink.cpp
+++ b/dom/html/nsHTMLContentSink.cpp
@@ -1014,17 +1014,17 @@ HTMLContentSink::FlushPendingNotificatio
   if (!mInNotification) {
     // Only flush if we're still a document observer (so that our child counts
     // should be correct).
     if (mIsDocumentObserver) {
       if (aType >= FlushType::ContentAndNotify) {
         FlushTags();
       }
     }
-    if (aType >= FlushType::EnsurePresShellInitAndFrames) {
+    if (aType >= FlushType::InterruptibleLayout) {
       // Make sure that layout has started so that the reflow flush
       // will actually happen.
       StartLayout(true);
     }
   }
 }
 
 nsresult
--- a/dom/xml/nsXMLContentSink.cpp
+++ b/dom/xml/nsXMLContentSink.cpp
@@ -1506,17 +1506,17 @@ nsXMLContentSink::FlushPendingNotificati
       // counts should be correct).
       if (aType >= FlushType::ContentAndNotify) {
         FlushTags();
       }
       else {
         FlushText(false);
       }
     }
-    if (aType >= FlushType::EnsurePresShellInitAndFrames) {
+    if (aType >= FlushType::InterruptibleLayout) {
       // Make sure that layout has started so that the reflow flush
       // will actually happen.
       MaybeStartLayout(true);
     }
   }
 }
 
 /**
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -4106,19 +4106,16 @@ PresShell::DoFlushPendingNotifications(m
 #ifdef MOZ_GECKO_PROFILER
   static const EnumeratedArray<FlushType,
                                FlushType::Count,
                                const char*> flushTypeNames = {
     "",
     "Event",
     "Content",
     "ContentAndNotify",
-    // As far as the profiler is concerned, EnsurePresShellInitAndFrames and
-    // Frames are the same
-    "Style",
     "Style",
     "InterruptibleLayout",
     "Layout",
     "Display"
   };
   AUTO_PROFILER_LABEL_DYNAMIC_CSTR("PresShell::DoFlushPendingNotifications",
                                    GRAPHICS, flushTypeNames[flushType]);
 #endif
--- a/parser/html/nsHtml5TreeOpExecutor.cpp
+++ b/parser/html/nsHtml5TreeOpExecutor.cpp
@@ -236,17 +236,17 @@ nsHtml5TreeOpExecutor::SetParser(nsParse
 {
   mParser = aParser;
   return NS_OK;
 }
 
 void
 nsHtml5TreeOpExecutor::FlushPendingNotifications(FlushType aType)
 {
-  if (aType >= FlushType::EnsurePresShellInitAndFrames) {
+  if (aType >= FlushType::InterruptibleLayout) {
     // Bug 577508 / 253951
     nsContentSink::StartLayout(true);
   }
 }
 
 nsISupports*
 nsHtml5TreeOpExecutor::GetTarget()
 {