diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index 3e222ca16d5..a6f8b3503a4 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -3021,6 +3021,25 @@ nsLineLayout::RelativePositionFrames(nsOverflowAreas& aOverflowAreas) RelativePositionFrames(mRootSpan, aOverflowAreas); } +// This method applies any relative positioning to the given frame. +void +nsLineLayout::ApplyRelativePositioning(PerFrameData* aPFD) +{ + if (!aPFD->mRelativePos) { + return; + } + + nsIFrame* frame = aPFD->mFrame; + WritingMode frameWM = frame->GetWritingMode(); + LogicalPoint origin = frame->GetLogicalPosition(mContainerWidth); + // right and bottom are handled by + // nsHTMLReflowState::ComputeRelativeOffsets + nsHTMLReflowState::ApplyRelativePositioning(frame, frameWM, + aPFD->mOffsets, &origin, + mContainerWidth); + frame->SetPosition(frameWM, origin, mContainerWidth); +} + void nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsOverflowAreas& aOverflowAreas) { @@ -3059,16 +3078,7 @@ nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsOverflowAreas& aOverflo nsIFrame* frame = pfd->mFrame; // Adjust the origin of the frame - if (pfd->mRelativePos) { - WritingMode frameWM = frame->GetWritingMode(); - LogicalPoint origin = frame->GetLogicalPosition(mContainerWidth); - // right and bottom are handled by - // nsHTMLReflowState::ComputeRelativeOffsets - nsHTMLReflowState::ApplyRelativePositioning(frame, frameWM, - pfd->mOffsets, &origin, - mContainerWidth); - frame->SetPosition(frameWM, origin, mContainerWidth); - } + ApplyRelativePositioning(pfd); // We must position the view correctly before positioning its // descendants so that widgets are positioned properly (since only diff --git a/layout/generic/nsLineLayout.h b/layout/generic/nsLineLayout.h index 5eb9fff79a6..32000148b55 100644 --- a/layout/generic/nsLineLayout.h +++ b/layout/generic/nsLineLayout.h @@ -665,6 +665,8 @@ protected: nscoord aDistanceFromStart, nscoord aLineBSize); + void ApplyRelativePositioning(PerFrameData* aPFD); + void RelativePositionFrames(PerSpanData* psd, nsOverflowAreas& aOverflowAreas); bool TrimTrailingWhiteSpaceIn(PerSpanData* psd, nscoord* aDeltaISize);