mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Remove code that munges block widths inside table cells. Bug 232754,
r+sr=dbaron
This commit is contained in:
parent
fecf778c64
commit
e792da8eeb
@ -246,12 +246,10 @@ struct nsHTMLReflowState {
|
||||
struct ReflowStateFlags {
|
||||
PRUint16 mSpecialHeightReflow:1; // used by tables to communicate special reflow (in process) to handle
|
||||
// percent height frames inside cells which may not have computed heights
|
||||
PRUint16 mTableDerivedComputedWidth:1; // Computed width is due to a table cell's final width, not style
|
||||
// on the frame itself. Restrictions apply.
|
||||
PRUint16 mIsTopOfPage:1; // is the current context at the top of a page?
|
||||
PRUint16 mBlinks:1; // Keep track of text-decoration: blink
|
||||
PRUint16 mVisualBidiFormControl:1; // Keep track of descendants of form controls on Visual Bidi pages
|
||||
PRUint16 mUnused:11; // for future use
|
||||
PRUint16 mUnused:12; // for future use
|
||||
} mFlags;
|
||||
|
||||
#ifdef IBMBIDI
|
||||
|
@ -132,7 +132,6 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
|
||||
mSpaceManager = nsnull;
|
||||
mLineLayout = nsnull;
|
||||
mFlags.mSpecialHeightReflow = PR_FALSE;
|
||||
mFlags.mTableDerivedComputedWidth = PR_FALSE;
|
||||
mFlags.mIsTopOfPage = PR_FALSE;
|
||||
mFlags.mUnused = 0;
|
||||
mPercentHeightObserver = nsnull;
|
||||
@ -165,7 +164,6 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
|
||||
mSpaceManager = nsnull;
|
||||
mLineLayout = nsnull;
|
||||
mFlags.mSpecialHeightReflow = PR_FALSE;
|
||||
mFlags.mTableDerivedComputedWidth = PR_FALSE;
|
||||
mFlags.mIsTopOfPage = PR_FALSE;
|
||||
mFlags.mUnused = 0;
|
||||
mPercentHeightObserver = nsnull;
|
||||
@ -347,9 +345,6 @@ void nsHTMLReflowState::InitCBReflowState()
|
||||
if (parentReflowState) {
|
||||
if (IS_TABLE_CELL(parentReflowState->frame->GetType())) {
|
||||
mCBReflowState = parentReflowState;
|
||||
// Set mFlags.mTableDerivedComputedWidth to true for a cell block. Its default
|
||||
// value was set to what the parent reflow state has.
|
||||
mFlags.mTableDerivedComputedWidth = PR_TRUE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1568,32 +1563,6 @@ static eNormalLineHeightControl GetNormalLineHeightCalcControl(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Reset mFlags.mTableDerivedComputedWidth if there is a non percent style width
|
||||
// or if there is a percent style width and the parent has a style width.
|
||||
// This function assumes that aWidthUnit is never Auto or Inherit and that aState's
|
||||
// mFlags.mTableDerivedComputedWidth is set.
|
||||
static void
|
||||
CheckResetTableDerivedComputedWidth(nsHTMLReflowState& aState,
|
||||
nsStyleUnit aWidthUnit)
|
||||
{
|
||||
if (eStyleUnit_Percent == aWidthUnit) {
|
||||
// If the parent isn't a table cell and has a style width reset the flag
|
||||
if (aState.parentReflowState) {
|
||||
if (!IS_TABLE_CELL(aState.parentReflowState->frame->GetType())) {
|
||||
nsStyleUnit parentUnit = aState.parentReflowState->mStylePosition->mWidth.GetUnit();
|
||||
if (eStyleUnit_Auto != parentUnit) {
|
||||
aState.mFlags.mTableDerivedComputedWidth = PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// always reset the flag if there is a fixed width
|
||||
aState.mFlags.mTableDerivedComputedWidth = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// XXX refactor this code to have methods for each set of properties
|
||||
// we are computing: width,height,line-height; margin; offsets
|
||||
|
||||
@ -1757,8 +1726,6 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
// A specified value of 'auto' uses the element's intrinsic width
|
||||
mComputedWidth = NS_INTRINSICSIZE;
|
||||
} else {
|
||||
if (mFlags.mTableDerivedComputedWidth)
|
||||
CheckResetTableDerivedComputedWidth(*this, widthUnit);
|
||||
ComputeHorizontalValue(aContainingBlockWidth, widthUnit,
|
||||
mStylePosition->mWidth, mComputedWidth);
|
||||
}
|
||||
@ -1812,8 +1779,6 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
} else {
|
||||
if (mFlags.mTableDerivedComputedWidth)
|
||||
CheckResetTableDerivedComputedWidth(*this, widthUnit);
|
||||
ComputeHorizontalValue(aContainingBlockWidth, widthUnit,
|
||||
mStylePosition->mWidth, mComputedWidth);
|
||||
}
|
||||
@ -1854,8 +1819,6 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
} else {
|
||||
if (mFlags.mTableDerivedComputedWidth)
|
||||
CheckResetTableDerivedComputedWidth(*this, widthUnit);
|
||||
ComputeHorizontalValue(aContainingBlockWidth, widthUnit,
|
||||
mStylePosition->mWidth, mComputedWidth);
|
||||
}
|
||||
@ -1973,8 +1936,6 @@ nsHTMLReflowState::ComputeBlockBoxData(nsIPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (mFlags.mTableDerivedComputedWidth)
|
||||
CheckResetTableDerivedComputedWidth(*this, aWidthUnit);
|
||||
ComputeHorizontalValue(aContainingBlockWidth, aWidthUnit,
|
||||
mStylePosition->mWidth, mComputedWidth);
|
||||
|
||||
@ -2550,16 +2511,6 @@ void nsHTMLReflowState::AdjustComputedWidth(PRBool aAdjustForBoxSizing)
|
||||
// If it did go bozo because of too much border or padding, set to 0
|
||||
if(mComputedWidth < 0) mComputedWidth = 0;
|
||||
}
|
||||
|
||||
// Tables allow enough width for cells without considering percent
|
||||
// based constraints of content within the cells. Since such content
|
||||
// could exceed the available width, we don't allow that to happen.
|
||||
if (mFlags.mTableDerivedComputedWidth) {
|
||||
nscoord borderPadding = mComputedBorderPadding.left + mComputedBorderPadding.right;
|
||||
if (borderPadding + mComputedWidth > availableWidth) {
|
||||
mComputedWidth = PR_MAX(0, availableWidth - borderPadding);
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef IBMBIDI
|
||||
PRBool
|
||||
|
@ -246,12 +246,10 @@ struct nsHTMLReflowState {
|
||||
struct ReflowStateFlags {
|
||||
PRUint16 mSpecialHeightReflow:1; // used by tables to communicate special reflow (in process) to handle
|
||||
// percent height frames inside cells which may not have computed heights
|
||||
PRUint16 mTableDerivedComputedWidth:1; // Computed width is due to a table cell's final width, not style
|
||||
// on the frame itself. Restrictions apply.
|
||||
PRUint16 mIsTopOfPage:1; // is the current context at the top of a page?
|
||||
PRUint16 mBlinks:1; // Keep track of text-decoration: blink
|
||||
PRUint16 mVisualBidiFormControl:1; // Keep track of descendants of form controls on Visual Bidi pages
|
||||
PRUint16 mUnused:11; // for future use
|
||||
PRUint16 mUnused:12; // for future use
|
||||
} mFlags;
|
||||
|
||||
#ifdef IBMBIDI
|
||||
|
@ -132,7 +132,6 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
|
||||
mSpaceManager = nsnull;
|
||||
mLineLayout = nsnull;
|
||||
mFlags.mSpecialHeightReflow = PR_FALSE;
|
||||
mFlags.mTableDerivedComputedWidth = PR_FALSE;
|
||||
mFlags.mIsTopOfPage = PR_FALSE;
|
||||
mFlags.mUnused = 0;
|
||||
mPercentHeightObserver = nsnull;
|
||||
@ -165,7 +164,6 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
|
||||
mSpaceManager = nsnull;
|
||||
mLineLayout = nsnull;
|
||||
mFlags.mSpecialHeightReflow = PR_FALSE;
|
||||
mFlags.mTableDerivedComputedWidth = PR_FALSE;
|
||||
mFlags.mIsTopOfPage = PR_FALSE;
|
||||
mFlags.mUnused = 0;
|
||||
mPercentHeightObserver = nsnull;
|
||||
@ -347,9 +345,6 @@ void nsHTMLReflowState::InitCBReflowState()
|
||||
if (parentReflowState) {
|
||||
if (IS_TABLE_CELL(parentReflowState->frame->GetType())) {
|
||||
mCBReflowState = parentReflowState;
|
||||
// Set mFlags.mTableDerivedComputedWidth to true for a cell block. Its default
|
||||
// value was set to what the parent reflow state has.
|
||||
mFlags.mTableDerivedComputedWidth = PR_TRUE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1568,32 +1563,6 @@ static eNormalLineHeightControl GetNormalLineHeightCalcControl(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Reset mFlags.mTableDerivedComputedWidth if there is a non percent style width
|
||||
// or if there is a percent style width and the parent has a style width.
|
||||
// This function assumes that aWidthUnit is never Auto or Inherit and that aState's
|
||||
// mFlags.mTableDerivedComputedWidth is set.
|
||||
static void
|
||||
CheckResetTableDerivedComputedWidth(nsHTMLReflowState& aState,
|
||||
nsStyleUnit aWidthUnit)
|
||||
{
|
||||
if (eStyleUnit_Percent == aWidthUnit) {
|
||||
// If the parent isn't a table cell and has a style width reset the flag
|
||||
if (aState.parentReflowState) {
|
||||
if (!IS_TABLE_CELL(aState.parentReflowState->frame->GetType())) {
|
||||
nsStyleUnit parentUnit = aState.parentReflowState->mStylePosition->mWidth.GetUnit();
|
||||
if (eStyleUnit_Auto != parentUnit) {
|
||||
aState.mFlags.mTableDerivedComputedWidth = PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// always reset the flag if there is a fixed width
|
||||
aState.mFlags.mTableDerivedComputedWidth = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// XXX refactor this code to have methods for each set of properties
|
||||
// we are computing: width,height,line-height; margin; offsets
|
||||
|
||||
@ -1757,8 +1726,6 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
// A specified value of 'auto' uses the element's intrinsic width
|
||||
mComputedWidth = NS_INTRINSICSIZE;
|
||||
} else {
|
||||
if (mFlags.mTableDerivedComputedWidth)
|
||||
CheckResetTableDerivedComputedWidth(*this, widthUnit);
|
||||
ComputeHorizontalValue(aContainingBlockWidth, widthUnit,
|
||||
mStylePosition->mWidth, mComputedWidth);
|
||||
}
|
||||
@ -1812,8 +1779,6 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
} else {
|
||||
if (mFlags.mTableDerivedComputedWidth)
|
||||
CheckResetTableDerivedComputedWidth(*this, widthUnit);
|
||||
ComputeHorizontalValue(aContainingBlockWidth, widthUnit,
|
||||
mStylePosition->mWidth, mComputedWidth);
|
||||
}
|
||||
@ -1854,8 +1819,6 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
} else {
|
||||
if (mFlags.mTableDerivedComputedWidth)
|
||||
CheckResetTableDerivedComputedWidth(*this, widthUnit);
|
||||
ComputeHorizontalValue(aContainingBlockWidth, widthUnit,
|
||||
mStylePosition->mWidth, mComputedWidth);
|
||||
}
|
||||
@ -1973,8 +1936,6 @@ nsHTMLReflowState::ComputeBlockBoxData(nsIPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (mFlags.mTableDerivedComputedWidth)
|
||||
CheckResetTableDerivedComputedWidth(*this, aWidthUnit);
|
||||
ComputeHorizontalValue(aContainingBlockWidth, aWidthUnit,
|
||||
mStylePosition->mWidth, mComputedWidth);
|
||||
|
||||
@ -2550,16 +2511,6 @@ void nsHTMLReflowState::AdjustComputedWidth(PRBool aAdjustForBoxSizing)
|
||||
// If it did go bozo because of too much border or padding, set to 0
|
||||
if(mComputedWidth < 0) mComputedWidth = 0;
|
||||
}
|
||||
|
||||
// Tables allow enough width for cells without considering percent
|
||||
// based constraints of content within the cells. Since such content
|
||||
// could exceed the available width, we don't allow that to happen.
|
||||
if (mFlags.mTableDerivedComputedWidth) {
|
||||
nscoord borderPadding = mComputedBorderPadding.left + mComputedBorderPadding.right;
|
||||
if (borderPadding + mComputedWidth > availableWidth) {
|
||||
mComputedWidth = PR_MAX(0, availableWidth - borderPadding);
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef IBMBIDI
|
||||
PRBool
|
||||
|
Loading…
Reference in New Issue
Block a user