Bug 1205630 - Translate a fixed background display item's clip rect correctly when setting it on the layer. r=mstange
authorBotond Ballo <botond@mozilla.com>
Fri, 25 Sep 2015 12:55:00 -0400
changeset 299532 50bb473484fbf2dc7c2f76b0ed2d0cc44510a1d9
parent 299531 443dc9a9c21c080d0779d709c7f750d3874c10db
child 299533 bae7847cafbd9db6559fd644cb87f3826e9e5278
push id5392
push userraliiev@mozilla.com
push dateMon, 14 Dec 2015 20:08:23 +0000
treeherdermozilla-beta@16ce8562a975 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1205630
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1205630 - Translate a fixed background display item's clip rect correctly when setting it on the layer. r=mstange
layout/base/FrameLayerBuilder.cpp
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -3263,17 +3263,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);