Bug 1406727 - more checks. r=mstange a=lizzard
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 25 Apr 2018 09:00:17 +0300
changeset 789608 bda9a66dc3583e484c42c77089160a2af9441a0b
parent 789607 e21076f36898f0677d2e9026dd1df5115d0b46ba
child 789609 faa0174ca76eefb9fe36c9bd0150e4c91f825170
push id108293
push usernthomas@mozilla.com
push dateMon, 30 Apr 2018 01:46:46 +0000
reviewersmstange, lizzard
bugs1406727
milestone60.0
Bug 1406727 - more checks. r=mstange a=lizzard
layout/generic/nsGfxScrollFrame.cpp
layout/painting/nsDisplayList.h
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -3338,16 +3338,18 @@ ScrollFrameHelper::BuildDisplayList(nsDi
       if (mScrollPosForLayerPixelAlignment == nsPoint(-1,-1)) {
         mScrollPosForLayerPixelAlignment = mScrollPosAtLastPaint;
       }
     } else {
       mScrollPosForLayerPixelAlignment = nsPoint(-1,-1);
     }
   }
 
+  aBuilder->Check();
+
   // It's safe to get this value before the DecideScrollableLayer call below
   // because that call cannot create a displayport for root scroll frames,
   // and hence it cannot create an ignore scroll frame.
   bool ignoringThisScrollFrame =
     aBuilder->GetIgnoreScrollFrame() == mOuter || IsIgnoringViewportClipping();
 
   // Overflow clipping can never clip frames outside our subtree, so there
   // is no need to worry about whether we are a moving frame that might clip
@@ -3362,16 +3364,17 @@ ScrollFrameHelper::BuildDisplayList(nsDi
   if (!ignoringThisScrollFrame) {
     visibleRect = visibleRect.Intersect(mScrollPort);
     dirtyRect = dirtyRect.Intersect(mScrollPort);
   }
 
   bool dirtyRectHasBeenOverriden = false;
   Unused << DecideScrollableLayer(aBuilder, &visibleRect, &dirtyRect,
               /* aSetBase = */ !mIsRoot, &dirtyRectHasBeenOverriden);
+  aBuilder->Check();
 
   if (aBuilder->IsForFrameVisibility()) {
     // We expand the dirty rect to catch frames just outside of the scroll port.
     // We use the dirty rect instead of the whole scroll port to prevent
     // too much expansion in the presence of very large (bigger than the
     // viewport) scroll ports.
     dirtyRect = ExpandRectToNearlyVisible(dirtyRect);
     visibleRect = dirtyRect;
@@ -3453,25 +3456,29 @@ ScrollFrameHelper::BuildDisplayList(nsDi
         // scroll frame for the display root, then we don't need a scroll
         // info layer. nsDisplayList::PaintForFrame already calls
         // ComputeFrameMetrics for us.
         (!(gfxPrefs::LayoutUseContainersForRootFrames() && mIsRoot) ||
          (aBuilder->RootReferenceFrame()->PresContext() != mOuter->PresContext()));
     }
   }
 
+  aBuilder->Check();
+
   // Now display the scrollbars and scrollcorner. These parts are drawn
   // in the border-background layer, on top of our own background and
   // borders and underneath borders and backgrounds of later elements
   // in the tree.
   // Note that this does not apply for overlay scrollbars; those are drawn
   // in the positioned-elements layer on top of everything else by the call
   // to AppendScrollPartsTo(..., true) further down.
   AppendScrollPartsTo(aBuilder, aLists, createLayersForScrollbars, false);
 
+  aBuilder->Check();
+
   const nsStyleDisplay* disp = mOuter->StyleDisplay();
   if (disp && (disp->mWillChangeBitField & NS_STYLE_WILL_CHANGE_SCROLL)) {
     aBuilder->AddToWillChangeBudget(mOuter, GetScrollPositionClampingScrollPortSize());
   }
 
   mScrollParentID = aBuilder->GetCurrentScrollParentId();
 
   Maybe<nsRect> contentBoxClip;
@@ -3523,16 +3530,18 @@ ScrollFrameHelper::BuildDisplayList(nsDi
         // caret height on the top, and its full width on the right.
         nsRect inflatedClip = clipRect;
         inflatedClip.Inflate(nsMargin(caretRect.height / 2, caretRect.width, 0, 0));
         contentBoxClip = Some(inflatedClip);
       }
     }
   }
 
+  aBuilder->Check();
+
   nsDisplayListCollection scrolledContent(aBuilder);
   {
     // Note that setting the current scroll parent id here means that positioned children
     // of this scroll info layer will pick up the scroll info layer as their scroll handoff
     // parent. This is intentional because that is what happens for positioned children
     // of scroll layers, and we want to maintain consistent behaviour between scroll layers
     // and scroll info layers.
     nsDisplayListBuilder::AutoCurrentScrollParentIdSetter idSetter(
@@ -3576,16 +3585,18 @@ ScrollFrameHelper::BuildDisplayList(nsDi
     if (mWillBuildScrollableLayer && aBuilder->IsPaintingToWindow()) {
       asrSetter.EnterScrollFrame(sf);
     }
 
     if (mIsScrollableLayerInRootContainer) {
       aBuilder->SetActiveScrolledRootForRootScrollframe(aBuilder->CurrentActiveScrolledRoot());
     }
 
+    aBuilder->Check();
+
     if (mWillBuildScrollableLayer) {
       // Create a hit test info item for the scrolled content that's not
       // clipped to the displayport. This ensures that within the bounds
       // of the scroll frame, the scrolled content is always hit, even
       // if we are checkerboarding.
       if (aBuilder->BuildCompositorHitTestInfo()) {
         CompositorHitTestInfo info = mScrolledFrame->GetCompositorHitTestInfo(aBuilder);
         if (info != CompositorHitTestInfo::eInvisibleToHitTest) {
@@ -3876,16 +3887,18 @@ ScrollFrameHelper::DecideScrollableLayer
   // Since making new layers is expensive, only create a scrollable layer
   // for some scroll frames.
   // When a displayport is being used, force building of a layer so that
   // the compositor can find the scrollable layer for async scrolling.
   // If the element is marked 'scrollgrab', also force building of a layer
   // so that APZ can implement scroll grabbing.
   mWillBuildScrollableLayer = usingDisplayPort || nsContentUtils::HasScrollgrab(content);
 
+  aBuilder->Check();
+
   // The cached animated geometry root for the display builder is out of
   // date if we just introduced a new animated geometry root.
   if (oldWillBuildScrollableLayer != mWillBuildScrollableLayer) {
     aBuilder->RecomputeCurrentAnimatedGeometryRoot();
   }
 
   if (gfxPrefs::LayoutUseContainersForRootFrames() && mWillBuildScrollableLayer && mIsRoot) {
     mIsScrollableLayerInRootContainer = true;
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -703,17 +703,17 @@ public:
     return mCurrentAGR;
   }
   AnimatedGeometryRoot* GetRootAnimatedGeometryRoot() {
     return mRootAGR;
   }
 
   void RecomputeCurrentAnimatedGeometryRoot();
 
-  void Check() {
+  MOZ_NEVER_INLINE void Check() {
     mPool.Check();
   }
 
   /**
    * Returns true if merging and flattening of display lists should be
    * performed while computing visibility.
    */
   bool AllowMergingAndFlattening() { return mAllowMergingAndFlattening; }