зеркало из https://github.com/mozilla/gecko-dev.git
Fix a bunch of errors in incremental computation of maximum width and max-element-size that were causing incremental reflow bugs. b=39683, 217369 r+sr=roc
This commit is contained in:
Родитель
aac9a7c1fe
Коммит
139e92501a
|
@ -1330,9 +1330,14 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
|||
|
||||
// If we're requested to update our maximum width, then compute it
|
||||
if (aState.GetFlag(BRS_COMPUTEMAXWIDTH)) {
|
||||
// We need to add in for the right border/padding
|
||||
// XXXldb Why right and not left?
|
||||
aMetrics.mMaximumWidth = aState.mMaximumWidth + borderPadding.right;
|
||||
if (!HaveAutoWidth(aReflowState) &&
|
||||
aReflowState.mStylePosition->mWidth.GetUnit() != eStyleUnit_Percent) {
|
||||
aMetrics.mMaximumWidth = aMetrics.width;
|
||||
} else {
|
||||
// We need to add in for the right border/padding
|
||||
// XXXldb Why right and not left?
|
||||
aMetrics.mMaximumWidth = aState.mMaximumWidth + borderPadding.right;
|
||||
}
|
||||
#ifdef NOISY_MAXIMUM_WIDTH
|
||||
printf("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth);
|
||||
#endif
|
||||
|
@ -3167,15 +3172,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
// updated value in the line, and update the current maximum width
|
||||
if (aState.GetFlag(BRS_COMPUTEMAXWIDTH)) {
|
||||
aLine->mMaximumWidth = brc.GetMaximumWidth();
|
||||
// need to add in margin on block's reported max width (see bug 35964)
|
||||
const nsMargin& margin = brc.GetMargin();
|
||||
aLine->mMaximumWidth += margin.left + margin.right;
|
||||
#ifdef NOISY_MAXIMUM_WIDTH
|
||||
printf("nsBlockFrame::ReflowBlockFrame parent block %p line %p aLine->mMaximumWidth set to brc.GetMaximumWidth %d, updating aState.mMaximumWidth\n",
|
||||
this, aLine, aLine->mMaximumWidth);
|
||||
#endif
|
||||
aState.UpdateMaximumWidth(aLine->mMaximumWidth);
|
||||
|
||||
}
|
||||
PostPlaceLine(aState, aLine, maxElementWidth);
|
||||
|
||||
|
|
|
@ -739,28 +739,50 @@ nsBlockReflowContext::PlaceBlock(const nsHTMLReflowState& aReflowState,
|
|||
nsContainerFrame::FinishReflowChild(mFrame, mPresContext, &aReflowState, mMetrics, x, y, 0);
|
||||
|
||||
// Adjust the max-element-size in the metrics to take into
|
||||
// account the margins around the block element. Note that we
|
||||
// use the collapsed top and bottom margin values.
|
||||
// account the margins around the block element.
|
||||
// Do not allow auto margins to impact the max-element size
|
||||
// since they are springy and don't really count!
|
||||
if (mMetrics.mComputeMEW) {
|
||||
nsMargin maxElemMargin = mMargin;
|
||||
nsMargin maxElemMargin;
|
||||
const nsStyleSides &styleMargin = mStyleMargin->mMargin;
|
||||
nsStyleCoord coord;
|
||||
if (styleMargin.GetLeftUnit() == eStyleUnit_Coord)
|
||||
maxElemMargin.left = styleMargin.GetLeft(coord).GetCoordValue();
|
||||
else
|
||||
maxElemMargin.left = 0;
|
||||
if (styleMargin.GetRightUnit() == eStyleUnit_Coord)
|
||||
maxElemMargin.right = styleMargin.GetRight(coord).GetCoordValue();
|
||||
else
|
||||
maxElemMargin.right = 0;
|
||||
|
||||
if (NS_SHRINKWRAPWIDTH == mComputedWidth) {
|
||||
nscoord dummyXOffset;
|
||||
// Base the margins on the max-element size
|
||||
ComputeShrinkwrapMargins(mStyleMargin, mMetrics.mMaxElementWidth,
|
||||
maxElemMargin, dummyXOffset);
|
||||
}
|
||||
nscoord dummyXOffset;
|
||||
// Base the margins on the max-element size
|
||||
ComputeShrinkwrapMargins(mStyleMargin, mMetrics.mMaxElementWidth,
|
||||
maxElemMargin, dummyXOffset);
|
||||
|
||||
// Do not allow auto margins to impact the max-element size
|
||||
// since they are springy and don't really count!
|
||||
if ((eStyleUnit_Auto != mStyleMargin->mMargin.GetLeftUnit()) &&
|
||||
(eStyleUnit_Null != mStyleMargin->mMargin.GetLeftUnit())) {
|
||||
mMetrics.mMaxElementWidth += maxElemMargin.left;
|
||||
}
|
||||
if ((eStyleUnit_Auto != mStyleMargin->mMargin.GetRightUnit()) &&
|
||||
(eStyleUnit_Null != mStyleMargin->mMargin.GetRightUnit())) {
|
||||
mMetrics.mMaxElementWidth += maxElemMargin.right;
|
||||
}
|
||||
mMetrics.mMaxElementWidth += maxElemMargin.left + maxElemMargin.right;
|
||||
}
|
||||
|
||||
// do the same for the maximum width
|
||||
if (mComputeMaximumWidth) {
|
||||
nsMargin maxWidthMargin;
|
||||
const nsStyleSides &styleMargin = mStyleMargin->mMargin;
|
||||
nsStyleCoord coord;
|
||||
if (styleMargin.GetLeftUnit() == eStyleUnit_Coord)
|
||||
maxWidthMargin.left = styleMargin.GetLeft(coord).GetCoordValue();
|
||||
else
|
||||
maxWidthMargin.left = 0;
|
||||
if (styleMargin.GetRightUnit() == eStyleUnit_Coord)
|
||||
maxWidthMargin.right = styleMargin.GetRight(coord).GetCoordValue();
|
||||
else
|
||||
maxWidthMargin.right = 0;
|
||||
|
||||
nscoord dummyXOffset;
|
||||
// Base the margins on the maximum width
|
||||
ComputeShrinkwrapMargins(mStyleMargin, mMetrics.mMaximumWidth,
|
||||
maxWidthMargin, dummyXOffset);
|
||||
|
||||
mMetrics.mMaximumWidth += maxWidthMargin.left + maxWidthMargin.right;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1330,9 +1330,14 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
|||
|
||||
// If we're requested to update our maximum width, then compute it
|
||||
if (aState.GetFlag(BRS_COMPUTEMAXWIDTH)) {
|
||||
// We need to add in for the right border/padding
|
||||
// XXXldb Why right and not left?
|
||||
aMetrics.mMaximumWidth = aState.mMaximumWidth + borderPadding.right;
|
||||
if (!HaveAutoWidth(aReflowState) &&
|
||||
aReflowState.mStylePosition->mWidth.GetUnit() != eStyleUnit_Percent) {
|
||||
aMetrics.mMaximumWidth = aMetrics.width;
|
||||
} else {
|
||||
// We need to add in for the right border/padding
|
||||
// XXXldb Why right and not left?
|
||||
aMetrics.mMaximumWidth = aState.mMaximumWidth + borderPadding.right;
|
||||
}
|
||||
#ifdef NOISY_MAXIMUM_WIDTH
|
||||
printf("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth);
|
||||
#endif
|
||||
|
@ -3167,15 +3172,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
// updated value in the line, and update the current maximum width
|
||||
if (aState.GetFlag(BRS_COMPUTEMAXWIDTH)) {
|
||||
aLine->mMaximumWidth = brc.GetMaximumWidth();
|
||||
// need to add in margin on block's reported max width (see bug 35964)
|
||||
const nsMargin& margin = brc.GetMargin();
|
||||
aLine->mMaximumWidth += margin.left + margin.right;
|
||||
#ifdef NOISY_MAXIMUM_WIDTH
|
||||
printf("nsBlockFrame::ReflowBlockFrame parent block %p line %p aLine->mMaximumWidth set to brc.GetMaximumWidth %d, updating aState.mMaximumWidth\n",
|
||||
this, aLine, aLine->mMaximumWidth);
|
||||
#endif
|
||||
aState.UpdateMaximumWidth(aLine->mMaximumWidth);
|
||||
|
||||
}
|
||||
PostPlaceLine(aState, aLine, maxElementWidth);
|
||||
|
||||
|
|
|
@ -739,28 +739,50 @@ nsBlockReflowContext::PlaceBlock(const nsHTMLReflowState& aReflowState,
|
|||
nsContainerFrame::FinishReflowChild(mFrame, mPresContext, &aReflowState, mMetrics, x, y, 0);
|
||||
|
||||
// Adjust the max-element-size in the metrics to take into
|
||||
// account the margins around the block element. Note that we
|
||||
// use the collapsed top and bottom margin values.
|
||||
// account the margins around the block element.
|
||||
// Do not allow auto margins to impact the max-element size
|
||||
// since they are springy and don't really count!
|
||||
if (mMetrics.mComputeMEW) {
|
||||
nsMargin maxElemMargin = mMargin;
|
||||
nsMargin maxElemMargin;
|
||||
const nsStyleSides &styleMargin = mStyleMargin->mMargin;
|
||||
nsStyleCoord coord;
|
||||
if (styleMargin.GetLeftUnit() == eStyleUnit_Coord)
|
||||
maxElemMargin.left = styleMargin.GetLeft(coord).GetCoordValue();
|
||||
else
|
||||
maxElemMargin.left = 0;
|
||||
if (styleMargin.GetRightUnit() == eStyleUnit_Coord)
|
||||
maxElemMargin.right = styleMargin.GetRight(coord).GetCoordValue();
|
||||
else
|
||||
maxElemMargin.right = 0;
|
||||
|
||||
if (NS_SHRINKWRAPWIDTH == mComputedWidth) {
|
||||
nscoord dummyXOffset;
|
||||
// Base the margins on the max-element size
|
||||
ComputeShrinkwrapMargins(mStyleMargin, mMetrics.mMaxElementWidth,
|
||||
maxElemMargin, dummyXOffset);
|
||||
}
|
||||
nscoord dummyXOffset;
|
||||
// Base the margins on the max-element size
|
||||
ComputeShrinkwrapMargins(mStyleMargin, mMetrics.mMaxElementWidth,
|
||||
maxElemMargin, dummyXOffset);
|
||||
|
||||
// Do not allow auto margins to impact the max-element size
|
||||
// since they are springy and don't really count!
|
||||
if ((eStyleUnit_Auto != mStyleMargin->mMargin.GetLeftUnit()) &&
|
||||
(eStyleUnit_Null != mStyleMargin->mMargin.GetLeftUnit())) {
|
||||
mMetrics.mMaxElementWidth += maxElemMargin.left;
|
||||
}
|
||||
if ((eStyleUnit_Auto != mStyleMargin->mMargin.GetRightUnit()) &&
|
||||
(eStyleUnit_Null != mStyleMargin->mMargin.GetRightUnit())) {
|
||||
mMetrics.mMaxElementWidth += maxElemMargin.right;
|
||||
}
|
||||
mMetrics.mMaxElementWidth += maxElemMargin.left + maxElemMargin.right;
|
||||
}
|
||||
|
||||
// do the same for the maximum width
|
||||
if (mComputeMaximumWidth) {
|
||||
nsMargin maxWidthMargin;
|
||||
const nsStyleSides &styleMargin = mStyleMargin->mMargin;
|
||||
nsStyleCoord coord;
|
||||
if (styleMargin.GetLeftUnit() == eStyleUnit_Coord)
|
||||
maxWidthMargin.left = styleMargin.GetLeft(coord).GetCoordValue();
|
||||
else
|
||||
maxWidthMargin.left = 0;
|
||||
if (styleMargin.GetRightUnit() == eStyleUnit_Coord)
|
||||
maxWidthMargin.right = styleMargin.GetRight(coord).GetCoordValue();
|
||||
else
|
||||
maxWidthMargin.right = 0;
|
||||
|
||||
nscoord dummyXOffset;
|
||||
// Base the margins on the maximum width
|
||||
ComputeShrinkwrapMargins(mStyleMargin, mMetrics.mMaximumWidth,
|
||||
maxWidthMargin, dummyXOffset);
|
||||
|
||||
mMetrics.mMaximumWidth += maxWidthMargin.left + maxWidthMargin.right;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче