Bug 398215 - Add RTL case for handling overflow width in BoxReflow. r+sr=roc, a=blocking1.9+

This commit is contained in:
dholbert@cs.stanford.edu 2007-11-07 03:18:30 -08:00
Родитель 65a5db4f35
Коммит a885817005
1 изменённых файлов: 32 добавлений и 28 удалений

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

@ -6163,32 +6163,41 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
// This kinda sucks. We should be able to handle the case
// where there's overflow above or to the left of the
// origin. But for now just chop that stuff off.
// (note: For RTL mode, replace "to the left of the origin"
// with "to the right of the range [0, aDesiredSize.width]")
//printf("OutsideChildren width=%d, height=%d\n", aDesiredSize.mOverflowArea.width, aDesiredSize.mOverflowArea.height);
aDesiredSize.width = aDesiredSize.mOverflowArea.XMost();
if (aDesiredSize.width <= aWidth)
aDesiredSize.height = aDesiredSize.mOverflowArea.YMost();
else {
if (aDesiredSize.width > aWidth)
{
nscoord computedWidth = aDesiredSize.width -
reflowState.mComputedBorderPadding.LeftRight();
computedWidth = PR_MAX(computedWidth, 0);
reflowState.SetComputedWidth(computedWidth);
reflowState.availableWidth = aDesiredSize.width;
DidReflow(aPresContext, &reflowState, NS_FRAME_REFLOW_FINISHED);
#ifdef DEBUG_REFLOW
nsAdaptorAddIndents();
nsAdaptorPrintReason(reflowState);
printf("\n");
#endif
AddStateBits(NS_FRAME_IS_DIRTY);
WillReflow(aPresContext);
Reflow(aPresContext, aDesiredSize, reflowState, status);
if (GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN)
aDesiredSize.height = aDesiredSize.mOverflowArea.YMost();
}
if (NS_STYLE_DIRECTION_LTR == GetStyleVisibility()->mDirection) {
// LTR mode -- extend for overflow on right side.
aDesiredSize.width = PR_MAX(aDesiredSize.width,
aDesiredSize.mOverflowArea.XMost());
} else {
// RTL mode -- extend for overflow on left side.
nscoord leftmostValue = PR_MIN(0, aDesiredSize.mOverflowArea.x);
// Note: If anything, this increases aDesiredSize.width, because
// leftmostValue is non-positive.
aDesiredSize.width = aDesiredSize.width - leftmostValue;
}
if (aDesiredSize.width <= aWidth) {
aDesiredSize.height = aDesiredSize.mOverflowArea.YMost();
} else {
nscoord computedWidth = aDesiredSize.width -
reflowState.mComputedBorderPadding.LeftRight();
computedWidth = PR_MAX(computedWidth, 0);
reflowState.SetComputedWidth(computedWidth);
reflowState.availableWidth = aDesiredSize.width;
DidReflow(aPresContext, &reflowState, NS_FRAME_REFLOW_FINISHED);
#ifdef DEBUG_REFLOW
nsAdaptorAddIndents();
nsAdaptorPrintReason(reflowState);
printf("\n");
#endif
AddStateBits(NS_FRAME_IS_DIRTY);
WillReflow(aPresContext);
Reflow(aPresContext, aDesiredSize, reflowState, status);
if (GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN)
aDesiredSize.height = aDesiredSize.mOverflowArea.YMost();
}
}
@ -6199,11 +6208,6 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
Redraw(aState, &r);
}
PRBool changedSize = PR_FALSE;
if (metrics->mLastSize.width != aDesiredSize.width || metrics->mLastSize.height != aDesiredSize.height)
changedSize = PR_TRUE;
PRUint32 layoutFlags = aState.LayoutFlags();
nsContainerFrame::FinishReflowChild(this, aPresContext, &reflowState,
aDesiredSize, aX, aY, layoutFlags | NS_FRAME_NO_MOVE_FRAME);