Bug 1220114. Part 1. Change ScrollFrameHelper::DecideScrollableLayer to recompute the current animated geometry root any time mWillBuildScrollableLayer changes in addition to when usingDisplayPort changes. r=mstange
authorTimothy Nikkel <tnikkel@gmail.com>
Fri, 06 Nov 2015 17:32:03 -0600
changeset 271621 7b7e78df378059cb1fc7b895ffe30de423cc1f2e
parent 271620 c13fae0ffac1c3a90258be4d61ae569e570f9408
child 271622 ac5202696eb28fa7bac0a1ea77dd75258cec3987
push id67710
push usertnikkel@gmail.com
push dateFri, 06 Nov 2015 23:32:14 +0000
treeherdermozilla-inbound@ac5202696eb2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1220114
milestone45.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 1220114. Part 1. Change ScrollFrameHelper::DecideScrollableLayer to recompute the current animated geometry root any time mWillBuildScrollableLayer changes in addition to when usingDisplayPort changes. r=mstange Changes in either one can result in AGRs being created or removed (although nothing removes them at this point in time).
layout/generic/nsGfxScrollFrame.cpp
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -3155,20 +3155,24 @@ ScrollFrameHelper::BuildDisplayList(nsDi
   scrolledContent.MoveTo(aLists);
 }
 
 bool
 ScrollFrameHelper::DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
                                          nsRect* aDirtyRect,
                                          bool aAllowCreateDisplayPort)
 {
+  // Save and check if this changes so we can recompute the current agr.
+  bool oldWillBuildScrollableLayer = mWillBuildScrollableLayer;
+
+  bool wasUsingDisplayPort = false;
   bool usingDisplayPort = false;
   nsIContent* content = mOuter->GetContent();
   if (aBuilder->IsPaintingToWindow()) {
-    bool wasUsingDisplayPort = nsLayoutUtils::GetDisplayPort(content);
+    wasUsingDisplayPort = nsLayoutUtils::GetDisplayPort(content);
 
     nsRect displayportBase = *aDirtyRect;
     nsPresContext* pc = mOuter->PresContext();
     if (mIsRoot && (pc->IsRootContentDocument() || !pc->GetParentPresContext())) {
       displayportBase =
         nsRect(nsPoint(0, 0), nsLayoutUtils::CalculateCompositionSizeForFrame(mOuter));
     }
 
@@ -3183,33 +3187,33 @@ ScrollFrameHelper::DecideScrollableLayer
       // which should have set a displayport base.
       MOZ_ASSERT(content->GetProperty(nsGkAtoms::DisplayPortBase));
       usingDisplayPort = nsLayoutUtils::GetDisplayPort(content, &displayPort);
     }
 
     // Override the dirty rectangle if the displayport has been set.
     if (usingDisplayPort) {
       *aDirtyRect = displayPort;
-
-      // The cached animated geometry root for the display builder is out of
-      // date if we just introduced a new animated geometry root.
-      if (!wasUsingDisplayPort) {
-        aBuilder->RecomputeCurrentAnimatedGeometryRoot();
-      }
     }
   }
 
   // Since making new layers is expensive, only create a scrollable layer
   // for some scroll frames.
   // When a displayport is being used, force building of a layer so that
   // the compositor can find the scrollable layer for async scrolling.
   // If the element is marked 'scrollgrab', also force building of a layer
   // so that APZ can implement scroll grabbing.
   mWillBuildScrollableLayer = usingDisplayPort || nsContentUtils::HasScrollgrab(content);
 
+  // The cached animated geometry root for the display builder is out of
+  // date if we just introduced a new animated geometry root.
+  if ((oldWillBuildScrollableLayer != mWillBuildScrollableLayer) || (wasUsingDisplayPort != usingDisplayPort)) {
+    aBuilder->RecomputeCurrentAnimatedGeometryRoot();
+  }
+
   if (gfxPrefs::LayoutUseContainersForRootFrames() && mWillBuildScrollableLayer && mIsRoot) {
     mIsScrollableLayerInRootContainer = true;
   }
 
   return mWillBuildScrollableLayer;
 }