Bug 1523052 - Only flush pending scroll anchor selection when we have restyling to do. r=emilio a=lizzard
authorRyan Hunt <rhunt@eqrion.net>
Sat, 26 Jan 2019 20:37:45 +0000
changeset 515958 1cccfe09e69b7f57d0261868ddeae5e4f3545fbb
parent 515957 b9933573c6a8d5f14dcba178603e82d054fec936
child 515959 191b3e80ff000ca6f352910e9d8ff8e52834bb70
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio, lizzard
bugs1523052
milestone66.0
Bug 1523052 - Only flush pending scroll anchor selection when we have restyling to do. r=emilio a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D17754
layout/base/RestyleManager.cpp
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -3004,21 +3004,16 @@ void RestyleManager::DoProcessPendingRes
     // PresShell::FlushPendingNotifications doesn't early-return in the case
     // where the PresShell hasn't yet been initialized (and therefore we haven't
     // yet done the initial style traversal of the DOM tree). We should arguably
     // fix up the callers and assert against this case, but we just detect and
     // handle it for now.
     return;
   }
 
-  // Select scroll anchors for frames that have been scrolled. Do this
-  // before restyling so that anchor nodes are correctly marked for
-  // scroll anchor update suppressions.
-  presContext->PresShell()->FlushPendingScrollAnchorSelections();
-
   // Create a AnimationsWithDestroyedFrame during restyling process to
   // stop animations and transitions on elements that have no frame at the end
   // of the restyling process.
   AnimationsWithDestroyedFrame animationsWithDestroyedFrame(this);
 
   ServoStyleSet* styleSet = StyleSet();
   Document* doc = presContext->Document();
 
@@ -3036,16 +3031,21 @@ void RestyleManager::DoProcessPendingRes
 
   if (mRestyleForCSSRuleChanges) {
     aFlags |= ServoTraversalFlags::ForCSSRuleChanges;
   }
 
   while (styleSet->StyleDocument(aFlags)) {
     ClearSnapshots();
 
+    // Select scroll anchors for frames that have been scrolled. Do this
+    // before processing restyled frames so that anchor nodes are correctly
+    // marked when directly moving frames with RecomputePosition.
+    presContext->PresShell()->FlushPendingScrollAnchorSelections();
+
     nsStyleChangeList currentChanges;
     bool anyStyleChanged = false;
 
     // Recreate styles , and queue up change hints (which also handle lazy frame
     // construction).
     {
       AutoRestyleTimelineMarker marker(presContext->GetDocShell(), false);
       DocumentStyleRootIterator iter(doc->GetServoRestyleRoot());