bug 29276 (text inside <label> tags within a table cell breaks out of table cell)

bug 1164 (ALIGN=MIDDLE and ALIGN=ABSMIDDLE values are not being supported)
bug 54119 (percentage (%) image (img) heights do nothing)
r=karnaze, rods, attinasi
a=waterson
This commit is contained in:
buster%netscape.com 2000-10-09 21:19:36 +00:00
parent c080ea9b7e
commit 13899dbffa
10 changed files with 164 additions and 86 deletions

View File

@ -2534,6 +2534,8 @@ static nsGenericHTMLElement::EnumTable kCompatTableHAlignTable[] = {
{ "char", NS_STYLE_TEXT_ALIGN_CHAR },
{ "justify",NS_STYLE_TEXT_ALIGN_JUSTIFY },
{ "abscenter", NS_STYLE_TEXT_ALIGN_CENTER },
{ "absmiddle", NS_STYLE_TEXT_ALIGN_CENTER },
{ "middle", NS_STYLE_TEXT_ALIGN_CENTER },
{ 0 }
};

View File

@ -1502,12 +1502,6 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
/*
ListTag(stdout);
printf(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n",
aReflowState.reason, aReflowState.availableWidth, aReflowState.availableHeight,
aReflowState.mComputedWidth, aReflowState.mComputedHeight);
*/
DO_GLOBAL_REFLOW_COUNT("nsBlockFrame", aReflowState.reason);
#ifdef DEBUG
@ -2570,14 +2564,24 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState)
nsLineBox* line = mLines;
if (tryAndSkipLines) {
// The line's bounds are relative to the border edge of the frame
nscoord newAvailWidth = aState.mReflowState.mComputedBorderPadding.left;
if (NS_SHRINKWRAPWIDTH == aState.mReflowState.mComputedWidth) {
newAvailWidth += aState.mReflowState.mComputedMaxWidth;
if (NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedMaxWidth) {
newAvailWidth += aState.mReflowState.mComputedMaxWidth;
}
else {
newAvailWidth += aState.mReflowState.availableWidth;
}
} else {
newAvailWidth += aState.mReflowState.mComputedWidth;
if (NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedMaxWidth) {
newAvailWidth += aState.mReflowState.mComputedWidth;
}
else {
newAvailWidth += aState.mReflowState.availableWidth;
}
}
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != newAvailWidth, "bad math, newAvailWidth is infinite");
#ifdef DEBUG
if (gNoisyReflow) {
@ -4450,13 +4454,14 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
if (NS_FAILED(rv)) {
return rv;
}
#if 0
// Mark next line dirty in case SplitLine didn't end up
// pushing any frames.
nsLineBox* next = aLine->mNext;
if ((nsnull != next) && !next->IsBlock()) {
next->MarkDirty();
}
#endif
}
}
else if (NS_FRAME_IS_NOT_COMPLETE(frameReflowStatus)) {

View File

@ -1502,12 +1502,6 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
/*
ListTag(stdout);
printf(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n",
aReflowState.reason, aReflowState.availableWidth, aReflowState.availableHeight,
aReflowState.mComputedWidth, aReflowState.mComputedHeight);
*/
DO_GLOBAL_REFLOW_COUNT("nsBlockFrame", aReflowState.reason);
#ifdef DEBUG
@ -2570,14 +2564,24 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState)
nsLineBox* line = mLines;
if (tryAndSkipLines) {
// The line's bounds are relative to the border edge of the frame
nscoord newAvailWidth = aState.mReflowState.mComputedBorderPadding.left;
if (NS_SHRINKWRAPWIDTH == aState.mReflowState.mComputedWidth) {
newAvailWidth += aState.mReflowState.mComputedMaxWidth;
if (NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedMaxWidth) {
newAvailWidth += aState.mReflowState.mComputedMaxWidth;
}
else {
newAvailWidth += aState.mReflowState.availableWidth;
}
} else {
newAvailWidth += aState.mReflowState.mComputedWidth;
if (NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedMaxWidth) {
newAvailWidth += aState.mReflowState.mComputedWidth;
}
else {
newAvailWidth += aState.mReflowState.availableWidth;
}
}
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != newAvailWidth, "bad math, newAvailWidth is infinite");
#ifdef DEBUG
if (gNoisyReflow) {
@ -4450,13 +4454,14 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
if (NS_FAILED(rv)) {
return rv;
}
#if 0
// Mark next line dirty in case SplitLine didn't end up
// pushing any frames.
nsLineBox* next = aLine->mNext;
if ((nsnull != next) && !next->IsBlock()) {
next->MarkDirty();
}
#endif
}
}
else if (NS_FRAME_IS_NOT_COMPLETE(frameReflowStatus)) {

View File

@ -1502,12 +1502,6 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
/*
ListTag(stdout);
printf(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n",
aReflowState.reason, aReflowState.availableWidth, aReflowState.availableHeight,
aReflowState.mComputedWidth, aReflowState.mComputedHeight);
*/
DO_GLOBAL_REFLOW_COUNT("nsBlockFrame", aReflowState.reason);
#ifdef DEBUG
@ -2570,14 +2564,24 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState)
nsLineBox* line = mLines;
if (tryAndSkipLines) {
// The line's bounds are relative to the border edge of the frame
nscoord newAvailWidth = aState.mReflowState.mComputedBorderPadding.left;
if (NS_SHRINKWRAPWIDTH == aState.mReflowState.mComputedWidth) {
newAvailWidth += aState.mReflowState.mComputedMaxWidth;
if (NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedMaxWidth) {
newAvailWidth += aState.mReflowState.mComputedMaxWidth;
}
else {
newAvailWidth += aState.mReflowState.availableWidth;
}
} else {
newAvailWidth += aState.mReflowState.mComputedWidth;
if (NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedMaxWidth) {
newAvailWidth += aState.mReflowState.mComputedWidth;
}
else {
newAvailWidth += aState.mReflowState.availableWidth;
}
}
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != newAvailWidth, "bad math, newAvailWidth is infinite");
#ifdef DEBUG
if (gNoisyReflow) {
@ -4450,13 +4454,14 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
if (NS_FAILED(rv)) {
return rv;
}
#if 0
// Mark next line dirty in case SplitLine didn't end up
// pushing any frames.
nsLineBox* next = aLine->mNext;
if ((nsnull != next) && !next->IsBlock()) {
next->MarkDirty();
}
#endif
}
}
else if (NS_FRAME_IS_NOT_COMPLETE(frameReflowStatus)) {

View File

@ -1441,18 +1441,13 @@ nsHTMLReflowState::ComputeContainingBlockRectangle(nsIPresContext* aPre
if (NS_UNCONSTRAINEDSIZE == availableWidth) {
aContainingBlockWidth = NS_UNCONSTRAINEDSIZE;
}
// a table in quirks mode gets a containing block based on the viewport (less
// body margins, border, padding) if the table is a child of the body.
// an element in quirks mode gets a containing block based on the viewport (less
// body margins, border, padding) if the element is a child of the body.
if (NS_AUTOHEIGHT == aContainingBlockHeight) {
nsCOMPtr<nsIAtom> fType;
frame->GetFrameType(getter_AddRefs(fType));
if (nsLayoutAtoms::tableFrame == fType.get() ||
nsLayoutAtoms::htmlFrameOuterFrame == fType.get()) {
nsCompatibility mode;
aPresContext->GetCompatibilityMode(&mode);
if (eCompatibility_NavQuirks == mode) {
aContainingBlockHeight = CalcQuirkContainingBlockHeight(*aContainingBlockRS);
}
nsCompatibility mode;
aPresContext->GetCompatibilityMode(&mode);
if (eCompatibility_NavQuirks == mode) {
aContainingBlockHeight = CalcQuirkContainingBlockHeight(*aContainingBlockRS);
}
}
}
@ -1551,8 +1546,34 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
// that depends on the content height
if (eStyleUnit_Percent == heightUnit) {
if (NS_AUTOHEIGHT == aContainingBlockHeight) {
// Interpret the height like 'auto'
heightUnit = eStyleUnit_Auto;
// this if clause enables %-height on replaced inline frames,
// such as images. See bug 54119. The else clause "heightUnit = eStyleUnit_Auto;"
// used to be called exclusively.
if (NS_FRAME_REPLACED(NS_CSS_FRAME_TYPE_INLINE) == mFrameType) {
// Get the containing block reflow state
const nsHTMLReflowState* cbrs =
GetContainingBlockReflowState(parentReflowState);
NS_ASSERTION(nsnull != cbrs, "no containing block");
nsCompatibility mode;
aPresContext->GetCompatibilityMode(&mode);
// in quirks mode, get the cb height using the special quirk method
if (eCompatibility_NavQuirks == mode) {
aContainingBlockHeight = CalcQuirkContainingBlockHeight(*cbrs);
}
// in standard mode, use the cb height. if it's "auto", as will be the case
// by default in BODY, use auto height as per CSS2 spec.
else
{
if (NS_AUTOHEIGHT != cbrs->mComputedHeight)
aContainingBlockHeight = cbrs->mComputedHeight;
else
heightUnit = eStyleUnit_Auto;
}
}
else {
// default to interpreting the height like 'auto'
heightUnit = eStyleUnit_Auto;
}
}
}
@ -1849,6 +1870,7 @@ nsHTMLReflowState::ComputeBlockBoxData(nsIPresContext* aPresContext,
// Use 'min-width' as the value for 'width'
mComputedWidth = mComputedMinWidth;
}
}
}
} else {

View File

@ -1502,12 +1502,6 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
/*
ListTag(stdout);
printf(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n",
aReflowState.reason, aReflowState.availableWidth, aReflowState.availableHeight,
aReflowState.mComputedWidth, aReflowState.mComputedHeight);
*/
DO_GLOBAL_REFLOW_COUNT("nsBlockFrame", aReflowState.reason);
#ifdef DEBUG
@ -2570,14 +2564,24 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState)
nsLineBox* line = mLines;
if (tryAndSkipLines) {
// The line's bounds are relative to the border edge of the frame
nscoord newAvailWidth = aState.mReflowState.mComputedBorderPadding.left;
if (NS_SHRINKWRAPWIDTH == aState.mReflowState.mComputedWidth) {
newAvailWidth += aState.mReflowState.mComputedMaxWidth;
if (NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedMaxWidth) {
newAvailWidth += aState.mReflowState.mComputedMaxWidth;
}
else {
newAvailWidth += aState.mReflowState.availableWidth;
}
} else {
newAvailWidth += aState.mReflowState.mComputedWidth;
if (NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedMaxWidth) {
newAvailWidth += aState.mReflowState.mComputedWidth;
}
else {
newAvailWidth += aState.mReflowState.availableWidth;
}
}
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != newAvailWidth, "bad math, newAvailWidth is infinite");
#ifdef DEBUG
if (gNoisyReflow) {
@ -4450,13 +4454,14 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
if (NS_FAILED(rv)) {
return rv;
}
#if 0
// Mark next line dirty in case SplitLine didn't end up
// pushing any frames.
nsLineBox* next = aLine->mNext;
if ((nsnull != next) && !next->IsBlock()) {
next->MarkDirty();
}
#endif
}
}
else if (NS_FRAME_IS_NOT_COMPLETE(frameReflowStatus)) {

View File

@ -1502,12 +1502,6 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
/*
ListTag(stdout);
printf(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n",
aReflowState.reason, aReflowState.availableWidth, aReflowState.availableHeight,
aReflowState.mComputedWidth, aReflowState.mComputedHeight);
*/
DO_GLOBAL_REFLOW_COUNT("nsBlockFrame", aReflowState.reason);
#ifdef DEBUG
@ -2570,14 +2564,24 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState)
nsLineBox* line = mLines;
if (tryAndSkipLines) {
// The line's bounds are relative to the border edge of the frame
nscoord newAvailWidth = aState.mReflowState.mComputedBorderPadding.left;
if (NS_SHRINKWRAPWIDTH == aState.mReflowState.mComputedWidth) {
newAvailWidth += aState.mReflowState.mComputedMaxWidth;
if (NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedMaxWidth) {
newAvailWidth += aState.mReflowState.mComputedMaxWidth;
}
else {
newAvailWidth += aState.mReflowState.availableWidth;
}
} else {
newAvailWidth += aState.mReflowState.mComputedWidth;
if (NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedMaxWidth) {
newAvailWidth += aState.mReflowState.mComputedWidth;
}
else {
newAvailWidth += aState.mReflowState.availableWidth;
}
}
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != newAvailWidth, "bad math, newAvailWidth is infinite");
#ifdef DEBUG
if (gNoisyReflow) {
@ -4450,13 +4454,14 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
if (NS_FAILED(rv)) {
return rv;
}
#if 0
// Mark next line dirty in case SplitLine didn't end up
// pushing any frames.
nsLineBox* next = aLine->mNext;
if ((nsnull != next) && !next->IsBlock()) {
next->MarkDirty();
}
#endif
}
}
else if (NS_FRAME_IS_NOT_COMPLETE(frameReflowStatus)) {

View File

@ -1502,12 +1502,6 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
/*
ListTag(stdout);
printf(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n",
aReflowState.reason, aReflowState.availableWidth, aReflowState.availableHeight,
aReflowState.mComputedWidth, aReflowState.mComputedHeight);
*/
DO_GLOBAL_REFLOW_COUNT("nsBlockFrame", aReflowState.reason);
#ifdef DEBUG
@ -2570,14 +2564,24 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState)
nsLineBox* line = mLines;
if (tryAndSkipLines) {
// The line's bounds are relative to the border edge of the frame
nscoord newAvailWidth = aState.mReflowState.mComputedBorderPadding.left;
if (NS_SHRINKWRAPWIDTH == aState.mReflowState.mComputedWidth) {
newAvailWidth += aState.mReflowState.mComputedMaxWidth;
if (NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedMaxWidth) {
newAvailWidth += aState.mReflowState.mComputedMaxWidth;
}
else {
newAvailWidth += aState.mReflowState.availableWidth;
}
} else {
newAvailWidth += aState.mReflowState.mComputedWidth;
if (NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedMaxWidth) {
newAvailWidth += aState.mReflowState.mComputedWidth;
}
else {
newAvailWidth += aState.mReflowState.availableWidth;
}
}
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != newAvailWidth, "bad math, newAvailWidth is infinite");
#ifdef DEBUG
if (gNoisyReflow) {
@ -4450,13 +4454,14 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
if (NS_FAILED(rv)) {
return rv;
}
#if 0
// Mark next line dirty in case SplitLine didn't end up
// pushing any frames.
nsLineBox* next = aLine->mNext;
if ((nsnull != next) && !next->IsBlock()) {
next->MarkDirty();
}
#endif
}
}
else if (NS_FRAME_IS_NOT_COMPLETE(frameReflowStatus)) {

View File

@ -1441,18 +1441,13 @@ nsHTMLReflowState::ComputeContainingBlockRectangle(nsIPresContext* aPre
if (NS_UNCONSTRAINEDSIZE == availableWidth) {
aContainingBlockWidth = NS_UNCONSTRAINEDSIZE;
}
// a table in quirks mode gets a containing block based on the viewport (less
// body margins, border, padding) if the table is a child of the body.
// an element in quirks mode gets a containing block based on the viewport (less
// body margins, border, padding) if the element is a child of the body.
if (NS_AUTOHEIGHT == aContainingBlockHeight) {
nsCOMPtr<nsIAtom> fType;
frame->GetFrameType(getter_AddRefs(fType));
if (nsLayoutAtoms::tableFrame == fType.get() ||
nsLayoutAtoms::htmlFrameOuterFrame == fType.get()) {
nsCompatibility mode;
aPresContext->GetCompatibilityMode(&mode);
if (eCompatibility_NavQuirks == mode) {
aContainingBlockHeight = CalcQuirkContainingBlockHeight(*aContainingBlockRS);
}
nsCompatibility mode;
aPresContext->GetCompatibilityMode(&mode);
if (eCompatibility_NavQuirks == mode) {
aContainingBlockHeight = CalcQuirkContainingBlockHeight(*aContainingBlockRS);
}
}
}
@ -1551,8 +1546,34 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
// that depends on the content height
if (eStyleUnit_Percent == heightUnit) {
if (NS_AUTOHEIGHT == aContainingBlockHeight) {
// Interpret the height like 'auto'
heightUnit = eStyleUnit_Auto;
// this if clause enables %-height on replaced inline frames,
// such as images. See bug 54119. The else clause "heightUnit = eStyleUnit_Auto;"
// used to be called exclusively.
if (NS_FRAME_REPLACED(NS_CSS_FRAME_TYPE_INLINE) == mFrameType) {
// Get the containing block reflow state
const nsHTMLReflowState* cbrs =
GetContainingBlockReflowState(parentReflowState);
NS_ASSERTION(nsnull != cbrs, "no containing block");
nsCompatibility mode;
aPresContext->GetCompatibilityMode(&mode);
// in quirks mode, get the cb height using the special quirk method
if (eCompatibility_NavQuirks == mode) {
aContainingBlockHeight = CalcQuirkContainingBlockHeight(*cbrs);
}
// in standard mode, use the cb height. if it's "auto", as will be the case
// by default in BODY, use auto height as per CSS2 spec.
else
{
if (NS_AUTOHEIGHT != cbrs->mComputedHeight)
aContainingBlockHeight = cbrs->mComputedHeight;
else
heightUnit = eStyleUnit_Auto;
}
}
else {
// default to interpreting the height like 'auto'
heightUnit = eStyleUnit_Auto;
}
}
}
@ -1849,6 +1870,7 @@ nsHTMLReflowState::ComputeBlockBoxData(nsIPresContext* aPresContext,
// Use 'min-width' as the value for 'width'
mComputedWidth = mComputedMinWidth;
}
}
}
} else {

View File

@ -2534,6 +2534,8 @@ static nsGenericHTMLElement::EnumTable kCompatTableHAlignTable[] = {
{ "char", NS_STYLE_TEXT_ALIGN_CHAR },
{ "justify",NS_STYLE_TEXT_ALIGN_JUSTIFY },
{ "abscenter", NS_STYLE_TEXT_ALIGN_CENTER },
{ "absmiddle", NS_STYLE_TEXT_ALIGN_CENTER },
{ "middle", NS_STYLE_TEXT_ALIGN_CENTER },
{ 0 }
};