Bug 1441796 - Part 2: Undo changes from bug 1416991 draft
authorMiko Mynttinen <mikokm@gmail.com>
Tue, 27 Mar 2018 12:21:38 +0200
changeset 773212 4aab0409a771cf980a43cf25755d19a242acac60
parent 773211 5593b0d7cb166c27f7206b64547ebbad7510a0b8
child 773213 5f8a6fc13065759ebfdd43a32d8944b9f64e23f4
push id104179
push userbmo:mikokm@gmail.com
push dateTue, 27 Mar 2018 17:19:18 +0000
bugs1441796, 1416991
milestone61.0a1
Bug 1441796 - Part 2: Undo changes from bug 1416991 MozReview-Commit-ID: HwnAdk8sG1w
layout/generic/nsFrame.cpp
layout/painting/nsDisplayList.cpp
layout/painting/nsDisplayList.h
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -3505,22 +3505,16 @@ nsIFrame::BuildDisplayListForChild(nsDis
   if (doingShortcut) {
     // This is the shortcut for frames been handled along the common
     // path, the most common one of THE COMMON CASE mentioned later.
     MOZ_ASSERT(child->Type() != LayoutFrameType::Placeholder);
     MOZ_ASSERT(!aBuilder->GetSelectedFramesOnly() &&
                !aBuilder->GetIncludeAllOutOfFlows(),
                "It should be held for painting to window");
 
-    if (child->HasPerspective()) {
-      // We need to allocate a perspective index before a potential early
-      // return below.
-      aBuilder->AllocatePerspectiveItemIndex();
-    }
-
     if (!DescendIntoChild(aBuilder, child, visible, dirty)) {
       return;
     }
 
     nsDisplayListBuilder::AutoBuildingDisplayList
       buildingForChild(aBuilder, child, visible, dirty, false);
 
     CheckForApzAwareEventHandlers(aBuilder, child);
@@ -3600,24 +3594,16 @@ nsIFrame::BuildDisplayListForChild(nsDis
       // to enter to reach other out-of-flow frames that are visible.
       visible.SetEmpty();
       dirty.SetEmpty();
     }
 
     pseudoStackingContext = true;
   }
 
-  const nsStyleDisplay* disp = child->StyleDisplay();
-
-  if (child->HasPerspective(disp)) {
-    // We need to allocate a perspective index before a potential early
-    // return below.
-    aBuilder->AllocatePerspectiveItemIndex();
-  }
-
   NS_ASSERTION(!child->IsPlaceholderFrame(),
                "Should have dealt with placeholders already");
   if (aBuilder->GetSelectedFramesOnly() &&
       child->IsLeaf() &&
       !aChild->IsSelected()) {
     return;
   }
 
@@ -3645,16 +3631,17 @@ nsIFrame::BuildDisplayListForChild(nsDis
     awayFromCommonPath = true;
   }
 
   child->SetBuiltDisplayList(true);
 
   // Child is composited if it's transformed, partially transparent, or has
   // SVG effects or a blend mode..
   EffectSet* effectSet = EffectSet::GetEffectSet(child);
+  const nsStyleDisplay* disp = child->StyleDisplay();
   const nsStyleEffects* effects = child->StyleEffects();
   const nsStylePosition* pos = child->StylePosition();
 
   const bool isVisuallyAtomic =
     child->IsVisuallyAtomic(effectSet, disp, effects);
 
   const bool isPositioned =
     disp->IsAbsPosContainingBlock(child);
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -9024,17 +9024,17 @@ nsDisplayTransform::WriteDebugInfo(std::
 
 nsDisplayPerspective::nsDisplayPerspective(nsDisplayListBuilder* aBuilder,
                                            nsIFrame* aTransformFrame,
                                            nsIFrame* aPerspectiveFrame,
                                            nsDisplayList* aList)
   : nsDisplayItem(aBuilder, aPerspectiveFrame)
   , mList(aBuilder, aPerspectiveFrame, aList)
   , mTransformFrame(aTransformFrame)
-  , mIndex(aBuilder->PerspectiveItemIndex())
+  , mIndex(aBuilder->AllocatePerspectiveItemIndex())
 {
   MOZ_ASSERT(mList.GetChildren()->Count() == 1);
   MOZ_ASSERT(mList.GetChildren()->GetTop()->GetType() == DisplayItemType::TYPE_TRANSFORM);
 
   if (aBuilder->IsRetainingDisplayList()) {
     mTransformFrame->AddDisplayItem(this);
   }
 }
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -1646,18 +1646,17 @@ public:
   /**
    * mContainsBlendMode is true if we processed a display item that
    * has a blend mode attached. We do this so we can insert a
    * nsDisplayBlendContainer in the parent stacking context.
    */
   void SetContainsBlendMode(bool aContainsBlendMode) { mContainsBlendMode = aContainsBlendMode; }
   bool ContainsBlendMode() const { return mContainsBlendMode; }
 
-  void AllocatePerspectiveItemIndex() { ++mPerspectiveItemIndex; }
-  uint32_t PerspectiveItemIndex() const { return mPerspectiveItemIndex; }
+  uint32_t AllocatePerspectiveItemIndex() { return mPerspectiveItemIndex++; }
 
   DisplayListClipState& ClipState() { return mClipState; }
   const ActiveScrolledRoot* CurrentActiveScrolledRoot() { return mCurrentActiveScrolledRoot; }
   const ActiveScrolledRoot* CurrentAncestorASRStackingContextContents() { return mCurrentContainerASR; }
 
   /**
    * Add the current frame to the will-change budget if possible and
    * remeber the outcome. Subsequent calls to IsInWillChangeBudget