Bug 1267438 - Remove the redundant aTransformAffectsLayerClip argument to AlignFixedAndStickyLayers. r=mstange draft
authorBotond Ballo <botond@mozilla.com>
Wed, 04 May 2016 20:20:57 -0400
changeset 364624 36d99200a254c4c94c101656885d59f63305e8a4
parent 364623 0b785c0881d1bf4ed5f7c991574d8d7033b71bfc
child 520331 22841f1d8d475cda4be35cfb1e9c8aa4d82af622
push id17504
push userbballo@mozilla.com
push dateFri, 06 May 2016 23:44:30 +0000
reviewersmstange
bugs1267438
milestone49.0a1
Bug 1267438 - Remove the redundant aTransformAffectsLayerClip argument to AlignFixedAndStickyLayers. r=mstange MozReview-Commit-ID: AjHA70EdCeX
gfx/layers/composite/AsyncCompositionManager.cpp
gfx/layers/composite/AsyncCompositionManager.h
--- a/gfx/layers/composite/AsyncCompositionManager.cpp
+++ b/gfx/layers/composite/AsyncCompositionManager.cpp
@@ -422,35 +422,33 @@ IsFixedOrSticky(Layer* aLayer)
 }
 
 void
 AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer,
                                                    Layer* aTransformedSubtreeRoot,
                                                    FrameMetrics::ViewID aTransformScrollId,
                                                    const LayerToParentLayerMatrix4x4& aPreviousTransformForRoot,
                                                    const LayerToParentLayerMatrix4x4& aCurrentTransformForRoot,
-                                                   const ScreenMargin& aFixedLayerMargins,
-                                                   bool aTransformAffectsLayerClip)
+                                                   const ScreenMargin& aFixedLayerMargins)
 {
   bool needsAsyncTransformUnapplied = false;
   if (Maybe<FrameMetrics::ViewID> fixedTo = IsFixedOrSticky(aLayer)) {
     needsAsyncTransformUnapplied = AsyncTransformShouldBeUnapplied(aLayer,
         *fixedTo, aTransformedSubtreeRoot, aTransformScrollId);
   }
 
   // We want to process all the fixed and sticky descendants of
   // aTransformedSubtreeRoot. Once we do encounter such a descendant, we don't
   // need to recurse any deeper because the adjustment to the fixed or sticky
   // layer will apply to its subtree.
   if (!needsAsyncTransformUnapplied) {
     for (Layer* child = aLayer->GetFirstChild(); child; child = child->GetNextSibling()) {
       AlignFixedAndStickyLayers(child, aTransformedSubtreeRoot, aTransformScrollId,
                                 aPreviousTransformForRoot,
-                                aCurrentTransformForRoot, aFixedLayerMargins,
-                                true /* descendants' clip rects are always affected */);
+                                aCurrentTransformForRoot, aFixedLayerMargins);
     }
     return;
   }
 
   // Insert a translation so that the position of the anchor point is the same
   // before and after the change to the transform of aTransformedSubtreeRoot.
 
   // Accumulate the transforms between this layer and the subtree root layer.
@@ -524,17 +522,17 @@ AsyncCompositionManager::AlignFixedAndSt
   }
 
   // Finally, apply the translation to the layer transform. Note that in cases
   // where the async transform on |aTransformedSubtreeRoot| affects this layer's
   // clip rect, we need to apply the same translation to said clip rect, so
   // that the effective transform on the clip rect takes it back to where it was
   // originally, had there been no async scroll.
   TranslateShadowLayer(aLayer, ThebesPoint(translation.ToUnknownPoint()),
-      aTransformAffectsLayerClip, &mClipPartsCache);
+      true, &mClipPartsCache);
 }
 
 static void
 SampleValue(float aPortion, Animation& aAnimation, StyleAnimationValue& aStart,
             StyleAnimationValue& aEnd, Animatable* aValue, Layer* aLayer)
 {
   StyleAnimationValue interpolatedValue;
   NS_ASSERTION(aStart.GetUnit() == aEnd.GetUnit() ||
@@ -976,18 +974,17 @@ AsyncCompositionManager::ApplyAsyncConte
     LayerToParentLayerMatrix4x4 transformWithoutOverscrollOrOmta =
         aLayer->GetTransformTyped()
       * CompleteAsyncTransform(
           AdjustForClip(asyncTransformWithoutOverscroll, aLayer));
 
     // Since fixed/sticky layers are relative to their nearest scrolling ancestor,
     // we use the ViewID from the bottommost scrollable metrics here.
     AlignFixedAndStickyLayers(aLayer, aLayer, metrics.GetScrollId(), oldTransform,
-                              transformWithoutOverscrollOrOmta, fixedLayerMargins,
-                              clipParts.IsSome());
+                              transformWithoutOverscrollOrOmta, fixedLayerMargins);
 
     // Combine the scrolled portion of the local clip with the ancestor
     // scroll clip. This is not included in the async transform above, since
     // the ancestor clip should not move with this APZC.
     if (scrollMetadata.HasScrollClip()) {
       ParentLayerIntRect clip = scrollMetadata.ScrollClip().GetClipRect();
       if (aLayer->GetParent() && aLayer->GetParent()->GetTransformIsPerspective()) {
         // If our parent layer has a perspective transform, we want to apply
@@ -1416,17 +1413,17 @@ AsyncCompositionManager::TransformScroll
       metrics.GetCompositionBounds().height;
   }
   oldTransform.PreScale(underZoomScale.width, underZoomScale.height, 1);
 
   // Make sure fixed position layers don't move away from their anchor points
   // when we're asynchronously panning or zooming
   AlignFixedAndStickyLayers(aLayer, aLayer, metrics.GetScrollId(), oldTransform,
                             aLayer->GetLocalTransformTyped(),
-                            fixedLayerMargins, false);
+                            fixedLayerMargins);
 
   ExpandRootClipRect(aLayer, fixedLayerMargins);
 }
 
 void
 AsyncCompositionManager::GetFrameUniformity(FrameUniformityData* aOutData)
 {
   MOZ_ASSERT(CompositorBridgeParent::IsInCompositorThread());
--- a/gfx/layers/composite/AsyncCompositionManager.h
+++ b/gfx/layers/composite/AsyncCompositionManager.h
@@ -125,20 +125,16 @@ public:
   // to store the two parts separately.
   struct ClipParts {
     Maybe<ParentLayerIntRect> mFixedClip;
     Maybe<ParentLayerIntRect> mScrolledClip;
 
     Maybe<ParentLayerIntRect> Intersect() const {
       return IntersectMaybeRects(mFixedClip, mScrolledClip);
     }
-
-    bool IsSome() const {
-      return mFixedClip.isSome() || mScrolledClip.isSome();
-    }
   };
 
   typedef std::map<Layer*, ClipParts> ClipPartsCache;
 private:
   void TransformScrollableLayer(Layer* aLayer);
   // Return true if an AsyncPanZoomController content transform was
   // applied for |aLayer|. |*aOutFoundRoot| is set to true on Android only, if
   // one of the metrics on one of the layers was determined to be the "root"
@@ -192,18 +188,17 @@ private:
    * aTransformedSubtreeRoot affects aLayer's clip rects, so we know
    * whether we need to perform a corresponding unadjustment to keep
    * the clip rect fixed.
    */
   void AlignFixedAndStickyLayers(Layer* aLayer, Layer* aTransformedSubtreeRoot,
                                  FrameMetrics::ViewID aTransformScrollId,
                                  const LayerToParentLayerMatrix4x4& aPreviousTransformForRoot,
                                  const LayerToParentLayerMatrix4x4& aCurrentTransformForRoot,
-                                 const ScreenMargin& aFixedLayerMargins,
-                                 bool aTransformAffectsLayerClip);
+                                 const ScreenMargin& aFixedLayerMargins);
 
   /**
    * DRAWING PHASE ONLY
    *
    * For reach RefLayer in our layer tree, look up its referent and connect it
    * to the layer tree, if found.
    * aHasRemoteContent - indicates if the layer tree contains a remote reflayer.
    *  May be null.