Bug 1441308 - Remove unnecessary StackingContextHelper params from clips r=kats
authorDoug Thayer <dothayer@mozilla.com>
Wed, 13 Mar 2019 16:44:05 +0000
changeset 521729 a64d942b966da7d12a3a70fa823284052f514dc9
parent 521728 7035735bcc1367ad46007851f321238551682bd8
child 521730 5fb5272aec8ea6c5018441e7e9b5ba1e7e890203
push id10867
push userdvarga@mozilla.com
push dateThu, 14 Mar 2019 15:20:45 +0000
treeherdermozilla-beta@abad13547875 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1441308
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 1441308 - Remove unnecessary StackingContextHelper params from clips r=kats These aren't used, so I'm just getting rid of them as cleanup. Differential Revision: https://phabricator.services.mozilla.com/D20693
gfx/layers/wr/ClipManager.cpp
gfx/layers/wr/ClipManager.h
gfx/layers/wr/WebRenderCommandBuilder.cpp
layout/painting/DisplayItemClip.cpp
layout/painting/DisplayItemClip.h
--- a/gfx/layers/wr/ClipManager.cpp
+++ b/gfx/layers/wr/ClipManager.cpp
@@ -129,18 +129,17 @@ wr::WrSpatialId ClipManager::SpatialIdAf
   }
   MOZ_ASSERT(!it->second.empty());
   CLIP_LOG("Overriding %zu with %s\n", aSpatialId.id,
            Stringify(it->second.top().id).c_str());
 
   return it->second.top();
 }
 
-wr::WrSpaceAndClipChain ClipManager::SwitchItem(
-    nsDisplayItem* aItem, const StackingContextHelper& aStackingContext) {
+wr::WrSpaceAndClipChain ClipManager::SwitchItem(nsDisplayItem* aItem) {
   const DisplayItemClipChain* clip = aItem->GetClipChain();
   const ActiveScrolledRoot* asr = aItem->GetActiveScrolledRoot();
   CLIP_LOG("processing item %p (%s) asr %p\n", aItem,
            DisplayItemTypeName(aItem->GetType()), asr);
 
   DisplayItemType type = aItem->GetType();
   if (type == DisplayItemType::TYPE_STICKY_POSITION) {
     // For sticky position items, the ASR is computed differently depending
@@ -209,22 +208,21 @@ wr::WrSpaceAndClipChain ClipManager::Swi
   // of these two chains because that one will include the other. Calling
   // DefineScrollLayers with this leafmost ASR will recursively define all the
   // ASRs that we care about for this item, but will not actually push
   // anything onto the WR stack.
   const ActiveScrolledRoot* leafmostASR = asr;
   if (clip) {
     leafmostASR = ActiveScrolledRoot::PickDescendant(leafmostASR, clip->mASR);
   }
-  Maybe<wr::WrSpaceAndClip> leafmostId =
-      DefineScrollLayers(leafmostASR, aItem, aStackingContext);
+  Maybe<wr::WrSpaceAndClip> leafmostId = DefineScrollLayers(leafmostASR, aItem);
 
   // Define all the clips in the item's clip chain, and obtain a clip chain id
   // for it.
-  clips.mClipChainId = DefineClipChain(clip, auPerDevPixel, aStackingContext);
+  clips.mClipChainId = DefineClipChain(clip, auPerDevPixel);
 
   Maybe<wr::WrSpaceAndClip> spaceAndClip = GetScrollLayer(asr);
   MOZ_ASSERT(spaceAndClip.isSome());
   clips.mScrollId = SpatialIdAfterOverride(spaceAndClip->space);
   CLIP_LOG("\tassigning %d -> %d\n", (int)spaceAndClip->space.id,
            (int)clips.mScrollId.id);
 
   // Now that we have the scroll id and a clip id for the item, push it onto
@@ -254,32 +252,31 @@ Maybe<wr::WrSpaceAndClip> ClipManager::G
   Maybe<wr::WrSpaceAndClip> spaceAndClip =
       mBuilder->GetScrollIdForDefinedScrollLayer(
           ScrollableLayerGuid::NULL_SCROLL_ID);
   MOZ_ASSERT(spaceAndClip.isSome());
   return spaceAndClip;
 }
 
 Maybe<wr::WrSpaceAndClip> ClipManager::DefineScrollLayers(
-    const ActiveScrolledRoot* aASR, nsDisplayItem* aItem,
-    const StackingContextHelper& aSc) {
+    const ActiveScrolledRoot* aASR, nsDisplayItem* aItem) {
   if (!aASR) {
     // Recursion base case
     return Nothing();
   }
   ScrollableLayerGuid::ViewID viewId = aASR->GetViewId();
   Maybe<wr::WrSpaceAndClip> spaceAndClip =
       mBuilder->GetScrollIdForDefinedScrollLayer(viewId);
   if (spaceAndClip) {
     // If we've already defined this scroll layer before, we can early-exit
     return spaceAndClip;
   }
   // Recurse to define the ancestors
   Maybe<wr::WrSpaceAndClip> ancestorSpaceAndClip =
-      DefineScrollLayers(aASR->mParent, aItem, aSc);
+      DefineScrollLayers(aASR->mParent, aItem);
 
   Maybe<ScrollMetadata> metadata =
       aASR->mScrollableFrame->ComputeScrollMetadata(
           mManager, aItem->ReferenceFrame(), Nothing(), nullptr);
   if (!metadata) {
     MOZ_ASSERT_UNREACHABLE("Expected scroll metadata to be available!");
     return ancestorSpaceAndClip;
   }
@@ -312,18 +309,17 @@ Maybe<wr::WrSpaceAndClip> ClipManager::D
   LayoutDevicePoint scrollOffset =
       metrics.GetScrollOffset() * metrics.GetDevPixelsPerCSSPixel();
   return Some(mBuilder->DefineScrollLayer(
       viewId, parent, wr::ToRoundedLayoutRect(contentRect),
       wr::ToRoundedLayoutRect(clipBounds), wr::ToLayoutPoint(scrollOffset)));
 }
 
 Maybe<wr::WrClipChainId> ClipManager::DefineClipChain(
-    const DisplayItemClipChain* aChain, int32_t aAppUnitsPerDevPixel,
-    const StackingContextHelper& aSc) {
+    const DisplayItemClipChain* aChain, int32_t aAppUnitsPerDevPixel) {
   AutoTArray<wr::WrClipId, 6> clipIds;
   // Iterate through the clips in the current item's clip chain, define them
   // in WR, and put their IDs into |clipIds|.
   for (const DisplayItemClipChain* chain = aChain; chain;
        chain = chain->mParent) {
     ClipIdMap& cache = mCacheStack.top();
     auto it = cache.find(chain);
     if (it != cache.end()) {
@@ -336,18 +332,17 @@ Maybe<wr::WrClipChainId> ClipManager::De
     if (!chain->mClip.HasClip()) {
       // This item in the chain is a no-op, skip over it
       continue;
     }
 
     LayoutDeviceRect clip = LayoutDeviceRect::FromAppUnits(
         chain->mClip.GetClipRect(), aAppUnitsPerDevPixel);
     nsTArray<wr::ComplexClipRegion> wrRoundedRects;
-    chain->mClip.ToComplexClipRegions(aAppUnitsPerDevPixel, aSc,
-                                      wrRoundedRects);
+    chain->mClip.ToComplexClipRegions(aAppUnitsPerDevPixel, wrRoundedRects);
 
     Maybe<wr::WrSpaceAndClip> spaceAndClip = GetScrollLayer(chain->mASR);
     // Before calling DefineClipChain we defined the ASRs by calling
     // DefineScrollLayers, so we must have a scrollId here.
     MOZ_ASSERT(spaceAndClip.isSome());
 
     // Define the clip
     spaceAndClip->space = SpatialIdAfterOverride(spaceAndClip->space);
--- a/gfx/layers/wr/ClipManager.h
+++ b/gfx/layers/wr/ClipManager.h
@@ -55,36 +55,33 @@ class ClipManager {
 
   void BeginBuild(WebRenderLayerManager* aManager,
                   wr::DisplayListBuilder& aBuilder);
   void EndBuild();
 
   void BeginList(const StackingContextHelper& aStackingContext);
   void EndList(const StackingContextHelper& aStackingContext);
 
-  wr::WrSpaceAndClipChain SwitchItem(
-      nsDisplayItem* aItem, const StackingContextHelper& aStackingContext);
+  wr::WrSpaceAndClipChain SwitchItem(nsDisplayItem* aItem);
   ~ClipManager();
 
   void PushOverrideForASR(const ActiveScrolledRoot* aASR,
                           const wr::WrSpatialId& aSpatialId);
   void PopOverrideForASR(const ActiveScrolledRoot* aASR);
 
  private:
   wr::WrSpatialId SpatialIdAfterOverride(const wr::WrSpatialId& aSpatialId);
 
   Maybe<wr::WrSpaceAndClip> GetScrollLayer(const ActiveScrolledRoot* aASR);
 
-  Maybe<wr::WrSpaceAndClip> DefineScrollLayers(
-      const ActiveScrolledRoot* aASR, nsDisplayItem* aItem,
-      const StackingContextHelper& aSc);
+  Maybe<wr::WrSpaceAndClip> DefineScrollLayers(const ActiveScrolledRoot* aASR,
+                                               nsDisplayItem* aItem);
 
   Maybe<wr::WrClipChainId> DefineClipChain(const DisplayItemClipChain* aChain,
-                                           int32_t aAppUnitsPerDevPixel,
-                                           const StackingContextHelper& aSc);
+                                           int32_t aAppUnitsPerDevPixel);
 
   WebRenderLayerManager* MOZ_NON_OWNING_REF mManager;
   wr::DisplayListBuilder* mBuilder;
 
   // Stack of clip caches. Each cache contains a map from gecko
   // DisplayItemClipChain objects to webrender WrClipIds, which allows us to
   // avoid redefining identical clips in WR. However, the gecko
   // DisplayItemClipChain items get deduplicated quite aggressively, without
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -1097,17 +1097,17 @@ void Grouper::ConstructGroups(nsDisplayL
   nsDisplayItem* startOfCurrentGroup = item;
   while (item) {
     if (IsItemProbablyActive(item, mDisplayListBuilder)) {
       currentGroup->EndGroup(aCommandBuilder->mManager, aDisplayListBuilder,
                              aBuilder, aResources, this, startOfCurrentGroup,
                              item);
 
       {
-        auto spaceAndClipChain = mClipManager.SwitchItem(item, aSc);
+        auto spaceAndClipChain = mClipManager.SwitchItem(item);
         wr::SpaceAndClipChainHelper saccHelper(aBuilder, spaceAndClipChain);
 
         sIndent++;
         // Note: this call to CreateWebRenderCommands can recurse back into
         // this function.
         RenderRootStateManager* manager =
             aCommandBuilder->mManager->GetRenderRootStateManager();
         bool createdWRCommands = item->CreateWebRenderCommands(
@@ -1598,17 +1598,17 @@ void WebRenderCommandBuilder::CreateWebR
       // walking up their ASR chain when building scroll metadata.
       if (forceNewLayerData) {
         mAsrStack.push_back(asr);
       }
     }
 
     // This is where we emulate the clip/scroll stack that was previously
     // implemented on the WR display list side.
-    auto spaceAndClipChain = mClipManager.SwitchItem(item, aSc);
+    auto spaceAndClipChain = mClipManager.SwitchItem(item);
     wr::SpaceAndClipChainHelper saccHelper(aBuilder, spaceAndClipChain);
 
     {  // scope restoreDoGrouping
       AutoRestore<bool> restoreDoGrouping(mDoGrouping);
       if (itemType == DisplayItemType::TYPE_SVG_WRAPPER) {
         // Inside an <svg>, all display items that are not LAYER_ACTIVE wrapper
         // display items (like animated transforms / opacity) share the same
         // animated geometry root, so we can combine subsequent items of that
--- a/layout/painting/DisplayItemClip.cpp
+++ b/layout/painting/DisplayItemClip.cpp
@@ -472,17 +472,17 @@ nsCString DisplayItemClip::ToString() co
                        r.mRadii[0], r.mRadii[1], r.mRadii[2], r.mRadii[3],
                        r.mRadii[4], r.mRadii[5], r.mRadii[6], r.mRadii[7]);
     }
   }
   return std::move(str);
 }
 
 void DisplayItemClip::ToComplexClipRegions(
-    int32_t aAppUnitsPerDevPixel, const layers::StackingContextHelper& aSc,
+    int32_t aAppUnitsPerDevPixel,
     nsTArray<wr::ComplexClipRegion>& aOutArray) const {
   for (const auto& clipRect : mRoundedClipRects) {
     aOutArray.AppendElement(wr::ToComplexClipRegion(
         clipRect.mRect, clipRect.mRadii, aAppUnitsPerDevPixel));
   }
 }
 
 }  // namespace mozilla
--- a/layout/painting/DisplayItemClip.h
+++ b/layout/painting/DisplayItemClip.h
@@ -170,17 +170,16 @@ class DisplayItemClip {
   void MoveBy(const nsPoint& aPoint);
 
   nsCString ToString() const;
 
   uint32_t GetRoundedRectCount() const { return mRoundedClipRects.Length(); }
   void AppendRoundedRects(nsTArray<RoundedRect>* aArray) const;
 
   void ToComplexClipRegions(int32_t aAppUnitsPerDevPixel,
-                            const layers::StackingContextHelper& aSc,
                             nsTArray<wr::ComplexClipRegion>& aOutArray) const;
 
   static const DisplayItemClip& NoClip();
 
   static void Shutdown();
 
  private:
   nsRect mClipRect;