From 182a8c2ebe79eb4e609819dfe0c14b01871cd8bc Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Fri, 13 Dec 2013 01:33:02 +1300 Subject: [PATCH] Bug 945634. The fixed-pos anchor point should be in the layer's coordinate system, whose 0,0 is the top-left of the fixed-pos frame. r=mattwoodrow --- gfx/layers/Layers.cpp | 3 ++- layout/base/FrameLayerBuilder.cpp | 3 +-- layout/base/nsDisplayList.cpp | 5 ++--- layout/base/nsLayoutUtils.cpp | 3 +-- layout/base/nsLayoutUtils.h | 1 - 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 1aa0a3b90e17..541226feeeda 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -1276,7 +1276,8 @@ Layer::PrintInfo(nsACString& aTo, const char* aPrefix) } } if (GetIsFixedPosition()) { - aTo.AppendPrintf(" [isFixedPosition anchor=%f,%f]", mAnchor.x, mAnchor.y); + aTo.AppendPrintf(" [isFixedPosition anchor=%f,%f margin=%f,%f,%f,%f]", mAnchor.x, mAnchor.y, + mMargins.top, mMargins.right, mMargins.bottom, mMargins.left); } if (GetIsStickyPosition()) { aTo.AppendPrintf(" [isStickyPosition scrollId=%d outer=%f,%f %fx%f " diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 9bb95ac0a123..3c4d96df5782 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -1674,8 +1674,7 @@ ContainerState::SetFixedPositionLayerData(Layer* aLayer, } nsLayoutUtils::SetFixedPositionLayerData(aLayer, - viewportFrame, viewportSize, aFixedPosFrame, mContainerReferenceFrame, - presContext, mParameters); + viewportFrame, viewportSize, aFixedPosFrame, presContext, mParameters); } void diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index b5a1495957b8..ae5ce6fdbeef 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -3363,9 +3363,8 @@ nsDisplayStickyPosition::BuildLayer(nsDisplayListBuilder* aBuilder, } nsLayoutUtils::SetFixedPositionLayerData(layer, scrollFrame, scrollFrameSize, - mStickyPosFrame, ReferenceFrame(), - presContext, - aContainerParameters); + mStickyPosFrame, + presContext, aContainerParameters); ViewID scrollId = nsLayoutUtils::FindOrCreateIDFor( stickyScrollContainer->ScrollFrame()->GetScrolledFrame()->GetContent()); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 208dfb981906..aef7bb43b61a 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -1204,14 +1204,13 @@ nsLayoutUtils::SetFixedPositionLayerData(Layer* aLayer, const nsIFrame* aViewportFrame, nsSize aViewportSize, const nsIFrame* aFixedPosFrame, - const nsIFrame* aReferenceFrame, nsPresContext* aPresContext, const ContainerLayerParameters& aContainerParameters) { // Find out the rect of the viewport frame relative to the reference frame. // This, in conjunction with the container scale, will correspond to the // coordinate-space of the built layer. float factor = aPresContext->AppUnitsPerDevPixel(); - nsPoint origin = aViewportFrame->GetOffsetToCrossDoc(aReferenceFrame); + nsPoint origin = aViewportFrame->GetOffsetToCrossDoc(aFixedPosFrame); LayerRect anchorRect(NSAppUnitsToFloatPixels(origin.x, factor) * aContainerParameters.mXScale, NSAppUnitsToFloatPixels(origin.y, factor) * diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index aa036d88604c..4224503b9c38 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -378,7 +378,6 @@ public: static void SetFixedPositionLayerData(Layer* aLayer, const nsIFrame* aViewportFrame, nsSize aViewportSize, const nsIFrame* aFixedPosFrame, - const nsIFrame* aReferenceFrame, nsPresContext* aPresContext, const ContainerLayerParameters& aContainerParameters);