Backed out 8 changesets (bug 1610731) for causing fullscreen related wpt failures CLOSED TREE
authorCiure Andrei <aciure@mozilla.com>
Sat, 04 Apr 2020 09:12:26 +0300
changeset 522130 26bcd52f3e7664622e8a24ebf049cbcd91c35b74
parent 522129 787a82df49667019d3353c08d2c8a3f707d502cf
child 522131 3dbfa1dc392135ee675901a7d2fd6a7255721370
push id37281
push userbtara@mozilla.com
push dateSat, 04 Apr 2020 09:29:13 +0000
treeherdermozilla-central@26bcd52f3e76 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1610731
milestone76.0a1
backs out8d11e5caff2a0ef0d0f3f75163aafdc302f464d2
089ef5398b323e4f56165b661ace555f90026866
bcbf21dcd7b44a1509b3f55c5e56b7d22914dd5c
0e5823826e91849859f39376d9bd8b23acb851f4
d8fbbc7fc65dd4d90869d852809d7e4ff0b66d1a
c2b1bd759595f7c1d3df3162d2ba9e7038ac2328
4162437c7931e011a2f48810d4a5111553de479c
e7d6f26c1019f7dd5d2395d0c6ac65a1ab5eb07b
first release with
nightly linux32
26bcd52f3e76 / 76.0a1 / 20200404092913 / files
nightly linux64
26bcd52f3e76 / 76.0a1 / 20200404092913 / files
nightly mac
26bcd52f3e76 / 76.0a1 / 20200404092913 / files
nightly win32
26bcd52f3e76 / 76.0a1 / 20200404092913 / files
nightly win64
26bcd52f3e76 / 76.0a1 / 20200404092913 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 8 changesets (bug 1610731) for causing fullscreen related wpt failures CLOSED TREE Backed out changeset 8d11e5caff2a (bug 1610731) Backed out changeset 089ef5398b32 (bug 1610731) Backed out changeset bcbf21dcd7b4 (bug 1610731) Backed out changeset 0e5823826e91 (bug 1610731) Backed out changeset d8fbbc7fc65d (bug 1610731) Backed out changeset c2b1bd759595 (bug 1610731) Backed out changeset 4162437c7931 (bug 1610731) Backed out changeset e7d6f26c1019 (bug 1610731)
gfx/ipc/GfxMessageUtils.h
gfx/layers/LayerMetricsWrapper.h
gfx/layers/apz/src/APZCTreeManager.cpp
gfx/layers/apz/src/APZCTreeManager.h
gfx/layers/apz/src/HitTestingTreeNode.cpp
gfx/layers/apz/src/HitTestingTreeNode.h
gfx/layers/wr/WebRenderScrollData.cpp
gfx/layers/wr/WebRenderScrollData.h
gfx/layers/wr/WebRenderScrollDataWrapper.h
layout/painting/nsDisplayList.cpp
layout/painting/nsDisplayList.h
layout/reftests/async-scrolling/dynamic-toolbar-fixed-bottom-1.html
layout/reftests/async-scrolling/dynamic-toolbar-fixed-top-1-ref.html
layout/reftests/async-scrolling/dynamic-toolbar-fixed-top-1.html
layout/reftests/async-scrolling/dynamic-toolbar-sticky-bottom-1-ref.html
layout/reftests/async-scrolling/dynamic-toolbar-sticky-bottom-1.html
layout/reftests/async-scrolling/dynamic-toolbar-sticky-top-1-ref.html
layout/reftests/async-scrolling/dynamic-toolbar-sticky-top-1.html
layout/reftests/async-scrolling/reftest.list
--- a/gfx/ipc/GfxMessageUtils.h
+++ b/gfx/ipc/GfxMessageUtils.h
@@ -565,41 +565,16 @@ struct ParamTraits<mozilla::gfx::RectTyp
     bool retVal = (ReadParam(msg, iter, &x) && ReadParam(msg, iter, &y) &&
                    ReadParam(msg, iter, &w) && ReadParam(msg, iter, &h));
     result->SetRect(x, y, w, h);
     return retVal;
   }
 };
 
 template <class T>
-struct ParamTraits<mozilla::gfx::RectAbsoluteTyped<T>> {
-  typedef mozilla::gfx::RectAbsoluteTyped<T> paramType;
-
-  static void Write(Message* msg, const paramType& param) {
-    WriteParam(msg, param.Left());
-    WriteParam(msg, param.Right());
-    WriteParam(msg, param.Top());
-    WriteParam(msg, param.Bottom());
-  }
-
-  static bool Read(const Message* msg, PickleIterator* iter,
-                   paramType* result) {
-    auto l = result->Left();
-    auto r = result->Right();
-    auto t = result->Top();
-    auto b = result->Bottom();
-
-    bool retVal = (ReadParam(msg, iter, &l) && ReadParam(msg, iter, &r) &&
-                   ReadParam(msg, iter, &t) && ReadParam(msg, iter, &b));
-    result->SetBox(l, r, t, b);
-    return retVal;
-  }
-};
-
-template <class T>
 struct ParamTraits<mozilla::gfx::IntRectTyped<T>> {
   typedef mozilla::gfx::IntRectTyped<T> paramType;
 
   static void Write(Message* msg, const paramType& param) {
     WriteParam(msg, param.X());
     WriteParam(msg, param.Y());
     WriteParam(msg, param.Width());
     WriteParam(msg, param.Height());
--- a/gfx/layers/LayerMetricsWrapper.h
+++ b/gfx/layers/LayerMetricsWrapper.h
@@ -404,68 +404,48 @@ class MOZ_STACK_CLASS LayerMetricsWrappe
     // WebRenderScrollDataWrapper. Although it will be called, the return
     // value is not used.
     return Nothing();
   }
 
   ScrollableLayerGuid::ViewID GetFixedPositionScrollContainerId() const {
     MOZ_ASSERT(IsValid());
 
-    if (AtBottomLayer()) {
-      return mLayer->GetFixedPositionScrollContainerId();
-    }
-    return ScrollableLayerGuid::NULL_SCROLL_ID;
+    // TODO: Restrict this only for AtBottomLayer.
+    return mLayer->GetFixedPositionScrollContainerId();
   }
 
   SideBits GetFixedPositionSides() const {
     MOZ_ASSERT(IsValid());
 
-    if (AtBottomLayer()) {
-      return mLayer->GetFixedPositionSides();
-    }
-    return SideBits::eNone;
+    return mLayer->GetFixedPositionSides();
+  }
+
+  bool GetIsStickyPosition() const {
+    MOZ_ASSERT(IsValid());
+
+    return mLayer->GetIsStickyPosition();
   }
 
   ScrollableLayerGuid::ViewID GetStickyScrollContainerId() const {
     MOZ_ASSERT(IsValid());
 
-    if (AtBottomLayer() && mLayer->GetIsStickyPosition()) {
-      return mLayer->GetStickyScrollContainerId();
-    }
-    return ScrollableLayerGuid::NULL_SCROLL_ID;
+    // TODO: Restrict this only for AtBottomLayer.
+    return mLayer->GetStickyScrollContainerId();
   }
 
   const LayerRectAbsolute& GetStickyScrollRangeOuter() const {
     MOZ_ASSERT(IsValid());
 
-    if (AtBottomLayer() && mLayer->GetIsStickyPosition()) {
-      return mLayer->GetStickyScrollRangeOuter();
-    }
-
-    static const LayerRectAbsolute empty;
-    return empty;
+    return mLayer->GetStickyScrollRangeOuter();
   }
-
   const LayerRectAbsolute& GetStickyScrollRangeInner() const {
     MOZ_ASSERT(IsValid());
 
-    if (AtBottomLayer() && mLayer->GetIsStickyPosition()) {
-      return mLayer->GetStickyScrollRangeInner();
-    }
-
-    static const LayerRectAbsolute empty;
-    return empty;
-  }
-
-  Maybe<uint64_t> GetStickyPositionAnimationId() const {
-    MOZ_ASSERT(IsValid());
-    // This function is only really needed for template-compatibility with
-    // WebRenderScrollDataWrapper. Although it will be called, the return
-    // value is not used.
-    return Nothing();
+    return mLayer->GetStickyScrollRangeInner();
   }
 
   Maybe<uint64_t> GetZoomAnimationId() const {
     MOZ_ASSERT(IsValid());
     // This function is only really needed for template-compatibility with
     // WebRenderScrollDataWrapper. Although it will be called, the return
     // value is not used.
     return Nothing();
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -142,22 +142,26 @@ struct APZCTreeManager::TreeBuildingStat
   // APZC instance that is for an RCD node. Generally it will be set on the
   // root node of the layers (sub-)tree, which may not be same as the RCD node
   // for the subtree, and so we need this mechanism to ensure it gets propagated
   // to the RCD's APZC instance. Once it is set on the APZC instance, the value
   // is cleared back to Nothing(). Note that this is only used in the WebRender
   // codepath.
   Maybe<uint64_t> mZoomAnimationId;
 
-  // See corresponding members of APZCTreeManager. These are the same thing, but
-  // on the tree-walking state. They are populated while walking the tree in
-  // a layers update, and then moved into APZCTreeManager.
-  std::vector<FixedPositionInfo> mFixedPositionInfo;
-  std::vector<RootScrollbarInfo> mRootScrollbarInfo;
-  std::vector<StickyPositionInfo> mStickyPositionInfo;
+  // This is populated with all the HitTestingTreeNodes that have a fixed
+  // position animation id (which indicates that they need to be sampled for
+  // WebRender on the sampler thread).
+  std::vector<HitTestingTreeNode*> mFixedPositionNodesWithAnimationId;
+
+  // This is populated with all the HitTestingTreeNodes that are scrollbar
+  // containers for the root viewport and have a scrollthumb animation id
+  // (which indicates that they need to be sampled for WebRender on the sampler
+  // thread).
+  std::vector<HitTestingTreeNode*> mRootScrollbars;
 };
 
 class APZCTreeManager::CheckerboardFlushObserver : public nsIObserver {
  public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
 
   explicit CheckerboardFlushObserver(APZCTreeManager* aTreeManager)
@@ -468,33 +472,23 @@ APZCTreeManager::UpdateHitTestingTreeImp
           // Note also that when webrender is enabled, a "valid" animation id
           // is always nonzero, so we don't need to worry about handling the
           // case where WR is enabled and the animation id is zero.
           if (node->GetScrollbarAnimationId()) {
             if (node->IsScrollThumbNode()) {
               state.mScrollThumbs.push_back(node);
             } else if (node->IsScrollbarContainerNode()) {
               // Only scrollbar containers for the root have an animation id.
-              state.mRootScrollbarInfo.emplace_back(
-                  *(node->GetScrollbarAnimationId()),
-                  node->GetScrollbarDirection());
+              state.mRootScrollbars.push_back(node);
             }
           }
 
           // GetFixedPositionAnimationId is only set when webrender is enabled.
           if (node->GetFixedPositionAnimationId().isSome()) {
-            state.mFixedPositionInfo.emplace_back(
-                *(node->GetFixedPositionAnimationId()),
-                node->GetFixedPosSides());
-          }
-          // GetStickyPositionAnimationId is only set when webrender is enabled.
-          if (node->GetStickyPositionAnimationId().isSome()) {
-            state.mStickyPositionInfo.emplace_back(
-                *(node->GetStickyPositionAnimationId()),
-                node->GetFixedPosSides());
+            state.mFixedPositionNodesWithAnimationId.push_back(node);
           }
           if (apzc && node->IsPrimaryHolder()) {
             state.mScrollTargets[apzc->GetGuid()] = node;
           }
 
           mApzcTreeLog << '\n';
 
           // Accumulate the CSS transform between layers that have an APZC.
@@ -631,19 +625,36 @@ APZCTreeManager::UpdateHitTestingTreeImp
       }
       HitTestingTreeNode* target = it->second;
       mScrollThumbInfo.emplace_back(
           *(thumb->GetScrollbarAnimationId()), thumb->GetTransform(),
           thumb->GetScrollbarData(), targetGuid, target->GetTransform(),
           target->IsAncestorOf(thumb));
     }
 
-    mRootScrollbarInfo = std::move(state.mRootScrollbarInfo);
-    mFixedPositionInfo = std::move(state.mFixedPositionInfo);
-    mStickyPositionInfo = std::move(state.mStickyPositionInfo);
+    mRootScrollbarInfo.clear();
+    // For non-webrender, and platforms without a dynamic toolbar,
+    // state.mRootScrollbarsWithAnimationId will be empty so this will be a
+    // no-op.
+    for (const HitTestingTreeNode* scrollbar : state.mRootScrollbars) {
+      MOZ_ASSERT(scrollbar->IsScrollbarContainerNode());
+      mRootScrollbarInfo.emplace_back(*(scrollbar->GetScrollbarAnimationId()),
+                                      scrollbar->GetScrollbarDirection());
+    }
+
+    mFixedPositionInfo.clear();
+    // For non-webrender, state.mFixedPositionNodesWithAnimationId will be empty
+    // so this will be a no-op.
+    for (HitTestingTreeNode* fixedPos :
+         state.mFixedPositionNodesWithAnimationId) {
+      MOZ_ASSERT(fixedPos->GetFixedPositionAnimationId().isSome());
+      mFixedPositionInfo.emplace_back(
+          fixedPos->GetFixedPositionAnimationId().value(),
+          fixedPos->GetFixedPosSides());
+    }
   }
 
   for (size_t i = 0; i < state.mNodesToDestroy.Length(); i++) {
     APZCTM_LOG("Destroying node at %p with APZC %p\n",
                state.mNodesToDestroy[i].get(),
                state.mNodesToDestroy[i]->GetApzc());
     state.mNodesToDestroy[i]->Destroy();
   }
@@ -812,59 +823,41 @@ void APZCTreeManager::SampleForWebRender
   }
 
   // Move the root scrollbar in response to the dynamic toolbar transition.
   for (const RootScrollbarInfo& info : mRootScrollbarInfo) {
     // We only care about the horizontal scrollbar.
     if (info.mScrollDirection == ScrollDirection::eHorizontal) {
       ScreenPoint translation =
           AsyncCompositionManager::ComputeFixedMarginsOffset(
-              GetCompositorFixedLayerMargins(), SideBits::eBottom,
-              ScreenMargin());
+              mCompositorFixedLayerMargins, SideBits::eBottom, ScreenMargin());
 
       LayerToParentLayerMatrix4x4 transform =
           LayerToParentLayerMatrix4x4::Translation(ViewAs<ParentLayerPixel>(
               translation, PixelCastJustification::ScreenIsParentLayerForRoot));
 
       transforms.AppendElement(
           wr::ToWrTransformProperty(info.mScrollbarAnimationId, transform));
     }
   }
 
   for (const FixedPositionInfo& info : mFixedPositionInfo) {
     ScreenPoint translation =
         AsyncCompositionManager::ComputeFixedMarginsOffset(
-            GetCompositorFixedLayerMargins(), info.mFixedPosSides,
+            mCompositorFixedLayerMargins, info.mFixedPosSides,
             mGeckoFixedLayerMargins);
 
     LayerToParentLayerMatrix4x4 transform =
         LayerToParentLayerMatrix4x4::Translation(ViewAs<ParentLayerPixel>(
             translation, PixelCastJustification::ScreenIsParentLayerForRoot));
 
     transforms.AppendElement(
         wr::ToWrTransformProperty(info.mFixedPositionAnimationId, transform));
   }
 
-  for (const StickyPositionInfo& info : mStickyPositionInfo) {
-    ScreenPoint translation =
-        AsyncCompositionManager::ComputeFixedMarginsOffset(
-            GetCompositorFixedLayerMargins(), info.mFixedPosSides,
-            // For sticky layers, we don't need to factor
-            // mGeckoFixedLayerMargins because Gecko doesn't shift the
-            // position of sticky elements for dynamic toolbar movements.
-            ScreenMargin());
-
-    LayerToParentLayerMatrix4x4 transform =
-        LayerToParentLayerMatrix4x4::Translation(ViewAs<ParentLayerPixel>(
-            translation, PixelCastJustification::ScreenIsParentLayerForRoot));
-
-    transforms.AppendElement(
-        wr::ToWrTransformProperty(info.mStickyPositionAnimationId, transform));
-  }
-
   aTxn.AppendTransformProperties(transforms);
 
   // Advance animations. It's important that this happens after
   // sampling all async transforms, because AdvanceAnimations() updates
   // the effective scroll offset to the value it should have for the *next*
   // composite after this one (if the APZ frame delay is enabled).
   bool activeAnimations =
       AdvanceAnimationsInternal(lock, Some(aRenderRoot), aSampleTime);
@@ -1195,20 +1188,24 @@ HitTestingTreeNode* APZCTreeManager::Pre
                    (!parentHasPerspective && aLayer.GetClipRect())
                        ? Some(ParentLayerIntRegion(*aLayer.GetClipRect()))
                        : Nothing());
     node->SetScrollbarData(aLayer.GetScrollbarAnimationId(),
                            aLayer.GetScrollbarData());
     node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId(),
                           aLayer.GetFixedPositionSides(),
                           aLayer.GetFixedPositionAnimationId());
-    node->SetStickyPosData(aLayer.GetStickyScrollContainerId(),
-                           aLayer.GetStickyScrollRangeOuter(),
-                           aLayer.GetStickyScrollRangeInner(),
-                           aLayer.GetStickyPositionAnimationId());
+    if (aLayer.GetIsStickyPosition()) {
+      node->SetStickyPosData(aLayer.GetStickyScrollContainerId(),
+                             aLayer.GetStickyScrollRangeOuter(),
+                             aLayer.GetStickyScrollRangeInner());
+    } else {
+      node->SetStickyPosData(ScrollableLayerGuid::NULL_SCROLL_ID,
+                             LayerRectAbsolute(), LayerRectAbsolute());
+    }
     return node;
   }
 
   AsyncPanZoomController* apzc = nullptr;
   // If we get here, aLayer is a scrollable layer and somebody
   // has registered a GeckoContentController for it, so we need to ensure
   // it has an APZC instance to manage its scrolling.
 
@@ -1425,20 +1422,24 @@ HitTestingTreeNode* APZCTreeManager::Pre
   // Note: if layer properties must be propagated to nodes, RecvUpdate in
   // LayerTransactionParent.cpp must ensure that APZ will be notified
   // when those properties change.
   node->SetScrollbarData(aLayer.GetScrollbarAnimationId(),
                          aLayer.GetScrollbarData());
   node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId(),
                         aLayer.GetFixedPositionSides(),
                         aLayer.GetFixedPositionAnimationId());
-  node->SetStickyPosData(aLayer.GetStickyScrollContainerId(),
-                         aLayer.GetStickyScrollRangeOuter(),
-                         aLayer.GetStickyScrollRangeInner(),
-                         aLayer.GetStickyPositionAnimationId());
+  if (aLayer.GetIsStickyPosition()) {
+    node->SetStickyPosData(aLayer.GetStickyScrollContainerId(),
+                           aLayer.GetStickyScrollRangeOuter(),
+                           aLayer.GetStickyScrollRangeInner());
+  } else {
+    node->SetStickyPosData(ScrollableLayerGuid::NULL_SCROLL_ID,
+                           LayerRectAbsolute(), LayerRectAbsolute());
+  }
   return node;
 }
 
 template <typename PanGestureOrScrollWheelInput>
 static bool WillHandleInput(const PanGestureOrScrollWheelInput& aPanInput) {
   if (!XRE_IsParentProcess() || !NS_IsMainThread()) {
     return true;
   }
@@ -2098,17 +2099,17 @@ APZEventResult APZCTreeManager::ProcessT
           result.mStatus = nsEventStatus_eIgnore;
           return result;
         }
         touchData.mScreenPoint = *untransformedScreenPoint;
         if (mFixedPosSidesForInputBlock != SideBits::eNone) {
           MutexAutoLock lock(mMapLock);
           touchData.mScreenPoint -=
               RoundedToInt(AsyncCompositionManager::ComputeFixedMarginsOffset(
-                  GetCompositorFixedLayerMargins(), mFixedPosSidesForInputBlock,
+                  mCompositorFixedLayerMargins, mFixedPosSidesForInputBlock,
                   mGeckoFixedLayerMargins));
         }
       }
     }
   }
 
   mTouchCounter.Update(aInput);
 
@@ -3386,17 +3387,17 @@ Maybe<ScreenIntPoint> APZCTreeManager::C
       GetScreenToApzcTransform(aApzc) * GetApzcToGeckoTransform(aApzc);
   Maybe<ScreenIntPoint> geckoPoint =
       UntransformBy(transformScreenToGecko, aPoint);
   if (geckoPoint) {
     if (mFixedPosSidesForInputBlock != SideBits::eNone) {
       MutexAutoLock mapLock(mMapLock);
       *geckoPoint -=
           RoundedToInt(AsyncCompositionManager::ComputeFixedMarginsOffset(
-              GetCompositorFixedLayerMargins(), mFixedPosSidesForInputBlock,
+              mCompositorFixedLayerMargins, mFixedPosSidesForInputBlock,
               mGeckoFixedLayerMargins));
     }
   }
   return geckoPoint;
 }
 
 already_AddRefed<AsyncPanZoomController> APZCTreeManager::CommonAncestor(
     AsyncPanZoomController* aApzc1, AsyncPanZoomController* aApzc2) const {
@@ -3460,18 +3461,18 @@ bool APZCTreeManager::IsFixedToRootConte
 bool APZCTreeManager::IsStuckToRootContentAtBottom(
     const HitTestingTreeNode* aNode) const {
   mTreeLock.AssertCurrentThreadIn();
   ScrollableLayerGuid::ViewID stickyTarget = aNode->GetStickyPosTarget();
   if (stickyTarget == ScrollableLayerGuid::NULL_SCROLL_ID) {
     return false;
   }
 
-  // We support the dynamic toolbar at top and bottom.
-  if ((aNode->GetFixedPosSides() & SideBits::eTopBottom) == SideBits::eNone) {
+  // Currently we only support the dyanmic toolbar at bottom.
+  if ((aNode->GetFixedPosSides() & SideBits::eBottom) == SideBits::eNone) {
     return false;
   }
 
   RefPtr<AsyncPanZoomController> stickyTargetApzc =
       GetTargetAPZC(aNode->GetLayersId(), stickyTarget);
   if (!stickyTargetApzc || !stickyTargetApzc->IsRootContent()) {
     return false;
   }
@@ -3556,31 +3557,31 @@ LayerToParentLayerMatrix4x4 APZCTreeMana
           });
     }
   } else if (IsFixedToRootContent(aNode)) {
     ParentLayerPoint translation;
     {
       MutexAutoLock mapLock(mMapLock);
       translation = ViewAs<ParentLayerPixel>(
           AsyncCompositionManager::ComputeFixedMarginsOffset(
-              GetCompositorFixedLayerMargins(), aNode->GetFixedPosSides(),
+              mCompositorFixedLayerMargins, aNode->GetFixedPosSides(),
               mGeckoFixedLayerMargins),
           PixelCastJustification::ScreenIsParentLayerForRoot);
     }
     return aNode->GetTransform() *
            CompleteAsyncTransform(
                AsyncTransformComponentMatrix::Translation(translation));
   } else if (IsStuckToRootContentAtBottom(aNode)) {
     ParentLayerPoint translation;
     {
       MutexAutoLock mapLock(mMapLock);
       translation = ViewAs<ParentLayerPixel>(
           AsyncCompositionManager::ComputeFixedMarginsOffset(
-              GetCompositorFixedLayerMargins(),
-              aNode->GetFixedPosSides() & SideBits::eTopBottom,
+              mCompositorFixedLayerMargins,
+              aNode->GetFixedPosSides() & SideBits::eBottom,
               // For sticky layers, we don't need to factor
               // mGeckoFixedLayerMargins because Gecko doesn't shift the
               // position of sticky elements for dynamic toolbar movements.
               ScreenMargin()),
           PixelCastJustification::ScreenIsParentLayerForRoot);
     }
     return aNode->GetTransform() *
            CompleteAsyncTransform(
@@ -3619,26 +3620,16 @@ already_AddRefed<GeckoContentController>
     LayersId aLayersId) {
   RefPtr<GeckoContentController> controller;
   CompositorBridgeParent::CallWithIndirectShadowTree(
       aLayersId,
       [&](LayerTreeState& aState) -> void { controller = aState.mController; });
   return controller.forget();
 }
 
-ScreenMargin APZCTreeManager::GetCompositorFixedLayerMargins() const {
-  RecursiveMutexAutoLock lock(mTreeLock);
-  ScreenMargin result = mCompositorFixedLayerMargins;
-  if (StaticPrefs::apz_fixed_margin_override_enabled()) {
-    result.top = StaticPrefs::apz_fixed_margin_override_top();
-    result.bottom = StaticPrefs::apz_fixed_margin_override_bottom();
-  }
-  return result;
-}
-
 bool APZCTreeManager::GetAPZTestData(LayersId aLayersId,
                                      APZTestData* aOutData) {
   AssertOnUpdaterThread();
 
   {  // copy the relevant test data into aOutData while holding the
      // mTestDataLock
     MutexAutoLock lock(mTestDataLock);
     auto it = mTestData.find(aLayersId);
--- a/gfx/layers/apz/src/APZCTreeManager.h
+++ b/gfx/layers/apz/src/APZCTreeManager.h
@@ -761,18 +761,16 @@ class APZCTreeManager : public IAPZCTree
   // composition bounds for the APZC corresponding to `aGuid` and returns those
   // bounds as a convenience. It recurses to also populate `aDestMap` with that
   // APZC's ancestors. In order to do this it needs to access mApzcMap
   // and therefore requires the caller to hold the map lock.
   ParentLayerRect ComputeClippedCompositionBounds(
       const MutexAutoLock& aProofOfMapLock,
       ClippedCompositionBoundsMap& aDestMap, ScrollableLayerGuid aGuid);
 
-  ScreenMargin GetCompositorFixedLayerMargins() const;
-
  protected:
   /* The input queue where input events are held until we know enough to
    * figure out where they're going. Protected so gtests can access it.
    */
   RefPtr<InputQueue> mInputQueue;
 
  private:
   /* Layers id for the root CompositorBridgeParent that owns this
@@ -813,18 +811,18 @@ class APZCTreeManager : public IAPZCTree
    */
   std::unordered_set<LayersId, LayersId::HashFn> mDetachedLayersIds;
 
   /* True if the current hit-testing tree contains an async zoom container
    * node.
    */
   bool mUsingAsyncZoomContainer;
 
-  /** A lock that protects mApzcMap, mScrollThumbInfo, mRootScrollbarInfo,
-   * mFixedPositionInfo, and mStickyPositionInfo.
+  /** A lock that protects mApzcMap, mScrollThumbInfo, mRootScrollbarInfo, and
+   * mFixedPositionInfo.
    */
   mutable mozilla::Mutex mMapLock;
 
   /**
    * Helper structure to store a bunch of things in mApzcMap so that they can
    * be used from the sampler thread.
    */
   struct ApzcMapData {
@@ -930,42 +928,16 @@ class APZCTreeManager : public IAPZCTree
    * case because accessing the HitTestingTreeNodes requires holding the tree
    * lock which we cannot do on the WR sampler thread. mFixedPositionInfo,
    * however, can be accessed while just holding the mMapLock which is safe to
    * do on the sampler thread. mMapLock must be acquired while accessing or
    * modifying mFixedPositionInfo.
    */
   std::vector<FixedPositionInfo> mFixedPositionInfo;
 
-  /**
-   * A helper structure to store all the information needed to compute the
-   * async transform for a sticky position element on the sampler thread.
-   */
-  struct StickyPositionInfo {
-    uint64_t mStickyPositionAnimationId;
-    SideBits mFixedPosSides;
-
-    StickyPositionInfo(const uint64_t& aStickyPositionAnimationId,
-                       const SideBits aFixedPosSides)
-        : mStickyPositionAnimationId(aStickyPositionAnimationId),
-          mFixedPosSides(aFixedPosSides) {}
-  };
-  /**
-   * If this APZCTreeManager is being used with WebRender, this vector gets
-   * populated during a layers update. It holds a package of information needed
-   * to compute and set the async transforms on sticky position content. This
-   * information is extracted from the HitTestingTreeNodes for the WebRender
-   * case because accessing the HitTestingTreeNodes requires holding the tree
-   * lock which we cannot do on the WR sampler thread. mStickyPositionInfo,
-   * however, can be accessed while just holding the mMapLock which is safe to
-   * do on the sampler thread. mMapLock must be acquired while accessing or
-   * modifying mStickyPositionInfo.
-   */
-  std::vector<StickyPositionInfo> mStickyPositionInfo;
-
   /* Holds the zoom constraints for scrollable layers, as determined by the
    * the main-thread gecko code. This can only be accessed on the updater
    * thread. */
   std::unordered_map<ScrollableLayerGuid, ZoomConstraints,
                      ScrollableLayerGuid::HashFn>
       mZoomConstraints;
   /* A list of keyboard shortcuts to use for translating keyboard inputs into
    * keyboard actions. This is gathered on the main thread from XBL bindings.
--- a/gfx/layers/apz/src/HitTestingTreeNode.cpp
+++ b/gfx/layers/apz/src/HitTestingTreeNode.cpp
@@ -172,40 +172,34 @@ void HitTestingTreeNode::SetPrevSibling(
       aSibling->SetApzcParent(parent);
     }
   }
 }
 
 void HitTestingTreeNode::SetStickyPosData(
     ScrollableLayerGuid::ViewID aStickyPosTarget,
     const LayerRectAbsolute& aScrollRangeOuter,
-    const LayerRectAbsolute& aScrollRangeInner,
-    const Maybe<uint64_t>& aStickyPositionAnimationId) {
+    const LayerRectAbsolute& aScrollRangeInner) {
   mStickyPosTarget = aStickyPosTarget;
   mStickyScrollRangeOuter = aScrollRangeOuter;
   mStickyScrollRangeInner = aScrollRangeInner;
-  mStickyPositionAnimationId = aStickyPositionAnimationId;
 }
 
 ScrollableLayerGuid::ViewID HitTestingTreeNode::GetStickyPosTarget() const {
   return mStickyPosTarget;
 }
 
 const LayerRectAbsolute& HitTestingTreeNode::GetStickyScrollRangeOuter() const {
   return mStickyScrollRangeOuter;
 }
 
 const LayerRectAbsolute& HitTestingTreeNode::GetStickyScrollRangeInner() const {
   return mStickyScrollRangeInner;
 }
 
-Maybe<uint64_t> HitTestingTreeNode::GetStickyPositionAnimationId() const {
-  return mStickyPositionAnimationId;
-}
-
 void HitTestingTreeNode::MakeRoot() {
   mParent = nullptr;
 
   if (GetApzc()) {
     SetApzcParent(nullptr);
   }
 }
 
--- a/gfx/layers/apz/src/HitTestingTreeNode.h
+++ b/gfx/layers/apz/src/HitTestingTreeNode.h
@@ -131,22 +131,20 @@ class HitTestingTreeNode {
                        const Maybe<uint64_t>& aFixedPositionAnimationId);
   ScrollableLayerGuid::ViewID GetFixedPosTarget() const;
   SideBits GetFixedPosSides() const;
   Maybe<uint64_t> GetFixedPositionAnimationId() const;
 
   /* Sticky pos info */
   void SetStickyPosData(ScrollableLayerGuid::ViewID aStickyPosTarget,
                         const LayerRectAbsolute& aScrollRangeOuter,
-                        const LayerRectAbsolute& aScrollRangeInner,
-                        const Maybe<uint64_t>& aStickyPositionAnimationId);
+                        const LayerRectAbsolute& aScrollRangeInner);
   ScrollableLayerGuid::ViewID GetStickyPosTarget() const;
   const LayerRectAbsolute& GetStickyScrollRangeOuter() const;
   const LayerRectAbsolute& GetStickyScrollRangeInner() const;
-  Maybe<uint64_t> GetStickyPositionAnimationId() const;
 
   /* Convert |aPoint| into the LayerPixel space for the layer corresponding to
    * this node. |aTransform| is the complete (content + async) transform for
    * this node. */
   Maybe<LayerPoint> Untransform(
       const ParentLayerPoint& aPoint,
       const LayerToParentLayerMatrix4x4& aTransform) const;
   /* Assuming aPoint is inside the clip region for this node, check which of the
@@ -202,19 +200,16 @@ class HitTestingTreeNode {
   Maybe<uint64_t> mFixedPositionAnimationId;
 
   ScrollableLayerGuid::ViewID mFixedPosTarget;
   SideBits mFixedPosSides;
 
   ScrollableLayerGuid::ViewID mStickyPosTarget;
   LayerRectAbsolute mStickyScrollRangeOuter;
   LayerRectAbsolute mStickyScrollRangeInner;
-  // This is only set if WebRender is enabled. It holds the animation id that
-  // we use to adjust sticky position content for the toolbar.
-  Maybe<uint64_t> mStickyPositionAnimationId;
 
   /* Let {L,M} be the {layer, scrollable metrics} pair that this node
    * corresponds to in the layer tree. mEventRegions contains the event regions
    * from L, in the case where event-regions are enabled. If event-regions are
    * disabled, it will contain the visible region of L, which we use as an
    * approximation to the hit region for the purposes of obscuring other layers.
    * This value is in L's LayerPixels.
    */
--- a/gfx/layers/wr/WebRenderScrollData.cpp
+++ b/gfx/layers/wr/WebRenderScrollData.cpp
@@ -18,17 +18,16 @@ namespace mozilla {
 namespace layers {
 
 WebRenderLayerScrollData::WebRenderLayerScrollData()
     : mDescendantCount(-1),
       mTransformIsPerspective(false),
       mEventRegionsOverride(EventRegionsOverride::NoOverride),
       mFixedPositionSides(mozilla::SideBits::eNone),
       mFixedPosScrollContainerId(ScrollableLayerGuid::NULL_SCROLL_ID),
-      mStickyPosScrollContainerId(ScrollableLayerGuid::NULL_SCROLL_ID),
       mRenderRoot(wr::RenderRoot::Default) {}
 
 WebRenderLayerScrollData::~WebRenderLayerScrollData() = default;
 
 void WebRenderLayerScrollData::InitializeRoot(int32_t aDescendantCount) {
   mDescendantCount = aDescendantCount;
 }
 
--- a/gfx/layers/wr/WebRenderScrollData.h
+++ b/gfx/layers/wr/WebRenderScrollData.h
@@ -119,44 +119,16 @@ class WebRenderLayerScrollData final {
 
   void SetFixedPositionScrollContainerId(ScrollableLayerGuid::ViewID aId) {
     mFixedPosScrollContainerId = aId;
   }
   ScrollableLayerGuid::ViewID GetFixedPositionScrollContainerId() const {
     return mFixedPosScrollContainerId;
   }
 
-  void SetStickyPositionScrollContainerId(ScrollableLayerGuid::ViewID aId) {
-    mStickyPosScrollContainerId = aId;
-  }
-  ScrollableLayerGuid::ViewID GetStickyPositionScrollContainerId() const {
-    return mStickyPosScrollContainerId;
-  }
-
-  void SetStickyScrollRangeOuter(const LayerRectAbsolute& scrollRange) {
-    mStickyScrollRangeOuter = scrollRange;
-  }
-  const LayerRectAbsolute& GetStickyScrollRangeOuter() const {
-    return mStickyScrollRangeOuter;
-  }
-
-  void SetStickyScrollRangeInner(const LayerRectAbsolute& scrollRange) {
-    mStickyScrollRangeInner = scrollRange;
-  }
-  const LayerRectAbsolute& GetStickyScrollRangeInner() const {
-    return mStickyScrollRangeInner;
-  }
-
-  void SetStickyPositionAnimationId(const uint64_t& aId) {
-    mStickyPositionAnimationId = Some(aId);
-  }
-  Maybe<uint64_t> GetStickyPositionAnimationId() const {
-    return mStickyPositionAnimationId;
-  }
-
   wr::RenderRoot GetRenderRoot() { return mRenderRoot; }
 
   void SetZoomAnimationId(const uint64_t& aId) { mZoomAnimationId = Some(aId); }
   Maybe<uint64_t> GetZoomAnimationId() const { return mZoomAnimationId; }
 
   void SetAsyncZoomContainerId(const ScrollableLayerGuid::ViewID aId) {
     mAsyncZoomContainerId = Some(aId);
   }
@@ -194,20 +166,16 @@ class WebRenderLayerScrollData final {
   LayerIntSize mRemoteDocumentSize;
   Maybe<LayersId> mReferentId;
   EventRegionsOverride mEventRegionsOverride;
   ScrollbarData mScrollbarData;
   Maybe<uint64_t> mScrollbarAnimationId;
   Maybe<uint64_t> mFixedPositionAnimationId;
   SideBits mFixedPositionSides;
   ScrollableLayerGuid::ViewID mFixedPosScrollContainerId;
-  ScrollableLayerGuid::ViewID mStickyPosScrollContainerId;
-  LayerRectAbsolute mStickyScrollRangeOuter;
-  LayerRectAbsolute mStickyScrollRangeInner;
-  Maybe<uint64_t> mStickyPositionAnimationId;
   wr::RenderRoot mRenderRoot;
   Maybe<uint64_t> mZoomAnimationId;
   Maybe<ScrollableLayerGuid::ViewID> mAsyncZoomContainerId;
 };
 
 // Data needed by APZ, for the whole layer tree. One instance of this class
 // is created for each transaction sent over PWebRenderBridge. It is populated
 // with information from the WebRender layer tree on the client side and the
@@ -301,20 +269,16 @@ struct ParamTraits<mozilla::layers::WebR
     WriteParam(aMsg, aParam.mRemoteDocumentSize);
     WriteParam(aMsg, aParam.mReferentId);
     WriteParam(aMsg, aParam.mEventRegionsOverride);
     WriteParam(aMsg, aParam.mScrollbarData);
     WriteParam(aMsg, aParam.mScrollbarAnimationId);
     WriteParam(aMsg, aParam.mFixedPositionAnimationId);
     WriteParam(aMsg, aParam.mFixedPositionSides);
     WriteParam(aMsg, aParam.mFixedPosScrollContainerId);
-    WriteParam(aMsg, aParam.mStickyPosScrollContainerId);
-    WriteParam(aMsg, aParam.mStickyScrollRangeOuter);
-    WriteParam(aMsg, aParam.mStickyScrollRangeInner);
-    WriteParam(aMsg, aParam.mStickyPositionAnimationId);
     WriteParam(aMsg, aParam.mRenderRoot);
     WriteParam(aMsg, aParam.mZoomAnimationId);
     WriteParam(aMsg, aParam.mAsyncZoomContainerId);
   }
 
   static bool Read(const Message* aMsg, PickleIterator* aIter,
                    paramType* aResult) {
     return ReadParam(aMsg, aIter, &aResult->mDescendantCount) &&
@@ -326,20 +290,16 @@ struct ParamTraits<mozilla::layers::WebR
            ReadParam(aMsg, aIter, &aResult->mRemoteDocumentSize) &&
            ReadParam(aMsg, aIter, &aResult->mReferentId) &&
            ReadParam(aMsg, aIter, &aResult->mEventRegionsOverride) &&
            ReadParam(aMsg, aIter, &aResult->mScrollbarData) &&
            ReadParam(aMsg, aIter, &aResult->mScrollbarAnimationId) &&
            ReadParam(aMsg, aIter, &aResult->mFixedPositionAnimationId) &&
            ReadParam(aMsg, aIter, &aResult->mFixedPositionSides) &&
            ReadParam(aMsg, aIter, &aResult->mFixedPosScrollContainerId) &&
-           ReadParam(aMsg, aIter, &aResult->mStickyPosScrollContainerId) &&
-           ReadParam(aMsg, aIter, &aResult->mStickyScrollRangeOuter) &&
-           ReadParam(aMsg, aIter, &aResult->mStickyScrollRangeInner) &&
-           ReadParam(aMsg, aIter, &aResult->mStickyPositionAnimationId) &&
            ReadParam(aMsg, aIter, &aResult->mRenderRoot) &&
            ReadParam(aMsg, aIter, &aResult->mZoomAnimationId) &&
            ReadParam(aMsg, aIter, &aResult->mAsyncZoomContainerId);
   }
 };
 
 template <>
 struct ParamTraits<mozilla::layers::WebRenderScrollData> {
--- a/gfx/layers/wr/WebRenderScrollDataWrapper.h
+++ b/gfx/layers/wr/WebRenderScrollDataWrapper.h
@@ -299,79 +299,56 @@ class MOZ_STACK_CLASS WebRenderScrollDat
 
   Maybe<uint64_t> GetScrollbarAnimationId() const {
     MOZ_ASSERT(IsValid());
     return mLayer->GetScrollbarAnimationId();
   }
 
   Maybe<uint64_t> GetFixedPositionAnimationId() const {
     MOZ_ASSERT(IsValid());
-
-    if (AtBottomLayer()) {
-      return mLayer->GetFixedPositionAnimationId();
-    }
-    return Nothing();
+    return mLayer->GetFixedPositionAnimationId();
   }
 
   ScrollableLayerGuid::ViewID GetFixedPositionScrollContainerId() const {
     MOZ_ASSERT(IsValid());
-
-    if (AtBottomLayer()) {
-      return mLayer->GetFixedPositionScrollContainerId();
-    }
-    return ScrollableLayerGuid::NULL_SCROLL_ID;
+    return mLayer->GetFixedPositionScrollContainerId();
   }
 
   SideBits GetFixedPositionSides() const {
     MOZ_ASSERT(IsValid());
+    return mLayer->GetFixedPositionSides();
+  }
 
-    if (AtBottomLayer()) {
-      return mLayer->GetFixedPositionSides();
-    }
-    return SideBits::eNone;
+  bool GetIsStickyPosition() const {
+    MOZ_ASSERT(IsValid());
+
+    // TODO: Bug 1610731 Implement this for WebRender.
+    return false;
   }
 
   ScrollableLayerGuid::ViewID GetStickyScrollContainerId() const {
     MOZ_ASSERT(IsValid());
 
-    if (AtBottomLayer()) {
-      return mLayer->GetStickyPositionScrollContainerId();
-    }
+    // TODO: Bug 1610731 Implement this for WebRender.
     return ScrollableLayerGuid::NULL_SCROLL_ID;
   }
 
   const LayerRectAbsolute& GetStickyScrollRangeOuter() const {
     MOZ_ASSERT(IsValid());
-
-    if (AtBottomLayer()) {
-      return mLayer->GetStickyScrollRangeOuter();
-    }
+    static const LayerRectAbsolute dummy;
 
-    static const LayerRectAbsolute empty;
-    return empty;
+    // TODO: Bug 1610731 Implement this for WebRender.
+    return dummy;
   }
-
   const LayerRectAbsolute& GetStickyScrollRangeInner() const {
     MOZ_ASSERT(IsValid());
-
-    if (AtBottomLayer()) {
-      return mLayer->GetStickyScrollRangeInner();
-    }
+    static const LayerRectAbsolute dummy;
 
-    static const LayerRectAbsolute empty;
-    return empty;
-  }
-
-  Maybe<uint64_t> GetStickyPositionAnimationId() const {
-    MOZ_ASSERT(IsValid());
-
-    if (AtBottomLayer()) {
-      return mLayer->GetStickyPositionAnimationId();
-    }
-    return Nothing();
+    // TODO: Bug 1610731 Implement this for WebRender.
+    return dummy;
   }
 
   Maybe<uint64_t> GetZoomAnimationId() const {
     MOZ_ASSERT(IsValid());
     return mLayer->GetZoomAnimationId();
   }
 
   bool IsBackfaceHidden() const {
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -6868,48 +6868,35 @@ bool nsDisplayOwnLayer::IsScrollThumbLay
          layers::ScrollbarLayerType::Thumb;
 }
 
 bool nsDisplayOwnLayer::IsScrollbarContainer() const {
   return mScrollbarData.mScrollbarLayerType ==
          layers::ScrollbarLayerType::Container;
 }
 
-bool nsDisplayOwnLayer::IsRootScrollbarContainer() const {
+bool nsDisplayOwnLayer::IsRootScrollbarContainerWithDynamicToolbar() const {
   if (!IsScrollbarContainer()) {
     return false;
   }
 
   return mFrame->PresContext()->IsRootContentDocumentCrossProcess() &&
+         mFrame->PresContext()->HasDynamicToolbar() &&
          mScrollbarData.mTargetViewId ==
              nsLayoutUtils::ScrollIdForRootScrollFrame(mFrame->PresContext());
 }
 
 bool nsDisplayOwnLayer::IsZoomingLayer() const {
   return GetType() == DisplayItemType::TYPE_ASYNC_ZOOM;
 }
 
 bool nsDisplayOwnLayer::IsFixedPositionLayer() const {
   return GetType() == DisplayItemType::TYPE_FIXED_POSITION;
 }
 
-bool nsDisplayOwnLayer::IsStickyPositionLayer() const {
-  return GetType() == DisplayItemType::TYPE_STICKY_POSITION;
-}
-
-bool nsDisplayOwnLayer::HasDynamicToolbar() const {
-  if (!mFrame->PresContext()->IsRootContentDocumentCrossProcess()) {
-    return false;
-  }
-  return mFrame->PresContext()->HasDynamicToolbar() ||
-         // For tests on Android, this pref is set to simulate the dynamic
-         // toolbar
-         StaticPrefs::apz_fixed_margin_override_enabled();
-}
-
 // nsDisplayOpacity uses layers for rendering
 already_AddRefed<Layer> nsDisplayOwnLayer::BuildLayer(
     nsDisplayListBuilder* aBuilder, LayerManager* aManager,
     const ContainerLayerParameters& aContainerParameters) {
   RefPtr<ContainerLayer> layer =
       aManager->GetLayerBuilder()->BuildContainerLayerFor(
           aBuilder, aManager, mFrame, this, &mList, aContainerParameters,
           nullptr, FrameLayerBuilder::CONTAINER_ALLOW_PULL_BACKGROUND_COLOR);
@@ -6925,21 +6912,20 @@ already_AddRefed<Layer> nsDisplayOwnLaye
 }
 
 bool nsDisplayOwnLayer::CreateWebRenderCommands(
     mozilla::wr::DisplayListBuilder& aBuilder,
     mozilla::wr::IpcResourceUpdateQueue& aResources,
     const StackingContextHelper& aSc, RenderRootStateManager* aManager,
     nsDisplayListBuilder* aDisplayListBuilder) {
   Maybe<wr::WrAnimationProperty> prop;
-  bool needsProp = aManager->LayerManager()->AsyncPanZoomEnabled() &&
-                   (IsScrollThumbLayer() || IsZoomingLayer() ||
-                    (IsFixedPositionLayer() && HasDynamicToolbar()) ||
-                    (IsStickyPositionLayer() && HasDynamicToolbar()) ||
-                    (IsRootScrollbarContainer() && HasDynamicToolbar()));
+  bool needsProp =
+      aManager->LayerManager()->AsyncPanZoomEnabled() &&
+      (IsScrollThumbLayer() || IsZoomingLayer() || IsFixedPositionLayer() ||
+       IsRootScrollbarContainerWithDynamicToolbar());
 
   if (needsProp) {
     // APZ is enabled and this is a scroll thumb or zooming layer, so we need
     // to create and set an animation id. That way APZ can adjust the position/
     // zoom of this content asynchronously as needed.
     RefPtr<WebRenderAPZAnimationData> animationData =
         aManager->CommandBuilder()
             .CreateOrRecycleWebRenderUserData<WebRenderAPZAnimationData>(
@@ -6967,49 +6953,41 @@ bool nsDisplayOwnLayer::CreateWebRenderC
   nsDisplayWrapList::CreateWebRenderCommands(aBuilder, aResources, sc, aManager,
                                              aDisplayListBuilder);
   return true;
 }
 
 bool nsDisplayOwnLayer::UpdateScrollData(
     mozilla::layers::WebRenderScrollData* aData,
     mozilla::layers::WebRenderLayerScrollData* aLayerData) {
-  bool isRelevantToApz =
-      (IsScrollThumbLayer() || IsScrollbarContainer() || IsZoomingLayer() ||
-       (IsFixedPositionLayer() && HasDynamicToolbar()) ||
-       (IsStickyPositionLayer() && HasDynamicToolbar()));
-
+  bool isRelevantToApz = (IsScrollThumbLayer() || IsScrollbarContainer() ||
+                          IsZoomingLayer() || IsFixedPositionLayer());
   if (!isRelevantToApz) {
     return false;
   }
 
   if (!aLayerData) {
     return true;
   }
 
   if (IsZoomingLayer()) {
     aLayerData->SetZoomAnimationId(mWrAnimationId);
     return true;
   }
 
-  if (IsFixedPositionLayer() && HasDynamicToolbar()) {
+  if (IsFixedPositionLayer()) {
     aLayerData->SetFixedPositionAnimationId(mWrAnimationId);
     return true;
   }
 
-  if (IsStickyPositionLayer() && HasDynamicToolbar()) {
-    aLayerData->SetStickyPositionAnimationId(mWrAnimationId);
-    return true;
-  }
-
   MOZ_ASSERT(IsScrollbarContainer() || IsScrollThumbLayer());
 
   aLayerData->SetScrollbarData(mScrollbarData);
 
-  if (IsRootScrollbarContainer() && HasDynamicToolbar()) {
+  if (IsRootScrollbarContainerWithDynamicToolbar()) {
     aLayerData->SetScrollbarAnimationId(mWrAnimationId);
     return true;
   }
 
   if (IsScrollThumbLayer()) {
     aLayerData->SetScrollbarAnimationId(mWrAnimationId);
     LayoutDeviceRect bounds = LayoutDeviceIntRect::FromAppUnits(
         mBounds, mFrame->PresContext()->AppUnitsPerDevPixel());
@@ -7341,18 +7319,17 @@ bool nsDisplayFixedPosition::UpdateScrol
     mozilla::layers::WebRenderLayerScrollData* aLayerData) {
   if (aLayerData) {
     if (!mIsFixedBackground) {
       aLayerData->SetFixedPositionSides(
           nsLayoutUtils::GetSideBitsForFixedPositionContent(mFrame));
     }
     aLayerData->SetFixedPositionScrollContainerId(GetScrollTargetId());
   }
-  nsDisplayOwnLayer::UpdateScrollData(aData, aLayerData);
-  return true;
+  return nsDisplayOwnLayer::UpdateScrollData(aData, aLayerData) | true;
 }
 
 void nsDisplayFixedPosition::WriteDebugInfo(std::stringstream& aStream) {
   aStream << nsPrintfCString(" (containerASR %s) (scrolltarget %" PRIu64 ")",
                              ActiveScrolledRoot::ToString(mContainerASR).get(),
                              GetScrollTargetId())
                  .get();
 }
@@ -7462,21 +7439,33 @@ already_AddRefed<Layer> nsDisplayStickyP
       nsRect(scrollFrame->GetOffsetToCrossDoc(ReferenceFrame()),
              scrollFrameSize),
       mFrame, presContext, aContainerParameters);
 
   ViewID scrollId = nsLayoutUtils::FindOrCreateIDFor(
       stickyScrollContainer->ScrollFrame()->GetScrolledFrame()->GetContent());
 
   float factor = presContext->AppUnitsPerDevPixel();
-  LayerRectAbsolute stickyOuter;
-  LayerRectAbsolute stickyInner;
-  CalculateLayerScrollRanges(
-      stickyScrollContainer, factor, aContainerParameters.mXScale,
-      aContainerParameters.mYScale, stickyOuter, stickyInner);
+  nsRectAbsolute outer;
+  nsRectAbsolute inner;
+  stickyScrollContainer->GetScrollRanges(mFrame, &outer, &inner);
+  LayerRectAbsolute stickyOuter(
+      NSAppUnitsToFloatPixels(outer.X(), factor) * aContainerParameters.mXScale,
+      NSAppUnitsToFloatPixels(outer.Y(), factor) * aContainerParameters.mYScale,
+      NSAppUnitsToFloatPixels(outer.XMost(), factor) *
+          aContainerParameters.mXScale,
+      NSAppUnitsToFloatPixels(outer.YMost(), factor) *
+          aContainerParameters.mYScale);
+  LayerRectAbsolute stickyInner(
+      NSAppUnitsToFloatPixels(inner.X(), factor) * aContainerParameters.mXScale,
+      NSAppUnitsToFloatPixels(inner.Y(), factor) * aContainerParameters.mYScale,
+      NSAppUnitsToFloatPixels(inner.XMost(), factor) *
+          aContainerParameters.mXScale,
+      NSAppUnitsToFloatPixels(inner.YMost(), factor) *
+          aContainerParameters.mYScale);
   layer->SetStickyPositionData(scrollId, stickyOuter, stickyInner);
 
   return layer.forget();
 }
 
 // Returns the smallest distance from "0" to the range [min, max] where
 // min <= max.
 static nscoord DistanceToRange(nscoord min, nscoord max) {
@@ -7486,17 +7475,21 @@ static nscoord DistanceToRange(nscoord m
   }
   if (min > 0) {
     return min;
   }
   MOZ_ASSERT(min <= 0 && max >= 0);
   return 0;
 }
 
-StickyScrollContainer* nsDisplayStickyPosition::GetStickyScrollContainer() {
+bool nsDisplayStickyPosition::CreateWebRenderCommands(
+    mozilla::wr::DisplayListBuilder& aBuilder,
+    mozilla::wr::IpcResourceUpdateQueue& aResources,
+    const StackingContextHelper& aSc, RenderRootStateManager* aManager,
+    nsDisplayListBuilder* aDisplayListBuilder) {
   StickyScrollContainer* stickyScrollContainer =
       StickyScrollContainer::GetStickyScrollContainerForFrame(mFrame);
   if (stickyScrollContainer) {
     // If there's no ASR for the scrollframe that this sticky item is attached
     // to, then don't create a WR sticky item for it either. Trying to do so
     // will end in sadness because WR will interpret some coordinates as
     // relative to the nearest enclosing scrollframe, which will correspond
     // to the nearest ancestor ASR on the gecko side. That ASR will not be the
@@ -7506,25 +7499,16 @@ StickyScrollContainer* nsDisplayStickyPo
     // will never be asynchronously scrolled. Instead we will always position
     // the sticky items correctly on the gecko side and WR will never need to
     // adjust their position itself.
     if (!stickyScrollContainer->ScrollFrame()
              ->IsMaybeAsynchronouslyScrolled()) {
       stickyScrollContainer = nullptr;
     }
   }
-  return stickyScrollContainer;
-}
-
-bool nsDisplayStickyPosition::CreateWebRenderCommands(
-    mozilla::wr::DisplayListBuilder& aBuilder,
-    mozilla::wr::IpcResourceUpdateQueue& aResources,
-    const StackingContextHelper& aSc, RenderRootStateManager* aManager,
-    nsDisplayListBuilder* aDisplayListBuilder) {
-  StickyScrollContainer* stickyScrollContainer = GetStickyScrollContainer();
 
   Maybe<wr::SpaceAndClipChainHelper> saccHelper;
 
   if (stickyScrollContainer) {
     float auPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
 
     bool snap;
     nsRect itemBounds = GetBounds(aDisplayListBuilder, &snap);
@@ -7650,83 +7634,27 @@ bool nsDisplayStickyPosition::CreateWebR
   }
 
   {
     wr::StackingContextParams params;
     params.clip =
         wr::WrStackingContextClip::ClipChain(aBuilder.CurrentClipChainId());
     StackingContextHelper sc(aSc, GetActiveScrolledRoot(), mFrame, this,
                              aBuilder, params);
-    nsDisplayOwnLayer::CreateWebRenderCommands(aBuilder, aResources, sc,
+    nsDisplayWrapList::CreateWebRenderCommands(aBuilder, aResources, sc,
                                                aManager, aDisplayListBuilder);
   }
 
   if (stickyScrollContainer) {
     aManager->CommandBuilder().PopOverrideForASR(mContainerASR);
   }
 
   return true;
 }
 
-void nsDisplayStickyPosition::CalculateLayerScrollRanges(
-    StickyScrollContainer* aStickyScrollContainer, float aAppUnitsPerDevPixel,
-    float aScaleX, float aScaleY, LayerRectAbsolute& aStickyOuter,
-    LayerRectAbsolute& aStickyInner) {
-  nsRectAbsolute outer;
-  nsRectAbsolute inner;
-  aStickyScrollContainer->GetScrollRanges(mFrame, &outer, &inner);
-  aStickyOuter.SetBox(
-      NSAppUnitsToFloatPixels(outer.X(), aAppUnitsPerDevPixel) * aScaleX,
-      NSAppUnitsToFloatPixels(outer.Y(), aAppUnitsPerDevPixel) * aScaleY,
-      NSAppUnitsToFloatPixels(outer.XMost(), aAppUnitsPerDevPixel) * aScaleX,
-      NSAppUnitsToFloatPixels(outer.YMost(), aAppUnitsPerDevPixel) * aScaleY);
-  aStickyInner.SetBox(
-      NSAppUnitsToFloatPixels(inner.X(), aAppUnitsPerDevPixel) * aScaleX,
-      NSAppUnitsToFloatPixels(inner.Y(), aAppUnitsPerDevPixel) * aScaleY,
-      NSAppUnitsToFloatPixels(inner.XMost(), aAppUnitsPerDevPixel) * aScaleX,
-      NSAppUnitsToFloatPixels(inner.YMost(), aAppUnitsPerDevPixel) * aScaleY);
-}
-
-bool nsDisplayStickyPosition::UpdateScrollData(
-    mozilla::layers::WebRenderScrollData* aData,
-    mozilla::layers::WebRenderLayerScrollData* aLayerData) {
-  bool hasDynamicToolbar = HasDynamicToolbar();
-  if (aLayerData && hasDynamicToolbar) {
-    StickyScrollContainer* stickyScrollContainer = GetStickyScrollContainer();
-    if (stickyScrollContainer) {
-      float auPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
-      float cumulativeResolution =
-          mFrame->PresShell()->GetCumulativeResolution();
-      LayerRectAbsolute stickyOuter;
-      LayerRectAbsolute stickyInner;
-      CalculateLayerScrollRanges(stickyScrollContainer, auPerDevPixel,
-                                 cumulativeResolution, cumulativeResolution,
-                                 stickyOuter, stickyInner);
-      aLayerData->SetStickyScrollRangeOuter(stickyOuter);
-      aLayerData->SetStickyScrollRangeInner(stickyInner);
-
-      SideBits sides =
-          nsLayoutUtils::GetSideBitsForFixedPositionContent(mFrame);
-      aLayerData->SetFixedPositionSides(sides);
-
-      ViewID scrollId =
-          nsLayoutUtils::FindOrCreateIDFor(stickyScrollContainer->ScrollFrame()
-                                               ->GetScrolledFrame()
-                                               ->GetContent());
-      aLayerData->SetStickyPositionScrollContainerId(scrollId);
-    }
-  }
-  // Return true if either there is a dynamic toolbar affecting this sticky
-  // item or the OwnLayer base implementation returns true for some other
-  // reason.
-  bool ret = hasDynamicToolbar;
-  ret |= nsDisplayOwnLayer::UpdateScrollData(aData, aLayerData);
-  return ret;
-}
-
 nsDisplayScrollInfoLayer::nsDisplayScrollInfoLayer(
     nsDisplayListBuilder* aBuilder, nsIFrame* aScrolledFrame,
     nsIFrame* aScrollFrame, const CompositorHitTestInfo& aHitInfo,
     const nsRect& aHitArea)
     : nsDisplayWrapList(aBuilder, aScrollFrame),
       mScrollFrame(aScrollFrame),
       mScrolledFrame(aScrolledFrame),
       mScrollParentId(aBuilder->GetCurrentScrollParentId()),
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -44,17 +44,16 @@
 #include "mozilla/gfx/UserData.h"
 #include "mozilla/layers/LayerAttributes.h"
 #include "mozilla/layers/ScrollableLayerGuid.h"
 #include "nsCSSRenderingBorders.h"
 #include "nsPresArena.h"
 #include "nsAutoLayoutPhase.h"
 #include "nsDisplayItemTypes.h"
 #include "RetainedDisplayListHelpers.h"
-#include "Units.h"
 
 #include <stdint.h>
 #include "nsTHashtable.h"
 
 #include <stdlib.h>
 #include <algorithm>
 #include <unordered_set>
 
@@ -73,17 +72,16 @@ struct WrFiltersHolder;
 
 namespace nsStyleTransformMatrix {
 class TransformReferenceBox;
 }
 
 namespace mozilla {
 class FrameLayerBuilder;
 class PresShell;
-class StickyScrollContainer;
 namespace layers {
 struct FrameMetrics;
 class RenderRootStateManager;
 class Layer;
 class ImageLayer;
 class ImageContainer;
 class StackingContextHelper;
 class WebRenderCommand;
@@ -6095,21 +6093,19 @@ class nsDisplayOwnLayer : public nsDispl
   bool ShouldFlattenAway(nsDisplayListBuilder* aBuilder) override {
     return false;
   }
 
   void WriteDebugInfo(std::stringstream& aStream) override;
   nsDisplayOwnLayerFlags GetFlags() { return mFlags; }
   bool IsScrollThumbLayer() const;
   bool IsScrollbarContainer() const;
-  bool IsRootScrollbarContainer() const;
+  bool IsRootScrollbarContainerWithDynamicToolbar() const;
   bool IsZoomingLayer() const;
   bool IsFixedPositionLayer() const;
-  bool IsStickyPositionLayer() const;
-  bool HasDynamicToolbar() const;
 
  protected:
   nsDisplayOwnLayerFlags mFlags;
 
   /**
    * If this nsDisplayOwnLayer represents a scroll thumb layer or a
    * scrollbar container layer, mScrollbarData stores information
    * about the scrollbar. Otherwise, mScrollbarData will be
@@ -6234,33 +6230,21 @@ class nsDisplayStickyPosition : public n
 
   bool CreateWebRenderCommands(
       mozilla::wr::DisplayListBuilder& aBuilder,
       mozilla::wr::IpcResourceUpdateQueue& aResources,
       const StackingContextHelper& aSc,
       mozilla::layers::RenderRootStateManager* aManager,
       nsDisplayListBuilder* aDisplayListBuilder) override;
 
-  bool UpdateScrollData(
-      mozilla::layers::WebRenderScrollData* aData,
-      mozilla::layers::WebRenderLayerScrollData* aLayerData) override;
-
   const ActiveScrolledRoot* GetContainerASR() const { return mContainerASR; }
 
  private:
   NS_DISPLAY_ALLOW_CLONING()
 
-  void CalculateLayerScrollRanges(
-      mozilla::StickyScrollContainer* aStickyScrollContainer,
-      float aAppUnitsPerDevPixel, float aScaleX, float aScaleY,
-      mozilla::LayerRectAbsolute& aStickyOuter,
-      mozilla::LayerRectAbsolute& aStickyInner);
-
-  mozilla::StickyScrollContainer* GetStickyScrollContainer();
-
   // This stores the ASR that this sticky container item would have assuming it
   // has no fixed descendants. This may be the same as the ASR returned by
   // GetActiveScrolledRoot(), or it may be a descendant of that.
   RefPtr<const ActiveScrolledRoot> mContainerASR;
 };
 
 class nsDisplayFixedPosition : public nsDisplayOwnLayer {
  public:
--- a/layout/reftests/async-scrolling/dynamic-toolbar-fixed-bottom-1.html
+++ b/layout/reftests/async-scrolling/dynamic-toolbar-fixed-bottom-1.html
@@ -1,11 +1,11 @@
 <!DOCTYPE HTML>
 <!--
-  Tests that setting a fixed bottom margin in the compositor results
+  Tests that setting a fixed bottom margin in AsyncCompositionManager results
   in the margin being applied to an element fixed to the bottom.
 
   The fixed margin is specified as a test-pref in reftest.list.
 
   The purpose of the fixed margin is to compensate for the transform that the
   dynamic toolbar applies to the entire content area. We don't have a way of
   simulating that transform in a reftest, so the fixed margin in isolation will
   cause the fixed element to be offset from the bottom of the screen, and in
deleted file mode 100644
--- a/layout/reftests/async-scrolling/dynamic-toolbar-fixed-top-1-ref.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<meta name="viewport" content="width=device-width">
-<style>
-html {
-    scrollbar-width: none;
-}
-#scrolled {
-    height: 2000px;
-    width: 100%;
-}
-#fixed {
-    width: 100%;
-    height: 200px;
-    position: fixed;
-    top: 0;
-    background: red;
-    margin-top: 50px;
-}
-</style>
-<body>
-  <div id="scrolled"></div>
-  <div id="fixed"></div>
-</body>
-</html>
deleted file mode 100644
--- a/layout/reftests/async-scrolling/dynamic-toolbar-fixed-top-1.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE HTML>
-<!--
-  Tests that setting a fixed top margin in the compositor results
-  in the margin being applied to an element fixed to the top.
-
-  The fixed margin is specified as a test-pref in reftest.list.
-
-  The purpose of the fixed margin is to compensate for the transform that the
-  dynamic toolbar applies to the entire content area. We don't have a way of
-  simulating that transform in a reftest, so the fixed margin in isolation will
-  cause the fixed element to be offset from the top of the screen, and in
-  the ref page we use a regular CSS "margin-top" to match the rendering.
--->
-<html>
-<meta name="viewport" content="width=device-width">
-<style>
-html {
-    scrollbar-width: none;
-}
-#scrolled {
-    height: 2000px;
-    width: 100%;
-}
-#fixed {
-    width: 100%;
-    height: 200px;
-    position: fixed;
-    top: 0;
-    background: red;
-}
-</style>
-<body>
-  <div id="scrolled"></div>
-  <div id="fixed"></div>
-</body>
-</html>
deleted file mode 100644
--- a/layout/reftests/async-scrolling/dynamic-toolbar-sticky-bottom-1-ref.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<html>
-<meta name="viewport" content="width=device-width">
-<style>
-html {
-    scrollbar-width: none;
-}
-#scrolled {
-    display: flex;
-    justify-content: space-around;
-    align-items: flex-start;
-
-    height: 2000px;
-    width: 100%;
-}
-#sticky {
-    width: 100%;
-    height: 200px;
-    position: sticky;
-    bottom: 70px;
-    background: red;
-    align-self: flex-end;
-}
-</style>
-<body>
-  <div id="scrolled">
-    <div id="sticky"></div>
-  </div>
-</body>
-</html>
deleted file mode 100644
--- a/layout/reftests/async-scrolling/dynamic-toolbar-sticky-bottom-1.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML>
-<!--
-  Tests that setting a fixed bottom margin in the compositor results
-  in the margin being applied to an element sticky to the bottom.
-
-  The fixed margin is specified as a test-pref in reftest.list.
-
-  The purpose of the fixed margin is to compensate for the transform that the
-  dynamic toolbar applies to the entire content area. We don't have a way of
-  simulating that transform in a reftest, so the fixed margin in isolation will
-  cause the sticky element to be offset from the bottom of the screen.
--->
-<html>
-<meta name="viewport" content="width=device-width">
-<style>
-html {
-    scrollbar-width: none;
-}
-#scrolled {
-    display: flex;
-    justify-content: space-around;
-    align-items: flex-start;
-
-    height: 2000px;
-    width: 100%;
-}
-#sticky {
-    width: 100%;
-    height: 200px;
-    position: sticky;
-    bottom: 20px;
-    background: red;
-    align-self: flex-end;
-}
-</style>
-<body>
-  <div id="scrolled">
-    <div id="sticky"></div>
-  </div>
-</body>
-</html>
deleted file mode 100644
--- a/layout/reftests/async-scrolling/dynamic-toolbar-sticky-top-1-ref.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<html>
-<meta name="viewport" content="width=device-width">
-<style>
-html {
-    scrollbar-width: none;
-}
-#scrolled {
-    display: flex;
-    justify-content: space-around;
-    align-items: flex-start;
-
-    height: 2000px;
-    width: 100%;
-}
-#sticky {
-    width: 100%;
-    height: 200px;
-    position: sticky;
-    top: 70px;
-    background: red;
-    align-self: flex-start;
-}
-</style>
-<body>
-  <div id="scrolled">
-    <div id="sticky"></div>
-  </div>
-</body>
-</html>
deleted file mode 100644
--- a/layout/reftests/async-scrolling/dynamic-toolbar-sticky-top-1.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE HTML>
-<!--
-  Tests that setting a fixed top margin in the compositor results
-  in the margin being applied to an element sticky to the top.
-
-  The fixed margin is specified as a test-pref in reftest.list.
-
-  The purpose of the fixed margin is to compensate for the transform that the
-  dynamic toolbar applies to the entire content area. We don't have a way of
-  simulating that transform in a reftest, so the fixed margin in isolation will
-  cause the fixed element to be offset from the top of the screen.
--->
-<html>
-<meta name="viewport" content="width=device-width">
-<style>
-html {
-    scrollbar-width: none;
-}
-#scrolled {
-    display: flex;
-    justify-content: space-around;
-    align-items: flex-start;
-
-    height: 2000px;
-    width: 100%;
-}
-#sticky {
-    width: 100%;
-    height: 200px;
-    position: sticky;
-    top: 20px;
-    background: red;
-}
-</style>
-<body>
-  <div id="scrolled">
-    <div id="sticky"></div>
-  </div>
-</body>
-</html>
--- a/layout/reftests/async-scrolling/reftest.list
+++ b/layout/reftests/async-scrolling/reftest.list
@@ -93,12 +93,9 @@ skip-if(!Android) pref(apz.allow_zooming
 skip-if(!Android) pref(apz.allow_zooming,true) == position-fixed-async-zoom-4.html position-fixed-async-zoom-4-ref.html
 skip-if(!Android) pref(apz.allow_zooming,true) == position-sticky-async-zoom-1.html position-sticky-async-zoom-1-ref.html
 skip-if(!Android) pref(apz.allow_zooming,true) == position-sticky-async-zoom-2.html position-sticky-async-zoom-2-ref.html
 
 fuzzy-if(!webrender,111-112,600-600) pref(apz.allow_zooming,true) == async-scroll-and-zoom.html async-scroll-and-zoom-ref.html
 
 # for this test, apz.allow_zooming is needed to ensure we take the containerless scrolling codepath that creates
 # an async zoom container (since we are testing a regression in that codepath)
-skip-if(!Android) pref(apz.allow_zooming,true) test-pref(apz.fixed-margin-override.enabled,true) test-pref(apz.fixed-margin-override.bottom,50) == dynamic-toolbar-fixed-bottom-1.html dynamic-toolbar-fixed-bottom-1-ref.html
-skip-if(!Android) pref(apz.allow_zooming,true) test-pref(apz.fixed-margin-override.enabled,true) test-pref(apz.fixed-margin-override.bottom,50) == dynamic-toolbar-sticky-bottom-1.html dynamic-toolbar-sticky-bottom-1-ref.html
-skip-if(!Android) pref(apz.allow_zooming,true) test-pref(apz.fixed-margin-override.enabled,true) test-pref(apz.fixed-margin-override.top,50) == dynamic-toolbar-fixed-top-1.html dynamic-toolbar-fixed-top-1-ref.html
-skip-if(!Android) pref(apz.allow_zooming,true) test-pref(apz.fixed-margin-override.enabled,true) test-pref(apz.fixed-margin-override.top,50) fails-if(geckoview&&!webrender) == dynamic-toolbar-sticky-top-1.html dynamic-toolbar-sticky-top-1-ref.html # bug 1627326 for geckoview&&!webrender
+skip-if(!Android) pref(apz.allow_zooming,true) test-pref(apz.fixed-margin-override.enabled,true) test-pref(apz.fixed-margin-override.bottom,50) fails-if(geckoview&&webrender) == dynamic-toolbar-fixed-bottom-1.html dynamic-toolbar-fixed-bottom-1-ref.html