Bug 1526486 - Build an async zoom container for event delivery as well. r=mstange
authorBotond Ballo <botond@mozilla.com>
Sat, 16 Feb 2019 00:51:40 +0000
changeset 459631 4009b930fbf1cf77be3cc0ada886dca0db4c8a99
parent 459630 fe6aac2cec49ddca852d54c9b4a15955e38b7bb2
child 459632 11133b5a9855c400b396312b6b11c3f00779560d
push id35563
push userccoroiu@mozilla.com
push dateSat, 16 Feb 2019 09:36:04 +0000
treeherdermozilla-central@1cfd69d05aa1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1526486
milestone67.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 1526486 - Build an async zoom container for event delivery as well. r=mstange Differential Revision: https://phabricator.services.mozilla.com/D19219
layout/base/nsLayoutUtils.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/painting/nsDisplayList.cpp
layout/painting/nsDisplayList.h
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -3600,19 +3600,17 @@ nsresult nsLayoutUtils::PaintFrame(gfxCo
       DisplayListChecker afterMergeChecker;
 
       // If we transition between wrapping the RCD-RSF contents into an async
       // zoom container vs. not, we need to rebuild the display list. This only
       // happens when the zooming or container scrolling prefs are toggled
       // (manually by the user, or during test setup).
       bool shouldAttemptPartialUpdate = useRetainedBuilder;
       bool didBuildAsyncZoomContainer = builder.ShouldBuildAsyncZoomContainer();
-      builder.SetBuildAsyncZoomContainer(
-          gfxPrefs::APZAllowZooming() &&
-          !gfxPrefs::LayoutUseContainersForRootFrames());
+      builder.UpdateShouldBuildAsyncZoomContainer();
       if (builder.ShouldBuildAsyncZoomContainer() !=
           didBuildAsyncZoomContainer) {
         shouldAttemptPartialUpdate = false;
       }
 
       // Attempt to do a partial build and merge into the existing list.
       // This calls BuildDisplayListForStacking context on a subset of the
       // viewport.
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -3890,17 +3890,16 @@ bool ScrollFrameHelper::DecideScrollable
   if (oldWillBuildScrollableLayer != mWillBuildScrollableLayer) {
     aBuilder->RecomputeCurrentAnimatedGeometryRoot();
   }
 
   if (gfxPrefs::LayoutUseContainersForRootFrames() &&
       mWillBuildScrollableLayer && mIsRoot) {
     mIsScrollableLayerInRootContainer = true;
   }
-
   return mWillBuildScrollableLayer;
 }
 
 Maybe<ScrollMetadata> ScrollFrameHelper::ComputeScrollMetadata(
     LayerManager* aLayerManager, const nsIFrame* aContainerReferenceFrame,
     const Maybe<ContainerLayerParameters>& aParameters,
     const DisplayItemClip* aClip) const {
   if (!mWillBuildScrollableLayer || mIsScrollableLayerInRootContainer) {
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -1048,16 +1048,18 @@ nsDisplayListBuilder::nsDisplayListBuild
       mIsInActiveDocShell(false),
       mBuildAsyncZoomContainer(false),
       mHitTestArea(),
       mHitTestInfo(CompositorHitTestInvisibleToHit) {
   MOZ_COUNT_CTOR(nsDisplayListBuilder);
 
   mBuildCompositorHitTestInfo = mAsyncPanZoomEnabled && IsForPainting();
 
+  UpdateShouldBuildAsyncZoomContainer();
+
   static_assert(
       static_cast<uint32_t>(DisplayItemType::TYPE_MAX) < (1 << TYPE_BITS),
       "Check TYPE_MAX should not overflow");
 }
 
 void nsDisplayListBuilder::BeginFrame() {
   nsCSSRendering::BeginFrameTreesLocked();
   mCurrentAGR = mRootAGR;
@@ -1187,16 +1189,21 @@ AnimatedGeometryRoot* nsDisplayListBuild
         aItem->Frame(), LayoutFrameType::Viewport, RootReferenceFrame());
     if (viewportFrame) {
       return FindAnimatedGeometryRootFor(viewportFrame);
     }
   }
   return FindAnimatedGeometryRootFor(aItem->Frame());
 }
 
+void nsDisplayListBuilder::UpdateShouldBuildAsyncZoomContainer() {
+  mBuildAsyncZoomContainer = gfxPrefs::APZAllowZooming() &&
+                             !gfxPrefs::LayoutUseContainersForRootFrames();
+}
+
 bool nsDisplayListBuilder::MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame,
                                                         nsIFrame* aFrame) {
   MOZ_ASSERT(aFrame->GetParent() == aDirtyFrame);
   nsRect dirty;
   nsRect visible = OutOfFlowDisplayData::ComputeVisibleRectForFrame(
       this, aFrame, GetVisibleRect(), GetDirtyRect(), &dirty);
   if (!(aFrame->GetStateBits() & NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO) &&
       visible.IsEmpty()) {
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -1731,19 +1731,17 @@ class nsDisplayListBuilder {
 
   void SetHitTestIsForVisibility(bool aHitTestIsForVisibility) {
     mHitTestIsForVisibility = aHitTestIsForVisibility;
   }
 
   bool ShouldBuildAsyncZoomContainer() const {
     return mBuildAsyncZoomContainer;
   }
-  void SetBuildAsyncZoomContainer(bool aBuildAsyncZoomContainer) {
-    mBuildAsyncZoomContainer = aBuildAsyncZoomContainer;
-  }
+  void UpdateShouldBuildAsyncZoomContainer();
 
   /**
    * Represents a region composed of frame/rect pairs.
    * WeakFrames are used to track whether a rect still belongs to the region.
    * Modified frames and rects are removed and re-added to the region if needed.
    */
   struct WeakFrameRegion {
     /**