Bug 1055658 part 1 - Move code for applying relative position to an independent method. r=dbaron

--HG--
extra : source : aa1e52e91dd5ae6fdcdc6ca17bd9ec2a0b946f2b
This commit is contained in:
Xidorn Quan 2015-01-12 14:31:55 +11:00
parent f72af35148
commit b4c630a9e1
2 changed files with 22 additions and 10 deletions

View File

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

View File

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