bug 151620 - always use quirk line-height inside a td. sr=waterson, r=dbaron.

This commit is contained in:
karnaze%netscape.com 2002-06-19 22:28:47 +00:00
Родитель 7dd19992b2
Коммит 8458aad931
8 изменённых файлов: 84 добавлений и 18 удалений

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

@ -61,6 +61,7 @@
#include "nsHTMLAtoms.h"
#include "nsHTMLValue.h"
#include "nsIDOMEvent.h"
#include "nsIDOMHTMLTableCellElement.h"
#include "nsIHTMLContent.h"
#include "prprf.h"
#include "nsLayoutAtoms.h"
@ -2971,6 +2972,10 @@ nsBlockFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool *aResult)
}
// IsEmpty treats standards and quirks mode differently. We want
// quirks behavior for a table cell block.
PRBool quirkMode = aIsQuirkMode || IsTDTableCellBlock(*this);
const nsStyleText* styleText = NS_STATIC_CAST(const nsStyleText*,
mStyleContext->GetStyleData(eStyleStruct_Text));
PRBool isPre =
@ -2981,7 +2986,7 @@ nsBlockFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool *aResult)
line != line_end;
++line)
{
line->IsEmpty(aIsQuirkMode, isPre, aResult);
line->IsEmpty(quirkMode, isPre, aResult);
if (! *aResult)
break;
}
@ -6551,6 +6556,27 @@ nsBlockFrame::BuildFloaterList()
// XXX keep the text-run data in the first-in-flow of the block
PRBool
nsBlockFrame::IsTDTableCellBlock(nsIFrame& aFrame)
{
nsIFrame* parent;
aFrame.GetParent(&parent);
if (parent) {
nsCOMPtr<nsIAtom> frameType;
parent->GetFrameType(getter_AddRefs(frameType));
if (nsLayoutAtoms::tableCellFrame == frameType) {
nsCOMPtr<nsIContent> content;
aFrame.GetContent(getter_AddRefs(content));
nsCOMPtr<nsIDOMHTMLTableCellElement> cellContent(do_QueryInterface(content));
if (cellContent) {
return PR_TRUE;
}
}
}
return PR_FALSE;
}
#ifdef DEBUG
void
nsBlockFrame::VerifyLines(PRBool aFinalCheckOK)
@ -6635,4 +6661,5 @@ nsBlockFrame::GetDepth() const
}
return depth;
}
#endif

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

@ -197,6 +197,9 @@ public:
inline nscoord GetAscent() { return mAscent; }
// Return true if aFrame is the (only) child of an nsTableCellFrame which has a TD content node.
static PRBool IsTDTableCellBlock(nsIFrame& aFrame);
protected:
nsBlockFrame();
virtual ~nsBlockFrame();

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

@ -450,9 +450,12 @@ nsBlockReflowState::ReconstructMarginAbove(nsLineList::iterator aLine)
((NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace) ||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace));
// IsEmpty treats standards and quirks mode differently. We want
// quirks behavior for a table cell block.
nsCompatibility mode;
mPresContext->GetCompatibilityMode(&mode);
PRBool isQuirkMode = mode == eCompatibility_NavQuirks;
PRBool isQuirkMode = (mode == eCompatibility_NavQuirks) ||
nsBlockFrame::IsTDTableCellBlock(*mBlock);
nsLineList::iterator firstLine = block->begin_lines();
for (;;) {

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

@ -2221,12 +2221,12 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
// "normally" according to css2 or should it effectively
// "disappear".
//
// In general, if the document being processed is in strict mode
// then it should act normally (with one exception). The exception
// case is when a span is continued and yet the span is empty
// (e.g. compressed whitespace). For this kind of span we treat it
// as if it were not there so that it doesn't impact the
// line-height.
// In general, if the document being processed is in strict mode then
// it should act normally (with two exceptions). The 1st exception
// is when a span is continued and yet the span is empty (e.g. compressed
// whitespace). For this kind of span we treat it as if it were not there
// so that it doesn't impact the line-height. The 2nd exception is if the
// span's containing block is a table cell block and the content is a TD.
//
// In compatability mode, we should sometimes make it disappear. The
// cases that matter are those where the span contains no real text
@ -2248,7 +2248,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
PRBool zeroEffectiveSpanBox = PR_FALSE;
// XXXldb If we really have empty continuations, then all these other
// checks don't make sense for them.
if ((emptyContinuation || !InStrictMode()) &&
if ((emptyContinuation || !InStrictMode() || nsBlockFrame::IsTDTableCellBlock(*spanFrame)) &&
((psd == mRootSpan) ||
((0 == spanFramePFD->mBorderPadding.top) &&
(0 == spanFramePFD->mBorderPadding.right) &&

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

@ -61,6 +61,7 @@
#include "nsHTMLAtoms.h"
#include "nsHTMLValue.h"
#include "nsIDOMEvent.h"
#include "nsIDOMHTMLTableCellElement.h"
#include "nsIHTMLContent.h"
#include "prprf.h"
#include "nsLayoutAtoms.h"
@ -2971,6 +2972,10 @@ nsBlockFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool *aResult)
}
// IsEmpty treats standards and quirks mode differently. We want
// quirks behavior for a table cell block.
PRBool quirkMode = aIsQuirkMode || IsTDTableCellBlock(*this);
const nsStyleText* styleText = NS_STATIC_CAST(const nsStyleText*,
mStyleContext->GetStyleData(eStyleStruct_Text));
PRBool isPre =
@ -2981,7 +2986,7 @@ nsBlockFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool *aResult)
line != line_end;
++line)
{
line->IsEmpty(aIsQuirkMode, isPre, aResult);
line->IsEmpty(quirkMode, isPre, aResult);
if (! *aResult)
break;
}
@ -6551,6 +6556,27 @@ nsBlockFrame::BuildFloaterList()
// XXX keep the text-run data in the first-in-flow of the block
PRBool
nsBlockFrame::IsTDTableCellBlock(nsIFrame& aFrame)
{
nsIFrame* parent;
aFrame.GetParent(&parent);
if (parent) {
nsCOMPtr<nsIAtom> frameType;
parent->GetFrameType(getter_AddRefs(frameType));
if (nsLayoutAtoms::tableCellFrame == frameType) {
nsCOMPtr<nsIContent> content;
aFrame.GetContent(getter_AddRefs(content));
nsCOMPtr<nsIDOMHTMLTableCellElement> cellContent(do_QueryInterface(content));
if (cellContent) {
return PR_TRUE;
}
}
}
return PR_FALSE;
}
#ifdef DEBUG
void
nsBlockFrame::VerifyLines(PRBool aFinalCheckOK)
@ -6635,4 +6661,5 @@ nsBlockFrame::GetDepth() const
}
return depth;
}
#endif

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

@ -197,6 +197,9 @@ public:
inline nscoord GetAscent() { return mAscent; }
// Return true if aFrame is the (only) child of an nsTableCellFrame which has a TD content node.
static PRBool IsTDTableCellBlock(nsIFrame& aFrame);
protected:
nsBlockFrame();
virtual ~nsBlockFrame();

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

@ -450,9 +450,12 @@ nsBlockReflowState::ReconstructMarginAbove(nsLineList::iterator aLine)
((NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace) ||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace));
// IsEmpty treats standards and quirks mode differently. We want
// quirks behavior for a table cell block.
nsCompatibility mode;
mPresContext->GetCompatibilityMode(&mode);
PRBool isQuirkMode = mode == eCompatibility_NavQuirks;
PRBool isQuirkMode = (mode == eCompatibility_NavQuirks) ||
nsBlockFrame::IsTDTableCellBlock(*mBlock);
nsLineList::iterator firstLine = block->begin_lines();
for (;;) {

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

@ -2221,12 +2221,12 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
// "normally" according to css2 or should it effectively
// "disappear".
//
// In general, if the document being processed is in strict mode
// then it should act normally (with one exception). The exception
// case is when a span is continued and yet the span is empty
// (e.g. compressed whitespace). For this kind of span we treat it
// as if it were not there so that it doesn't impact the
// line-height.
// In general, if the document being processed is in strict mode then
// it should act normally (with two exceptions). The 1st exception
// is when a span is continued and yet the span is empty (e.g. compressed
// whitespace). For this kind of span we treat it as if it were not there
// so that it doesn't impact the line-height. The 2nd exception is if the
// span's containing block is a table cell block and the content is a TD.
//
// In compatability mode, we should sometimes make it disappear. The
// cases that matter are those where the span contains no real text
@ -2248,7 +2248,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
PRBool zeroEffectiveSpanBox = PR_FALSE;
// XXXldb If we really have empty continuations, then all these other
// checks don't make sense for them.
if ((emptyContinuation || !InStrictMode()) &&
if ((emptyContinuation || !InStrictMode() || nsBlockFrame::IsTDTableCellBlock(*spanFrame)) &&
((psd == mRootSpan) ||
((0 == spanFramePFD->mBorderPadding.top) &&
(0 == spanFramePFD->mBorderPadding.right) &&