Bug 404180. Bidi reordering moves frames around so we can't trust pfd->mBounds in nsLineLayout::RelativePositionFrames. r+sr=dbaron

This commit is contained in:
roc+%cs.cmu.edu 2007-12-12 01:43:09 +00:00
Родитель c5c7b201eb
Коммит 789b4eec86
5 изменённых файлов: 21 добавлений и 4 удалений

Просмотреть файл

@ -4006,6 +4006,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
} // bidi enabled } // bidi enabled
#endif // IBMBIDI #endif // IBMBIDI
// From here on, pfd->mBounds rectangles are incorrect because bidi
// might have moved frames around!
nsRect combinedArea; nsRect combinedArea;
aLineLayout.RelativePositionFrames(combinedArea); // XXXldb This returned width as -15, 2001-06-12, Bugzilla aLineLayout.RelativePositionFrames(combinedArea); // XXXldb This returned width as -15, 2001-06-12, Bugzilla
aLine->SetCombinedArea(combinedArea); aLine->SetCombinedArea(combinedArea);

Просмотреть файл

@ -2612,8 +2612,10 @@ nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsRect& aCombinedArea)
// -- the bounds of all inline descendants // -- the bounds of all inline descendants
// The former two parts are computed right here, we gather the descendants // The former two parts are computed right here, we gather the descendants
// below. // below.
nsRect adjustedBounds(0, 0, psd->mFrame->mBounds.width, // At this point psd->mFrame->mBounds might be out of date since
psd->mFrame->mBounds.height); // bidi reordering can move and resize the frames. So use the frame's
// rect instead of mBounds.
nsRect adjustedBounds(nsPoint(0, 0), psd->mFrame->mFrame->GetSize());
combinedAreaResult.UnionRect(psd->mFrame->mCombinedArea, adjustedBounds); combinedAreaResult.UnionRect(psd->mFrame->mCombinedArea, adjustedBounds);
} }
else { else {
@ -2630,16 +2632,16 @@ nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsRect& aCombinedArea)
} }
for (PerFrameData* pfd = psd->mFirstFrame; pfd; pfd = pfd->mNext) { for (PerFrameData* pfd = psd->mFirstFrame; pfd; pfd = pfd->mNext) {
nsPoint origin = nsPoint(pfd->mBounds.x, pfd->mBounds.y);
nsIFrame* frame = pfd->mFrame; nsIFrame* frame = pfd->mFrame;
nsPoint origin = frame->GetPosition();
// Adjust the origin of the frame // Adjust the origin of the frame
if (pfd->GetFlag(PFD_RELATIVEPOS)) { if (pfd->GetFlag(PFD_RELATIVEPOS)) {
// right and bottom are handled by // right and bottom are handled by
// nsHTMLReflowState::ComputeRelativeOffsets // nsHTMLReflowState::ComputeRelativeOffsets
nsPoint change(pfd->mOffsets.left, pfd->mOffsets.top); nsPoint change(pfd->mOffsets.left, pfd->mOffsets.top);
frame->SetPosition(frame->GetPosition() + change);
origin += change; origin += change;
frame->SetPosition(origin);
} }
// We must position the view correctly before positioning its // We must position the view correctly before positioning its

Просмотреть файл

@ -0,0 +1,6 @@
<!DOCTYPE HTML>
<html>
<body>
<span style="border-left: 80px solid blue;"></span>&#x05d0;12345
</body>
</html>

Просмотреть файл

@ -0,0 +1,6 @@
<!DOCTYPE HTML>
<html>
<body>
<span style="border-left: 80px solid blue;">&#x05d0;12345</span>
</body>
</html>

Просмотреть файл

@ -495,6 +495,7 @@ random == 403134-1.html 403134-1-ref.html # bug 405377
#== 403657-1.html 403657-1-ref.html # Fails depending on the fonts... #== 403657-1.html 403657-1-ref.html # Fails depending on the fonts...
== 403733-1.html 403733-1-ref.html == 403733-1.html 403733-1-ref.html
== 403962-1.xhtml 403962-1-ref.xhtml == 403962-1.xhtml 403962-1-ref.xhtml
== 404180-1.html 404180-1-ref.html
== 404030-1.html 404030-1-ref.html == 404030-1.html 404030-1-ref.html
!= 404030-1-notref.html 404030-1.html != 404030-1-notref.html 404030-1.html
!= 404030-1-notref2.html 404030-1.html != 404030-1-notref2.html 404030-1.html