Reimplemented SizeOf methods in some of the frame classes; partial rework of first-line handling snapshot

git-svn-id: svn://10.0.0.236/trunk@45274 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kipp%netscape.com 1999-08-31 03:09:40 +00:00
parent 9f5b856289
commit c9002f20df
101 changed files with 2760 additions and 1522 deletions

View File

@ -75,8 +75,10 @@ LAYOUT_ATOM(viewportScrollPseudo, ":viewport-scroll")
// Alphabetical list of frame types
LAYOUT_ATOM(areaFrame, "AreaFrame")
LAYOUT_ATOM(blockFrame, "BlockFrame")
LAYOUT_ATOM(hrFrame, "HRFrame")
LAYOUT_ATOM(htmlFrameInnerFrame, "htmlFrameInnerFrame")
LAYOUT_ATOM(htmlFrameOuterFrame, "htmlFrameOuterFrame")
LAYOUT_ATOM(imageFrame, "ImageFrame")
LAYOUT_ATOM(inlineFrame, "InlineFrame")
LAYOUT_ATOM(letterFrame, "LetterFrame")
LAYOUT_ATOM(lineFrame, "LineFrame")

File diff suppressed because it is too large Load Diff

View File

@ -627,9 +627,27 @@ InitializeScrollFrame(nsIPresContext* aPresContext,
// Methods support creating block frames and their children
nsIStyleContext* GetFirstLetterStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static nsIStyleContext* GetFirstLetterStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static nsIStyleContext* GetFirstLineStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static PRBool HaveFirstLetterStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static PRBool HaveFirstLineStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static void HaveSpecialBlockStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
PRBool* aHaveFirstLetterStyle,
PRBool* aHaveFirstLineStyle);
PRBool ShouldCreateFirstLetterFrame(nsIPresContext* aPresContext,
nsIContent* aContent,
@ -679,6 +697,29 @@ InitializeScrollFrame(nsIPresContext* aPresContext,
nsFrameItems& aFloatingItems,
nsIStyleContext* aStyleContext);
nsresult WrapFramesInFirstLineFrame(nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
nsIFrame* aFrame,
nsFrameItems& aFrameItems);
nsresult AppendFirstLineFrames(nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
nsIFrame* aBlockFrame,
nsFrameItems& aFrameItems);
nsresult InsertFirstLineFrames(nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
nsIFrame* aBlockFrame,
nsIFrame** aParentFrame,
nsIFrame* aPrevSibling,
nsFrameItems& aFrameItems);
nsresult MaybeCreateContainerFrame(nsIPresContext* aPresContext,
nsIContent* aContainer);
protected:
nsIDocument* mDocument;

View File

@ -75,8 +75,10 @@ LAYOUT_ATOM(viewportScrollPseudo, ":viewport-scroll")
// Alphabetical list of frame types
LAYOUT_ATOM(areaFrame, "AreaFrame")
LAYOUT_ATOM(blockFrame, "BlockFrame")
LAYOUT_ATOM(hrFrame, "HRFrame")
LAYOUT_ATOM(htmlFrameInnerFrame, "htmlFrameInnerFrame")
LAYOUT_ATOM(htmlFrameOuterFrame, "htmlFrameOuterFrame")
LAYOUT_ATOM(imageFrame, "ImageFrame")
LAYOUT_ATOM(inlineFrame, "InlineFrame")
LAYOUT_ATOM(letterFrame, "LetterFrame")
LAYOUT_ATOM(lineFrame, "LineFrame")

View File

@ -31,6 +31,7 @@ class nsIFrame;
class nsIPresContext;
class nsIPresShell;
class nsIRenderingContext;
class nsISizeOfHandler;
class nsISpaceManager;
class nsIStyleContext;
class nsIView;
@ -588,7 +589,7 @@ public:
* called when the frame has been scrolled to a new
* position. only called for frames with views.
*/
NS_IMETHOD Scrolled(nsIView *aView) = 0;
NS_IMETHOD Scrolled(nsIView *aView) = 0;
// Debugging
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const = 0;
@ -608,6 +609,23 @@ public:
*/
NS_IMETHOD DumpRegressionData(FILE* out, PRInt32 aIndent) = 0;
/**
* Get the size of the frame object. The size value should include
* all subordinate data referenced by the frame that is not
* accounted for by child frames. However, this value should not
* include the content objects, style contexts, views or other data
* that lies logically outside the frame system.
*
* If the implementation so chooses, instead of returning the total
* subordinate data it may instead use the sizeof handler to store
* away subordinate data under its own key so that the subordinate
* data may be tabulated independently of the frame itself.
*
* The caller is responsible for recursing over all child-lists that
* the frame supports.
*/
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0;
NS_IMETHOD VerifyTree() const = 0;
/** Selection related calls

View File

@ -75,8 +75,10 @@ LAYOUT_ATOM(viewportScrollPseudo, ":viewport-scroll")
// Alphabetical list of frame types
LAYOUT_ATOM(areaFrame, "AreaFrame")
LAYOUT_ATOM(blockFrame, "BlockFrame")
LAYOUT_ATOM(hrFrame, "HRFrame")
LAYOUT_ATOM(htmlFrameInnerFrame, "htmlFrameInnerFrame")
LAYOUT_ATOM(htmlFrameOuterFrame, "htmlFrameOuterFrame")
LAYOUT_ATOM(imageFrame, "ImageFrame")
LAYOUT_ATOM(inlineFrame, "InlineFrame")
LAYOUT_ATOM(letterFrame, "LetterFrame")
LAYOUT_ATOM(lineFrame, "LineFrame")

View File

@ -451,3 +451,14 @@ nsAreaFrame::GetFrameName(nsString& aResult) const
{
return MakeFrameName("Area", aResult);
}
NS_IMETHODIMP
nsAreaFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
nsBlockFrame::SizeOf(aHandler, aResult);
*aResult += sizeof(*this) - sizeof(nsBlockFrame);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -104,6 +104,8 @@ public:
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
// nsIAreaFrame
NS_IMETHOD GetPositionedInfo(nscoord& aXMost, nscoord& aYMost) const;

View File

@ -45,8 +45,6 @@
#include "nsITextContent.h"
#include "nsStyleChangeList.h"
// XXX for IsEmptyLine
#include "nsTextFragment.h"
#include "nsIFocusTracker.h"
#include "nsIFrameSelection.h"
@ -985,6 +983,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
}
#ifdef BLOCK_DOES_FIRST_LINE
// It is possible that we just acquired first-line style. See if
// this is the case, and if so, fix things up.
if (0 == (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState)) {
@ -1005,6 +1004,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
}
}
#endif
return rv;
}
@ -2185,7 +2185,6 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
// Setup the line-layout for the new line
aState.mCurrentLine = aLine;
aLine->ClearDirty();
aLine->SetNeedDidReflow();
// Now that we know what kind of line we have, reflow it
nsRect oldCombinedArea = aLine->mCombinedArea;
@ -2643,38 +2642,6 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState,
return PR_FALSE;
}
#if 0
const nsStyleText* styleText;
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) styleText);
if ((NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace) ||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace)) {
// Since whitespace is significant, we know that the paragraph
// is not empty (even if it has no text in it because it has
return PR_FALSE;
static PRBool
IsEmptyHTMLParagraph(nsIFrame* aFrame)
{
nsBlockFrame* bf;
if (NS_SUCCEEDED(aRS.frame->QueryInterface(kBlockFrameCID, (void**)&bf)) &&
nsBlockReflowContext::IsHTMLParagraph(aFrame)) {
if (!bf->mLines) {
// It's an html paragraph and it's empty
return PR_TRUE;
}
nsLineBox* line = bf->mLines;
while (line) {
if (!IsEmptyLine(line)) {
return PR_FALSE;
}
line = line->mNext;
}
}
return PR_FALSE;
}
#endif
nsIFrame*
nsBlockFrame::GetTopBlockChild()
{
@ -3071,6 +3038,9 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState,
availWidth, availHeight,
impactedByFloaters,
PR_FALSE /*XXX isTopOfPage*/);
// XXX Unfortunately we need to know this before reflowing the first
// inline frame in the line. FIX ME.
if ((0 == aLineLayout.GetLineNumber()) &&
(NS_BLOCK_HAS_FIRST_LETTER_STYLE & mState)) {
aLineLayout.SetFirstLetterStyleOK(PR_TRUE);
@ -3287,10 +3257,13 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
// line and don't stop the line reflow...
PRBool splitLine = !reflowingFirstLetter;
if (reflowingFirstLetter) {
#ifdef BLOCK_DOES_FIRST_LINE
if (aLine->IsFirstLine()) {
splitLine = PR_TRUE;
}
else {
else
#endif
{
nsIAtom* frameType;
if (NS_SUCCEEDED(aFrame->GetFrameType(&frameType)) && frameType) {
if (frameType == nsLayoutAtoms::inlineFrame) {
@ -3391,7 +3364,9 @@ nsBlockFrame::SplitLine(nsBlockReflowState& aState,
aLine->mNext = to;
}
to->SetIsBlock(aLine->IsBlock());
#ifdef BLOCK_DOES_FIRST_LINE
to->SetIsFirstLine(aLine->IsFirstLine());
#endif
aLine->mChildCount -= pushCount;
// Let line layout know that some frames are no longer part of its
@ -3656,20 +3631,6 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState,
aLine->mMaxElementWidth = aMaxElementSize.width;
}
#if XXX_need_line_outside_children
// Compute LINE_OUTSIDE_CHILDREN state for this line. The bit is set
// if any child frame has outside children.
if ((aLine->mCombinedArea.x < aLine->mBounds.x) ||
(aLine->mCombinedArea.XMost() > aLine->mBounds.XMost()) ||
(aLine->mCombinedArea.y < aLine->mBounds.y) ||
(aLine->mCombinedArea.YMost() > aLine->mBounds.YMost())) {
aLine->SetOutsideChildren();
}
else {
aLine->ClearOutsideChildren();
}
#endif
// Update xmost
nscoord xmost = aLine->mBounds.XMost();
if (xmost > aState.mKidXMost) {
@ -3847,6 +3808,7 @@ nsBlockFrame::LastChild()
return nsnull;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::WrapFramesInFirstLineFrame(nsIPresContext* aPresContext)
{
@ -3938,6 +3900,7 @@ nsBlockFrame::WrapFramesInFirstLineFrame(nsIPresContext* aPresContext)
return rv;
}
#endif
NS_IMETHODIMP
nsBlockFrame::AppendFrames(nsIPresContext& aPresContext,
@ -3963,12 +3926,14 @@ nsBlockFrame::AppendFrames(nsIPresContext& aPresContext,
nsLineBox* lastLine = nsLineBox::LastLine(mLines);
if (lastLine) {
lastKid = lastLine->LastChild();
#ifdef BLOCK_DOES_FIRST_LINE
if (lastLine->IsFirstLine()) {
// Get last frame in the nsFirstLineFrame
lastKid->FirstChild(nsnull, &lastKid);
nsFrameList frames(lastKid);
lastKid = frames.LastChild();
}
#endif
}
// Add frames after the last child
@ -4058,6 +4023,7 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
nsLineBox* prevSibLine = nsnull;
PRInt32 prevSiblingIndex = -1;
if (aPrevSibling) {
#ifdef BLOCK_DOES_FIRST_LINE
// Its possible we have an nsFirstLineFrame managing some of our
// child frames. If we do and the AddFrames is targetted at it,
// use AddFirstLineFrames to get the frames properly placed.
@ -4079,7 +4045,9 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
(nsFirstLineFrame*)prevSiblingParent,
aFrameList, aPrevSibling);
}
else {
else
#endif
{
// Find the line that contains the previous sibling
prevSibLine = nsLineBox::FindLineContaining(mLines, aPrevSibling,
&prevSiblingIndex);
@ -4091,12 +4059,14 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
}
}
}
#ifdef BLOCK_DOES_FIRST_LINE
else if (mLines && mLines->IsFirstLine()) {
mLines->MarkDirty();
return AddFirstLineFrames(aPresContext,
(nsFirstLineFrame*)mLines->mFirstChild,
aFrameList, nsnull);
}
#endif
// Find the frame following aPrevSibling so that we can join up the
// two lists of frames.
@ -4168,20 +4138,22 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
aPrevSibling->SetNextSibling(prevSiblingNextFrame);
}
#ifdef BLOCK_DOES_FIRST_LINE
// Fixup any frames that should be in a first-line frame but aren't
if ((NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) &&
(nsnull != mLines) && !mLines->IsBlock()) {
// We just added one or more frame(s) to the first line.
WrapFramesInFirstLineFrame(aPresContext);
}
#endif
#ifdef DEBUG
VerifyLines(PR_TRUE);
#endif
MarkEmptyLines(aPresContext);
return NS_OK;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::AddFirstLineFrames(nsIPresContext* aPresContext,
nsFirstLineFrame* aLineFrame,
@ -4310,6 +4282,7 @@ nsBlockFrame::TakeKidsFromLineFrame(nsFirstLineFrame* aLineFrame,
return kids.FirstChild();
}
#endif
void
nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame)
@ -4404,12 +4377,14 @@ nsresult
nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
nsIFrame* aDeletedFrame)
{
#ifdef BLOCK_DOES_FIRST_LINE
nsIFrame* parent;
aDeletedFrame->GetParent(&parent);
if (parent != this) {
return RemoveFirstLineFrame(aPresContext, (nsFirstLineFrame*)parent,
aDeletedFrame);
}
#endif
// Find the line and the previous sibling that contains
// deletedFrame; we also find the pointer to the line.
@ -4446,6 +4421,9 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
while (nsnull != aDeletedFrame) {
while ((nsnull != line) && (nsnull != aDeletedFrame)) {
#ifdef NS_DEBUG
#ifndef BLOCK_DOES_FIRST_LINE
nsIFrame* parent;
#endif
aDeletedFrame->GetParent(&parent);
NS_ASSERTION(flow == parent, "messed up delete code");
NS_ASSERTION(line->Contains(aDeletedFrame), "frame not in line");
@ -4547,6 +4525,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
}
}
#ifdef BLOCK_DOES_FIRST_LINE
// Fixup any frames that should be in a first-line frame but aren't
if ((NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) &&
(nsnull != mLines) && !mLines->IsBlock()) {
@ -4554,14 +4533,15 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
// removed a block that preceeded the first line.
WrapFramesInFirstLineFrame(aPresContext);
}
#endif
#ifdef DEBUG
VerifyLines(PR_TRUE);
#endif
MarkEmptyLines(aPresContext);
return NS_OK;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::RemoveFirstLineFrame(nsIPresContext* aPresContext,
nsFirstLineFrame* aLineFrame,
@ -4596,106 +4576,7 @@ nsBlockFrame::RemoveFirstLineFrame(nsIPresContext* aPresContext,
}
return NS_OK;
}
static PRBool
IsEmptyLine(nsIPresContext* aPresContext, nsLineBox* aLine)
{
PRInt32 i, n = aLine->ChildCount();
nsIFrame* frame = aLine->mFirstChild;
for (i = 0; i < n; i++) {
nsIContent* content;
nsresult rv = frame->GetContent(&content);
if (NS_FAILED(rv) || (nsnull == content)) {
// If it doesn't have any content then this can't be an empty line
return PR_FALSE;
}
nsITextContent* tc;
rv = content->QueryInterface(kITextContentIID, (void**) &tc);
if (NS_FAILED(rv) || (nsnull == tc)) {
// If it's not text content then this can't be an empty line
NS_RELEASE(content);
return PR_FALSE;
}
const nsTextFragment* frag;
PRInt32 numFrags;
rv = tc->GetText(frag, numFrags);
if (NS_FAILED(rv)) {
NS_RELEASE(content);
NS_RELEASE(tc);
return PR_FALSE;
}
// If the text has any non-whitespace characters in it then the
// line is not an empty line.
while (--numFrags >= 0) {
PRInt32 len = frag->GetLength();
if (frag->Is2b()) {
const PRUnichar* cp = frag->Get2b();
const PRUnichar* end = cp + len;
while (cp < end) {
PRUnichar ch = *cp++;
if (!XP_IS_SPACE(ch)) {
NS_RELEASE(tc);
NS_RELEASE(content);
return PR_FALSE;
}
}
}
else {
const char* cp = frag->Get1b();
const char* end = cp + len;
while (cp < end) {
char ch = *cp++;
if (!XP_IS_SPACE(ch)) {
NS_RELEASE(tc);
NS_RELEASE(content);
return PR_FALSE;
}
}
}
frag++;
}
NS_RELEASE(tc);
NS_RELEASE(content);
frame->GetNextSibling(&frame);
}
return PR_TRUE;
}
void
nsBlockFrame::MarkEmptyLines(nsIPresContext* aPresContext)
{
// PRE-formatted content considers whitespace significant
const nsStyleText* text;
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) text);
if ((NS_STYLE_WHITESPACE_PRE == text->mWhiteSpace) ||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == text->mWhiteSpace)) {
return;
}
PRBool afterBlock = PR_TRUE;
nsLineBox* line = mLines;
while (nsnull != line) {
if (line->IsBlock()) {
afterBlock = PR_TRUE;
}
else if (afterBlock) {
afterBlock = PR_FALSE;
// This is an inline line and it is immediately after a block
// (or its our first line). See if it contains nothing but
// collapsible text.
PRBool isEmpty = IsEmptyLine(aPresContext, line);
line->SetIsEmptyLine(isEmpty);
}
else {
line->SetIsEmptyLine(PR_FALSE);
}
line = line->mNext;
}
}
#endif
void
nsBlockFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
@ -5609,6 +5490,40 @@ nsBlockFrame::VerifyTree() const
return NS_OK;
}
NS_IMETHODIMP
nsBlockFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
PRUint32 sum = sizeof(*this);
// Add in size of each line object
nsLineBox* line = mLines;
while (line) {
sum += sizeof(nsLineBox);
line = line->mNext;
}
line = mOverflowLines;
while (line) {
sum += sizeof(nsLineBox);
line = line->mNext;
}
// Add in text-run data
nsTextRun* runs = mTextRuns;
while (runs) {
PRUint32 runSize;
runs->SizeOf(aHandler, &runSize);
sum += runSize;
runs = runs->GetNext();
}
*aResult = sum;
return NS_OK;
}
//----------------------------------------------------------------------
NS_IMETHODIMP
@ -5643,6 +5558,7 @@ nsBlockFrame::GetFirstLetterStyle(nsIPresContext* aPresContext)
return fls;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsIStyleContext*
nsBlockFrame::GetFirstLineStyle(nsIPresContext* aPresContext)
{
@ -5652,6 +5568,7 @@ nsBlockFrame::GetFirstLineStyle(nsIPresContext* aPresContext)
mStyleContext, PR_FALSE, &fls);
return fls;
}
#endif
NS_IMETHODIMP
nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
@ -5677,6 +5594,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
NS_RELEASE(firstLetterStyle);
}
#ifdef BLOCK_DOES_FIRST_LINE
nsIStyleContext* firstLineStyle = GetFirstLineStyle(&aPresContext);
if (nsnull != firstLineStyle) {
mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE;
@ -5686,6 +5604,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
#endif
NS_RELEASE(firstLineStyle);
}
#endif
}
rv = AddFrames(&aPresContext, aChildList, nsnull);
@ -6238,9 +6157,15 @@ nsBlockFrame::VerifyLines(PRBool aFinalCheckOK)
if (line->IsBlock()) {
seenBlock = PR_TRUE;
}
if (line->IsFirstLine() || line->IsBlock()) {
#ifdef BLOCK_DOES_FIRST_LINE
if (line->IsFirstLine()) {
NS_ASSERTION(1 == line->mChildCount, "bad first line");
}
#endif
if (line->IsBlock()) {
NS_ASSERTION(1 == line->mChildCount, "bad first line");
}
#ifdef BLOCK_DOES_FIRST_LINE
if (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) {
if (seenBlock) {
NS_ASSERTION(!line->IsFirstLine(), "bad first line");
@ -6249,6 +6174,7 @@ nsBlockFrame::VerifyLines(PRBool aFinalCheckOK)
NS_ASSERTION(line->IsFirstLine(), "bad first line");
}
}
#endif
}
NS_ASSERTION(line->mChildCount < MAX_LINE_COUNT, "bad line child count");
count += line->mChildCount;

View File

@ -40,7 +40,9 @@ class nsFirstLineFrame;
*/
#define NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET 0x80000000
#define NS_BLOCK_IS_HTML_PARAGRAPH 0x40000000
#ifdef BLOCK_DOES_FIRST_LINE
#define NS_BLOCK_HAS_FIRST_LINE_STYLE 0x20000000
#endif
#define NS_BLOCK_HAS_FIRST_LETTER_STYLE 0x10000000
#define nsBlockFrameSuper nsHTMLContainerFrame
@ -99,6 +101,7 @@ public:
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
NS_IMETHOD VerifyTree() const;
NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame);
NS_IMETHOD HandleEvent(nsIPresContext& aPresContext,
@ -145,7 +148,9 @@ protected:
nsIStyleContext* GetFirstLetterStyle(nsIPresContext* aPresContext);
#ifdef BLOCK_DOES_FIRST_LINE
nsIStyleContext* GetFirstLineStyle(nsIPresContext* aPresContext);
#endif
void SetFlags(PRUint32 aFlags) {
mFlags = aFlags;
@ -171,12 +176,11 @@ protected:
nsBlockReflowState& aState,
nsHTMLReflowMetrics& aMetrics);
void MarkEmptyLines(nsIPresContext* aPresContext);
nsresult AddFrames(nsIPresContext* aPresContext,
nsIFrame* aFrameList,
nsIFrame* aPrevSibling);
#ifdef BLOCK_DOES_FIRST_LINE
nsresult AddFirstLineFrames(nsIPresContext* aPresContext,
nsFirstLineFrame* aLineFrame,
nsIFrame* aFrameList,
@ -185,16 +189,18 @@ protected:
nsIFrame* TakeKidsFromLineFrame(nsFirstLineFrame* aLineFrame,
nsIFrame* aFromKid);
void FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame);
nsresult DoRemoveFrame(nsIPresContext* aPresContext,
nsIFrame* aDeletedFrame);
nsresult RemoveFirstLineFrame(nsIPresContext* aPresContext,
nsFirstLineFrame* aLineFrame,
nsIFrame* aDeletedFrame);
nsresult WrapFramesInFirstLineFrame(nsIPresContext* aPresContext);
#endif
void FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame);
nsresult DoRemoveFrame(nsIPresContext* aPresContext,
nsIFrame* aDeletedFrame);
nsresult PrepareInitialReflow(nsBlockReflowState& aState);

View File

@ -45,8 +45,6 @@
#include "nsITextContent.h"
#include "nsStyleChangeList.h"
// XXX for IsEmptyLine
#include "nsTextFragment.h"
#include "nsIFocusTracker.h"
#include "nsIFrameSelection.h"
@ -985,6 +983,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
}
#ifdef BLOCK_DOES_FIRST_LINE
// It is possible that we just acquired first-line style. See if
// this is the case, and if so, fix things up.
if (0 == (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState)) {
@ -1005,6 +1004,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
}
}
#endif
return rv;
}
@ -2185,7 +2185,6 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
// Setup the line-layout for the new line
aState.mCurrentLine = aLine;
aLine->ClearDirty();
aLine->SetNeedDidReflow();
// Now that we know what kind of line we have, reflow it
nsRect oldCombinedArea = aLine->mCombinedArea;
@ -2643,38 +2642,6 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState,
return PR_FALSE;
}
#if 0
const nsStyleText* styleText;
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) styleText);
if ((NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace) ||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace)) {
// Since whitespace is significant, we know that the paragraph
// is not empty (even if it has no text in it because it has
return PR_FALSE;
static PRBool
IsEmptyHTMLParagraph(nsIFrame* aFrame)
{
nsBlockFrame* bf;
if (NS_SUCCEEDED(aRS.frame->QueryInterface(kBlockFrameCID, (void**)&bf)) &&
nsBlockReflowContext::IsHTMLParagraph(aFrame)) {
if (!bf->mLines) {
// It's an html paragraph and it's empty
return PR_TRUE;
}
nsLineBox* line = bf->mLines;
while (line) {
if (!IsEmptyLine(line)) {
return PR_FALSE;
}
line = line->mNext;
}
}
return PR_FALSE;
}
#endif
nsIFrame*
nsBlockFrame::GetTopBlockChild()
{
@ -3071,6 +3038,9 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState,
availWidth, availHeight,
impactedByFloaters,
PR_FALSE /*XXX isTopOfPage*/);
// XXX Unfortunately we need to know this before reflowing the first
// inline frame in the line. FIX ME.
if ((0 == aLineLayout.GetLineNumber()) &&
(NS_BLOCK_HAS_FIRST_LETTER_STYLE & mState)) {
aLineLayout.SetFirstLetterStyleOK(PR_TRUE);
@ -3287,10 +3257,13 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
// line and don't stop the line reflow...
PRBool splitLine = !reflowingFirstLetter;
if (reflowingFirstLetter) {
#ifdef BLOCK_DOES_FIRST_LINE
if (aLine->IsFirstLine()) {
splitLine = PR_TRUE;
}
else {
else
#endif
{
nsIAtom* frameType;
if (NS_SUCCEEDED(aFrame->GetFrameType(&frameType)) && frameType) {
if (frameType == nsLayoutAtoms::inlineFrame) {
@ -3391,7 +3364,9 @@ nsBlockFrame::SplitLine(nsBlockReflowState& aState,
aLine->mNext = to;
}
to->SetIsBlock(aLine->IsBlock());
#ifdef BLOCK_DOES_FIRST_LINE
to->SetIsFirstLine(aLine->IsFirstLine());
#endif
aLine->mChildCount -= pushCount;
// Let line layout know that some frames are no longer part of its
@ -3656,20 +3631,6 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState,
aLine->mMaxElementWidth = aMaxElementSize.width;
}
#if XXX_need_line_outside_children
// Compute LINE_OUTSIDE_CHILDREN state for this line. The bit is set
// if any child frame has outside children.
if ((aLine->mCombinedArea.x < aLine->mBounds.x) ||
(aLine->mCombinedArea.XMost() > aLine->mBounds.XMost()) ||
(aLine->mCombinedArea.y < aLine->mBounds.y) ||
(aLine->mCombinedArea.YMost() > aLine->mBounds.YMost())) {
aLine->SetOutsideChildren();
}
else {
aLine->ClearOutsideChildren();
}
#endif
// Update xmost
nscoord xmost = aLine->mBounds.XMost();
if (xmost > aState.mKidXMost) {
@ -3847,6 +3808,7 @@ nsBlockFrame::LastChild()
return nsnull;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::WrapFramesInFirstLineFrame(nsIPresContext* aPresContext)
{
@ -3938,6 +3900,7 @@ nsBlockFrame::WrapFramesInFirstLineFrame(nsIPresContext* aPresContext)
return rv;
}
#endif
NS_IMETHODIMP
nsBlockFrame::AppendFrames(nsIPresContext& aPresContext,
@ -3963,12 +3926,14 @@ nsBlockFrame::AppendFrames(nsIPresContext& aPresContext,
nsLineBox* lastLine = nsLineBox::LastLine(mLines);
if (lastLine) {
lastKid = lastLine->LastChild();
#ifdef BLOCK_DOES_FIRST_LINE
if (lastLine->IsFirstLine()) {
// Get last frame in the nsFirstLineFrame
lastKid->FirstChild(nsnull, &lastKid);
nsFrameList frames(lastKid);
lastKid = frames.LastChild();
}
#endif
}
// Add frames after the last child
@ -4058,6 +4023,7 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
nsLineBox* prevSibLine = nsnull;
PRInt32 prevSiblingIndex = -1;
if (aPrevSibling) {
#ifdef BLOCK_DOES_FIRST_LINE
// Its possible we have an nsFirstLineFrame managing some of our
// child frames. If we do and the AddFrames is targetted at it,
// use AddFirstLineFrames to get the frames properly placed.
@ -4079,7 +4045,9 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
(nsFirstLineFrame*)prevSiblingParent,
aFrameList, aPrevSibling);
}
else {
else
#endif
{
// Find the line that contains the previous sibling
prevSibLine = nsLineBox::FindLineContaining(mLines, aPrevSibling,
&prevSiblingIndex);
@ -4091,12 +4059,14 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
}
}
}
#ifdef BLOCK_DOES_FIRST_LINE
else if (mLines && mLines->IsFirstLine()) {
mLines->MarkDirty();
return AddFirstLineFrames(aPresContext,
(nsFirstLineFrame*)mLines->mFirstChild,
aFrameList, nsnull);
}
#endif
// Find the frame following aPrevSibling so that we can join up the
// two lists of frames.
@ -4168,20 +4138,22 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
aPrevSibling->SetNextSibling(prevSiblingNextFrame);
}
#ifdef BLOCK_DOES_FIRST_LINE
// Fixup any frames that should be in a first-line frame but aren't
if ((NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) &&
(nsnull != mLines) && !mLines->IsBlock()) {
// We just added one or more frame(s) to the first line.
WrapFramesInFirstLineFrame(aPresContext);
}
#endif
#ifdef DEBUG
VerifyLines(PR_TRUE);
#endif
MarkEmptyLines(aPresContext);
return NS_OK;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::AddFirstLineFrames(nsIPresContext* aPresContext,
nsFirstLineFrame* aLineFrame,
@ -4310,6 +4282,7 @@ nsBlockFrame::TakeKidsFromLineFrame(nsFirstLineFrame* aLineFrame,
return kids.FirstChild();
}
#endif
void
nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame)
@ -4404,12 +4377,14 @@ nsresult
nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
nsIFrame* aDeletedFrame)
{
#ifdef BLOCK_DOES_FIRST_LINE
nsIFrame* parent;
aDeletedFrame->GetParent(&parent);
if (parent != this) {
return RemoveFirstLineFrame(aPresContext, (nsFirstLineFrame*)parent,
aDeletedFrame);
}
#endif
// Find the line and the previous sibling that contains
// deletedFrame; we also find the pointer to the line.
@ -4446,6 +4421,9 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
while (nsnull != aDeletedFrame) {
while ((nsnull != line) && (nsnull != aDeletedFrame)) {
#ifdef NS_DEBUG
#ifndef BLOCK_DOES_FIRST_LINE
nsIFrame* parent;
#endif
aDeletedFrame->GetParent(&parent);
NS_ASSERTION(flow == parent, "messed up delete code");
NS_ASSERTION(line->Contains(aDeletedFrame), "frame not in line");
@ -4547,6 +4525,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
}
}
#ifdef BLOCK_DOES_FIRST_LINE
// Fixup any frames that should be in a first-line frame but aren't
if ((NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) &&
(nsnull != mLines) && !mLines->IsBlock()) {
@ -4554,14 +4533,15 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
// removed a block that preceeded the first line.
WrapFramesInFirstLineFrame(aPresContext);
}
#endif
#ifdef DEBUG
VerifyLines(PR_TRUE);
#endif
MarkEmptyLines(aPresContext);
return NS_OK;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::RemoveFirstLineFrame(nsIPresContext* aPresContext,
nsFirstLineFrame* aLineFrame,
@ -4596,106 +4576,7 @@ nsBlockFrame::RemoveFirstLineFrame(nsIPresContext* aPresContext,
}
return NS_OK;
}
static PRBool
IsEmptyLine(nsIPresContext* aPresContext, nsLineBox* aLine)
{
PRInt32 i, n = aLine->ChildCount();
nsIFrame* frame = aLine->mFirstChild;
for (i = 0; i < n; i++) {
nsIContent* content;
nsresult rv = frame->GetContent(&content);
if (NS_FAILED(rv) || (nsnull == content)) {
// If it doesn't have any content then this can't be an empty line
return PR_FALSE;
}
nsITextContent* tc;
rv = content->QueryInterface(kITextContentIID, (void**) &tc);
if (NS_FAILED(rv) || (nsnull == tc)) {
// If it's not text content then this can't be an empty line
NS_RELEASE(content);
return PR_FALSE;
}
const nsTextFragment* frag;
PRInt32 numFrags;
rv = tc->GetText(frag, numFrags);
if (NS_FAILED(rv)) {
NS_RELEASE(content);
NS_RELEASE(tc);
return PR_FALSE;
}
// If the text has any non-whitespace characters in it then the
// line is not an empty line.
while (--numFrags >= 0) {
PRInt32 len = frag->GetLength();
if (frag->Is2b()) {
const PRUnichar* cp = frag->Get2b();
const PRUnichar* end = cp + len;
while (cp < end) {
PRUnichar ch = *cp++;
if (!XP_IS_SPACE(ch)) {
NS_RELEASE(tc);
NS_RELEASE(content);
return PR_FALSE;
}
}
}
else {
const char* cp = frag->Get1b();
const char* end = cp + len;
while (cp < end) {
char ch = *cp++;
if (!XP_IS_SPACE(ch)) {
NS_RELEASE(tc);
NS_RELEASE(content);
return PR_FALSE;
}
}
}
frag++;
}
NS_RELEASE(tc);
NS_RELEASE(content);
frame->GetNextSibling(&frame);
}
return PR_TRUE;
}
void
nsBlockFrame::MarkEmptyLines(nsIPresContext* aPresContext)
{
// PRE-formatted content considers whitespace significant
const nsStyleText* text;
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) text);
if ((NS_STYLE_WHITESPACE_PRE == text->mWhiteSpace) ||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == text->mWhiteSpace)) {
return;
}
PRBool afterBlock = PR_TRUE;
nsLineBox* line = mLines;
while (nsnull != line) {
if (line->IsBlock()) {
afterBlock = PR_TRUE;
}
else if (afterBlock) {
afterBlock = PR_FALSE;
// This is an inline line and it is immediately after a block
// (or its our first line). See if it contains nothing but
// collapsible text.
PRBool isEmpty = IsEmptyLine(aPresContext, line);
line->SetIsEmptyLine(isEmpty);
}
else {
line->SetIsEmptyLine(PR_FALSE);
}
line = line->mNext;
}
}
#endif
void
nsBlockFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
@ -5609,6 +5490,40 @@ nsBlockFrame::VerifyTree() const
return NS_OK;
}
NS_IMETHODIMP
nsBlockFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
PRUint32 sum = sizeof(*this);
// Add in size of each line object
nsLineBox* line = mLines;
while (line) {
sum += sizeof(nsLineBox);
line = line->mNext;
}
line = mOverflowLines;
while (line) {
sum += sizeof(nsLineBox);
line = line->mNext;
}
// Add in text-run data
nsTextRun* runs = mTextRuns;
while (runs) {
PRUint32 runSize;
runs->SizeOf(aHandler, &runSize);
sum += runSize;
runs = runs->GetNext();
}
*aResult = sum;
return NS_OK;
}
//----------------------------------------------------------------------
NS_IMETHODIMP
@ -5643,6 +5558,7 @@ nsBlockFrame::GetFirstLetterStyle(nsIPresContext* aPresContext)
return fls;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsIStyleContext*
nsBlockFrame::GetFirstLineStyle(nsIPresContext* aPresContext)
{
@ -5652,6 +5568,7 @@ nsBlockFrame::GetFirstLineStyle(nsIPresContext* aPresContext)
mStyleContext, PR_FALSE, &fls);
return fls;
}
#endif
NS_IMETHODIMP
nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
@ -5677,6 +5594,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
NS_RELEASE(firstLetterStyle);
}
#ifdef BLOCK_DOES_FIRST_LINE
nsIStyleContext* firstLineStyle = GetFirstLineStyle(&aPresContext);
if (nsnull != firstLineStyle) {
mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE;
@ -5686,6 +5604,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
#endif
NS_RELEASE(firstLineStyle);
}
#endif
}
rv = AddFrames(&aPresContext, aChildList, nsnull);
@ -6238,9 +6157,15 @@ nsBlockFrame::VerifyLines(PRBool aFinalCheckOK)
if (line->IsBlock()) {
seenBlock = PR_TRUE;
}
if (line->IsFirstLine() || line->IsBlock()) {
#ifdef BLOCK_DOES_FIRST_LINE
if (line->IsFirstLine()) {
NS_ASSERTION(1 == line->mChildCount, "bad first line");
}
#endif
if (line->IsBlock()) {
NS_ASSERTION(1 == line->mChildCount, "bad first line");
}
#ifdef BLOCK_DOES_FIRST_LINE
if (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) {
if (seenBlock) {
NS_ASSERTION(!line->IsFirstLine(), "bad first line");
@ -6249,6 +6174,7 @@ nsBlockFrame::VerifyLines(PRBool aFinalCheckOK)
NS_ASSERTION(line->IsFirstLine(), "bad first line");
}
}
#endif
}
NS_ASSERTION(line->mChildCount < MAX_LINE_COUNT, "bad line child count");
count += line->mChildCount;

View File

@ -45,8 +45,6 @@
#include "nsITextContent.h"
#include "nsStyleChangeList.h"
// XXX for IsEmptyLine
#include "nsTextFragment.h"
#include "nsIFocusTracker.h"
#include "nsIFrameSelection.h"
@ -985,6 +983,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
}
#ifdef BLOCK_DOES_FIRST_LINE
// It is possible that we just acquired first-line style. See if
// this is the case, and if so, fix things up.
if (0 == (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState)) {
@ -1005,6 +1004,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
}
}
#endif
return rv;
}
@ -2185,7 +2185,6 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
// Setup the line-layout for the new line
aState.mCurrentLine = aLine;
aLine->ClearDirty();
aLine->SetNeedDidReflow();
// Now that we know what kind of line we have, reflow it
nsRect oldCombinedArea = aLine->mCombinedArea;
@ -2643,38 +2642,6 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState,
return PR_FALSE;
}
#if 0
const nsStyleText* styleText;
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) styleText);
if ((NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace) ||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace)) {
// Since whitespace is significant, we know that the paragraph
// is not empty (even if it has no text in it because it has
return PR_FALSE;
static PRBool
IsEmptyHTMLParagraph(nsIFrame* aFrame)
{
nsBlockFrame* bf;
if (NS_SUCCEEDED(aRS.frame->QueryInterface(kBlockFrameCID, (void**)&bf)) &&
nsBlockReflowContext::IsHTMLParagraph(aFrame)) {
if (!bf->mLines) {
// It's an html paragraph and it's empty
return PR_TRUE;
}
nsLineBox* line = bf->mLines;
while (line) {
if (!IsEmptyLine(line)) {
return PR_FALSE;
}
line = line->mNext;
}
}
return PR_FALSE;
}
#endif
nsIFrame*
nsBlockFrame::GetTopBlockChild()
{
@ -3071,6 +3038,9 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState,
availWidth, availHeight,
impactedByFloaters,
PR_FALSE /*XXX isTopOfPage*/);
// XXX Unfortunately we need to know this before reflowing the first
// inline frame in the line. FIX ME.
if ((0 == aLineLayout.GetLineNumber()) &&
(NS_BLOCK_HAS_FIRST_LETTER_STYLE & mState)) {
aLineLayout.SetFirstLetterStyleOK(PR_TRUE);
@ -3287,10 +3257,13 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
// line and don't stop the line reflow...
PRBool splitLine = !reflowingFirstLetter;
if (reflowingFirstLetter) {
#ifdef BLOCK_DOES_FIRST_LINE
if (aLine->IsFirstLine()) {
splitLine = PR_TRUE;
}
else {
else
#endif
{
nsIAtom* frameType;
if (NS_SUCCEEDED(aFrame->GetFrameType(&frameType)) && frameType) {
if (frameType == nsLayoutAtoms::inlineFrame) {
@ -3391,7 +3364,9 @@ nsBlockFrame::SplitLine(nsBlockReflowState& aState,
aLine->mNext = to;
}
to->SetIsBlock(aLine->IsBlock());
#ifdef BLOCK_DOES_FIRST_LINE
to->SetIsFirstLine(aLine->IsFirstLine());
#endif
aLine->mChildCount -= pushCount;
// Let line layout know that some frames are no longer part of its
@ -3656,20 +3631,6 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState,
aLine->mMaxElementWidth = aMaxElementSize.width;
}
#if XXX_need_line_outside_children
// Compute LINE_OUTSIDE_CHILDREN state for this line. The bit is set
// if any child frame has outside children.
if ((aLine->mCombinedArea.x < aLine->mBounds.x) ||
(aLine->mCombinedArea.XMost() > aLine->mBounds.XMost()) ||
(aLine->mCombinedArea.y < aLine->mBounds.y) ||
(aLine->mCombinedArea.YMost() > aLine->mBounds.YMost())) {
aLine->SetOutsideChildren();
}
else {
aLine->ClearOutsideChildren();
}
#endif
// Update xmost
nscoord xmost = aLine->mBounds.XMost();
if (xmost > aState.mKidXMost) {
@ -3847,6 +3808,7 @@ nsBlockFrame::LastChild()
return nsnull;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::WrapFramesInFirstLineFrame(nsIPresContext* aPresContext)
{
@ -3938,6 +3900,7 @@ nsBlockFrame::WrapFramesInFirstLineFrame(nsIPresContext* aPresContext)
return rv;
}
#endif
NS_IMETHODIMP
nsBlockFrame::AppendFrames(nsIPresContext& aPresContext,
@ -3963,12 +3926,14 @@ nsBlockFrame::AppendFrames(nsIPresContext& aPresContext,
nsLineBox* lastLine = nsLineBox::LastLine(mLines);
if (lastLine) {
lastKid = lastLine->LastChild();
#ifdef BLOCK_DOES_FIRST_LINE
if (lastLine->IsFirstLine()) {
// Get last frame in the nsFirstLineFrame
lastKid->FirstChild(nsnull, &lastKid);
nsFrameList frames(lastKid);
lastKid = frames.LastChild();
}
#endif
}
// Add frames after the last child
@ -4058,6 +4023,7 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
nsLineBox* prevSibLine = nsnull;
PRInt32 prevSiblingIndex = -1;
if (aPrevSibling) {
#ifdef BLOCK_DOES_FIRST_LINE
// Its possible we have an nsFirstLineFrame managing some of our
// child frames. If we do and the AddFrames is targetted at it,
// use AddFirstLineFrames to get the frames properly placed.
@ -4079,7 +4045,9 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
(nsFirstLineFrame*)prevSiblingParent,
aFrameList, aPrevSibling);
}
else {
else
#endif
{
// Find the line that contains the previous sibling
prevSibLine = nsLineBox::FindLineContaining(mLines, aPrevSibling,
&prevSiblingIndex);
@ -4091,12 +4059,14 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
}
}
}
#ifdef BLOCK_DOES_FIRST_LINE
else if (mLines && mLines->IsFirstLine()) {
mLines->MarkDirty();
return AddFirstLineFrames(aPresContext,
(nsFirstLineFrame*)mLines->mFirstChild,
aFrameList, nsnull);
}
#endif
// Find the frame following aPrevSibling so that we can join up the
// two lists of frames.
@ -4168,20 +4138,22 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
aPrevSibling->SetNextSibling(prevSiblingNextFrame);
}
#ifdef BLOCK_DOES_FIRST_LINE
// Fixup any frames that should be in a first-line frame but aren't
if ((NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) &&
(nsnull != mLines) && !mLines->IsBlock()) {
// We just added one or more frame(s) to the first line.
WrapFramesInFirstLineFrame(aPresContext);
}
#endif
#ifdef DEBUG
VerifyLines(PR_TRUE);
#endif
MarkEmptyLines(aPresContext);
return NS_OK;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::AddFirstLineFrames(nsIPresContext* aPresContext,
nsFirstLineFrame* aLineFrame,
@ -4310,6 +4282,7 @@ nsBlockFrame::TakeKidsFromLineFrame(nsFirstLineFrame* aLineFrame,
return kids.FirstChild();
}
#endif
void
nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame)
@ -4404,12 +4377,14 @@ nsresult
nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
nsIFrame* aDeletedFrame)
{
#ifdef BLOCK_DOES_FIRST_LINE
nsIFrame* parent;
aDeletedFrame->GetParent(&parent);
if (parent != this) {
return RemoveFirstLineFrame(aPresContext, (nsFirstLineFrame*)parent,
aDeletedFrame);
}
#endif
// Find the line and the previous sibling that contains
// deletedFrame; we also find the pointer to the line.
@ -4446,6 +4421,9 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
while (nsnull != aDeletedFrame) {
while ((nsnull != line) && (nsnull != aDeletedFrame)) {
#ifdef NS_DEBUG
#ifndef BLOCK_DOES_FIRST_LINE
nsIFrame* parent;
#endif
aDeletedFrame->GetParent(&parent);
NS_ASSERTION(flow == parent, "messed up delete code");
NS_ASSERTION(line->Contains(aDeletedFrame), "frame not in line");
@ -4547,6 +4525,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
}
}
#ifdef BLOCK_DOES_FIRST_LINE
// Fixup any frames that should be in a first-line frame but aren't
if ((NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) &&
(nsnull != mLines) && !mLines->IsBlock()) {
@ -4554,14 +4533,15 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
// removed a block that preceeded the first line.
WrapFramesInFirstLineFrame(aPresContext);
}
#endif
#ifdef DEBUG
VerifyLines(PR_TRUE);
#endif
MarkEmptyLines(aPresContext);
return NS_OK;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::RemoveFirstLineFrame(nsIPresContext* aPresContext,
nsFirstLineFrame* aLineFrame,
@ -4596,106 +4576,7 @@ nsBlockFrame::RemoveFirstLineFrame(nsIPresContext* aPresContext,
}
return NS_OK;
}
static PRBool
IsEmptyLine(nsIPresContext* aPresContext, nsLineBox* aLine)
{
PRInt32 i, n = aLine->ChildCount();
nsIFrame* frame = aLine->mFirstChild;
for (i = 0; i < n; i++) {
nsIContent* content;
nsresult rv = frame->GetContent(&content);
if (NS_FAILED(rv) || (nsnull == content)) {
// If it doesn't have any content then this can't be an empty line
return PR_FALSE;
}
nsITextContent* tc;
rv = content->QueryInterface(kITextContentIID, (void**) &tc);
if (NS_FAILED(rv) || (nsnull == tc)) {
// If it's not text content then this can't be an empty line
NS_RELEASE(content);
return PR_FALSE;
}
const nsTextFragment* frag;
PRInt32 numFrags;
rv = tc->GetText(frag, numFrags);
if (NS_FAILED(rv)) {
NS_RELEASE(content);
NS_RELEASE(tc);
return PR_FALSE;
}
// If the text has any non-whitespace characters in it then the
// line is not an empty line.
while (--numFrags >= 0) {
PRInt32 len = frag->GetLength();
if (frag->Is2b()) {
const PRUnichar* cp = frag->Get2b();
const PRUnichar* end = cp + len;
while (cp < end) {
PRUnichar ch = *cp++;
if (!XP_IS_SPACE(ch)) {
NS_RELEASE(tc);
NS_RELEASE(content);
return PR_FALSE;
}
}
}
else {
const char* cp = frag->Get1b();
const char* end = cp + len;
while (cp < end) {
char ch = *cp++;
if (!XP_IS_SPACE(ch)) {
NS_RELEASE(tc);
NS_RELEASE(content);
return PR_FALSE;
}
}
}
frag++;
}
NS_RELEASE(tc);
NS_RELEASE(content);
frame->GetNextSibling(&frame);
}
return PR_TRUE;
}
void
nsBlockFrame::MarkEmptyLines(nsIPresContext* aPresContext)
{
// PRE-formatted content considers whitespace significant
const nsStyleText* text;
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) text);
if ((NS_STYLE_WHITESPACE_PRE == text->mWhiteSpace) ||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == text->mWhiteSpace)) {
return;
}
PRBool afterBlock = PR_TRUE;
nsLineBox* line = mLines;
while (nsnull != line) {
if (line->IsBlock()) {
afterBlock = PR_TRUE;
}
else if (afterBlock) {
afterBlock = PR_FALSE;
// This is an inline line and it is immediately after a block
// (or its our first line). See if it contains nothing but
// collapsible text.
PRBool isEmpty = IsEmptyLine(aPresContext, line);
line->SetIsEmptyLine(isEmpty);
}
else {
line->SetIsEmptyLine(PR_FALSE);
}
line = line->mNext;
}
}
#endif
void
nsBlockFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
@ -5609,6 +5490,40 @@ nsBlockFrame::VerifyTree() const
return NS_OK;
}
NS_IMETHODIMP
nsBlockFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
PRUint32 sum = sizeof(*this);
// Add in size of each line object
nsLineBox* line = mLines;
while (line) {
sum += sizeof(nsLineBox);
line = line->mNext;
}
line = mOverflowLines;
while (line) {
sum += sizeof(nsLineBox);
line = line->mNext;
}
// Add in text-run data
nsTextRun* runs = mTextRuns;
while (runs) {
PRUint32 runSize;
runs->SizeOf(aHandler, &runSize);
sum += runSize;
runs = runs->GetNext();
}
*aResult = sum;
return NS_OK;
}
//----------------------------------------------------------------------
NS_IMETHODIMP
@ -5643,6 +5558,7 @@ nsBlockFrame::GetFirstLetterStyle(nsIPresContext* aPresContext)
return fls;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsIStyleContext*
nsBlockFrame::GetFirstLineStyle(nsIPresContext* aPresContext)
{
@ -5652,6 +5568,7 @@ nsBlockFrame::GetFirstLineStyle(nsIPresContext* aPresContext)
mStyleContext, PR_FALSE, &fls);
return fls;
}
#endif
NS_IMETHODIMP
nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
@ -5677,6 +5594,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
NS_RELEASE(firstLetterStyle);
}
#ifdef BLOCK_DOES_FIRST_LINE
nsIStyleContext* firstLineStyle = GetFirstLineStyle(&aPresContext);
if (nsnull != firstLineStyle) {
mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE;
@ -5686,6 +5604,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
#endif
NS_RELEASE(firstLineStyle);
}
#endif
}
rv = AddFrames(&aPresContext, aChildList, nsnull);
@ -6238,9 +6157,15 @@ nsBlockFrame::VerifyLines(PRBool aFinalCheckOK)
if (line->IsBlock()) {
seenBlock = PR_TRUE;
}
if (line->IsFirstLine() || line->IsBlock()) {
#ifdef BLOCK_DOES_FIRST_LINE
if (line->IsFirstLine()) {
NS_ASSERTION(1 == line->mChildCount, "bad first line");
}
#endif
if (line->IsBlock()) {
NS_ASSERTION(1 == line->mChildCount, "bad first line");
}
#ifdef BLOCK_DOES_FIRST_LINE
if (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) {
if (seenBlock) {
NS_ASSERTION(!line->IsFirstLine(), "bad first line");
@ -6249,6 +6174,7 @@ nsBlockFrame::VerifyLines(PRBool aFinalCheckOK)
NS_ASSERTION(line->IsFirstLine(), "bad first line");
}
}
#endif
}
NS_ASSERTION(line->mChildCount < MAX_LINE_COUNT, "bad line child count");
count += line->mChildCount;

View File

@ -667,3 +667,13 @@ nsContainerFrame::List(FILE* out, PRInt32 aIndent) const
return NS_OK;
}
NS_IMETHODIMP
nsContainerFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
*aResult = sizeof(*this);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -50,6 +50,7 @@ public:
nsIFrame* aOldFrame,
nsIFrame* aNewFrame);
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
// nsIHTMLReflow overrides
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,

View File

@ -205,6 +205,15 @@ nsFirstLetterFrame::Reflow(nsIPresContext& aPresContext,
ll.EndLineReflow();
}
else {
// XXX currently the block code sets this up; see comment in
// ReflowInlineFrames
#if XXX
// Only the first-in-flow frame of a first-letter frame gets the
// special first-letter reflow treatment.
if (!mPrevInFlow) {
rs.mLineLayout->SetFirstLetterStyleOK(PR_TRUE);
}
#endif
htmlReflow->Reflow(aPresContext, aMetrics, rs, aReflowStatus);
}

View File

@ -1586,6 +1586,16 @@ nsFrame::DumpBaseRegressionData(FILE* out, PRInt32 aIndent)
} while (nsnull != list);
}
NS_IMETHODIMP
nsFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
*aResult = sizeof(*this);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP
nsFrame::VerifyTree() const
{

View File

@ -223,6 +223,7 @@ public:
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD DumpRegressionData(FILE* out, PRInt32 aIndent);
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
NS_IMETHOD VerifyTree() const;
NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread);
NS_IMETHOD GetSelected(PRBool *aSelected) const;

View File

@ -89,6 +89,7 @@ public:
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
// XXX Temporary hack...
NS_IMETHOD SetRect(const nsRect& aRect);
@ -450,3 +451,13 @@ RootFrame::GetFrameName(nsString& aResult) const
{
return MakeFrameName("Root", aResult);
}
NS_IMETHODIMP
RootFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
*aResult = sizeof(*this);
return NS_OK;
}

View File

@ -31,6 +31,7 @@ class nsIFrame;
class nsIPresContext;
class nsIPresShell;
class nsIRenderingContext;
class nsISizeOfHandler;
class nsISpaceManager;
class nsIStyleContext;
class nsIView;
@ -588,7 +589,7 @@ public:
* called when the frame has been scrolled to a new
* position. only called for frames with views.
*/
NS_IMETHOD Scrolled(nsIView *aView) = 0;
NS_IMETHOD Scrolled(nsIView *aView) = 0;
// Debugging
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const = 0;
@ -608,6 +609,23 @@ public:
*/
NS_IMETHOD DumpRegressionData(FILE* out, PRInt32 aIndent) = 0;
/**
* Get the size of the frame object. The size value should include
* all subordinate data referenced by the frame that is not
* accounted for by child frames. However, this value should not
* include the content objects, style contexts, views or other data
* that lies logically outside the frame system.
*
* If the implementation so chooses, instead of returning the total
* subordinate data it may instead use the sizeof handler to store
* away subordinate data under its own key so that the subordinate
* data may be tabulated independently of the frame itself.
*
* The caller is responsible for recursing over all child-lists that
* the frame supports.
*/
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0;
NS_IMETHOD VerifyTree() const = 0;
/** Selection related calls

View File

@ -55,6 +55,7 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#include "nsTextFragment.h"
#include "nsIDOMHTMLMapElement.h"
#include "nsIStyleSet.h"
#include "nsLayoutAtoms.h"
#ifdef DEBUG
#undef NOISY_IMAGE_LOADING
@ -859,3 +860,26 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext,
return NS_OK;
}
NS_IMETHODIMP
nsImageFrame::GetFrameType(nsIAtom** aType) const
{
NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer");
*aType = nsLayoutAtoms::imageFrame;
NS_ADDREF(*aType);
return NS_OK;
}
// Note: this doesn't factor in:
// -- the mImageMap (it might be shared)
NS_IMETHODIMP
nsImageFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
PRUint32 sum = sizeof(*this) - sizeof(mImageLoader) +
mImageLoader.GetDataSize();
*aResult = sum;
return NS_OK;
}

View File

@ -59,6 +59,8 @@ public:
nsIContent* aChild,
nsIAtom* aAttribute,
PRInt32 aHint);
NS_IMETHOD GetFrameType(nsIAtom** aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
protected:
virtual ~nsImageFrame();

View File

@ -78,7 +78,7 @@ public:
const nsString& GetAltText() const { return mAltText; }
PRBool GetSuppress() const { return mSuppressFeedback; }
virtual void SizeOf(nsISizeOfHandler* aHandler) const;
virtual void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
nsString mBase;
nsString mHREF;
@ -106,15 +106,18 @@ Area::~Area()
}
void
Area::SizeOf(nsISizeOfHandler* aHandler) const
Area::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
aHandler->Add(sizeof(*this));
aHandler->Add((size_t) (- ((PRInt32)sizeof(nsString) * 4) ) );
mBase.SizeOf(aHandler);
mHREF.SizeOf(aHandler);
mTarget.SizeOf(aHandler);
mAltText.SizeOf(aHandler);
aHandler->Add(mNumCoords * sizeof(nscoord));
if (aResult) {
PRUint32 sum = sizeof(*this);
PRUint32 s;
mBase.SizeOf(aHandler, &s); sum += s;
mHREF.SizeOf(aHandler, &s); sum += s;
mTarget.SizeOf(aHandler, &s); sum += s;
mAltText.SizeOf(aHandler, &s); sum += s;
sum += mNumCoords * sizeof(nscoord);
*aResult = sum;
}
}
#include <stdlib.h>
@ -1132,3 +1135,19 @@ nsImageMap::DocumentWillBeDestroyed(nsIDocument *aDocument)
{
return NS_OK;
}
void
nsImageMap::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
PRUint32 sum = sizeof(*this);
PRInt32 i, n = mAreas.Count();
for (i = 0; i < n; i++) {
Area* area = (Area*) mAreas.ElementAt(i);
PRUint32 areaSize;
area->SizeOf(aHandler, &areaSize);
sum += areaSize;
}
*aResult = sum;
}
}

View File

@ -62,6 +62,8 @@ public:
void Draw(nsIPresContext& aCX, nsIRenderingContext& aRC);
void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
// nsISupports
NS_DECL_ISUPPORTS

View File

@ -1240,6 +1240,20 @@ nsInlineFrame::Reflow(nsIPresContext& aPresContext,
}
DrainOverflow(&aPresContext);
if (IsFrameTreeTooDeep(aReflowState, aMetrics)) {
#ifdef DEBUG_kipp
{
extern char* nsPresShell_ReflowStackPointerTop;
char marker;
char* newsp = (char*) &marker;
printf("XXX: frame tree is too deep; approx stack size = %d\n",
nsPresShell_ReflowStackPointerTop - newsp);
}
#endif
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
}
// Set our own reflow state (additional state above and beyond
// aReflowState)
InlineReflowState irs;
@ -1472,6 +1486,7 @@ nsInlineFrame::ReflowInlineFrames(nsIPresContext* aPresContext,
aMetrics.height += aReflowState.mComputedBorderPadding.top +
aReflowState.mComputedBorderPadding.bottom;
#ifdef DEBUG_kipp
// Note: we use the actual font height for sizing our selves
// instead of the computed font height. On systems where they
// disagree the actual font height is more appropriate. This
@ -1484,6 +1499,7 @@ nsInlineFrame::ReflowInlineFrames(nsIPresContext* aPresContext,
if (getenv("GECKO_USE_COMPUTED_HEIGHT")) {
useComputedHeight = PR_TRUE;
}
firstTime = 0;
}
#endif
if (useComputedHeight) {
@ -1505,6 +1521,7 @@ nsInlineFrame::ReflowInlineFrames(nsIPresContext* aPresContext,
aMetrics.height = computedHeight;
}
}
#endif /* DEBUG_kipp */
NS_RELEASE(fm);
}
@ -1892,8 +1909,16 @@ nsFirstLineFrame::AppendFrames(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aFrameList)
{
#ifdef BLOCK_DOES_FIRST_LINE
return mParent->AppendFrames(aPresContext, aPresShell, aListName,
aFrameList);
#else
nsresult rv = nsInlineFrame::AppendFrames(aPresContext, aPresShell,
aListName, aFrameList);
// nsFrameList frames(aFrameList);
// ReResolveChildList(&aPresContext, mStyleContext, frames);
return rv;
#endif
}
NS_IMETHODIMP
@ -1903,8 +1928,16 @@ nsFirstLineFrame::InsertFrames(nsIPresContext& aPresContext,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList)
{
#ifdef BLOCK_DOES_FIRST_LINE
return mParent->InsertFrames(aPresContext, aPresShell, aListName,
aPrevFrame, aFrameList);
#else
nsresult rv = nsInlineFrame::InsertFrames(aPresContext, aPresShell,
aListName, aPrevFrame, aFrameList);
// nsFrameList frames(aFrameList);
// ReResolveChildList(&aPresContext, mStyleContext, frames);
return rv;
#endif
}
NS_IMETHODIMP
@ -1913,10 +1946,17 @@ nsFirstLineFrame::RemoveFrame(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aOldFrame)
{
#ifdef BLOCK_DOES_FIRST_LINE
return mParent->RemoveFrame(aPresContext, aPresShell, aListName,
aOldFrame);
#else
nsresult rv = nsInlineFrame::RemoveFrame(aPresContext, aPresShell,
aListName, aOldFrame);
return rv;
#endif
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsFirstLineFrame::AppendFrames2(nsIPresContext* aPresContext,
nsIFrame* aFrameList)
@ -1952,9 +1992,10 @@ nsFirstLineFrame::RemoveFrame2(nsIPresContext* aPresContext,
mFrames.RemoveFrame(aOldFrame);
return NS_OK;
}
#endif
void
nsFirstLineFrame::RemoveFramesFrom(nsIFrame* aFrame)
nsFirstLineFrame::StealFramesFrom(nsIFrame* aFrame)
{
nsIFrame* prevFrame = mFrames.GetPrevSiblingFor(aFrame);
if (prevFrame) {
@ -2138,3 +2179,14 @@ nsFirstLineFrame::Reflow(nsIPresContext& aPresContext,
return rv;
}
NS_IMETHODIMP
nsPositionedInlineFrame::SizeOf(nsISizeOfHandler* aHandler,
PRUint32* aResult) const
{
if (aResult) {
*aResult = sizeof(*this);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -192,8 +192,10 @@ public:
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
#ifdef BLOCK_DOES_FIRST_LINE
// AppendFrames/InsertFrames/RemoveFrame are implemented to forward
// the method call to the parent frame.
#endif
NS_IMETHOD AppendFrames(nsIPresContext& aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
@ -208,6 +210,7 @@ public:
nsIAtom* aListName,
nsIFrame* aOldFrame);
#ifdef BLOCK_DOES_FIRST_LINE
// These methods are used by the parent frame to actually modify the
// child frames of the line frame. These methods do not generate
// reflow commands.
@ -221,9 +224,14 @@ public:
nsresult RemoveFrame2(nsIPresContext* aPresContext,
nsIFrame* aOldFrame);
void RemoveFramesFrom(nsIFrame* aFrame);
#endif
// Take frames starting at aFrame until the end of the frame-list
// away from this frame. The caller is presumed to keep them alive.
void StealFramesFrom(nsIFrame* aFrame);
void RemoveAllFrames() {
// Take all of the frames away from this frame. The caller is
// presumed to keep them alive.
void StealAllFrames() {
mFrames.SetFrames(nsnull);
}
@ -250,6 +258,7 @@ class nsPositionedInlineFrame : public nsInlineFrame
{
public:
NS_IMETHOD Destroy(nsIPresContext& aPresContext);
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,

View File

@ -126,3 +126,13 @@ nsLeafFrame::ContentChanged(nsIPresContext* aPresContext,
return rv;
}
NS_IMETHODIMP
nsLeafFrame::SizeOf(nsISizeOfHandler* aHandler,
PRUint32* aResult) const
{
if (aResult) {
*aResult = sizeof(*this);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -41,6 +41,7 @@ public:
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent);
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
protected:
virtual ~nsLeafFrame();

View File

@ -26,7 +26,7 @@ nsLineBox::nsLineBox(nsIFrame* aFrame, PRInt32 aCount, PRUint16 flags)
{
mFirstChild = aFrame;
mChildCount = aCount;
mState = LINE_IS_DIRTY | LINE_NEED_DID_REFLOW | flags;
mState = LINE_IS_DIRTY | flags;
mFloaters = nsnull;
mNext = nsnull;
mBounds.SetRect(0,0,0,0);

View File

@ -23,16 +23,13 @@
#include "nsPlaceholderFrame.h"
#include "nsILineIterator.h"
// bits in nsLineBox.mFlags
// bits in nsLineBox.mState
#define LINE_IS_DIRTY 0x1
#define LINE_IS_BLOCK 0x2
#define LINE_WAS_DIRTY 0x4
#define LINE_NEED_DID_REFLOW 0x8
#define LINE_TOP_MARGIN_IS_AUTO 0x10
#define LINE_BOTTOM_MARGIN_IS_AUTO 0x20
#define LINE_OUTSIDE_CHILDREN 0x40
#define LINE_ISA_EMPTY_LINE 0x80
#define LINE_IS_FIRST_LINE 0x100
#ifdef BLOCK_DOES_FIRST_LINE
#define LINE_IS_FIRST_LINE 0x4
#endif
#define LINE_WAS_DIRTY 0x8
class nsISpaceManager;
class nsLineBox;
@ -51,17 +48,6 @@ public:
nscoord GetHeight() const { return mBounds.height; }
PRBool IsEmptyLine() const {
return 0 != (mState & LINE_ISA_EMPTY_LINE);
}
void SetIsEmptyLine(PRBool aSetting) {
if (aSetting)
mState |= aSetting;
else
mState &= ~aSetting;
}
//----------------------------------------------------------------------
// XXX old junk
nsLineBox(nsIFrame* aFrame, PRInt32 aCount, PRUint16 flags);
@ -106,6 +92,7 @@ public:
}
}
#ifdef BLOCK_DOES_FIRST_LINE
PRBool IsFirstLine() const {
return 0 != (LINE_IS_FIRST_LINE & mState);
}
@ -118,6 +105,7 @@ public:
mState &= ~LINE_IS_FIRST_LINE;
}
}
#endif
void MarkDirty() {
mState |= LINE_IS_DIRTY;
@ -143,34 +131,6 @@ public:
return 0 != (LINE_WAS_DIRTY & mState);
}
void SetNeedDidReflow() {
mState |= LINE_NEED_DID_REFLOW;
}
void ClearNeedDidReflow() {
mState &= ~LINE_NEED_DID_REFLOW;
}
PRBool NeedsDidReflow() {
return 0 != (LINE_NEED_DID_REFLOW & mState);
}
#ifdef XXX_need_line_outside_children
void SetOutsideChildren() {
mState |= LINE_OUTSIDE_CHILDREN;
}
void ClearOutsideChildren() {
mState &= ~LINE_OUTSIDE_CHILDREN;
}
PRBool OutsideChildren() const {
return 0 != (LINE_OUTSIDE_CHILDREN & mState);
}
#endif
PRUint16 GetState() const { return mState; }
char* StateToString(char* aBuf, PRInt32 aBufSize) const;
PRInt32 IndexOf(nsIFrame* aFrame) const;
@ -185,7 +145,7 @@ public:
nsIFrame* mFirstChild;
PRUint16 mChildCount;
PRUint16 mState;
PRUint8 mState;
PRUint8 mBreakType;
nsRect mBounds;
nsRect mCombinedArea;

View File

@ -806,7 +806,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// the state out. We need to know how to treat the current frame
// when breaking.
PRBool notSafeToBreak = CanPlaceFloaterNow() || InWord();
//XXX PRBool firstLetterOK = mFirstLetterStyleOK;
// Apply left margins (as appropriate) to the frame computing the
// new starting x,y coordinates for the frame.
@ -979,8 +978,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
parent->DeleteChildsNextInFlow(mPresContext, aFrame);
}
}
//XXX if (firstLetterOK && !mFirstLetterStyleOK) {
//XXX }
// See if we can place the frame. If we can't fit it, then we
// return now.

View File

@ -113,3 +113,13 @@ nsPlaceholderFrame::List(FILE* out, PRInt32 aIndent) const
fputs("\n", out);
return NS_OK;
}
NS_IMETHODIMP
nsPlaceholderFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
*aResult = sizeof(*this);
return NS_OK;
}

View File

@ -56,6 +56,7 @@ public:
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
protected:
nsIFrame* mOutOfFlowFrame;

View File

@ -193,4 +193,15 @@ nsSplittableFrame::DumpBaseRegressionData(FILE* out, PRInt32 aIndent)
IndentBy(out, aIndent);
fprintf(out, "<prev-in-flow va=\"%ld\"/>\n", PRUptrdiff(mPrevInFlow));
}
}
NS_IMETHODIMP
nsSplittableFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
*aResult = sizeof(*this);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -31,6 +31,7 @@ public:
nsIFrame* aPrevInFlow);
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
// Flow member functions.
NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const;

View File

@ -227,6 +227,8 @@ public:
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
NS_IMETHOD GetPosition(nsIPresContext& aCX,
nscoord aXCoord,
nsIContent ** aNewContent,
@ -3072,6 +3074,16 @@ nsTextFrame::GetFrameType(nsIAtom** aType) const
return NS_OK;
}
NS_IMETHODIMP
nsTextFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
*aResult = sizeof(*this);
return NS_OK;
}
NS_IMETHODIMP
nsTextFrame::GetFrameName(nsString& aResult) const
{

View File

@ -83,6 +83,7 @@ public:
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
protected:
nsresult IncrementalReflow(nsIPresContext& aPresContext,
@ -571,3 +572,13 @@ ViewportFrame::GetFrameName(nsString& aResult) const
{
return MakeFrameName("Viewport", aResult);
}
NS_IMETHODIMP
ViewportFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
*aResult = sizeof(*this);
return NS_OK;
}

View File

@ -451,3 +451,14 @@ nsAreaFrame::GetFrameName(nsString& aResult) const
{
return MakeFrameName("Area", aResult);
}
NS_IMETHODIMP
nsAreaFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
nsBlockFrame::SizeOf(aHandler, aResult);
*aResult += sizeof(*this) - sizeof(nsBlockFrame);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -104,6 +104,8 @@ public:
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
// nsIAreaFrame
NS_IMETHOD GetPositionedInfo(nscoord& aXMost, nscoord& aYMost) const;

View File

@ -45,8 +45,6 @@
#include "nsITextContent.h"
#include "nsStyleChangeList.h"
// XXX for IsEmptyLine
#include "nsTextFragment.h"
#include "nsIFocusTracker.h"
#include "nsIFrameSelection.h"
@ -985,6 +983,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
}
#ifdef BLOCK_DOES_FIRST_LINE
// It is possible that we just acquired first-line style. See if
// this is the case, and if so, fix things up.
if (0 == (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState)) {
@ -1005,6 +1004,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
}
}
#endif
return rv;
}
@ -2185,7 +2185,6 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
// Setup the line-layout for the new line
aState.mCurrentLine = aLine;
aLine->ClearDirty();
aLine->SetNeedDidReflow();
// Now that we know what kind of line we have, reflow it
nsRect oldCombinedArea = aLine->mCombinedArea;
@ -2643,38 +2642,6 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState,
return PR_FALSE;
}
#if 0
const nsStyleText* styleText;
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) styleText);
if ((NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace) ||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace)) {
// Since whitespace is significant, we know that the paragraph
// is not empty (even if it has no text in it because it has
return PR_FALSE;
static PRBool
IsEmptyHTMLParagraph(nsIFrame* aFrame)
{
nsBlockFrame* bf;
if (NS_SUCCEEDED(aRS.frame->QueryInterface(kBlockFrameCID, (void**)&bf)) &&
nsBlockReflowContext::IsHTMLParagraph(aFrame)) {
if (!bf->mLines) {
// It's an html paragraph and it's empty
return PR_TRUE;
}
nsLineBox* line = bf->mLines;
while (line) {
if (!IsEmptyLine(line)) {
return PR_FALSE;
}
line = line->mNext;
}
}
return PR_FALSE;
}
#endif
nsIFrame*
nsBlockFrame::GetTopBlockChild()
{
@ -3071,6 +3038,9 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState,
availWidth, availHeight,
impactedByFloaters,
PR_FALSE /*XXX isTopOfPage*/);
// XXX Unfortunately we need to know this before reflowing the first
// inline frame in the line. FIX ME.
if ((0 == aLineLayout.GetLineNumber()) &&
(NS_BLOCK_HAS_FIRST_LETTER_STYLE & mState)) {
aLineLayout.SetFirstLetterStyleOK(PR_TRUE);
@ -3287,10 +3257,13 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
// line and don't stop the line reflow...
PRBool splitLine = !reflowingFirstLetter;
if (reflowingFirstLetter) {
#ifdef BLOCK_DOES_FIRST_LINE
if (aLine->IsFirstLine()) {
splitLine = PR_TRUE;
}
else {
else
#endif
{
nsIAtom* frameType;
if (NS_SUCCEEDED(aFrame->GetFrameType(&frameType)) && frameType) {
if (frameType == nsLayoutAtoms::inlineFrame) {
@ -3391,7 +3364,9 @@ nsBlockFrame::SplitLine(nsBlockReflowState& aState,
aLine->mNext = to;
}
to->SetIsBlock(aLine->IsBlock());
#ifdef BLOCK_DOES_FIRST_LINE
to->SetIsFirstLine(aLine->IsFirstLine());
#endif
aLine->mChildCount -= pushCount;
// Let line layout know that some frames are no longer part of its
@ -3656,20 +3631,6 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState,
aLine->mMaxElementWidth = aMaxElementSize.width;
}
#if XXX_need_line_outside_children
// Compute LINE_OUTSIDE_CHILDREN state for this line. The bit is set
// if any child frame has outside children.
if ((aLine->mCombinedArea.x < aLine->mBounds.x) ||
(aLine->mCombinedArea.XMost() > aLine->mBounds.XMost()) ||
(aLine->mCombinedArea.y < aLine->mBounds.y) ||
(aLine->mCombinedArea.YMost() > aLine->mBounds.YMost())) {
aLine->SetOutsideChildren();
}
else {
aLine->ClearOutsideChildren();
}
#endif
// Update xmost
nscoord xmost = aLine->mBounds.XMost();
if (xmost > aState.mKidXMost) {
@ -3847,6 +3808,7 @@ nsBlockFrame::LastChild()
return nsnull;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::WrapFramesInFirstLineFrame(nsIPresContext* aPresContext)
{
@ -3938,6 +3900,7 @@ nsBlockFrame::WrapFramesInFirstLineFrame(nsIPresContext* aPresContext)
return rv;
}
#endif
NS_IMETHODIMP
nsBlockFrame::AppendFrames(nsIPresContext& aPresContext,
@ -3963,12 +3926,14 @@ nsBlockFrame::AppendFrames(nsIPresContext& aPresContext,
nsLineBox* lastLine = nsLineBox::LastLine(mLines);
if (lastLine) {
lastKid = lastLine->LastChild();
#ifdef BLOCK_DOES_FIRST_LINE
if (lastLine->IsFirstLine()) {
// Get last frame in the nsFirstLineFrame
lastKid->FirstChild(nsnull, &lastKid);
nsFrameList frames(lastKid);
lastKid = frames.LastChild();
}
#endif
}
// Add frames after the last child
@ -4058,6 +4023,7 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
nsLineBox* prevSibLine = nsnull;
PRInt32 prevSiblingIndex = -1;
if (aPrevSibling) {
#ifdef BLOCK_DOES_FIRST_LINE
// Its possible we have an nsFirstLineFrame managing some of our
// child frames. If we do and the AddFrames is targetted at it,
// use AddFirstLineFrames to get the frames properly placed.
@ -4079,7 +4045,9 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
(nsFirstLineFrame*)prevSiblingParent,
aFrameList, aPrevSibling);
}
else {
else
#endif
{
// Find the line that contains the previous sibling
prevSibLine = nsLineBox::FindLineContaining(mLines, aPrevSibling,
&prevSiblingIndex);
@ -4091,12 +4059,14 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
}
}
}
#ifdef BLOCK_DOES_FIRST_LINE
else if (mLines && mLines->IsFirstLine()) {
mLines->MarkDirty();
return AddFirstLineFrames(aPresContext,
(nsFirstLineFrame*)mLines->mFirstChild,
aFrameList, nsnull);
}
#endif
// Find the frame following aPrevSibling so that we can join up the
// two lists of frames.
@ -4168,20 +4138,22 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
aPrevSibling->SetNextSibling(prevSiblingNextFrame);
}
#ifdef BLOCK_DOES_FIRST_LINE
// Fixup any frames that should be in a first-line frame but aren't
if ((NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) &&
(nsnull != mLines) && !mLines->IsBlock()) {
// We just added one or more frame(s) to the first line.
WrapFramesInFirstLineFrame(aPresContext);
}
#endif
#ifdef DEBUG
VerifyLines(PR_TRUE);
#endif
MarkEmptyLines(aPresContext);
return NS_OK;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::AddFirstLineFrames(nsIPresContext* aPresContext,
nsFirstLineFrame* aLineFrame,
@ -4310,6 +4282,7 @@ nsBlockFrame::TakeKidsFromLineFrame(nsFirstLineFrame* aLineFrame,
return kids.FirstChild();
}
#endif
void
nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame)
@ -4404,12 +4377,14 @@ nsresult
nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
nsIFrame* aDeletedFrame)
{
#ifdef BLOCK_DOES_FIRST_LINE
nsIFrame* parent;
aDeletedFrame->GetParent(&parent);
if (parent != this) {
return RemoveFirstLineFrame(aPresContext, (nsFirstLineFrame*)parent,
aDeletedFrame);
}
#endif
// Find the line and the previous sibling that contains
// deletedFrame; we also find the pointer to the line.
@ -4446,6 +4421,9 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
while (nsnull != aDeletedFrame) {
while ((nsnull != line) && (nsnull != aDeletedFrame)) {
#ifdef NS_DEBUG
#ifndef BLOCK_DOES_FIRST_LINE
nsIFrame* parent;
#endif
aDeletedFrame->GetParent(&parent);
NS_ASSERTION(flow == parent, "messed up delete code");
NS_ASSERTION(line->Contains(aDeletedFrame), "frame not in line");
@ -4547,6 +4525,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
}
}
#ifdef BLOCK_DOES_FIRST_LINE
// Fixup any frames that should be in a first-line frame but aren't
if ((NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) &&
(nsnull != mLines) && !mLines->IsBlock()) {
@ -4554,14 +4533,15 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
// removed a block that preceeded the first line.
WrapFramesInFirstLineFrame(aPresContext);
}
#endif
#ifdef DEBUG
VerifyLines(PR_TRUE);
#endif
MarkEmptyLines(aPresContext);
return NS_OK;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::RemoveFirstLineFrame(nsIPresContext* aPresContext,
nsFirstLineFrame* aLineFrame,
@ -4596,106 +4576,7 @@ nsBlockFrame::RemoveFirstLineFrame(nsIPresContext* aPresContext,
}
return NS_OK;
}
static PRBool
IsEmptyLine(nsIPresContext* aPresContext, nsLineBox* aLine)
{
PRInt32 i, n = aLine->ChildCount();
nsIFrame* frame = aLine->mFirstChild;
for (i = 0; i < n; i++) {
nsIContent* content;
nsresult rv = frame->GetContent(&content);
if (NS_FAILED(rv) || (nsnull == content)) {
// If it doesn't have any content then this can't be an empty line
return PR_FALSE;
}
nsITextContent* tc;
rv = content->QueryInterface(kITextContentIID, (void**) &tc);
if (NS_FAILED(rv) || (nsnull == tc)) {
// If it's not text content then this can't be an empty line
NS_RELEASE(content);
return PR_FALSE;
}
const nsTextFragment* frag;
PRInt32 numFrags;
rv = tc->GetText(frag, numFrags);
if (NS_FAILED(rv)) {
NS_RELEASE(content);
NS_RELEASE(tc);
return PR_FALSE;
}
// If the text has any non-whitespace characters in it then the
// line is not an empty line.
while (--numFrags >= 0) {
PRInt32 len = frag->GetLength();
if (frag->Is2b()) {
const PRUnichar* cp = frag->Get2b();
const PRUnichar* end = cp + len;
while (cp < end) {
PRUnichar ch = *cp++;
if (!XP_IS_SPACE(ch)) {
NS_RELEASE(tc);
NS_RELEASE(content);
return PR_FALSE;
}
}
}
else {
const char* cp = frag->Get1b();
const char* end = cp + len;
while (cp < end) {
char ch = *cp++;
if (!XP_IS_SPACE(ch)) {
NS_RELEASE(tc);
NS_RELEASE(content);
return PR_FALSE;
}
}
}
frag++;
}
NS_RELEASE(tc);
NS_RELEASE(content);
frame->GetNextSibling(&frame);
}
return PR_TRUE;
}
void
nsBlockFrame::MarkEmptyLines(nsIPresContext* aPresContext)
{
// PRE-formatted content considers whitespace significant
const nsStyleText* text;
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) text);
if ((NS_STYLE_WHITESPACE_PRE == text->mWhiteSpace) ||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == text->mWhiteSpace)) {
return;
}
PRBool afterBlock = PR_TRUE;
nsLineBox* line = mLines;
while (nsnull != line) {
if (line->IsBlock()) {
afterBlock = PR_TRUE;
}
else if (afterBlock) {
afterBlock = PR_FALSE;
// This is an inline line and it is immediately after a block
// (or its our first line). See if it contains nothing but
// collapsible text.
PRBool isEmpty = IsEmptyLine(aPresContext, line);
line->SetIsEmptyLine(isEmpty);
}
else {
line->SetIsEmptyLine(PR_FALSE);
}
line = line->mNext;
}
}
#endif
void
nsBlockFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
@ -5609,6 +5490,40 @@ nsBlockFrame::VerifyTree() const
return NS_OK;
}
NS_IMETHODIMP
nsBlockFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
PRUint32 sum = sizeof(*this);
// Add in size of each line object
nsLineBox* line = mLines;
while (line) {
sum += sizeof(nsLineBox);
line = line->mNext;
}
line = mOverflowLines;
while (line) {
sum += sizeof(nsLineBox);
line = line->mNext;
}
// Add in text-run data
nsTextRun* runs = mTextRuns;
while (runs) {
PRUint32 runSize;
runs->SizeOf(aHandler, &runSize);
sum += runSize;
runs = runs->GetNext();
}
*aResult = sum;
return NS_OK;
}
//----------------------------------------------------------------------
NS_IMETHODIMP
@ -5643,6 +5558,7 @@ nsBlockFrame::GetFirstLetterStyle(nsIPresContext* aPresContext)
return fls;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsIStyleContext*
nsBlockFrame::GetFirstLineStyle(nsIPresContext* aPresContext)
{
@ -5652,6 +5568,7 @@ nsBlockFrame::GetFirstLineStyle(nsIPresContext* aPresContext)
mStyleContext, PR_FALSE, &fls);
return fls;
}
#endif
NS_IMETHODIMP
nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
@ -5677,6 +5594,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
NS_RELEASE(firstLetterStyle);
}
#ifdef BLOCK_DOES_FIRST_LINE
nsIStyleContext* firstLineStyle = GetFirstLineStyle(&aPresContext);
if (nsnull != firstLineStyle) {
mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE;
@ -5686,6 +5604,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
#endif
NS_RELEASE(firstLineStyle);
}
#endif
}
rv = AddFrames(&aPresContext, aChildList, nsnull);
@ -6238,9 +6157,15 @@ nsBlockFrame::VerifyLines(PRBool aFinalCheckOK)
if (line->IsBlock()) {
seenBlock = PR_TRUE;
}
if (line->IsFirstLine() || line->IsBlock()) {
#ifdef BLOCK_DOES_FIRST_LINE
if (line->IsFirstLine()) {
NS_ASSERTION(1 == line->mChildCount, "bad first line");
}
#endif
if (line->IsBlock()) {
NS_ASSERTION(1 == line->mChildCount, "bad first line");
}
#ifdef BLOCK_DOES_FIRST_LINE
if (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) {
if (seenBlock) {
NS_ASSERTION(!line->IsFirstLine(), "bad first line");
@ -6249,6 +6174,7 @@ nsBlockFrame::VerifyLines(PRBool aFinalCheckOK)
NS_ASSERTION(line->IsFirstLine(), "bad first line");
}
}
#endif
}
NS_ASSERTION(line->mChildCount < MAX_LINE_COUNT, "bad line child count");
count += line->mChildCount;

View File

@ -40,7 +40,9 @@ class nsFirstLineFrame;
*/
#define NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET 0x80000000
#define NS_BLOCK_IS_HTML_PARAGRAPH 0x40000000
#ifdef BLOCK_DOES_FIRST_LINE
#define NS_BLOCK_HAS_FIRST_LINE_STYLE 0x20000000
#endif
#define NS_BLOCK_HAS_FIRST_LETTER_STYLE 0x10000000
#define nsBlockFrameSuper nsHTMLContainerFrame
@ -99,6 +101,7 @@ public:
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
NS_IMETHOD VerifyTree() const;
NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame);
NS_IMETHOD HandleEvent(nsIPresContext& aPresContext,
@ -145,7 +148,9 @@ protected:
nsIStyleContext* GetFirstLetterStyle(nsIPresContext* aPresContext);
#ifdef BLOCK_DOES_FIRST_LINE
nsIStyleContext* GetFirstLineStyle(nsIPresContext* aPresContext);
#endif
void SetFlags(PRUint32 aFlags) {
mFlags = aFlags;
@ -171,12 +176,11 @@ protected:
nsBlockReflowState& aState,
nsHTMLReflowMetrics& aMetrics);
void MarkEmptyLines(nsIPresContext* aPresContext);
nsresult AddFrames(nsIPresContext* aPresContext,
nsIFrame* aFrameList,
nsIFrame* aPrevSibling);
#ifdef BLOCK_DOES_FIRST_LINE
nsresult AddFirstLineFrames(nsIPresContext* aPresContext,
nsFirstLineFrame* aLineFrame,
nsIFrame* aFrameList,
@ -185,16 +189,18 @@ protected:
nsIFrame* TakeKidsFromLineFrame(nsFirstLineFrame* aLineFrame,
nsIFrame* aFromKid);
void FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame);
nsresult DoRemoveFrame(nsIPresContext* aPresContext,
nsIFrame* aDeletedFrame);
nsresult RemoveFirstLineFrame(nsIPresContext* aPresContext,
nsFirstLineFrame* aLineFrame,
nsIFrame* aDeletedFrame);
nsresult WrapFramesInFirstLineFrame(nsIPresContext* aPresContext);
#endif
void FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame);
nsresult DoRemoveFrame(nsIPresContext* aPresContext,
nsIFrame* aDeletedFrame);
nsresult PrepareInitialReflow(nsBlockReflowState& aState);

View File

@ -45,8 +45,6 @@
#include "nsITextContent.h"
#include "nsStyleChangeList.h"
// XXX for IsEmptyLine
#include "nsTextFragment.h"
#include "nsIFocusTracker.h"
#include "nsIFrameSelection.h"
@ -985,6 +983,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
}
#ifdef BLOCK_DOES_FIRST_LINE
// It is possible that we just acquired first-line style. See if
// this is the case, and if so, fix things up.
if (0 == (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState)) {
@ -1005,6 +1004,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
}
}
#endif
return rv;
}
@ -2185,7 +2185,6 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
// Setup the line-layout for the new line
aState.mCurrentLine = aLine;
aLine->ClearDirty();
aLine->SetNeedDidReflow();
// Now that we know what kind of line we have, reflow it
nsRect oldCombinedArea = aLine->mCombinedArea;
@ -2643,38 +2642,6 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState,
return PR_FALSE;
}
#if 0
const nsStyleText* styleText;
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) styleText);
if ((NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace) ||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace)) {
// Since whitespace is significant, we know that the paragraph
// is not empty (even if it has no text in it because it has
return PR_FALSE;
static PRBool
IsEmptyHTMLParagraph(nsIFrame* aFrame)
{
nsBlockFrame* bf;
if (NS_SUCCEEDED(aRS.frame->QueryInterface(kBlockFrameCID, (void**)&bf)) &&
nsBlockReflowContext::IsHTMLParagraph(aFrame)) {
if (!bf->mLines) {
// It's an html paragraph and it's empty
return PR_TRUE;
}
nsLineBox* line = bf->mLines;
while (line) {
if (!IsEmptyLine(line)) {
return PR_FALSE;
}
line = line->mNext;
}
}
return PR_FALSE;
}
#endif
nsIFrame*
nsBlockFrame::GetTopBlockChild()
{
@ -3071,6 +3038,9 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState,
availWidth, availHeight,
impactedByFloaters,
PR_FALSE /*XXX isTopOfPage*/);
// XXX Unfortunately we need to know this before reflowing the first
// inline frame in the line. FIX ME.
if ((0 == aLineLayout.GetLineNumber()) &&
(NS_BLOCK_HAS_FIRST_LETTER_STYLE & mState)) {
aLineLayout.SetFirstLetterStyleOK(PR_TRUE);
@ -3287,10 +3257,13 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
// line and don't stop the line reflow...
PRBool splitLine = !reflowingFirstLetter;
if (reflowingFirstLetter) {
#ifdef BLOCK_DOES_FIRST_LINE
if (aLine->IsFirstLine()) {
splitLine = PR_TRUE;
}
else {
else
#endif
{
nsIAtom* frameType;
if (NS_SUCCEEDED(aFrame->GetFrameType(&frameType)) && frameType) {
if (frameType == nsLayoutAtoms::inlineFrame) {
@ -3391,7 +3364,9 @@ nsBlockFrame::SplitLine(nsBlockReflowState& aState,
aLine->mNext = to;
}
to->SetIsBlock(aLine->IsBlock());
#ifdef BLOCK_DOES_FIRST_LINE
to->SetIsFirstLine(aLine->IsFirstLine());
#endif
aLine->mChildCount -= pushCount;
// Let line layout know that some frames are no longer part of its
@ -3656,20 +3631,6 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState,
aLine->mMaxElementWidth = aMaxElementSize.width;
}
#if XXX_need_line_outside_children
// Compute LINE_OUTSIDE_CHILDREN state for this line. The bit is set
// if any child frame has outside children.
if ((aLine->mCombinedArea.x < aLine->mBounds.x) ||
(aLine->mCombinedArea.XMost() > aLine->mBounds.XMost()) ||
(aLine->mCombinedArea.y < aLine->mBounds.y) ||
(aLine->mCombinedArea.YMost() > aLine->mBounds.YMost())) {
aLine->SetOutsideChildren();
}
else {
aLine->ClearOutsideChildren();
}
#endif
// Update xmost
nscoord xmost = aLine->mBounds.XMost();
if (xmost > aState.mKidXMost) {
@ -3847,6 +3808,7 @@ nsBlockFrame::LastChild()
return nsnull;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::WrapFramesInFirstLineFrame(nsIPresContext* aPresContext)
{
@ -3938,6 +3900,7 @@ nsBlockFrame::WrapFramesInFirstLineFrame(nsIPresContext* aPresContext)
return rv;
}
#endif
NS_IMETHODIMP
nsBlockFrame::AppendFrames(nsIPresContext& aPresContext,
@ -3963,12 +3926,14 @@ nsBlockFrame::AppendFrames(nsIPresContext& aPresContext,
nsLineBox* lastLine = nsLineBox::LastLine(mLines);
if (lastLine) {
lastKid = lastLine->LastChild();
#ifdef BLOCK_DOES_FIRST_LINE
if (lastLine->IsFirstLine()) {
// Get last frame in the nsFirstLineFrame
lastKid->FirstChild(nsnull, &lastKid);
nsFrameList frames(lastKid);
lastKid = frames.LastChild();
}
#endif
}
// Add frames after the last child
@ -4058,6 +4023,7 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
nsLineBox* prevSibLine = nsnull;
PRInt32 prevSiblingIndex = -1;
if (aPrevSibling) {
#ifdef BLOCK_DOES_FIRST_LINE
// Its possible we have an nsFirstLineFrame managing some of our
// child frames. If we do and the AddFrames is targetted at it,
// use AddFirstLineFrames to get the frames properly placed.
@ -4079,7 +4045,9 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
(nsFirstLineFrame*)prevSiblingParent,
aFrameList, aPrevSibling);
}
else {
else
#endif
{
// Find the line that contains the previous sibling
prevSibLine = nsLineBox::FindLineContaining(mLines, aPrevSibling,
&prevSiblingIndex);
@ -4091,12 +4059,14 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
}
}
}
#ifdef BLOCK_DOES_FIRST_LINE
else if (mLines && mLines->IsFirstLine()) {
mLines->MarkDirty();
return AddFirstLineFrames(aPresContext,
(nsFirstLineFrame*)mLines->mFirstChild,
aFrameList, nsnull);
}
#endif
// Find the frame following aPrevSibling so that we can join up the
// two lists of frames.
@ -4168,20 +4138,22 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
aPrevSibling->SetNextSibling(prevSiblingNextFrame);
}
#ifdef BLOCK_DOES_FIRST_LINE
// Fixup any frames that should be in a first-line frame but aren't
if ((NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) &&
(nsnull != mLines) && !mLines->IsBlock()) {
// We just added one or more frame(s) to the first line.
WrapFramesInFirstLineFrame(aPresContext);
}
#endif
#ifdef DEBUG
VerifyLines(PR_TRUE);
#endif
MarkEmptyLines(aPresContext);
return NS_OK;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::AddFirstLineFrames(nsIPresContext* aPresContext,
nsFirstLineFrame* aLineFrame,
@ -4310,6 +4282,7 @@ nsBlockFrame::TakeKidsFromLineFrame(nsFirstLineFrame* aLineFrame,
return kids.FirstChild();
}
#endif
void
nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame)
@ -4404,12 +4377,14 @@ nsresult
nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
nsIFrame* aDeletedFrame)
{
#ifdef BLOCK_DOES_FIRST_LINE
nsIFrame* parent;
aDeletedFrame->GetParent(&parent);
if (parent != this) {
return RemoveFirstLineFrame(aPresContext, (nsFirstLineFrame*)parent,
aDeletedFrame);
}
#endif
// Find the line and the previous sibling that contains
// deletedFrame; we also find the pointer to the line.
@ -4446,6 +4421,9 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
while (nsnull != aDeletedFrame) {
while ((nsnull != line) && (nsnull != aDeletedFrame)) {
#ifdef NS_DEBUG
#ifndef BLOCK_DOES_FIRST_LINE
nsIFrame* parent;
#endif
aDeletedFrame->GetParent(&parent);
NS_ASSERTION(flow == parent, "messed up delete code");
NS_ASSERTION(line->Contains(aDeletedFrame), "frame not in line");
@ -4547,6 +4525,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
}
}
#ifdef BLOCK_DOES_FIRST_LINE
// Fixup any frames that should be in a first-line frame but aren't
if ((NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) &&
(nsnull != mLines) && !mLines->IsBlock()) {
@ -4554,14 +4533,15 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
// removed a block that preceeded the first line.
WrapFramesInFirstLineFrame(aPresContext);
}
#endif
#ifdef DEBUG
VerifyLines(PR_TRUE);
#endif
MarkEmptyLines(aPresContext);
return NS_OK;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::RemoveFirstLineFrame(nsIPresContext* aPresContext,
nsFirstLineFrame* aLineFrame,
@ -4596,106 +4576,7 @@ nsBlockFrame::RemoveFirstLineFrame(nsIPresContext* aPresContext,
}
return NS_OK;
}
static PRBool
IsEmptyLine(nsIPresContext* aPresContext, nsLineBox* aLine)
{
PRInt32 i, n = aLine->ChildCount();
nsIFrame* frame = aLine->mFirstChild;
for (i = 0; i < n; i++) {
nsIContent* content;
nsresult rv = frame->GetContent(&content);
if (NS_FAILED(rv) || (nsnull == content)) {
// If it doesn't have any content then this can't be an empty line
return PR_FALSE;
}
nsITextContent* tc;
rv = content->QueryInterface(kITextContentIID, (void**) &tc);
if (NS_FAILED(rv) || (nsnull == tc)) {
// If it's not text content then this can't be an empty line
NS_RELEASE(content);
return PR_FALSE;
}
const nsTextFragment* frag;
PRInt32 numFrags;
rv = tc->GetText(frag, numFrags);
if (NS_FAILED(rv)) {
NS_RELEASE(content);
NS_RELEASE(tc);
return PR_FALSE;
}
// If the text has any non-whitespace characters in it then the
// line is not an empty line.
while (--numFrags >= 0) {
PRInt32 len = frag->GetLength();
if (frag->Is2b()) {
const PRUnichar* cp = frag->Get2b();
const PRUnichar* end = cp + len;
while (cp < end) {
PRUnichar ch = *cp++;
if (!XP_IS_SPACE(ch)) {
NS_RELEASE(tc);
NS_RELEASE(content);
return PR_FALSE;
}
}
}
else {
const char* cp = frag->Get1b();
const char* end = cp + len;
while (cp < end) {
char ch = *cp++;
if (!XP_IS_SPACE(ch)) {
NS_RELEASE(tc);
NS_RELEASE(content);
return PR_FALSE;
}
}
}
frag++;
}
NS_RELEASE(tc);
NS_RELEASE(content);
frame->GetNextSibling(&frame);
}
return PR_TRUE;
}
void
nsBlockFrame::MarkEmptyLines(nsIPresContext* aPresContext)
{
// PRE-formatted content considers whitespace significant
const nsStyleText* text;
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) text);
if ((NS_STYLE_WHITESPACE_PRE == text->mWhiteSpace) ||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == text->mWhiteSpace)) {
return;
}
PRBool afterBlock = PR_TRUE;
nsLineBox* line = mLines;
while (nsnull != line) {
if (line->IsBlock()) {
afterBlock = PR_TRUE;
}
else if (afterBlock) {
afterBlock = PR_FALSE;
// This is an inline line and it is immediately after a block
// (or its our first line). See if it contains nothing but
// collapsible text.
PRBool isEmpty = IsEmptyLine(aPresContext, line);
line->SetIsEmptyLine(isEmpty);
}
else {
line->SetIsEmptyLine(PR_FALSE);
}
line = line->mNext;
}
}
#endif
void
nsBlockFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
@ -5609,6 +5490,40 @@ nsBlockFrame::VerifyTree() const
return NS_OK;
}
NS_IMETHODIMP
nsBlockFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
PRUint32 sum = sizeof(*this);
// Add in size of each line object
nsLineBox* line = mLines;
while (line) {
sum += sizeof(nsLineBox);
line = line->mNext;
}
line = mOverflowLines;
while (line) {
sum += sizeof(nsLineBox);
line = line->mNext;
}
// Add in text-run data
nsTextRun* runs = mTextRuns;
while (runs) {
PRUint32 runSize;
runs->SizeOf(aHandler, &runSize);
sum += runSize;
runs = runs->GetNext();
}
*aResult = sum;
return NS_OK;
}
//----------------------------------------------------------------------
NS_IMETHODIMP
@ -5643,6 +5558,7 @@ nsBlockFrame::GetFirstLetterStyle(nsIPresContext* aPresContext)
return fls;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsIStyleContext*
nsBlockFrame::GetFirstLineStyle(nsIPresContext* aPresContext)
{
@ -5652,6 +5568,7 @@ nsBlockFrame::GetFirstLineStyle(nsIPresContext* aPresContext)
mStyleContext, PR_FALSE, &fls);
return fls;
}
#endif
NS_IMETHODIMP
nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
@ -5677,6 +5594,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
NS_RELEASE(firstLetterStyle);
}
#ifdef BLOCK_DOES_FIRST_LINE
nsIStyleContext* firstLineStyle = GetFirstLineStyle(&aPresContext);
if (nsnull != firstLineStyle) {
mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE;
@ -5686,6 +5604,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
#endif
NS_RELEASE(firstLineStyle);
}
#endif
}
rv = AddFrames(&aPresContext, aChildList, nsnull);
@ -6238,9 +6157,15 @@ nsBlockFrame::VerifyLines(PRBool aFinalCheckOK)
if (line->IsBlock()) {
seenBlock = PR_TRUE;
}
if (line->IsFirstLine() || line->IsBlock()) {
#ifdef BLOCK_DOES_FIRST_LINE
if (line->IsFirstLine()) {
NS_ASSERTION(1 == line->mChildCount, "bad first line");
}
#endif
if (line->IsBlock()) {
NS_ASSERTION(1 == line->mChildCount, "bad first line");
}
#ifdef BLOCK_DOES_FIRST_LINE
if (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) {
if (seenBlock) {
NS_ASSERTION(!line->IsFirstLine(), "bad first line");
@ -6249,6 +6174,7 @@ nsBlockFrame::VerifyLines(PRBool aFinalCheckOK)
NS_ASSERTION(line->IsFirstLine(), "bad first line");
}
}
#endif
}
NS_ASSERTION(line->mChildCount < MAX_LINE_COUNT, "bad line child count");
count += line->mChildCount;

View File

@ -45,8 +45,6 @@
#include "nsITextContent.h"
#include "nsStyleChangeList.h"
// XXX for IsEmptyLine
#include "nsTextFragment.h"
#include "nsIFocusTracker.h"
#include "nsIFrameSelection.h"
@ -985,6 +983,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
}
#ifdef BLOCK_DOES_FIRST_LINE
// It is possible that we just acquired first-line style. See if
// this is the case, and if so, fix things up.
if (0 == (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState)) {
@ -1005,6 +1004,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
}
}
#endif
return rv;
}
@ -2185,7 +2185,6 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
// Setup the line-layout for the new line
aState.mCurrentLine = aLine;
aLine->ClearDirty();
aLine->SetNeedDidReflow();
// Now that we know what kind of line we have, reflow it
nsRect oldCombinedArea = aLine->mCombinedArea;
@ -2643,38 +2642,6 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState,
return PR_FALSE;
}
#if 0
const nsStyleText* styleText;
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) styleText);
if ((NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace) ||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace)) {
// Since whitespace is significant, we know that the paragraph
// is not empty (even if it has no text in it because it has
return PR_FALSE;
static PRBool
IsEmptyHTMLParagraph(nsIFrame* aFrame)
{
nsBlockFrame* bf;
if (NS_SUCCEEDED(aRS.frame->QueryInterface(kBlockFrameCID, (void**)&bf)) &&
nsBlockReflowContext::IsHTMLParagraph(aFrame)) {
if (!bf->mLines) {
// It's an html paragraph and it's empty
return PR_TRUE;
}
nsLineBox* line = bf->mLines;
while (line) {
if (!IsEmptyLine(line)) {
return PR_FALSE;
}
line = line->mNext;
}
}
return PR_FALSE;
}
#endif
nsIFrame*
nsBlockFrame::GetTopBlockChild()
{
@ -3071,6 +3038,9 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState,
availWidth, availHeight,
impactedByFloaters,
PR_FALSE /*XXX isTopOfPage*/);
// XXX Unfortunately we need to know this before reflowing the first
// inline frame in the line. FIX ME.
if ((0 == aLineLayout.GetLineNumber()) &&
(NS_BLOCK_HAS_FIRST_LETTER_STYLE & mState)) {
aLineLayout.SetFirstLetterStyleOK(PR_TRUE);
@ -3287,10 +3257,13 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
// line and don't stop the line reflow...
PRBool splitLine = !reflowingFirstLetter;
if (reflowingFirstLetter) {
#ifdef BLOCK_DOES_FIRST_LINE
if (aLine->IsFirstLine()) {
splitLine = PR_TRUE;
}
else {
else
#endif
{
nsIAtom* frameType;
if (NS_SUCCEEDED(aFrame->GetFrameType(&frameType)) && frameType) {
if (frameType == nsLayoutAtoms::inlineFrame) {
@ -3391,7 +3364,9 @@ nsBlockFrame::SplitLine(nsBlockReflowState& aState,
aLine->mNext = to;
}
to->SetIsBlock(aLine->IsBlock());
#ifdef BLOCK_DOES_FIRST_LINE
to->SetIsFirstLine(aLine->IsFirstLine());
#endif
aLine->mChildCount -= pushCount;
// Let line layout know that some frames are no longer part of its
@ -3656,20 +3631,6 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState,
aLine->mMaxElementWidth = aMaxElementSize.width;
}
#if XXX_need_line_outside_children
// Compute LINE_OUTSIDE_CHILDREN state for this line. The bit is set
// if any child frame has outside children.
if ((aLine->mCombinedArea.x < aLine->mBounds.x) ||
(aLine->mCombinedArea.XMost() > aLine->mBounds.XMost()) ||
(aLine->mCombinedArea.y < aLine->mBounds.y) ||
(aLine->mCombinedArea.YMost() > aLine->mBounds.YMost())) {
aLine->SetOutsideChildren();
}
else {
aLine->ClearOutsideChildren();
}
#endif
// Update xmost
nscoord xmost = aLine->mBounds.XMost();
if (xmost > aState.mKidXMost) {
@ -3847,6 +3808,7 @@ nsBlockFrame::LastChild()
return nsnull;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::WrapFramesInFirstLineFrame(nsIPresContext* aPresContext)
{
@ -3938,6 +3900,7 @@ nsBlockFrame::WrapFramesInFirstLineFrame(nsIPresContext* aPresContext)
return rv;
}
#endif
NS_IMETHODIMP
nsBlockFrame::AppendFrames(nsIPresContext& aPresContext,
@ -3963,12 +3926,14 @@ nsBlockFrame::AppendFrames(nsIPresContext& aPresContext,
nsLineBox* lastLine = nsLineBox::LastLine(mLines);
if (lastLine) {
lastKid = lastLine->LastChild();
#ifdef BLOCK_DOES_FIRST_LINE
if (lastLine->IsFirstLine()) {
// Get last frame in the nsFirstLineFrame
lastKid->FirstChild(nsnull, &lastKid);
nsFrameList frames(lastKid);
lastKid = frames.LastChild();
}
#endif
}
// Add frames after the last child
@ -4058,6 +4023,7 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
nsLineBox* prevSibLine = nsnull;
PRInt32 prevSiblingIndex = -1;
if (aPrevSibling) {
#ifdef BLOCK_DOES_FIRST_LINE
// Its possible we have an nsFirstLineFrame managing some of our
// child frames. If we do and the AddFrames is targetted at it,
// use AddFirstLineFrames to get the frames properly placed.
@ -4079,7 +4045,9 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
(nsFirstLineFrame*)prevSiblingParent,
aFrameList, aPrevSibling);
}
else {
else
#endif
{
// Find the line that contains the previous sibling
prevSibLine = nsLineBox::FindLineContaining(mLines, aPrevSibling,
&prevSiblingIndex);
@ -4091,12 +4059,14 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
}
}
}
#ifdef BLOCK_DOES_FIRST_LINE
else if (mLines && mLines->IsFirstLine()) {
mLines->MarkDirty();
return AddFirstLineFrames(aPresContext,
(nsFirstLineFrame*)mLines->mFirstChild,
aFrameList, nsnull);
}
#endif
// Find the frame following aPrevSibling so that we can join up the
// two lists of frames.
@ -4168,20 +4138,22 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
aPrevSibling->SetNextSibling(prevSiblingNextFrame);
}
#ifdef BLOCK_DOES_FIRST_LINE
// Fixup any frames that should be in a first-line frame but aren't
if ((NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) &&
(nsnull != mLines) && !mLines->IsBlock()) {
// We just added one or more frame(s) to the first line.
WrapFramesInFirstLineFrame(aPresContext);
}
#endif
#ifdef DEBUG
VerifyLines(PR_TRUE);
#endif
MarkEmptyLines(aPresContext);
return NS_OK;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::AddFirstLineFrames(nsIPresContext* aPresContext,
nsFirstLineFrame* aLineFrame,
@ -4310,6 +4282,7 @@ nsBlockFrame::TakeKidsFromLineFrame(nsFirstLineFrame* aLineFrame,
return kids.FirstChild();
}
#endif
void
nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame)
@ -4404,12 +4377,14 @@ nsresult
nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
nsIFrame* aDeletedFrame)
{
#ifdef BLOCK_DOES_FIRST_LINE
nsIFrame* parent;
aDeletedFrame->GetParent(&parent);
if (parent != this) {
return RemoveFirstLineFrame(aPresContext, (nsFirstLineFrame*)parent,
aDeletedFrame);
}
#endif
// Find the line and the previous sibling that contains
// deletedFrame; we also find the pointer to the line.
@ -4446,6 +4421,9 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
while (nsnull != aDeletedFrame) {
while ((nsnull != line) && (nsnull != aDeletedFrame)) {
#ifdef NS_DEBUG
#ifndef BLOCK_DOES_FIRST_LINE
nsIFrame* parent;
#endif
aDeletedFrame->GetParent(&parent);
NS_ASSERTION(flow == parent, "messed up delete code");
NS_ASSERTION(line->Contains(aDeletedFrame), "frame not in line");
@ -4547,6 +4525,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
}
}
#ifdef BLOCK_DOES_FIRST_LINE
// Fixup any frames that should be in a first-line frame but aren't
if ((NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) &&
(nsnull != mLines) && !mLines->IsBlock()) {
@ -4554,14 +4533,15 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
// removed a block that preceeded the first line.
WrapFramesInFirstLineFrame(aPresContext);
}
#endif
#ifdef DEBUG
VerifyLines(PR_TRUE);
#endif
MarkEmptyLines(aPresContext);
return NS_OK;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsBlockFrame::RemoveFirstLineFrame(nsIPresContext* aPresContext,
nsFirstLineFrame* aLineFrame,
@ -4596,106 +4576,7 @@ nsBlockFrame::RemoveFirstLineFrame(nsIPresContext* aPresContext,
}
return NS_OK;
}
static PRBool
IsEmptyLine(nsIPresContext* aPresContext, nsLineBox* aLine)
{
PRInt32 i, n = aLine->ChildCount();
nsIFrame* frame = aLine->mFirstChild;
for (i = 0; i < n; i++) {
nsIContent* content;
nsresult rv = frame->GetContent(&content);
if (NS_FAILED(rv) || (nsnull == content)) {
// If it doesn't have any content then this can't be an empty line
return PR_FALSE;
}
nsITextContent* tc;
rv = content->QueryInterface(kITextContentIID, (void**) &tc);
if (NS_FAILED(rv) || (nsnull == tc)) {
// If it's not text content then this can't be an empty line
NS_RELEASE(content);
return PR_FALSE;
}
const nsTextFragment* frag;
PRInt32 numFrags;
rv = tc->GetText(frag, numFrags);
if (NS_FAILED(rv)) {
NS_RELEASE(content);
NS_RELEASE(tc);
return PR_FALSE;
}
// If the text has any non-whitespace characters in it then the
// line is not an empty line.
while (--numFrags >= 0) {
PRInt32 len = frag->GetLength();
if (frag->Is2b()) {
const PRUnichar* cp = frag->Get2b();
const PRUnichar* end = cp + len;
while (cp < end) {
PRUnichar ch = *cp++;
if (!XP_IS_SPACE(ch)) {
NS_RELEASE(tc);
NS_RELEASE(content);
return PR_FALSE;
}
}
}
else {
const char* cp = frag->Get1b();
const char* end = cp + len;
while (cp < end) {
char ch = *cp++;
if (!XP_IS_SPACE(ch)) {
NS_RELEASE(tc);
NS_RELEASE(content);
return PR_FALSE;
}
}
}
frag++;
}
NS_RELEASE(tc);
NS_RELEASE(content);
frame->GetNextSibling(&frame);
}
return PR_TRUE;
}
void
nsBlockFrame::MarkEmptyLines(nsIPresContext* aPresContext)
{
// PRE-formatted content considers whitespace significant
const nsStyleText* text;
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) text);
if ((NS_STYLE_WHITESPACE_PRE == text->mWhiteSpace) ||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == text->mWhiteSpace)) {
return;
}
PRBool afterBlock = PR_TRUE;
nsLineBox* line = mLines;
while (nsnull != line) {
if (line->IsBlock()) {
afterBlock = PR_TRUE;
}
else if (afterBlock) {
afterBlock = PR_FALSE;
// This is an inline line and it is immediately after a block
// (or its our first line). See if it contains nothing but
// collapsible text.
PRBool isEmpty = IsEmptyLine(aPresContext, line);
line->SetIsEmptyLine(isEmpty);
}
else {
line->SetIsEmptyLine(PR_FALSE);
}
line = line->mNext;
}
}
#endif
void
nsBlockFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
@ -5609,6 +5490,40 @@ nsBlockFrame::VerifyTree() const
return NS_OK;
}
NS_IMETHODIMP
nsBlockFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
PRUint32 sum = sizeof(*this);
// Add in size of each line object
nsLineBox* line = mLines;
while (line) {
sum += sizeof(nsLineBox);
line = line->mNext;
}
line = mOverflowLines;
while (line) {
sum += sizeof(nsLineBox);
line = line->mNext;
}
// Add in text-run data
nsTextRun* runs = mTextRuns;
while (runs) {
PRUint32 runSize;
runs->SizeOf(aHandler, &runSize);
sum += runSize;
runs = runs->GetNext();
}
*aResult = sum;
return NS_OK;
}
//----------------------------------------------------------------------
NS_IMETHODIMP
@ -5643,6 +5558,7 @@ nsBlockFrame::GetFirstLetterStyle(nsIPresContext* aPresContext)
return fls;
}
#ifdef BLOCK_DOES_FIRST_LINE
nsIStyleContext*
nsBlockFrame::GetFirstLineStyle(nsIPresContext* aPresContext)
{
@ -5652,6 +5568,7 @@ nsBlockFrame::GetFirstLineStyle(nsIPresContext* aPresContext)
mStyleContext, PR_FALSE, &fls);
return fls;
}
#endif
NS_IMETHODIMP
nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
@ -5677,6 +5594,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
NS_RELEASE(firstLetterStyle);
}
#ifdef BLOCK_DOES_FIRST_LINE
nsIStyleContext* firstLineStyle = GetFirstLineStyle(&aPresContext);
if (nsnull != firstLineStyle) {
mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE;
@ -5686,6 +5604,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
#endif
NS_RELEASE(firstLineStyle);
}
#endif
}
rv = AddFrames(&aPresContext, aChildList, nsnull);
@ -6238,9 +6157,15 @@ nsBlockFrame::VerifyLines(PRBool aFinalCheckOK)
if (line->IsBlock()) {
seenBlock = PR_TRUE;
}
if (line->IsFirstLine() || line->IsBlock()) {
#ifdef BLOCK_DOES_FIRST_LINE
if (line->IsFirstLine()) {
NS_ASSERTION(1 == line->mChildCount, "bad first line");
}
#endif
if (line->IsBlock()) {
NS_ASSERTION(1 == line->mChildCount, "bad first line");
}
#ifdef BLOCK_DOES_FIRST_LINE
if (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState) {
if (seenBlock) {
NS_ASSERTION(!line->IsFirstLine(), "bad first line");
@ -6249,6 +6174,7 @@ nsBlockFrame::VerifyLines(PRBool aFinalCheckOK)
NS_ASSERTION(line->IsFirstLine(), "bad first line");
}
}
#endif
}
NS_ASSERTION(line->mChildCount < MAX_LINE_COUNT, "bad line child count");
count += line->mChildCount;

View File

@ -667,3 +667,13 @@ nsContainerFrame::List(FILE* out, PRInt32 aIndent) const
return NS_OK;
}
NS_IMETHODIMP
nsContainerFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
*aResult = sizeof(*this);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -50,6 +50,7 @@ public:
nsIFrame* aOldFrame,
nsIFrame* aNewFrame);
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
// nsIHTMLReflow overrides
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,

View File

@ -205,6 +205,15 @@ nsFirstLetterFrame::Reflow(nsIPresContext& aPresContext,
ll.EndLineReflow();
}
else {
// XXX currently the block code sets this up; see comment in
// ReflowInlineFrames
#if XXX
// Only the first-in-flow frame of a first-letter frame gets the
// special first-letter reflow treatment.
if (!mPrevInFlow) {
rs.mLineLayout->SetFirstLetterStyleOK(PR_TRUE);
}
#endif
htmlReflow->Reflow(aPresContext, aMetrics, rs, aReflowStatus);
}

View File

@ -1586,6 +1586,16 @@ nsFrame::DumpBaseRegressionData(FILE* out, PRInt32 aIndent)
} while (nsnull != list);
}
NS_IMETHODIMP
nsFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
*aResult = sizeof(*this);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP
nsFrame::VerifyTree() const
{

View File

@ -223,6 +223,7 @@ public:
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD DumpRegressionData(FILE* out, PRInt32 aIndent);
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
NS_IMETHOD VerifyTree() const;
NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread);
NS_IMETHOD GetSelected(PRBool *aSelected) const;

View File

@ -33,6 +33,7 @@
#include "nsIDOMHTMLHRElement.h"
#include "nsIDeviceContext.h"
#include "nsStyleUtil.h"
#include "nsLayoutAtoms.h"
static NS_DEFINE_IID(kIDOMHTMLHRElementIID, NS_IDOMHTMLHRELEMENT_IID);
@ -51,6 +52,8 @@ public:
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
nsFramePaintLayer aWhichLayer);
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
protected:
PRBool GetNoShade();
@ -253,3 +256,22 @@ HRuleFrame::GetNoShade()
}
return result;
}
NS_IMETHODIMP
HRuleFrame::GetFrameType(nsIAtom** aType) const
{
NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer");
*aType = nsLayoutAtoms::hrFrame;
NS_ADDREF(*aType);
return NS_OK;
}
NS_IMETHODIMP
HRuleFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
*aResult = sizeof(*this);
return NS_OK;
}

View File

@ -89,6 +89,7 @@ public:
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
// XXX Temporary hack...
NS_IMETHOD SetRect(const nsRect& aRect);
@ -450,3 +451,13 @@ RootFrame::GetFrameName(nsString& aResult) const
{
return MakeFrameName("Root", aResult);
}
NS_IMETHODIMP
RootFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
*aResult = sizeof(*this);
return NS_OK;
}

View File

@ -372,3 +372,17 @@ nsHTMLImageLoader::GetLoadStatus() const
}
return loadStatus;
}
// Note: this doesn't factor in:
// -- the mBaseURL (it might be shared)
// -- the mFrame (that will be counted elsewhere most likely)
// -- the mClosure (we don't know what type it is)
// -- the mImageLoader (it might be shared)
PRUint32
nsHTMLImageLoader::GetDataSize() const
{
PRUint32 sum = sizeof(*this);
sum += sizeof(PRUnichar) * mURLSpec.Length() +
sizeof(PRUnichar) * mURL.Length();
return sum;
}

View File

@ -82,6 +82,8 @@ public:
return mFlags.mHaveComputedSize;
}
PRUint32 GetDataSize() const;
protected:
static nsresult ImageLoadCB(nsIPresContext* aPresContext,
nsIFrameImageLoader* aLoader,

View File

@ -55,6 +55,7 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#include "nsTextFragment.h"
#include "nsIDOMHTMLMapElement.h"
#include "nsIStyleSet.h"
#include "nsLayoutAtoms.h"
#ifdef DEBUG
#undef NOISY_IMAGE_LOADING
@ -859,3 +860,26 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext,
return NS_OK;
}
NS_IMETHODIMP
nsImageFrame::GetFrameType(nsIAtom** aType) const
{
NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer");
*aType = nsLayoutAtoms::imageFrame;
NS_ADDREF(*aType);
return NS_OK;
}
// Note: this doesn't factor in:
// -- the mImageMap (it might be shared)
NS_IMETHODIMP
nsImageFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
PRUint32 sum = sizeof(*this) - sizeof(mImageLoader) +
mImageLoader.GetDataSize();
*aResult = sum;
return NS_OK;
}

View File

@ -59,6 +59,8 @@ public:
nsIContent* aChild,
nsIAtom* aAttribute,
PRInt32 aHint);
NS_IMETHOD GetFrameType(nsIAtom** aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
protected:
virtual ~nsImageFrame();

View File

@ -78,7 +78,7 @@ public:
const nsString& GetAltText() const { return mAltText; }
PRBool GetSuppress() const { return mSuppressFeedback; }
virtual void SizeOf(nsISizeOfHandler* aHandler) const;
virtual void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
nsString mBase;
nsString mHREF;
@ -106,15 +106,18 @@ Area::~Area()
}
void
Area::SizeOf(nsISizeOfHandler* aHandler) const
Area::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
aHandler->Add(sizeof(*this));
aHandler->Add((size_t) (- ((PRInt32)sizeof(nsString) * 4) ) );
mBase.SizeOf(aHandler);
mHREF.SizeOf(aHandler);
mTarget.SizeOf(aHandler);
mAltText.SizeOf(aHandler);
aHandler->Add(mNumCoords * sizeof(nscoord));
if (aResult) {
PRUint32 sum = sizeof(*this);
PRUint32 s;
mBase.SizeOf(aHandler, &s); sum += s;
mHREF.SizeOf(aHandler, &s); sum += s;
mTarget.SizeOf(aHandler, &s); sum += s;
mAltText.SizeOf(aHandler, &s); sum += s;
sum += mNumCoords * sizeof(nscoord);
*aResult = sum;
}
}
#include <stdlib.h>
@ -1132,3 +1135,19 @@ nsImageMap::DocumentWillBeDestroyed(nsIDocument *aDocument)
{
return NS_OK;
}
void
nsImageMap::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
PRUint32 sum = sizeof(*this);
PRInt32 i, n = mAreas.Count();
for (i = 0; i < n; i++) {
Area* area = (Area*) mAreas.ElementAt(i);
PRUint32 areaSize;
area->SizeOf(aHandler, &areaSize);
sum += areaSize;
}
*aResult = sum;
}
}

View File

@ -62,6 +62,8 @@ public:
void Draw(nsIPresContext& aCX, nsIRenderingContext& aRC);
void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
// nsISupports
NS_DECL_ISUPPORTS

View File

@ -1240,6 +1240,20 @@ nsInlineFrame::Reflow(nsIPresContext& aPresContext,
}
DrainOverflow(&aPresContext);
if (IsFrameTreeTooDeep(aReflowState, aMetrics)) {
#ifdef DEBUG_kipp
{
extern char* nsPresShell_ReflowStackPointerTop;
char marker;
char* newsp = (char*) &marker;
printf("XXX: frame tree is too deep; approx stack size = %d\n",
nsPresShell_ReflowStackPointerTop - newsp);
}
#endif
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
}
// Set our own reflow state (additional state above and beyond
// aReflowState)
InlineReflowState irs;
@ -1472,6 +1486,7 @@ nsInlineFrame::ReflowInlineFrames(nsIPresContext* aPresContext,
aMetrics.height += aReflowState.mComputedBorderPadding.top +
aReflowState.mComputedBorderPadding.bottom;
#ifdef DEBUG_kipp
// Note: we use the actual font height for sizing our selves
// instead of the computed font height. On systems where they
// disagree the actual font height is more appropriate. This
@ -1484,6 +1499,7 @@ nsInlineFrame::ReflowInlineFrames(nsIPresContext* aPresContext,
if (getenv("GECKO_USE_COMPUTED_HEIGHT")) {
useComputedHeight = PR_TRUE;
}
firstTime = 0;
}
#endif
if (useComputedHeight) {
@ -1505,6 +1521,7 @@ nsInlineFrame::ReflowInlineFrames(nsIPresContext* aPresContext,
aMetrics.height = computedHeight;
}
}
#endif /* DEBUG_kipp */
NS_RELEASE(fm);
}
@ -1892,8 +1909,16 @@ nsFirstLineFrame::AppendFrames(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aFrameList)
{
#ifdef BLOCK_DOES_FIRST_LINE
return mParent->AppendFrames(aPresContext, aPresShell, aListName,
aFrameList);
#else
nsresult rv = nsInlineFrame::AppendFrames(aPresContext, aPresShell,
aListName, aFrameList);
// nsFrameList frames(aFrameList);
// ReResolveChildList(&aPresContext, mStyleContext, frames);
return rv;
#endif
}
NS_IMETHODIMP
@ -1903,8 +1928,16 @@ nsFirstLineFrame::InsertFrames(nsIPresContext& aPresContext,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList)
{
#ifdef BLOCK_DOES_FIRST_LINE
return mParent->InsertFrames(aPresContext, aPresShell, aListName,
aPrevFrame, aFrameList);
#else
nsresult rv = nsInlineFrame::InsertFrames(aPresContext, aPresShell,
aListName, aPrevFrame, aFrameList);
// nsFrameList frames(aFrameList);
// ReResolveChildList(&aPresContext, mStyleContext, frames);
return rv;
#endif
}
NS_IMETHODIMP
@ -1913,10 +1946,17 @@ nsFirstLineFrame::RemoveFrame(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aOldFrame)
{
#ifdef BLOCK_DOES_FIRST_LINE
return mParent->RemoveFrame(aPresContext, aPresShell, aListName,
aOldFrame);
#else
nsresult rv = nsInlineFrame::RemoveFrame(aPresContext, aPresShell,
aListName, aOldFrame);
return rv;
#endif
}
#ifdef BLOCK_DOES_FIRST_LINE
nsresult
nsFirstLineFrame::AppendFrames2(nsIPresContext* aPresContext,
nsIFrame* aFrameList)
@ -1952,9 +1992,10 @@ nsFirstLineFrame::RemoveFrame2(nsIPresContext* aPresContext,
mFrames.RemoveFrame(aOldFrame);
return NS_OK;
}
#endif
void
nsFirstLineFrame::RemoveFramesFrom(nsIFrame* aFrame)
nsFirstLineFrame::StealFramesFrom(nsIFrame* aFrame)
{
nsIFrame* prevFrame = mFrames.GetPrevSiblingFor(aFrame);
if (prevFrame) {
@ -2138,3 +2179,14 @@ nsFirstLineFrame::Reflow(nsIPresContext& aPresContext,
return rv;
}
NS_IMETHODIMP
nsPositionedInlineFrame::SizeOf(nsISizeOfHandler* aHandler,
PRUint32* aResult) const
{
if (aResult) {
*aResult = sizeof(*this);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -192,8 +192,10 @@ public:
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
#ifdef BLOCK_DOES_FIRST_LINE
// AppendFrames/InsertFrames/RemoveFrame are implemented to forward
// the method call to the parent frame.
#endif
NS_IMETHOD AppendFrames(nsIPresContext& aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
@ -208,6 +210,7 @@ public:
nsIAtom* aListName,
nsIFrame* aOldFrame);
#ifdef BLOCK_DOES_FIRST_LINE
// These methods are used by the parent frame to actually modify the
// child frames of the line frame. These methods do not generate
// reflow commands.
@ -221,9 +224,14 @@ public:
nsresult RemoveFrame2(nsIPresContext* aPresContext,
nsIFrame* aOldFrame);
void RemoveFramesFrom(nsIFrame* aFrame);
#endif
// Take frames starting at aFrame until the end of the frame-list
// away from this frame. The caller is presumed to keep them alive.
void StealFramesFrom(nsIFrame* aFrame);
void RemoveAllFrames() {
// Take all of the frames away from this frame. The caller is
// presumed to keep them alive.
void StealAllFrames() {
mFrames.SetFrames(nsnull);
}
@ -250,6 +258,7 @@ class nsPositionedInlineFrame : public nsInlineFrame
{
public:
NS_IMETHOD Destroy(nsIPresContext& aPresContext);
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,

View File

@ -126,3 +126,13 @@ nsLeafFrame::ContentChanged(nsIPresContext* aPresContext,
return rv;
}
NS_IMETHODIMP
nsLeafFrame::SizeOf(nsISizeOfHandler* aHandler,
PRUint32* aResult) const
{
if (aResult) {
*aResult = sizeof(*this);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -41,6 +41,7 @@ public:
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent);
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
protected:
virtual ~nsLeafFrame();

View File

@ -26,7 +26,7 @@ nsLineBox::nsLineBox(nsIFrame* aFrame, PRInt32 aCount, PRUint16 flags)
{
mFirstChild = aFrame;
mChildCount = aCount;
mState = LINE_IS_DIRTY | LINE_NEED_DID_REFLOW | flags;
mState = LINE_IS_DIRTY | flags;
mFloaters = nsnull;
mNext = nsnull;
mBounds.SetRect(0,0,0,0);

View File

@ -23,16 +23,13 @@
#include "nsPlaceholderFrame.h"
#include "nsILineIterator.h"
// bits in nsLineBox.mFlags
// bits in nsLineBox.mState
#define LINE_IS_DIRTY 0x1
#define LINE_IS_BLOCK 0x2
#define LINE_WAS_DIRTY 0x4
#define LINE_NEED_DID_REFLOW 0x8
#define LINE_TOP_MARGIN_IS_AUTO 0x10
#define LINE_BOTTOM_MARGIN_IS_AUTO 0x20
#define LINE_OUTSIDE_CHILDREN 0x40
#define LINE_ISA_EMPTY_LINE 0x80
#define LINE_IS_FIRST_LINE 0x100
#ifdef BLOCK_DOES_FIRST_LINE
#define LINE_IS_FIRST_LINE 0x4
#endif
#define LINE_WAS_DIRTY 0x8
class nsISpaceManager;
class nsLineBox;
@ -51,17 +48,6 @@ public:
nscoord GetHeight() const { return mBounds.height; }
PRBool IsEmptyLine() const {
return 0 != (mState & LINE_ISA_EMPTY_LINE);
}
void SetIsEmptyLine(PRBool aSetting) {
if (aSetting)
mState |= aSetting;
else
mState &= ~aSetting;
}
//----------------------------------------------------------------------
// XXX old junk
nsLineBox(nsIFrame* aFrame, PRInt32 aCount, PRUint16 flags);
@ -106,6 +92,7 @@ public:
}
}
#ifdef BLOCK_DOES_FIRST_LINE
PRBool IsFirstLine() const {
return 0 != (LINE_IS_FIRST_LINE & mState);
}
@ -118,6 +105,7 @@ public:
mState &= ~LINE_IS_FIRST_LINE;
}
}
#endif
void MarkDirty() {
mState |= LINE_IS_DIRTY;
@ -143,34 +131,6 @@ public:
return 0 != (LINE_WAS_DIRTY & mState);
}
void SetNeedDidReflow() {
mState |= LINE_NEED_DID_REFLOW;
}
void ClearNeedDidReflow() {
mState &= ~LINE_NEED_DID_REFLOW;
}
PRBool NeedsDidReflow() {
return 0 != (LINE_NEED_DID_REFLOW & mState);
}
#ifdef XXX_need_line_outside_children
void SetOutsideChildren() {
mState |= LINE_OUTSIDE_CHILDREN;
}
void ClearOutsideChildren() {
mState &= ~LINE_OUTSIDE_CHILDREN;
}
PRBool OutsideChildren() const {
return 0 != (LINE_OUTSIDE_CHILDREN & mState);
}
#endif
PRUint16 GetState() const { return mState; }
char* StateToString(char* aBuf, PRInt32 aBufSize) const;
PRInt32 IndexOf(nsIFrame* aFrame) const;
@ -185,7 +145,7 @@ public:
nsIFrame* mFirstChild;
PRUint16 mChildCount;
PRUint16 mState;
PRUint8 mState;
PRUint8 mBreakType;
nsRect mBounds;
nsRect mCombinedArea;

View File

@ -806,7 +806,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// the state out. We need to know how to treat the current frame
// when breaking.
PRBool notSafeToBreak = CanPlaceFloaterNow() || InWord();
//XXX PRBool firstLetterOK = mFirstLetterStyleOK;
// Apply left margins (as appropriate) to the frame computing the
// new starting x,y coordinates for the frame.
@ -979,8 +978,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
parent->DeleteChildsNextInFlow(mPresContext, aFrame);
}
}
//XXX if (firstLetterOK && !mFirstLetterStyleOK) {
//XXX }
// See if we can place the frame. If we can't fit it, then we
// return now.

View File

@ -113,3 +113,13 @@ nsPlaceholderFrame::List(FILE* out, PRInt32 aIndent) const
fputs("\n", out);
return NS_OK;
}
NS_IMETHODIMP
nsPlaceholderFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
*aResult = sizeof(*this);
return NS_OK;
}

View File

@ -56,6 +56,7 @@ public:
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
protected:
nsIFrame* mOutOfFlowFrame;

View File

@ -761,3 +761,13 @@ nsScrollFrame::GetFrameName(nsString& aResult) const
{
return MakeFrameName("Scroll", aResult);
}
NS_IMETHODIMP
nsScrollFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
*aResult = sizeof(*this);
return NS_OK;
}

View File

@ -86,6 +86,7 @@ public:
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
protected:
nsScrollFrame();

View File

@ -193,4 +193,15 @@ nsSplittableFrame::DumpBaseRegressionData(FILE* out, PRInt32 aIndent)
IndentBy(out, aIndent);
fprintf(out, "<prev-in-flow va=\"%ld\"/>\n", PRUptrdiff(mPrevInFlow));
}
}
NS_IMETHODIMP
nsSplittableFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
*aResult = sizeof(*this);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -31,6 +31,7 @@ public:
nsIFrame* aPrevInFlow);
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
// Flow member functions.
NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const;

View File

@ -227,6 +227,8 @@ public:
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
NS_IMETHOD GetPosition(nsIPresContext& aCX,
nscoord aXCoord,
nsIContent ** aNewContent,
@ -3072,6 +3074,16 @@ nsTextFrame::GetFrameType(nsIAtom** aType) const
return NS_OK;
}
NS_IMETHODIMP
nsTextFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
*aResult = sizeof(*this);
return NS_OK;
}
NS_IMETHODIMP
nsTextFrame::GetFrameName(nsString& aResult) const
{

View File

@ -50,6 +50,13 @@ public:
return mArray.Count();
}
void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const {
if (aResult) {
mArray.SizeOf(aHandler, aResult);
*aResult += sizeof(this) - sizeof(mArray);
}
}
nsIFrame* operator[](PRInt32 aIndex) const {
return (nsIFrame*) mArray[aIndex];
}

View File

@ -83,6 +83,7 @@ public:
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
protected:
nsresult IncrementalReflow(nsIPresContext& aPresContext,
@ -571,3 +572,13 @@ ViewportFrame::GetFrameName(nsString& aResult) const
{
return MakeFrameName("Viewport", aResult);
}
NS_IMETHODIMP
ViewportFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
*aResult = sizeof(*this);
return NS_OK;
}

File diff suppressed because it is too large Load Diff

View File

@ -627,9 +627,27 @@ InitializeScrollFrame(nsIPresContext* aPresContext,
// Methods support creating block frames and their children
nsIStyleContext* GetFirstLetterStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static nsIStyleContext* GetFirstLetterStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static nsIStyleContext* GetFirstLineStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static PRBool HaveFirstLetterStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static PRBool HaveFirstLineStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static void HaveSpecialBlockStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
PRBool* aHaveFirstLetterStyle,
PRBool* aHaveFirstLineStyle);
PRBool ShouldCreateFirstLetterFrame(nsIPresContext* aPresContext,
nsIContent* aContent,
@ -679,6 +697,29 @@ InitializeScrollFrame(nsIPresContext* aPresContext,
nsFrameItems& aFloatingItems,
nsIStyleContext* aStyleContext);
nsresult WrapFramesInFirstLineFrame(nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
nsIFrame* aFrame,
nsFrameItems& aFrameItems);
nsresult AppendFirstLineFrames(nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
nsIFrame* aBlockFrame,
nsFrameItems& aFrameItems);
nsresult InsertFirstLineFrames(nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
nsIFrame* aBlockFrame,
nsIFrame** aParentFrame,
nsIFrame* aPrevSibling,
nsFrameItems& aFrameItems);
nsresult MaybeCreateContainerFrame(nsIPresContext* aPresContext,
nsIContent* aContainer);
protected:
nsIDocument* mDocument;

View File

@ -1150,3 +1150,15 @@ nsPoint nsTableCellFrame::GetCollapseOffset()
return mCollapseOffset;
}
NS_IMETHODIMP
nsTableCellFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
PRUint32 sum = sizeof(*this);
// XXX write me
*aResult = sum;
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -111,6 +111,8 @@ public:
*/
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
NS_IMETHOD GetFrameName(nsString& aResult) const;
virtual void VerticallyAlignChild();

View File

@ -174,3 +174,15 @@ nsTableColFrame::GetFrameName(nsString& aResult) const
{
return MakeFrameName("TableCol", aResult);
}
NS_IMETHODIMP
nsTableColFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
PRUint32 sum = sizeof(*this);
// XXX write me
*aResult = sum;
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -82,6 +82,7 @@ public:
nsReflowStatus& aStatus);
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
/** return the index of the column the col represents. always >= 0 */
virtual PRInt32 GetColumnIndex ();

View File

@ -700,3 +700,15 @@ nsTableColGroupFrame::GetFrameName(nsString& aResult) const
{
return MakeFrameName("TableColGroup", aResult);
}
NS_IMETHODIMP
nsTableColGroupFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
PRUint32 sum = sizeof(*this);
// XXX write me
*aResult = sum;
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -79,6 +79,7 @@ public:
nsReflowStatus& aStatus);
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
/** returns the number of columns represented by this group.
* if there are col children, count them (taking into account the span of each)

View File

@ -5362,3 +5362,14 @@ PRBool nsTableFrame::ColIsSpannedInto(PRInt32 aColIndex)
}
NS_IMETHODIMP
nsTableFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
PRUint32 sum = sizeof(*this);
// XXX write me
*aResult = sum;
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -235,6 +235,8 @@ public:
/** @see nsIFrame::GetFrameName */
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
/** get the max border thickness for each edge */
void GetTableBorder(nsMargin &aBorder);

View File

@ -1184,3 +1184,15 @@ nsTableOuterFrame::GetFrameName(nsString& aResult) const
{
return MakeFrameName("TableOuter", aResult);
}
NS_IMETHODIMP
nsTableOuterFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
PRUint32 sum = sizeof(*this);
// XXX write me
*aResult = sum;
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -92,6 +92,8 @@ public:
/** @see nsIFrame::GetFrameName */
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
/** SetSelected needs to be overridden to talk to inner tableframe
*/
NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread);

View File

@ -1587,5 +1587,14 @@ nsTableRowFrame::GetFrameName(nsString& aResult) const
return MakeFrameName("TableRow", aResult);
}
NS_IMETHODIMP
nsTableRowFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
PRUint32 sum = sizeof(*this);
// XXX write me
*aResult = sum;
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -148,6 +148,8 @@ public:
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
/** set mTallestCell to 0 in anticipation of recalculating it */
void ResetMaxChildHeight();

View File

@ -1561,3 +1561,15 @@ nsTableRowGroupFrame::GetFrameName(nsString& aResult) const
return MakeFrameName("TableRowGroup", aResult);
}
NS_IMETHODIMP
nsTableRowGroupFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
PRUint32 sum = sizeof(*this);
// XXX write me
*aResult = sum;
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -154,6 +154,8 @@ public:
*/
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
NS_IMETHOD GetFrameName(nsString& aResult) const;
/** set aCount to the number of child rows (not necessarily == number of child frames) */

View File

@ -1150,3 +1150,15 @@ nsPoint nsTableCellFrame::GetCollapseOffset()
return mCollapseOffset;
}
NS_IMETHODIMP
nsTableCellFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
PRUint32 sum = sizeof(*this);
// XXX write me
*aResult = sum;
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -111,6 +111,8 @@ public:
*/
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
NS_IMETHOD GetFrameName(nsString& aResult) const;
virtual void VerticallyAlignChild();

View File

@ -174,3 +174,15 @@ nsTableColFrame::GetFrameName(nsString& aResult) const
{
return MakeFrameName("TableCol", aResult);
}
NS_IMETHODIMP
nsTableColFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
PRUint32 sum = sizeof(*this);
// XXX write me
*aResult = sum;
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -82,6 +82,7 @@ public:
nsReflowStatus& aStatus);
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
/** return the index of the column the col represents. always >= 0 */
virtual PRInt32 GetColumnIndex ();

View File

@ -700,3 +700,15 @@ nsTableColGroupFrame::GetFrameName(nsString& aResult) const
{
return MakeFrameName("TableColGroup", aResult);
}
NS_IMETHODIMP
nsTableColGroupFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
PRUint32 sum = sizeof(*this);
// XXX write me
*aResult = sum;
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -79,6 +79,7 @@ public:
nsReflowStatus& aStatus);
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
/** returns the number of columns represented by this group.
* if there are col children, count them (taking into account the span of each)

View File

@ -5362,3 +5362,14 @@ PRBool nsTableFrame::ColIsSpannedInto(PRInt32 aColIndex)
}
NS_IMETHODIMP
nsTableFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
PRUint32 sum = sizeof(*this);
// XXX write me
*aResult = sum;
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -235,6 +235,8 @@ public:
/** @see nsIFrame::GetFrameName */
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
/** get the max border thickness for each edge */
void GetTableBorder(nsMargin &aBorder);

View File

@ -1184,3 +1184,15 @@ nsTableOuterFrame::GetFrameName(nsString& aResult) const
{
return MakeFrameName("TableOuter", aResult);
}
NS_IMETHODIMP
nsTableOuterFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
PRUint32 sum = sizeof(*this);
// XXX write me
*aResult = sum;
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -92,6 +92,8 @@ public:
/** @see nsIFrame::GetFrameName */
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
/** SetSelected needs to be overridden to talk to inner tableframe
*/
NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread);

View File

@ -1587,5 +1587,14 @@ nsTableRowFrame::GetFrameName(nsString& aResult) const
return MakeFrameName("TableRow", aResult);
}
NS_IMETHODIMP
nsTableRowFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
PRUint32 sum = sizeof(*this);
// XXX write me
*aResult = sum;
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

View File

@ -148,6 +148,8 @@ public:
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD GetFrameName(nsString& aResult) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
/** set mTallestCell to 0 in anticipation of recalculating it */
void ResetMaxChildHeight();

View File

@ -1561,3 +1561,15 @@ nsTableRowGroupFrame::GetFrameName(nsString& aResult) const
return MakeFrameName("TableRowGroup", aResult);
}
NS_IMETHODIMP
nsTableRowGroupFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
if (aResult) {
PRUint32 sum = sizeof(*this);
// XXX write me
*aResult = sum;
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
}

Some files were not shown because too many files have changed in this diff Show More