Bug 1273250 - Set a layer clip rather than a scroll clip for fixed background layers if the clip moves with the layer. r=mstange draft
authorBotond Ballo <botond@mozilla.com>
Mon, 16 May 2016 17:20:23 -0400
changeset 367611 b561f8721d91c930bced7664f11a331552b97a5e
parent 367610 5da55ed6ec733ff10c2c855c95bf4109fdbbe4b5
child 367612 ba114ec32272b696c3b29d45d42c4a36ad3854fb
child 369272 2e894c9dd444cf49606a4a4381e86a5b9f11669b
push id18289
push userbballo@mozilla.com
push dateMon, 16 May 2016 23:53:34 +0000
reviewersmstange
bugs1273250, 1272525
milestone49.0a1
Bug 1273250 - Set a layer clip rather than a scroll clip for fixed background layers if the clip moves with the layer. r=mstange This patch also removes the earlier workaround added in bug 1272525. MozReview-Commit-ID: HR2wF2BGsKl
layout/base/FrameLayerBuilder.cpp
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -3871,18 +3871,21 @@ ContainerState::ProcessDisplayItems(nsDi
            scrollClip = scrollClip->mParent) {
         if (scrollClip->mClip) {
           clip.IntersectWith(*scrollClip->mClip);
         }
       }
       item->SetClip(mBuilder, clip);
     }
 
-    bool shouldFixToViewport = !(*animatedGeometryRoot)->GetParent() &&
-      item->ShouldFixToViewport(mBuilder);
+    bool clipMovesWithLayer = (animatedGeometryRoot == animatedGeometryRootForClip);
+
+    bool shouldFixToViewport = !clipMovesWithLayer &&
+        !(*animatedGeometryRoot)->GetParent() &&
+        item->ShouldFixToViewport(mBuilder);
 
     // For items that are fixed to the viewport, remove their clip at the
     // display item level because additional areas could be brought into
     // view by async scrolling. Save the clip so we can set it on the layer
     // instead later.
     DisplayItemClip fixedToViewportClip = DisplayItemClip::NoClip();
     if (shouldFixToViewport) {
       fixedToViewportClip = item->GetClip();
@@ -4111,17 +4114,17 @@ ContainerState::ProcessDisplayItems(nsDi
       ownLayer->SetClipRect(Nothing());
       ownLayer->SetScrolledClip(Nothing());
       if (layerClip.HasClip()) {
         // For layers fixed to the viewport, the clip becomes part of the
         // layer's scrolled clip. However, BasicLayerManager doesn't support
         // scrolled clips, and doesn't care about the distinction anyways
         // (it only matters for async scrolling), so only set a scrolled clip
         // if we have a widget layer manager.
-        if (shouldFixToViewport && mManager->IsWidgetLayerManager()) {
+        if (shouldFixToViewport) {
           LayerClip scrolledClip;
           scrolledClip.SetClipRect(layerClipRect);
           if (layerClip.IsRectClippedByRoundedCorner(itemContent)) {
             scrolledClip.SetMaskLayerIndex(
                 SetupMaskLayerForScrolledClip(ownLayer.get(), layerClip));
           }
           ownLayer->SetScrolledClip(Some(scrolledClip));
         } else {