Bug 1422057 - Extract a local variable. r?mstange draft
authorKartikaya Gupta <kgupta@mozilla.com>
Sat, 06 Jan 2018 09:52:58 -0500
changeset 716815 b082d005d5e04d547750561281120d9f5ee51464
parent 716814 19eba7048daaba8e263632ff259346ef54066c0f
child 716816 a287abe5ba1afd123c8ace60c6d6b7d08ff809b6
push id94505
push userkgupta@mozilla.com
push dateSat, 06 Jan 2018 16:27:17 +0000
reviewersmstange
bugs1422057
milestone59.0a1
Bug 1422057 - Extract a local variable. r?mstange This makes the next patch cleaner. MozReview-Commit-ID: KjqdiBFFlMM
gfx/layers/wr/ScrollingLayersHelper.cpp
--- a/gfx/layers/wr/ScrollingLayersHelper.cpp
+++ b/gfx/layers/wr/ScrollingLayersHelper.cpp
@@ -73,44 +73,44 @@ ScrollingLayersHelper::EndList(const Sta
 }
 
 void
 ScrollingLayersHelper::BeginItem(nsDisplayItem* aItem,
                                  const StackingContextHelper& aStackingContext)
 {
   SLH_LOG("processing item %p\n", aItem);
 
-  ItemClips clips(aItem->GetActiveScrolledRoot(), aItem->GetClipChain());
+  const DisplayItemClipChain* clip = aItem->GetClipChain();
+  ItemClips clips(aItem->GetActiveScrolledRoot(), clip);
   MOZ_ASSERT(!mItemClipStack.empty());
   if (clips.HasSameInputs(mItemClipStack.back())) {
     // Early-exit because if the clips are the same then we don't need to do
     // do the work of popping the old stuff and then pushing it right back on
     // for the new item.
     SLH_LOG("early-exit for %p\n", aItem);
     return;
   }
   mItemClipStack.back().Unapply(mBuilder);
   mItemClipStack.pop_back();
 
   int32_t auPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel();
 
   // There are two ASR chains here that we need to be fully defined. One is the
   // ASR chain pointed to by aItem->GetActiveScrolledRoot(). The other is the
-  // ASR chain pointed to by aItem->GetClipChain()->mASR. We pick the leafmost
+  // ASR chain pointed to by clip->mASR. We pick the leafmost
   // of these two chains because that one will include the other.
-  // The leafmost clip is trivially going to be aItem->GetClipChain().
+  // The leafmost clip is trivially going to be |clip|.
   // So we call DefineClipChain with these two leafmost things, and it will
   // recursively define all the clips and scroll layers with the appropriate
   // parents, but will not actually push anything onto the WR stack.
   const ActiveScrolledRoot* leafmostASR = aItem->GetActiveScrolledRoot();
-  if (aItem->GetClipChain()) {
-    leafmostASR = ActiveScrolledRoot::PickDescendant(leafmostASR,
-        aItem->GetClipChain()->mASR);
+  if (clip) {
+    leafmostASR = ActiveScrolledRoot::PickDescendant(leafmostASR, clip->mASR);
   }
-  auto ids = DefineClipChain(aItem, leafmostASR, aItem->GetClipChain(),
+  auto ids = DefineClipChain(aItem, leafmostASR, clip,
       auPerDevPixel, aStackingContext);
 
   // Now that stuff is defined, we need to ensure the right items are on the
   // stack. We need this primarily for the WR display items that will be
   // generated while processing aItem. However those display items only care
   // about the topmost clip on the stack. If that were all we cared about we
   // would only need to push one thing here and we would be done. However, we
   // also care about the ScrollingLayersHelper instance that might be created
@@ -144,17 +144,17 @@ ScrollingLayersHelper::BeginItem(nsDispl
   // If we don't need a ClipAndScroll, ensure the item's ASR is at the top of
   // the scroll stack
   if (!needClipAndScroll && mBuilder->TopmostScrollId() != scrollId) {
     MOZ_ASSERT(leafmostId == scrollId); // because !needClipAndScroll
     clips.mScrollId = Some(scrollId);
   }
   // And ensure the leafmost clip, if scrolled by that ASR, is at the top of the
   // stack.
-  if (ids.second && aItem->GetClipChain()->mASR == leafmostASR) {
+  if (ids.second && clip->mASR == leafmostASR) {
     clips.mClipId = ids.second;
   }
   // If we need the ClipAndScroll, we want to replace the topmost scroll layer
   // with the item's ASR but preseve the topmost clip (which is scrolled by
   // some other ASR).
   if (needClipAndScroll) {
     // If mClipId is set that means we want to push it such that it's going
     // to be the TopmostClipId(), but we haven't actually pushed it yet.