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

This commit is contained in:
Robert O'Callahan 2013-12-13 01:33:02 +13:00
parent c6e1a46c08
commit ef28de860d
5 changed files with 6 additions and 9 deletions

View File

@ -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 "

View File

@ -1674,8 +1674,7 @@ ContainerState::SetFixedPositionLayerData(Layer* aLayer,
}
nsLayoutUtils::SetFixedPositionLayerData(aLayer,
viewportFrame, viewportSize, aFixedPosFrame, mContainerReferenceFrame,
presContext, mParameters);
viewportFrame, viewportSize, aFixedPosFrame, presContext, mParameters);
}
void

View File

@ -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());

View File

@ -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) *

View File

@ -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);