Bug 1205630 - Translate a fixed background display item's clip rect correctly when setting it on the layer. r=mstange, a=lizzard
authorBotond Ballo <botond@mozilla.com>
Fri, 25 Sep 2015 12:55:00 -0400
changeset 296353 ea5e14f1c519034119d8c7e85e31870048a15e08
parent 296352 fc9c55d72e834f89cddd8ff07a307770f5a1be45
child 296354 a2d2548a56976dde606e5e5b247aacc3f25ebe55
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange, lizzard
bugs1205630
milestone43.0a2
Bug 1205630 - Translate a fixed background display item's clip rect correctly when setting it on the layer. r=mstange, a=lizzard
layout/base/FrameLayerBuilder.cpp
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -3210,17 +3210,19 @@ void ContainerState::FinishPaintedLayerD
     // use a mask layer for rounded rect clipping.
     // data->mCommonClipCount may be -1 if we haven't put any actual
     // drawable items in this layer (i.e. it's only catching events).
     int32_t commonClipCount;
     // If the layer contains a single item fixed to the viewport, we removed
     // its clip in ProcessDisplayItems() and saved it to set on the layer instead.
     // Set the clip on the layer now.
     if (data->mSingleItemFixedToViewport && data->mItemClip.HasClip()) {
-      data->mLayer->SetClipRect(Some(ViewAs<ParentLayerPixel>(ScaleToNearestPixels(data->mItemClip.GetClipRect()))));
+      nsIntRect layerClipRect = ScaleToNearestPixels(data->mItemClip.GetClipRect());
+      layerClipRect.MoveBy(mParameters.mOffset);
+      data->mLayer->SetClipRect(Some(ViewAs<ParentLayerPixel>(layerClipRect)));
       // There is only one item, so all of the clips are in common to all items.
       // data->mCommonClipCount will be zero because we removed the clip from
       // the display item. (It could also be -1 if we're inside an inactive
       // layer tree in which we don't call UpdateCommonClipCount() at all.)
       MOZ_ASSERT(data->mCommonClipCount == -1 || data->mCommonClipCount == 0);
       commonClipCount = data->mItemClip.GetRoundedRectCount();
     } else {
       commonClipCount = std::max(0, data->mCommonClipCount);