Bug 1079154 patch 3: logical versions of ApplyRelativePositioning, r=jfkthame

This commit is contained in:
Simon Montagu 2015-01-06 23:10:07 -08:00
parent 02b85bac8f
commit 16d0d92ccc

View File

@ -825,6 +825,34 @@ public:
ApplyRelativePositioning(frame, ComputedPhysicalOffsets(), aPosition);
}
static void
ApplyRelativePositioning(nsIFrame* aFrame,
mozilla::WritingMode aWritingMode,
const mozilla::LogicalMargin& aComputedOffsets,
mozilla::LogicalPoint* aPosition,
nscoord aContainerWidth) {
// Subtract the width of the frame from the container width that we
// use for converting between the logical and physical origins of
// the frame. This accounts for the fact that logical origins in RTL
// coordinate systems are at the top right of the frame instead of
// the top left.
nscoord frameWidth = aFrame->GetSize().width;
nsPoint pos = aPosition->GetPhysicalPoint(aWritingMode,
aContainerWidth - frameWidth);
ApplyRelativePositioning(aFrame,
aComputedOffsets.GetPhysicalMargin(aWritingMode),
&pos);
*aPosition = mozilla::LogicalPoint(aWritingMode, pos,
aContainerWidth - frameWidth);
}
void ApplyRelativePositioning(mozilla::LogicalPoint* aPosition,
nscoord aContainerWidth) const {
ApplyRelativePositioning(frame, mWritingMode,
ComputedLogicalOffsets(), aPosition,
aContainerWidth);
}
#ifdef DEBUG
// Reflow trace methods. Defined in nsFrame.cpp so they have access
// to the display-reflow infrastructure.