зеркало из https://github.com/mozilla/gecko-dev.git
Removed nsIInlineReflow and folded it into nsIHTMLReflow
This commit is contained in:
Родитель
01ce12892a
Коммит
b5b596a60a
|
@ -19,7 +19,6 @@
|
|||
#include "nsHTMLParts.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
|
@ -27,24 +26,24 @@
|
|||
#include "nsIFontMetrics.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
|
||||
class BRFrame : public nsFrame, public nsIInlineReflow {
|
||||
class BRFrame : public nsFrame {
|
||||
public:
|
||||
BRFrame(nsIContent* aContent, nsIFrame* aParentFrame);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame
|
||||
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
// nsIInlineReflow
|
||||
// nsIHTMLReflow
|
||||
#if 0
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
#endif
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
protected:
|
||||
virtual ~BRFrame();
|
||||
|
@ -72,20 +71,6 @@ BRFrame::~BRFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BRFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIInlineReflowIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIInlineReflow*)this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
BRFrame::Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
@ -100,6 +85,7 @@ BRFrame::Paint(nsIPresContext& aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
BRFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
|
@ -107,11 +93,13 @@ BRFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
|||
aLineLayout.EndTextRun();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
BRFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
BRFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
if (nsnull != aMetrics.maxElementSize) {
|
||||
aMetrics.maxElementSize->width = 0;
|
||||
|
@ -121,15 +109,18 @@ BRFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
aMetrics.width = 0;
|
||||
aMetrics.ascent = 0;
|
||||
aMetrics.descent = 0;
|
||||
aLineLayout.SetBRFrame(this);
|
||||
NS_ASSERTION(nsnull != aReflowState.lineLayout, "no line layout");
|
||||
aReflowState.lineLayout->SetBRFrame(this);
|
||||
|
||||
// Return our inline reflow status
|
||||
// Return our reflow status
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
PRUint32 breakType = display->mBreakType;
|
||||
if (NS_STYLE_CLEAR_NONE == breakType) {
|
||||
breakType = NS_STYLE_CLEAR_LINE;
|
||||
}
|
||||
return NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER |
|
||||
|
||||
aStatus = NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER |
|
||||
NS_INLINE_MAKE_BREAK_TYPE(breakType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -313,7 +313,9 @@ public:
|
|||
|
||||
nsresult StyleChangedReflow(nsBlockReflowState& aState);
|
||||
|
||||
#if 0
|
||||
nsresult FindTextRuns(nsBlockReflowState& aState);
|
||||
#endif
|
||||
|
||||
nsresult ChildIncrementalReflow(nsBlockReflowState& aState);
|
||||
|
||||
|
@ -326,11 +328,11 @@ public:
|
|||
|
||||
PRBool ReflowLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus& aReflowResult);
|
||||
nsReflowStatus& aReflowResult);
|
||||
|
||||
PRBool PlaceLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus aReflowStatus);
|
||||
nsReflowStatus aReflowStatus);
|
||||
|
||||
void FindFloaters(LineData* aLine);
|
||||
|
||||
|
@ -339,7 +341,7 @@ public:
|
|||
PRBool ReflowInlineFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
nsresult SplitLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
|
@ -349,13 +351,13 @@ public:
|
|||
PRBool ReflowBlockFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
PRBool PullFrame(nsBlockReflowState& aState,
|
||||
LineData* aToLine,
|
||||
LineData** aFromList,
|
||||
PRBool aUpdateGeometricParent,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
void PushLines(nsBlockReflowState& aState);
|
||||
|
||||
|
@ -401,14 +403,11 @@ public:
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class BulletFrame : public nsFrame, private nsIInlineReflow {
|
||||
class BulletFrame : public nsFrame {
|
||||
public:
|
||||
BulletFrame(nsIContent* aContent, nsIFrame* aParentFrame);
|
||||
virtual ~BulletFrame();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame
|
||||
NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext);
|
||||
NS_IMETHOD Paint(nsIPresContext &aCX,
|
||||
|
@ -417,12 +416,15 @@ public:
|
|||
NS_IMETHOD ListTag(FILE* out) const;
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
||||
|
||||
// nsIInlineReflow
|
||||
// nsIHTMLReflow
|
||||
#if 0
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
#endif
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
void SetListItemOrdinal(nsBlockReflowState& aBlockState);
|
||||
|
||||
|
@ -448,20 +450,6 @@ BulletFrame::~BulletFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIInlineReflowIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIInlineReflow*)this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::DeleteFrame(nsIPresContext& aPresContext)
|
||||
{
|
||||
|
@ -840,12 +828,13 @@ BulletFrame::GetDesiredSize(nsIPresContext* aCX,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
BulletFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
// Get the base size
|
||||
GetDesiredSize(&aLineLayout.mPresContext, aReflowState, aMetrics);
|
||||
GetDesiredSize(&aPresContext, aReflowState, aMetrics);
|
||||
|
||||
// Add in the border and padding; split the top/bottom between the
|
||||
// ascent and descent to make things look nice
|
||||
|
@ -862,9 +851,11 @@ BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
aMetrics.maxElementSize->width = aMetrics.width;
|
||||
aMetrics.maxElementSize->height = aMetrics.height;
|
||||
}
|
||||
return NS_FRAME_COMPLETE;
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
|
@ -872,6 +863,7 @@ BulletFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
|||
aLineLayout.EndTextRun();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
@ -2105,11 +2097,13 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext,
|
|||
nsresult
|
||||
nsBlockFrame::InitialReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
#if 0
|
||||
// Generate text-run information
|
||||
nsresult rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Reflow everything
|
||||
aState.GetAvailableSpace();
|
||||
|
@ -2163,11 +2157,13 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
// impacted line will be marked dirty
|
||||
AppendNewFrames(aState.mPresContext, firstAppendedFrame);
|
||||
|
||||
#if 0
|
||||
// Generate text-run information
|
||||
rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Recover our reflow state
|
||||
LineData* firstDirtyLine = mLines;
|
||||
|
@ -2221,6 +2217,7 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
return ReflowLinesAt(aState, firstDirtyLine);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// XXX keep the text-run data in the first-in-flow of the block
|
||||
nsresult
|
||||
nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
||||
|
@ -2268,6 +2265,7 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState)
|
||||
|
@ -2432,12 +2430,14 @@ nsBlockFrame::FrameRemovedReflow(nsBlockReflowState& aState)
|
|||
nsresult
|
||||
nsBlockFrame::ChildIncrementalReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
#if 0
|
||||
// Generate text-run information; this will also "fluff out" any
|
||||
// inline children's frame tree.
|
||||
nsresult rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// XXX temporary
|
||||
aState.GetAvailableSpace();
|
||||
|
@ -2475,7 +2475,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
{
|
||||
// Reflow the lines that are already ours
|
||||
while (nsnull != aLine) {
|
||||
nsInlineReflowStatus rs;
|
||||
nsReflowStatus rs;
|
||||
if (!ReflowLine(aState, aLine, rs)) {
|
||||
if (NS_IS_REFLOW_ERROR(rs)) {
|
||||
return nsresult(rs);
|
||||
|
@ -2543,7 +2543,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
|
||||
// Now reflow it and any lines that it makes during it's reflow.
|
||||
while (nsnull != aLine) {
|
||||
nsInlineReflowStatus rs;
|
||||
nsReflowStatus rs;
|
||||
if (!ReflowLine(aState, aLine, rs)) {
|
||||
if (NS_IS_REFLOW_ERROR(rs)) {
|
||||
return nsresult(rs);
|
||||
|
@ -2566,7 +2566,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
PRBool
|
||||
nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("nsBlockFrame::ReflowLine: line=%p", aLine));
|
||||
|
@ -2868,7 +2868,7 @@ PRBool
|
|||
nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
NS_PRECONDITION(0 == aState.mLineLayout.GetPlacedFrames(),
|
||||
"non-empty line with a block");
|
||||
|
@ -2993,7 +2993,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
aFrame,
|
||||
nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3003,7 +3003,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
(LINE_IS_BLOCK |
|
||||
LINE_LAST_CONTENT_IS_COMPLETE));
|
||||
if (nsnull == line) {
|
||||
aReflowResult = nsInlineReflowStatus(NS_ERROR_OUT_OF_MEMORY);
|
||||
aReflowResult = NS_ERROR_OUT_OF_MEMORY;
|
||||
return PR_FALSE;
|
||||
}
|
||||
line->mNext = aLine->mNext;
|
||||
|
@ -3031,7 +3031,7 @@ PRBool
|
|||
nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIFrame* nextInFlow;
|
||||
|
@ -3064,7 +3064,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
rv = nsHTMLContainerFrame::CreateNextInFlow(aState.mPresContext,
|
||||
this, aFrame, nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3088,7 +3088,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
this, aFrame,
|
||||
nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3106,7 +3106,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
// Split line since we aren't going to keep going
|
||||
rv = SplitLine(aState, aLine, aFrame, lineWasComplete);
|
||||
if (NS_IS_REFLOW_ERROR(rv)) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -3167,7 +3167,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState,
|
|||
LineData* aLine,
|
||||
LineData** aFromList,
|
||||
PRBool aUpdateGeometricParent,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
LineData* fromLine = *aFromList;
|
||||
NS_ASSERTION(nsnull != fromLine, "bad line to pull from");
|
||||
|
@ -3250,7 +3250,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState,
|
|||
PRBool
|
||||
nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus aReflowStatus)
|
||||
nsReflowStatus aReflowStatus)
|
||||
{
|
||||
// Align the children. This also determines the actual height and
|
||||
// width of the line.
|
||||
|
@ -3352,13 +3352,14 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||
nsSize availSize;
|
||||
availSize.width = NS_UNCONSTRAINEDSIZE;
|
||||
availSize.height = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState reflowState(mBullet, aState, availSize);
|
||||
nsHTMLReflowState reflowState(mBullet, aState, availSize, &aState.mLineLayout);
|
||||
nsHTMLReflowMetrics metrics(nsnull);
|
||||
nsIInlineReflow* iir;
|
||||
if (NS_OK == mBullet->QueryInterface(kIInlineReflowIID, (void**) &iir)) {
|
||||
mBullet->WillReflow(aState.mPresContext);
|
||||
iir->InlineReflow(aState.mLineLayout, metrics, reflowState);
|
||||
mBullet->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED);
|
||||
nsIHTMLReflow* htmlReflow;
|
||||
if (NS_OK == mBullet->QueryInterface(kIHTMLReflowIID, (void**) &htmlReflow)) {
|
||||
nsReflowStatus status;
|
||||
htmlReflow->WillReflow(aState.mPresContext);
|
||||
htmlReflow->Reflow(aState.mPresContext, metrics, reflowState, status);
|
||||
htmlReflow->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED);
|
||||
}
|
||||
|
||||
// Place the bullet now
|
||||
|
|
|
@ -313,7 +313,9 @@ public:
|
|||
|
||||
nsresult StyleChangedReflow(nsBlockReflowState& aState);
|
||||
|
||||
#if 0
|
||||
nsresult FindTextRuns(nsBlockReflowState& aState);
|
||||
#endif
|
||||
|
||||
nsresult ChildIncrementalReflow(nsBlockReflowState& aState);
|
||||
|
||||
|
@ -326,11 +328,11 @@ public:
|
|||
|
||||
PRBool ReflowLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus& aReflowResult);
|
||||
nsReflowStatus& aReflowResult);
|
||||
|
||||
PRBool PlaceLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus aReflowStatus);
|
||||
nsReflowStatus aReflowStatus);
|
||||
|
||||
void FindFloaters(LineData* aLine);
|
||||
|
||||
|
@ -339,7 +341,7 @@ public:
|
|||
PRBool ReflowInlineFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
nsresult SplitLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
|
@ -349,13 +351,13 @@ public:
|
|||
PRBool ReflowBlockFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
PRBool PullFrame(nsBlockReflowState& aState,
|
||||
LineData* aToLine,
|
||||
LineData** aFromList,
|
||||
PRBool aUpdateGeometricParent,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
void PushLines(nsBlockReflowState& aState);
|
||||
|
||||
|
@ -401,14 +403,11 @@ public:
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class BulletFrame : public nsFrame, private nsIInlineReflow {
|
||||
class BulletFrame : public nsFrame {
|
||||
public:
|
||||
BulletFrame(nsIContent* aContent, nsIFrame* aParentFrame);
|
||||
virtual ~BulletFrame();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame
|
||||
NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext);
|
||||
NS_IMETHOD Paint(nsIPresContext &aCX,
|
||||
|
@ -417,12 +416,15 @@ public:
|
|||
NS_IMETHOD ListTag(FILE* out) const;
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
||||
|
||||
// nsIInlineReflow
|
||||
// nsIHTMLReflow
|
||||
#if 0
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
#endif
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
void SetListItemOrdinal(nsBlockReflowState& aBlockState);
|
||||
|
||||
|
@ -448,20 +450,6 @@ BulletFrame::~BulletFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIInlineReflowIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIInlineReflow*)this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::DeleteFrame(nsIPresContext& aPresContext)
|
||||
{
|
||||
|
@ -840,12 +828,13 @@ BulletFrame::GetDesiredSize(nsIPresContext* aCX,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
BulletFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
// Get the base size
|
||||
GetDesiredSize(&aLineLayout.mPresContext, aReflowState, aMetrics);
|
||||
GetDesiredSize(&aPresContext, aReflowState, aMetrics);
|
||||
|
||||
// Add in the border and padding; split the top/bottom between the
|
||||
// ascent and descent to make things look nice
|
||||
|
@ -862,9 +851,11 @@ BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
aMetrics.maxElementSize->width = aMetrics.width;
|
||||
aMetrics.maxElementSize->height = aMetrics.height;
|
||||
}
|
||||
return NS_FRAME_COMPLETE;
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
|
@ -872,6 +863,7 @@ BulletFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
|||
aLineLayout.EndTextRun();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
@ -2105,11 +2097,13 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext,
|
|||
nsresult
|
||||
nsBlockFrame::InitialReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
#if 0
|
||||
// Generate text-run information
|
||||
nsresult rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Reflow everything
|
||||
aState.GetAvailableSpace();
|
||||
|
@ -2163,11 +2157,13 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
// impacted line will be marked dirty
|
||||
AppendNewFrames(aState.mPresContext, firstAppendedFrame);
|
||||
|
||||
#if 0
|
||||
// Generate text-run information
|
||||
rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Recover our reflow state
|
||||
LineData* firstDirtyLine = mLines;
|
||||
|
@ -2221,6 +2217,7 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
return ReflowLinesAt(aState, firstDirtyLine);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// XXX keep the text-run data in the first-in-flow of the block
|
||||
nsresult
|
||||
nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
||||
|
@ -2268,6 +2265,7 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState)
|
||||
|
@ -2432,12 +2430,14 @@ nsBlockFrame::FrameRemovedReflow(nsBlockReflowState& aState)
|
|||
nsresult
|
||||
nsBlockFrame::ChildIncrementalReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
#if 0
|
||||
// Generate text-run information; this will also "fluff out" any
|
||||
// inline children's frame tree.
|
||||
nsresult rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// XXX temporary
|
||||
aState.GetAvailableSpace();
|
||||
|
@ -2475,7 +2475,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
{
|
||||
// Reflow the lines that are already ours
|
||||
while (nsnull != aLine) {
|
||||
nsInlineReflowStatus rs;
|
||||
nsReflowStatus rs;
|
||||
if (!ReflowLine(aState, aLine, rs)) {
|
||||
if (NS_IS_REFLOW_ERROR(rs)) {
|
||||
return nsresult(rs);
|
||||
|
@ -2543,7 +2543,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
|
||||
// Now reflow it and any lines that it makes during it's reflow.
|
||||
while (nsnull != aLine) {
|
||||
nsInlineReflowStatus rs;
|
||||
nsReflowStatus rs;
|
||||
if (!ReflowLine(aState, aLine, rs)) {
|
||||
if (NS_IS_REFLOW_ERROR(rs)) {
|
||||
return nsresult(rs);
|
||||
|
@ -2566,7 +2566,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
PRBool
|
||||
nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("nsBlockFrame::ReflowLine: line=%p", aLine));
|
||||
|
@ -2868,7 +2868,7 @@ PRBool
|
|||
nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
NS_PRECONDITION(0 == aState.mLineLayout.GetPlacedFrames(),
|
||||
"non-empty line with a block");
|
||||
|
@ -2993,7 +2993,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
aFrame,
|
||||
nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3003,7 +3003,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
(LINE_IS_BLOCK |
|
||||
LINE_LAST_CONTENT_IS_COMPLETE));
|
||||
if (nsnull == line) {
|
||||
aReflowResult = nsInlineReflowStatus(NS_ERROR_OUT_OF_MEMORY);
|
||||
aReflowResult = NS_ERROR_OUT_OF_MEMORY;
|
||||
return PR_FALSE;
|
||||
}
|
||||
line->mNext = aLine->mNext;
|
||||
|
@ -3031,7 +3031,7 @@ PRBool
|
|||
nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIFrame* nextInFlow;
|
||||
|
@ -3064,7 +3064,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
rv = nsHTMLContainerFrame::CreateNextInFlow(aState.mPresContext,
|
||||
this, aFrame, nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3088,7 +3088,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
this, aFrame,
|
||||
nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3106,7 +3106,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
// Split line since we aren't going to keep going
|
||||
rv = SplitLine(aState, aLine, aFrame, lineWasComplete);
|
||||
if (NS_IS_REFLOW_ERROR(rv)) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -3167,7 +3167,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState,
|
|||
LineData* aLine,
|
||||
LineData** aFromList,
|
||||
PRBool aUpdateGeometricParent,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
LineData* fromLine = *aFromList;
|
||||
NS_ASSERTION(nsnull != fromLine, "bad line to pull from");
|
||||
|
@ -3250,7 +3250,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState,
|
|||
PRBool
|
||||
nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus aReflowStatus)
|
||||
nsReflowStatus aReflowStatus)
|
||||
{
|
||||
// Align the children. This also determines the actual height and
|
||||
// width of the line.
|
||||
|
@ -3352,13 +3352,14 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||
nsSize availSize;
|
||||
availSize.width = NS_UNCONSTRAINEDSIZE;
|
||||
availSize.height = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState reflowState(mBullet, aState, availSize);
|
||||
nsHTMLReflowState reflowState(mBullet, aState, availSize, &aState.mLineLayout);
|
||||
nsHTMLReflowMetrics metrics(nsnull);
|
||||
nsIInlineReflow* iir;
|
||||
if (NS_OK == mBullet->QueryInterface(kIInlineReflowIID, (void**) &iir)) {
|
||||
mBullet->WillReflow(aState.mPresContext);
|
||||
iir->InlineReflow(aState.mLineLayout, metrics, reflowState);
|
||||
mBullet->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED);
|
||||
nsIHTMLReflow* htmlReflow;
|
||||
if (NS_OK == mBullet->QueryInterface(kIHTMLReflowIID, (void**) &htmlReflow)) {
|
||||
nsReflowStatus status;
|
||||
htmlReflow->WillReflow(aState.mPresContext);
|
||||
htmlReflow->Reflow(aState.mPresContext, metrics, reflowState, status);
|
||||
htmlReflow->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED);
|
||||
}
|
||||
|
||||
// Place the bullet now
|
||||
|
|
|
@ -313,7 +313,9 @@ public:
|
|||
|
||||
nsresult StyleChangedReflow(nsBlockReflowState& aState);
|
||||
|
||||
#if 0
|
||||
nsresult FindTextRuns(nsBlockReflowState& aState);
|
||||
#endif
|
||||
|
||||
nsresult ChildIncrementalReflow(nsBlockReflowState& aState);
|
||||
|
||||
|
@ -326,11 +328,11 @@ public:
|
|||
|
||||
PRBool ReflowLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus& aReflowResult);
|
||||
nsReflowStatus& aReflowResult);
|
||||
|
||||
PRBool PlaceLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus aReflowStatus);
|
||||
nsReflowStatus aReflowStatus);
|
||||
|
||||
void FindFloaters(LineData* aLine);
|
||||
|
||||
|
@ -339,7 +341,7 @@ public:
|
|||
PRBool ReflowInlineFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
nsresult SplitLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
|
@ -349,13 +351,13 @@ public:
|
|||
PRBool ReflowBlockFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
PRBool PullFrame(nsBlockReflowState& aState,
|
||||
LineData* aToLine,
|
||||
LineData** aFromList,
|
||||
PRBool aUpdateGeometricParent,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
void PushLines(nsBlockReflowState& aState);
|
||||
|
||||
|
@ -401,14 +403,11 @@ public:
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class BulletFrame : public nsFrame, private nsIInlineReflow {
|
||||
class BulletFrame : public nsFrame {
|
||||
public:
|
||||
BulletFrame(nsIContent* aContent, nsIFrame* aParentFrame);
|
||||
virtual ~BulletFrame();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame
|
||||
NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext);
|
||||
NS_IMETHOD Paint(nsIPresContext &aCX,
|
||||
|
@ -417,12 +416,15 @@ public:
|
|||
NS_IMETHOD ListTag(FILE* out) const;
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
||||
|
||||
// nsIInlineReflow
|
||||
// nsIHTMLReflow
|
||||
#if 0
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
#endif
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
void SetListItemOrdinal(nsBlockReflowState& aBlockState);
|
||||
|
||||
|
@ -448,20 +450,6 @@ BulletFrame::~BulletFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIInlineReflowIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIInlineReflow*)this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::DeleteFrame(nsIPresContext& aPresContext)
|
||||
{
|
||||
|
@ -840,12 +828,13 @@ BulletFrame::GetDesiredSize(nsIPresContext* aCX,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
BulletFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
// Get the base size
|
||||
GetDesiredSize(&aLineLayout.mPresContext, aReflowState, aMetrics);
|
||||
GetDesiredSize(&aPresContext, aReflowState, aMetrics);
|
||||
|
||||
// Add in the border and padding; split the top/bottom between the
|
||||
// ascent and descent to make things look nice
|
||||
|
@ -862,9 +851,11 @@ BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
aMetrics.maxElementSize->width = aMetrics.width;
|
||||
aMetrics.maxElementSize->height = aMetrics.height;
|
||||
}
|
||||
return NS_FRAME_COMPLETE;
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
|
@ -872,6 +863,7 @@ BulletFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
|||
aLineLayout.EndTextRun();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
@ -2105,11 +2097,13 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext,
|
|||
nsresult
|
||||
nsBlockFrame::InitialReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
#if 0
|
||||
// Generate text-run information
|
||||
nsresult rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Reflow everything
|
||||
aState.GetAvailableSpace();
|
||||
|
@ -2163,11 +2157,13 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
// impacted line will be marked dirty
|
||||
AppendNewFrames(aState.mPresContext, firstAppendedFrame);
|
||||
|
||||
#if 0
|
||||
// Generate text-run information
|
||||
rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Recover our reflow state
|
||||
LineData* firstDirtyLine = mLines;
|
||||
|
@ -2221,6 +2217,7 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
return ReflowLinesAt(aState, firstDirtyLine);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// XXX keep the text-run data in the first-in-flow of the block
|
||||
nsresult
|
||||
nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
||||
|
@ -2268,6 +2265,7 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState)
|
||||
|
@ -2432,12 +2430,14 @@ nsBlockFrame::FrameRemovedReflow(nsBlockReflowState& aState)
|
|||
nsresult
|
||||
nsBlockFrame::ChildIncrementalReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
#if 0
|
||||
// Generate text-run information; this will also "fluff out" any
|
||||
// inline children's frame tree.
|
||||
nsresult rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// XXX temporary
|
||||
aState.GetAvailableSpace();
|
||||
|
@ -2475,7 +2475,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
{
|
||||
// Reflow the lines that are already ours
|
||||
while (nsnull != aLine) {
|
||||
nsInlineReflowStatus rs;
|
||||
nsReflowStatus rs;
|
||||
if (!ReflowLine(aState, aLine, rs)) {
|
||||
if (NS_IS_REFLOW_ERROR(rs)) {
|
||||
return nsresult(rs);
|
||||
|
@ -2543,7 +2543,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
|
||||
// Now reflow it and any lines that it makes during it's reflow.
|
||||
while (nsnull != aLine) {
|
||||
nsInlineReflowStatus rs;
|
||||
nsReflowStatus rs;
|
||||
if (!ReflowLine(aState, aLine, rs)) {
|
||||
if (NS_IS_REFLOW_ERROR(rs)) {
|
||||
return nsresult(rs);
|
||||
|
@ -2566,7 +2566,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
PRBool
|
||||
nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("nsBlockFrame::ReflowLine: line=%p", aLine));
|
||||
|
@ -2868,7 +2868,7 @@ PRBool
|
|||
nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
NS_PRECONDITION(0 == aState.mLineLayout.GetPlacedFrames(),
|
||||
"non-empty line with a block");
|
||||
|
@ -2993,7 +2993,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
aFrame,
|
||||
nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3003,7 +3003,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
(LINE_IS_BLOCK |
|
||||
LINE_LAST_CONTENT_IS_COMPLETE));
|
||||
if (nsnull == line) {
|
||||
aReflowResult = nsInlineReflowStatus(NS_ERROR_OUT_OF_MEMORY);
|
||||
aReflowResult = NS_ERROR_OUT_OF_MEMORY;
|
||||
return PR_FALSE;
|
||||
}
|
||||
line->mNext = aLine->mNext;
|
||||
|
@ -3031,7 +3031,7 @@ PRBool
|
|||
nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIFrame* nextInFlow;
|
||||
|
@ -3064,7 +3064,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
rv = nsHTMLContainerFrame::CreateNextInFlow(aState.mPresContext,
|
||||
this, aFrame, nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3088,7 +3088,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
this, aFrame,
|
||||
nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3106,7 +3106,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
// Split line since we aren't going to keep going
|
||||
rv = SplitLine(aState, aLine, aFrame, lineWasComplete);
|
||||
if (NS_IS_REFLOW_ERROR(rv)) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -3167,7 +3167,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState,
|
|||
LineData* aLine,
|
||||
LineData** aFromList,
|
||||
PRBool aUpdateGeometricParent,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
LineData* fromLine = *aFromList;
|
||||
NS_ASSERTION(nsnull != fromLine, "bad line to pull from");
|
||||
|
@ -3250,7 +3250,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState,
|
|||
PRBool
|
||||
nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus aReflowStatus)
|
||||
nsReflowStatus aReflowStatus)
|
||||
{
|
||||
// Align the children. This also determines the actual height and
|
||||
// width of the line.
|
||||
|
@ -3352,13 +3352,14 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||
nsSize availSize;
|
||||
availSize.width = NS_UNCONSTRAINEDSIZE;
|
||||
availSize.height = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState reflowState(mBullet, aState, availSize);
|
||||
nsHTMLReflowState reflowState(mBullet, aState, availSize, &aState.mLineLayout);
|
||||
nsHTMLReflowMetrics metrics(nsnull);
|
||||
nsIInlineReflow* iir;
|
||||
if (NS_OK == mBullet->QueryInterface(kIInlineReflowIID, (void**) &iir)) {
|
||||
mBullet->WillReflow(aState.mPresContext);
|
||||
iir->InlineReflow(aState.mLineLayout, metrics, reflowState);
|
||||
mBullet->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED);
|
||||
nsIHTMLReflow* htmlReflow;
|
||||
if (NS_OK == mBullet->QueryInterface(kIHTMLReflowIID, (void**) &htmlReflow)) {
|
||||
nsReflowStatus status;
|
||||
htmlReflow->WillReflow(aState.mPresContext);
|
||||
htmlReflow->Reflow(aState.mPresContext, metrics, reflowState, status);
|
||||
htmlReflow->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED);
|
||||
}
|
||||
|
||||
// Place the bullet now
|
||||
|
|
|
@ -54,16 +54,12 @@ nsInlineReflowState::~nsInlineReflowState()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class nsInlineFrame : public nsHTMLContainerFrame,
|
||||
public nsIInlineReflow
|
||||
class nsInlineFrame : public nsHTMLContainerFrame
|
||||
{
|
||||
public:
|
||||
nsInlineFrame(nsIContent* aContent, nsIFrame* aParent);
|
||||
virtual ~nsInlineFrame();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame
|
||||
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList);
|
||||
NS_IMETHOD CreateContinuingFrame(nsIPresContext& aCX,
|
||||
|
@ -71,12 +67,15 @@ public:
|
|||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame*& aContinuingFrame);
|
||||
|
||||
// nsIInlineReflow
|
||||
// nsIHTMLReflow
|
||||
#if 0
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
#endif
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
virtual PRIntn GetSkipSides() const;
|
||||
|
||||
|
@ -93,8 +92,8 @@ public:
|
|||
nsresult FrameAppendedReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow);
|
||||
|
||||
nsresult FrameRemovedReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow);
|
||||
nsReflowStatus FrameRemovedReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow);
|
||||
|
||||
nsresult ChildIncrementalReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow);
|
||||
|
@ -108,15 +107,15 @@ public:
|
|||
|
||||
PRBool ReflowMapped(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow,
|
||||
nsInlineReflowStatus& aReflowStatus);
|
||||
nsReflowStatus& aReflowStatus);
|
||||
|
||||
PRBool ReflowFrame(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aReflowStatus);
|
||||
nsReflowStatus& aReflowStatus);
|
||||
|
||||
nsInlineReflowStatus PullUpChildren(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow);
|
||||
nsReflowStatus PullUpChildren(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow);
|
||||
|
||||
nsIFrame* PullOneChild(nsInlineFrame* aNextInFlow,
|
||||
nsIFrame* aLastChild);
|
||||
|
@ -159,20 +158,6 @@ nsInlineFrame::~nsInlineFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInlineFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIInlineReflowIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIInlineReflow*)this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
|
||||
}
|
||||
|
||||
PRIntn
|
||||
nsInlineFrame::GetSkipSides() const
|
||||
{
|
||||
|
@ -249,7 +234,7 @@ nsInlineFrame::CreateContinuingFrame(nsIPresContext& aCX,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
|
@ -284,6 +269,7 @@ nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
|||
("exit nsInlineFrame::FindTextRuns rv=%x", rv));
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
nsInlineFrame::InsertNewFrame(nsIPresContext& aPresContext,
|
||||
|
@ -316,9 +302,10 @@ nsInlineFrame::InsertNewFrame(nsIPresContext& aPresContext,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
nsInlineFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("enter nsInlineFrame::InlineReflow maxSize=%d,%d reason=%d nif=%p",
|
||||
|
@ -335,7 +322,7 @@ nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
}
|
||||
|
||||
// Prepare for reflow
|
||||
nsInlineReflowState state(aLineLayout.mPresContext, aReflowState, aMetrics);
|
||||
nsInlineReflowState state(aPresContext, aReflowState, aMetrics);
|
||||
|
||||
// If we're constrained adjust the available size so it excludes space
|
||||
// needed for border/padding
|
||||
|
@ -351,21 +338,22 @@ nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
|
||||
|
||||
// Prepare inline reflow engine
|
||||
nsInlineReflow inlineReflow(aLineLayout, state, this);
|
||||
NS_ASSERTION(nsnull != aReflowState.lineLayout, "no line layout");
|
||||
nsInlineReflow inlineReflow(*aReflowState.lineLayout, state, this);
|
||||
inlineReflow.Init(state.mBorderPadding.left, state.mBorderPadding.top,
|
||||
width, height);
|
||||
|
||||
// ListTag(stdout); printf(": enter isMarginRoot=%c\n", state.mIsMarginRoot?'T':'F');
|
||||
// Now translate in by our border and padding
|
||||
aLineLayout.mSpaceManager->Translate(state.mBorderPadding.left,
|
||||
NS_ASSERTION(nsnull != aReflowState.spaceManager, "no space manager");
|
||||
aReflowState.spaceManager->Translate(state.mBorderPadding.left,
|
||||
state.mBorderPadding.top);
|
||||
|
||||
// Based on the type of reflow, switch out to the appropriate
|
||||
// routine.
|
||||
nsresult rv = NS_OK;
|
||||
if (eReflowReason_Initial == state.reason) {
|
||||
DrainOverflowLists();
|
||||
rv = InitialReflow(state, inlineReflow);
|
||||
aStatus = InitialReflow(state, inlineReflow);
|
||||
mState &= ~NS_FRAME_FIRST_REFLOW;
|
||||
}
|
||||
else if (eReflowReason_Incremental == state.reason) {
|
||||
|
@ -385,7 +373,7 @@ nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
nsIFrame* prevSibling;
|
||||
switch (type) {
|
||||
case nsIReflowCommand::FrameAppended:
|
||||
rv = FrameAppendedReflow(state, inlineReflow);
|
||||
aStatus = FrameAppendedReflow(state, inlineReflow);
|
||||
break;
|
||||
|
||||
case nsIReflowCommand::FrameInserted:
|
||||
|
@ -394,16 +382,16 @@ nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
state.reflowCommand->GetPrevSiblingFrame(prevSibling);
|
||||
InsertNewFrame(state.mPresContext, newFrame, prevSibling);
|
||||
// XXX For now map into full reflow...
|
||||
rv = ResizeReflow(state, inlineReflow);
|
||||
aStatus = ResizeReflow(state, inlineReflow);
|
||||
break;
|
||||
|
||||
case nsIReflowCommand::FrameRemoved:
|
||||
rv = FrameRemovedReflow(state, inlineReflow);
|
||||
aStatus = FrameRemovedReflow(state, inlineReflow);
|
||||
break;
|
||||
|
||||
default:
|
||||
// XXX For now map the other incremental operations into full reflows
|
||||
rv = ResizeReflow(state, inlineReflow);
|
||||
aStatus = ResizeReflow(state, inlineReflow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -412,24 +400,24 @@ nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
state.reflowCommand->GetNext(state.mNextRCFrame);
|
||||
|
||||
// Continue the reflow
|
||||
rv = ChildIncrementalReflow(state, inlineReflow);
|
||||
aStatus = ChildIncrementalReflow(state, inlineReflow);
|
||||
}
|
||||
}
|
||||
else if (eReflowReason_Resize == state.reason) {
|
||||
DrainOverflowLists();
|
||||
rv = ResizeReflow(state, inlineReflow);
|
||||
aStatus = ResizeReflow(state, inlineReflow);
|
||||
}
|
||||
ComputeFinalSize(state, inlineReflow, aMetrics);
|
||||
// ListTag(stdout); printf(": exit carriedMargins=%d,%d\n", aMetrics.mCarriedOutTopMargin, aMetrics.mCarriedOutBottomMargin);
|
||||
|
||||
// Now translate in by our border and padding
|
||||
aLineLayout.mSpaceManager->Translate(-state.mBorderPadding.left,
|
||||
aReflowState.spaceManager->Translate(-state.mBorderPadding.left,
|
||||
-state.mBorderPadding.top);
|
||||
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("exit nsInlineFrame::InlineReflow size=%d,%d rv=%x nif=%p",
|
||||
aMetrics.width, aMetrics.height, rv, mNextInFlow));
|
||||
return rv;
|
||||
("exit nsInlineFrame::InlineReflow size=%d,%d status=%x nif=%p",
|
||||
aMetrics.width, aMetrics.height, aStatus, mNextInFlow));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX factor this (into nsFrameReflowState?) so that both block and
|
||||
|
@ -573,13 +561,13 @@ nsInlineFrame::ComputeFinalSize(nsInlineReflowState& aState,
|
|||
}
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
nsInlineFrame::InitialReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow)
|
||||
{
|
||||
NS_PRECONDITION(nsnull == mNextInFlow, "bad frame-appended-reflow");
|
||||
|
||||
nsInlineReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
nsReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
if (nsnull != mFirstChild) {
|
||||
if (!ReflowMapped(aState, aInlineReflow, rs)) {
|
||||
return rs;
|
||||
|
@ -588,7 +576,7 @@ nsInlineFrame::InitialReflow(nsInlineReflowState& aState,
|
|||
return rs;
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
nsInlineFrame::FrameAppendedReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow)
|
||||
{
|
||||
|
@ -601,7 +589,7 @@ nsInlineFrame::FrameAppendedReflow(nsInlineReflowState& aState,
|
|||
// Add the new frames
|
||||
AppendNewFrames(aState.mPresContext, firstAppendedFrame);
|
||||
|
||||
nsInlineReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
nsReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
if (nsnull != mFirstChild) {
|
||||
if (!ReflowMapped(aState, aInlineReflow, rs)) {
|
||||
return rs;
|
||||
|
@ -610,7 +598,7 @@ nsInlineFrame::FrameAppendedReflow(nsInlineReflowState& aState,
|
|||
return rs;
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
nsInlineFrame::FrameRemovedReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow)
|
||||
{
|
||||
|
@ -666,7 +654,7 @@ nsInlineFrame::FrameRemovedReflow(nsInlineReflowState& aState,
|
|||
return ResizeReflow(aState, aInlineReflow);
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
nsInlineFrame::ChildIncrementalReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow)
|
||||
{
|
||||
|
@ -674,11 +662,11 @@ nsInlineFrame::ChildIncrementalReflow(nsInlineReflowState& aState,
|
|||
return ResizeReflow(aState, aInlineReflow);
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
nsInlineFrame::ResizeReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow)
|
||||
{
|
||||
nsInlineReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
nsReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
if (nsnull != mFirstChild) {
|
||||
if (!ReflowMapped(aState, aInlineReflow, rs)) {
|
||||
return rs;
|
||||
|
@ -695,7 +683,7 @@ nsInlineFrame::ResizeReflow(nsInlineReflowState& aState,
|
|||
PRBool
|
||||
nsInlineFrame::ReflowMapped(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow,
|
||||
nsInlineReflowStatus& aReflowStatus)
|
||||
nsReflowStatus& aReflowStatus)
|
||||
{
|
||||
PRBool keepGoing = PR_TRUE;
|
||||
aState.mLastChild = nsnull;
|
||||
|
@ -711,11 +699,11 @@ nsInlineFrame::ReflowMapped(nsInlineReflowState& aState,
|
|||
return keepGoing;
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
nsInlineFrame::PullUpChildren(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow)
|
||||
{
|
||||
nsInlineReflowStatus reflowStatus = NS_FRAME_COMPLETE;
|
||||
nsReflowStatus reflowStatus = NS_FRAME_COMPLETE;
|
||||
nsInlineFrame* nextInFlow = (nsInlineFrame*) mNextInFlow;
|
||||
while (nsnull != nextInFlow) {
|
||||
// Get child from our next-in-flow
|
||||
|
@ -751,7 +739,7 @@ PRBool
|
|||
nsInlineFrame::ReflowFrame(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aReflowStatus)
|
||||
nsReflowStatus& aReflowStatus)
|
||||
{
|
||||
aInlineReflow.SetIsFirstChild(aFrame == mFirstChild);
|
||||
aReflowStatus = aInlineReflow.ReflowFrame(aFrame);
|
||||
|
@ -812,7 +800,7 @@ nsInlineFrame::ReflowFrame(nsInlineReflowState& aState,
|
|||
nsresult rv;
|
||||
rv = CreateNextInFlow(aState.mPresContext, this, aFrame, newFrame);
|
||||
if (NS_OK != rv) {
|
||||
aReflowStatus = nsInlineReflowStatus(rv);
|
||||
// XXX RETURN ERROR STATUS...
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,21 +56,7 @@ nsPlaceholderFrame::~nsPlaceholderFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlaceholderFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIInlineReflowIID)) {
|
||||
nsIInlineReflow* tmp = this;
|
||||
*aInstancePtrResult = (void*) tmp;
|
||||
return NS_OK;
|
||||
}
|
||||
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
|
||||
}
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
nsPlaceholderFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
|
@ -78,14 +64,14 @@ nsPlaceholderFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
|||
aLineLayout.EndTextRun();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlaceholderFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
nsPlaceholderFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
nsIPresContext& presContext = aLineLayout.mPresContext;
|
||||
|
||||
// Get the floater container in which we're inserted
|
||||
nsIFrame* containingBlock;
|
||||
nsIFloaterContainer* container = nsnull;
|
||||
|
@ -106,11 +92,12 @@ nsPlaceholderFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
NS_ASSERTION(nsnull != mAnchoredItem, "no anchored item");
|
||||
|
||||
// Notify our containing block that there's a new floater
|
||||
container->AddFloater(&presContext, aReflowState, mAnchoredItem, this);
|
||||
container->AddFloater(&aPresContext, aReflowState, mAnchoredItem, this);
|
||||
}
|
||||
|
||||
// Let line layout know about the floater
|
||||
aLineLayout.AddFloater(this);
|
||||
NS_ASSERTION(nsnull != aReflowState.lineLayout, "no line layout");
|
||||
aReflowState.lineLayout->AddFloater(this);
|
||||
|
||||
aDesiredSize.width = 0;
|
||||
aDesiredSize.height = 0;
|
||||
|
@ -120,7 +107,9 @@ nsPlaceholderFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
||||
aDesiredSize.maxElementSize->height = aDesiredSize.height;
|
||||
}
|
||||
return NS_FRAME_COMPLETE;
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -19,11 +19,10 @@
|
|||
#define nsPlaceholderFrame_h___
|
||||
|
||||
#include "nsFrame.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
|
||||
// Implementation of a frame that's used as a placeholder for an anchored item
|
||||
|
||||
class nsPlaceholderFrame : public nsFrame, public nsIInlineReflow {
|
||||
class nsPlaceholderFrame : public nsFrame {
|
||||
public:
|
||||
/**
|
||||
* Create a new placeholder frame
|
||||
|
@ -37,15 +36,17 @@ public:
|
|||
nsIFrame* GetAnchoredItem() const {return mAnchoredItem;}
|
||||
void SetAnchoredItem(nsIFrame* aAnchoredItem) {mAnchoredItem = aAnchoredItem;}
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame overrides
|
||||
// nsIHTMLReflow overrides
|
||||
#if 0
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
#endif
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
// nsIFrame overrides
|
||||
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nsHTMLParts.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
@ -33,19 +32,19 @@
|
|||
#define TYPE_LINE 1 // line-break + vertical space
|
||||
#define TYPE_IMAGE 2 // acts like a sized image with nothing to see
|
||||
|
||||
class SpacerFrame : public nsFrame, private nsIInlineReflow {
|
||||
class SpacerFrame : public nsFrame {
|
||||
public:
|
||||
SpacerFrame(nsIContent* aContent, nsIFrame* aParentFrame);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIInlineReflow
|
||||
// nsIHTMLReflow
|
||||
#if 0
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
#endif
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
PRUint8 GetType();
|
||||
|
||||
|
@ -76,25 +75,12 @@ SpacerFrame::~SpacerFrame()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SpacerFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
SpacerFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIInlineReflowIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIInlineReflow*)this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SpacerFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
nsresult rv = NS_FRAME_COMPLETE;
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
|
||||
// By default, we have no area
|
||||
aMetrics.width = 0;
|
||||
|
@ -133,7 +119,7 @@ SpacerFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
NS_RELEASE(hc);
|
||||
}
|
||||
|
||||
float p2t = aLineLayout.mPresContext.GetPixelsToTwips();
|
||||
float p2t = aPresContext.GetPixelsToTwips();
|
||||
switch (type) {
|
||||
case TYPE_WORD:
|
||||
if (0 != width) {
|
||||
|
@ -143,7 +129,7 @@ SpacerFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
|
||||
case TYPE_LINE:
|
||||
if (0 != width) {
|
||||
rv = NS_INLINE_LINE_BREAK_AFTER(0);
|
||||
aStatus = NS_INLINE_LINE_BREAK_AFTER(0);
|
||||
aMetrics.height = NSIntPixelsToTwips(width, p2t);
|
||||
aMetrics.ascent = aMetrics.height;
|
||||
}
|
||||
|
@ -161,9 +147,10 @@ SpacerFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
aMetrics.maxElementSize->height = aMetrics.height;
|
||||
}
|
||||
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
SpacerFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
|
@ -171,6 +158,7 @@ SpacerFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
|||
aLineLayout.EndTextRun();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
PRUint8
|
||||
SpacerFrame::GetType()
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nsHTMLParts.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsSplittableFrame.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
@ -110,13 +109,10 @@ public:
|
|||
nsVoidArray mFrames;
|
||||
};
|
||||
|
||||
class TextFrame : public nsSplittableFrame, private nsIInlineReflow {
|
||||
class TextFrame : public nsSplittableFrame {
|
||||
public:
|
||||
TextFrame(nsIContent* aContent, nsIFrame* aParentFrame);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame
|
||||
NS_IMETHOD CreateContinuingFrame(nsIPresContext& aPresContext,
|
||||
nsIFrame* aParent,
|
||||
|
@ -148,13 +144,15 @@ public:
|
|||
PRUint32& aAcutalContentOffset,
|
||||
PRInt32& aOffset);
|
||||
|
||||
// nsIInlineReflow
|
||||
// nsIHTMLReflow
|
||||
#if 0
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
#endif
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
// TextFrame methods
|
||||
struct SelectionInfo {
|
||||
|
@ -200,18 +198,18 @@ public:
|
|||
nscolor aSelectionBGColor,
|
||||
nscoord dx, nscoord dy);
|
||||
|
||||
nsInlineReflowStatus ReflowPre(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
const nsStyleFont& aFont,
|
||||
PRInt32 aStartingOffset);
|
||||
nsReflowStatus ReflowPre(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
const nsStyleFont& aFont,
|
||||
PRInt32 aStartingOffset);
|
||||
|
||||
nsInlineReflowStatus ReflowNormal(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
const nsStyleFont& aFontStyle,
|
||||
const nsStyleText& aTextStyle,
|
||||
PRInt32 aStartingOffset);
|
||||
nsReflowStatus ReflowNormal(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
const nsStyleFont& aFontStyle,
|
||||
const nsStyleText& aTextStyle,
|
||||
PRInt32 aStartingOffset);
|
||||
|
||||
protected:
|
||||
virtual ~TextFrame();
|
||||
|
@ -370,20 +368,6 @@ TextFrame::~TextFrame()
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIInlineReflowIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIInlineReflow*)this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextFrame::GetCursorAndContentAt(nsIPresContext& aPresContext,
|
||||
const nsPoint& aPoint,
|
||||
|
@ -1208,6 +1192,7 @@ TextFrame::PaintAsciiText(nsIPresContext& aPresContext,
|
|||
NS_RELEASE(doc);
|
||||
}
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
TextFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
|
@ -1217,6 +1202,7 @@ TextFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
|||
}
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------
|
||||
// Uses a binary search for find where the cursor falls in the line of text
|
||||
|
@ -1351,9 +1337,10 @@ TextFrame::GetPosition(nsIPresContext& aCX,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
TextFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("enter TextFrame::Reflow: aMaxSize=%d,%d",
|
||||
|
@ -1382,28 +1369,28 @@ TextFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
const nsStyleText* text =
|
||||
(const nsStyleText*)mStyleContext->GetStyleData(eStyleStruct_Text);
|
||||
|
||||
nsInlineReflowStatus rs;
|
||||
NS_ASSERTION(nsnull != aReflowState.lineLayout, "no line layout");
|
||||
if (NS_STYLE_WHITESPACE_PRE == text->mWhiteSpace) {
|
||||
// Use a specialized routine for pre-formatted text
|
||||
rs = ReflowPre(aLineLayout, aMetrics, aReflowState,
|
||||
*font, startingOffset);
|
||||
aStatus = ReflowPre(*aReflowState.lineLayout, aMetrics, aReflowState,
|
||||
*font, startingOffset);
|
||||
} else {
|
||||
// Use normal wrapping routine for non-pre text (this includes
|
||||
// text that is not wrapping)
|
||||
rs = ReflowNormal(aLineLayout, aMetrics, aReflowState,
|
||||
*font, *text, startingOffset);
|
||||
aStatus = ReflowNormal(*aReflowState.lineLayout, aMetrics, aReflowState,
|
||||
*font, *text, startingOffset);
|
||||
}
|
||||
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("exit TextFrame::Reflow: rv=%x width=%d",
|
||||
rs, aMetrics.width));
|
||||
return rs;
|
||||
("exit TextFrame::Reflow: status=%x width=%d",
|
||||
aStatus, aMetrics.width));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Reflow normal text (stuff that doesn't have to deal with horizontal
|
||||
// tabs). Normal text reflow may or may not wrap depending on the
|
||||
// "whiteSpace" style property.
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
TextFrame::ReflowNormal(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
|
@ -1578,14 +1565,14 @@ TextFrame::ReflowNormal(nsLineLayout& aLineLayout,
|
|||
return (cp == end) ? NS_FRAME_COMPLETE : NS_FRAME_NOT_COMPLETE;
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
TextFrame::ReflowPre(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
const nsStyleFont& aFont,
|
||||
PRInt32 aStartingOffset)
|
||||
{
|
||||
nsInlineReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
nsReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
|
||||
PRInt32 textLength;
|
||||
const PRUnichar* cp = GetText(mContent, textLength);
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "nsHTMLParts.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
|
@ -27,24 +26,24 @@
|
|||
#include "nsIFontMetrics.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
|
||||
class BRFrame : public nsFrame, public nsIInlineReflow {
|
||||
class BRFrame : public nsFrame {
|
||||
public:
|
||||
BRFrame(nsIContent* aContent, nsIFrame* aParentFrame);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame
|
||||
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
// nsIInlineReflow
|
||||
// nsIHTMLReflow
|
||||
#if 0
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
#endif
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
protected:
|
||||
virtual ~BRFrame();
|
||||
|
@ -72,20 +71,6 @@ BRFrame::~BRFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BRFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIInlineReflowIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIInlineReflow*)this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
BRFrame::Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
@ -100,6 +85,7 @@ BRFrame::Paint(nsIPresContext& aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
BRFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
|
@ -107,11 +93,13 @@ BRFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
|||
aLineLayout.EndTextRun();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
BRFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
BRFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
if (nsnull != aMetrics.maxElementSize) {
|
||||
aMetrics.maxElementSize->width = 0;
|
||||
|
@ -121,15 +109,18 @@ BRFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
aMetrics.width = 0;
|
||||
aMetrics.ascent = 0;
|
||||
aMetrics.descent = 0;
|
||||
aLineLayout.SetBRFrame(this);
|
||||
NS_ASSERTION(nsnull != aReflowState.lineLayout, "no line layout");
|
||||
aReflowState.lineLayout->SetBRFrame(this);
|
||||
|
||||
// Return our inline reflow status
|
||||
// Return our reflow status
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
PRUint32 breakType = display->mBreakType;
|
||||
if (NS_STYLE_CLEAR_NONE == breakType) {
|
||||
breakType = NS_STYLE_CLEAR_LINE;
|
||||
}
|
||||
return NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER |
|
||||
|
||||
aStatus = NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER |
|
||||
NS_INLINE_MAKE_BREAK_TYPE(breakType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -313,7 +313,9 @@ public:
|
|||
|
||||
nsresult StyleChangedReflow(nsBlockReflowState& aState);
|
||||
|
||||
#if 0
|
||||
nsresult FindTextRuns(nsBlockReflowState& aState);
|
||||
#endif
|
||||
|
||||
nsresult ChildIncrementalReflow(nsBlockReflowState& aState);
|
||||
|
||||
|
@ -326,11 +328,11 @@ public:
|
|||
|
||||
PRBool ReflowLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus& aReflowResult);
|
||||
nsReflowStatus& aReflowResult);
|
||||
|
||||
PRBool PlaceLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus aReflowStatus);
|
||||
nsReflowStatus aReflowStatus);
|
||||
|
||||
void FindFloaters(LineData* aLine);
|
||||
|
||||
|
@ -339,7 +341,7 @@ public:
|
|||
PRBool ReflowInlineFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
nsresult SplitLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
|
@ -349,13 +351,13 @@ public:
|
|||
PRBool ReflowBlockFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
PRBool PullFrame(nsBlockReflowState& aState,
|
||||
LineData* aToLine,
|
||||
LineData** aFromList,
|
||||
PRBool aUpdateGeometricParent,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
void PushLines(nsBlockReflowState& aState);
|
||||
|
||||
|
@ -401,14 +403,11 @@ public:
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class BulletFrame : public nsFrame, private nsIInlineReflow {
|
||||
class BulletFrame : public nsFrame {
|
||||
public:
|
||||
BulletFrame(nsIContent* aContent, nsIFrame* aParentFrame);
|
||||
virtual ~BulletFrame();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame
|
||||
NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext);
|
||||
NS_IMETHOD Paint(nsIPresContext &aCX,
|
||||
|
@ -417,12 +416,15 @@ public:
|
|||
NS_IMETHOD ListTag(FILE* out) const;
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
||||
|
||||
// nsIInlineReflow
|
||||
// nsIHTMLReflow
|
||||
#if 0
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
#endif
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
void SetListItemOrdinal(nsBlockReflowState& aBlockState);
|
||||
|
||||
|
@ -448,20 +450,6 @@ BulletFrame::~BulletFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIInlineReflowIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIInlineReflow*)this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::DeleteFrame(nsIPresContext& aPresContext)
|
||||
{
|
||||
|
@ -840,12 +828,13 @@ BulletFrame::GetDesiredSize(nsIPresContext* aCX,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
BulletFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
// Get the base size
|
||||
GetDesiredSize(&aLineLayout.mPresContext, aReflowState, aMetrics);
|
||||
GetDesiredSize(&aPresContext, aReflowState, aMetrics);
|
||||
|
||||
// Add in the border and padding; split the top/bottom between the
|
||||
// ascent and descent to make things look nice
|
||||
|
@ -862,9 +851,11 @@ BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
aMetrics.maxElementSize->width = aMetrics.width;
|
||||
aMetrics.maxElementSize->height = aMetrics.height;
|
||||
}
|
||||
return NS_FRAME_COMPLETE;
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
|
@ -872,6 +863,7 @@ BulletFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
|||
aLineLayout.EndTextRun();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
@ -2105,11 +2097,13 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext,
|
|||
nsresult
|
||||
nsBlockFrame::InitialReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
#if 0
|
||||
// Generate text-run information
|
||||
nsresult rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Reflow everything
|
||||
aState.GetAvailableSpace();
|
||||
|
@ -2163,11 +2157,13 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
// impacted line will be marked dirty
|
||||
AppendNewFrames(aState.mPresContext, firstAppendedFrame);
|
||||
|
||||
#if 0
|
||||
// Generate text-run information
|
||||
rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Recover our reflow state
|
||||
LineData* firstDirtyLine = mLines;
|
||||
|
@ -2221,6 +2217,7 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
return ReflowLinesAt(aState, firstDirtyLine);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// XXX keep the text-run data in the first-in-flow of the block
|
||||
nsresult
|
||||
nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
||||
|
@ -2268,6 +2265,7 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState)
|
||||
|
@ -2432,12 +2430,14 @@ nsBlockFrame::FrameRemovedReflow(nsBlockReflowState& aState)
|
|||
nsresult
|
||||
nsBlockFrame::ChildIncrementalReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
#if 0
|
||||
// Generate text-run information; this will also "fluff out" any
|
||||
// inline children's frame tree.
|
||||
nsresult rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// XXX temporary
|
||||
aState.GetAvailableSpace();
|
||||
|
@ -2475,7 +2475,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
{
|
||||
// Reflow the lines that are already ours
|
||||
while (nsnull != aLine) {
|
||||
nsInlineReflowStatus rs;
|
||||
nsReflowStatus rs;
|
||||
if (!ReflowLine(aState, aLine, rs)) {
|
||||
if (NS_IS_REFLOW_ERROR(rs)) {
|
||||
return nsresult(rs);
|
||||
|
@ -2543,7 +2543,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
|
||||
// Now reflow it and any lines that it makes during it's reflow.
|
||||
while (nsnull != aLine) {
|
||||
nsInlineReflowStatus rs;
|
||||
nsReflowStatus rs;
|
||||
if (!ReflowLine(aState, aLine, rs)) {
|
||||
if (NS_IS_REFLOW_ERROR(rs)) {
|
||||
return nsresult(rs);
|
||||
|
@ -2566,7 +2566,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
PRBool
|
||||
nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("nsBlockFrame::ReflowLine: line=%p", aLine));
|
||||
|
@ -2868,7 +2868,7 @@ PRBool
|
|||
nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
NS_PRECONDITION(0 == aState.mLineLayout.GetPlacedFrames(),
|
||||
"non-empty line with a block");
|
||||
|
@ -2993,7 +2993,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
aFrame,
|
||||
nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3003,7 +3003,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
(LINE_IS_BLOCK |
|
||||
LINE_LAST_CONTENT_IS_COMPLETE));
|
||||
if (nsnull == line) {
|
||||
aReflowResult = nsInlineReflowStatus(NS_ERROR_OUT_OF_MEMORY);
|
||||
aReflowResult = NS_ERROR_OUT_OF_MEMORY;
|
||||
return PR_FALSE;
|
||||
}
|
||||
line->mNext = aLine->mNext;
|
||||
|
@ -3031,7 +3031,7 @@ PRBool
|
|||
nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIFrame* nextInFlow;
|
||||
|
@ -3064,7 +3064,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
rv = nsHTMLContainerFrame::CreateNextInFlow(aState.mPresContext,
|
||||
this, aFrame, nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3088,7 +3088,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
this, aFrame,
|
||||
nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3106,7 +3106,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
// Split line since we aren't going to keep going
|
||||
rv = SplitLine(aState, aLine, aFrame, lineWasComplete);
|
||||
if (NS_IS_REFLOW_ERROR(rv)) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -3167,7 +3167,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState,
|
|||
LineData* aLine,
|
||||
LineData** aFromList,
|
||||
PRBool aUpdateGeometricParent,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
LineData* fromLine = *aFromList;
|
||||
NS_ASSERTION(nsnull != fromLine, "bad line to pull from");
|
||||
|
@ -3250,7 +3250,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState,
|
|||
PRBool
|
||||
nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus aReflowStatus)
|
||||
nsReflowStatus aReflowStatus)
|
||||
{
|
||||
// Align the children. This also determines the actual height and
|
||||
// width of the line.
|
||||
|
@ -3352,13 +3352,14 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||
nsSize availSize;
|
||||
availSize.width = NS_UNCONSTRAINEDSIZE;
|
||||
availSize.height = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState reflowState(mBullet, aState, availSize);
|
||||
nsHTMLReflowState reflowState(mBullet, aState, availSize, &aState.mLineLayout);
|
||||
nsHTMLReflowMetrics metrics(nsnull);
|
||||
nsIInlineReflow* iir;
|
||||
if (NS_OK == mBullet->QueryInterface(kIInlineReflowIID, (void**) &iir)) {
|
||||
mBullet->WillReflow(aState.mPresContext);
|
||||
iir->InlineReflow(aState.mLineLayout, metrics, reflowState);
|
||||
mBullet->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED);
|
||||
nsIHTMLReflow* htmlReflow;
|
||||
if (NS_OK == mBullet->QueryInterface(kIHTMLReflowIID, (void**) &htmlReflow)) {
|
||||
nsReflowStatus status;
|
||||
htmlReflow->WillReflow(aState.mPresContext);
|
||||
htmlReflow->Reflow(aState.mPresContext, metrics, reflowState, status);
|
||||
htmlReflow->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED);
|
||||
}
|
||||
|
||||
// Place the bullet now
|
||||
|
|
|
@ -313,7 +313,9 @@ public:
|
|||
|
||||
nsresult StyleChangedReflow(nsBlockReflowState& aState);
|
||||
|
||||
#if 0
|
||||
nsresult FindTextRuns(nsBlockReflowState& aState);
|
||||
#endif
|
||||
|
||||
nsresult ChildIncrementalReflow(nsBlockReflowState& aState);
|
||||
|
||||
|
@ -326,11 +328,11 @@ public:
|
|||
|
||||
PRBool ReflowLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus& aReflowResult);
|
||||
nsReflowStatus& aReflowResult);
|
||||
|
||||
PRBool PlaceLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus aReflowStatus);
|
||||
nsReflowStatus aReflowStatus);
|
||||
|
||||
void FindFloaters(LineData* aLine);
|
||||
|
||||
|
@ -339,7 +341,7 @@ public:
|
|||
PRBool ReflowInlineFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
nsresult SplitLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
|
@ -349,13 +351,13 @@ public:
|
|||
PRBool ReflowBlockFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
PRBool PullFrame(nsBlockReflowState& aState,
|
||||
LineData* aToLine,
|
||||
LineData** aFromList,
|
||||
PRBool aUpdateGeometricParent,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
void PushLines(nsBlockReflowState& aState);
|
||||
|
||||
|
@ -401,14 +403,11 @@ public:
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class BulletFrame : public nsFrame, private nsIInlineReflow {
|
||||
class BulletFrame : public nsFrame {
|
||||
public:
|
||||
BulletFrame(nsIContent* aContent, nsIFrame* aParentFrame);
|
||||
virtual ~BulletFrame();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame
|
||||
NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext);
|
||||
NS_IMETHOD Paint(nsIPresContext &aCX,
|
||||
|
@ -417,12 +416,15 @@ public:
|
|||
NS_IMETHOD ListTag(FILE* out) const;
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
||||
|
||||
// nsIInlineReflow
|
||||
// nsIHTMLReflow
|
||||
#if 0
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
#endif
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
void SetListItemOrdinal(nsBlockReflowState& aBlockState);
|
||||
|
||||
|
@ -448,20 +450,6 @@ BulletFrame::~BulletFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIInlineReflowIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIInlineReflow*)this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::DeleteFrame(nsIPresContext& aPresContext)
|
||||
{
|
||||
|
@ -840,12 +828,13 @@ BulletFrame::GetDesiredSize(nsIPresContext* aCX,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
BulletFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
// Get the base size
|
||||
GetDesiredSize(&aLineLayout.mPresContext, aReflowState, aMetrics);
|
||||
GetDesiredSize(&aPresContext, aReflowState, aMetrics);
|
||||
|
||||
// Add in the border and padding; split the top/bottom between the
|
||||
// ascent and descent to make things look nice
|
||||
|
@ -862,9 +851,11 @@ BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
aMetrics.maxElementSize->width = aMetrics.width;
|
||||
aMetrics.maxElementSize->height = aMetrics.height;
|
||||
}
|
||||
return NS_FRAME_COMPLETE;
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
|
@ -872,6 +863,7 @@ BulletFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
|||
aLineLayout.EndTextRun();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
@ -2105,11 +2097,13 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext,
|
|||
nsresult
|
||||
nsBlockFrame::InitialReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
#if 0
|
||||
// Generate text-run information
|
||||
nsresult rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Reflow everything
|
||||
aState.GetAvailableSpace();
|
||||
|
@ -2163,11 +2157,13 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
// impacted line will be marked dirty
|
||||
AppendNewFrames(aState.mPresContext, firstAppendedFrame);
|
||||
|
||||
#if 0
|
||||
// Generate text-run information
|
||||
rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Recover our reflow state
|
||||
LineData* firstDirtyLine = mLines;
|
||||
|
@ -2221,6 +2217,7 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
return ReflowLinesAt(aState, firstDirtyLine);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// XXX keep the text-run data in the first-in-flow of the block
|
||||
nsresult
|
||||
nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
||||
|
@ -2268,6 +2265,7 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState)
|
||||
|
@ -2432,12 +2430,14 @@ nsBlockFrame::FrameRemovedReflow(nsBlockReflowState& aState)
|
|||
nsresult
|
||||
nsBlockFrame::ChildIncrementalReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
#if 0
|
||||
// Generate text-run information; this will also "fluff out" any
|
||||
// inline children's frame tree.
|
||||
nsresult rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// XXX temporary
|
||||
aState.GetAvailableSpace();
|
||||
|
@ -2475,7 +2475,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
{
|
||||
// Reflow the lines that are already ours
|
||||
while (nsnull != aLine) {
|
||||
nsInlineReflowStatus rs;
|
||||
nsReflowStatus rs;
|
||||
if (!ReflowLine(aState, aLine, rs)) {
|
||||
if (NS_IS_REFLOW_ERROR(rs)) {
|
||||
return nsresult(rs);
|
||||
|
@ -2543,7 +2543,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
|
||||
// Now reflow it and any lines that it makes during it's reflow.
|
||||
while (nsnull != aLine) {
|
||||
nsInlineReflowStatus rs;
|
||||
nsReflowStatus rs;
|
||||
if (!ReflowLine(aState, aLine, rs)) {
|
||||
if (NS_IS_REFLOW_ERROR(rs)) {
|
||||
return nsresult(rs);
|
||||
|
@ -2566,7 +2566,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
PRBool
|
||||
nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("nsBlockFrame::ReflowLine: line=%p", aLine));
|
||||
|
@ -2868,7 +2868,7 @@ PRBool
|
|||
nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
NS_PRECONDITION(0 == aState.mLineLayout.GetPlacedFrames(),
|
||||
"non-empty line with a block");
|
||||
|
@ -2993,7 +2993,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
aFrame,
|
||||
nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3003,7 +3003,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
(LINE_IS_BLOCK |
|
||||
LINE_LAST_CONTENT_IS_COMPLETE));
|
||||
if (nsnull == line) {
|
||||
aReflowResult = nsInlineReflowStatus(NS_ERROR_OUT_OF_MEMORY);
|
||||
aReflowResult = NS_ERROR_OUT_OF_MEMORY;
|
||||
return PR_FALSE;
|
||||
}
|
||||
line->mNext = aLine->mNext;
|
||||
|
@ -3031,7 +3031,7 @@ PRBool
|
|||
nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIFrame* nextInFlow;
|
||||
|
@ -3064,7 +3064,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
rv = nsHTMLContainerFrame::CreateNextInFlow(aState.mPresContext,
|
||||
this, aFrame, nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3088,7 +3088,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
this, aFrame,
|
||||
nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3106,7 +3106,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
// Split line since we aren't going to keep going
|
||||
rv = SplitLine(aState, aLine, aFrame, lineWasComplete);
|
||||
if (NS_IS_REFLOW_ERROR(rv)) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -3167,7 +3167,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState,
|
|||
LineData* aLine,
|
||||
LineData** aFromList,
|
||||
PRBool aUpdateGeometricParent,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
LineData* fromLine = *aFromList;
|
||||
NS_ASSERTION(nsnull != fromLine, "bad line to pull from");
|
||||
|
@ -3250,7 +3250,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState,
|
|||
PRBool
|
||||
nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus aReflowStatus)
|
||||
nsReflowStatus aReflowStatus)
|
||||
{
|
||||
// Align the children. This also determines the actual height and
|
||||
// width of the line.
|
||||
|
@ -3352,13 +3352,14 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||
nsSize availSize;
|
||||
availSize.width = NS_UNCONSTRAINEDSIZE;
|
||||
availSize.height = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState reflowState(mBullet, aState, availSize);
|
||||
nsHTMLReflowState reflowState(mBullet, aState, availSize, &aState.mLineLayout);
|
||||
nsHTMLReflowMetrics metrics(nsnull);
|
||||
nsIInlineReflow* iir;
|
||||
if (NS_OK == mBullet->QueryInterface(kIInlineReflowIID, (void**) &iir)) {
|
||||
mBullet->WillReflow(aState.mPresContext);
|
||||
iir->InlineReflow(aState.mLineLayout, metrics, reflowState);
|
||||
mBullet->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED);
|
||||
nsIHTMLReflow* htmlReflow;
|
||||
if (NS_OK == mBullet->QueryInterface(kIHTMLReflowIID, (void**) &htmlReflow)) {
|
||||
nsReflowStatus status;
|
||||
htmlReflow->WillReflow(aState.mPresContext);
|
||||
htmlReflow->Reflow(aState.mPresContext, metrics, reflowState, status);
|
||||
htmlReflow->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED);
|
||||
}
|
||||
|
||||
// Place the bullet now
|
||||
|
|
|
@ -313,7 +313,9 @@ public:
|
|||
|
||||
nsresult StyleChangedReflow(nsBlockReflowState& aState);
|
||||
|
||||
#if 0
|
||||
nsresult FindTextRuns(nsBlockReflowState& aState);
|
||||
#endif
|
||||
|
||||
nsresult ChildIncrementalReflow(nsBlockReflowState& aState);
|
||||
|
||||
|
@ -326,11 +328,11 @@ public:
|
|||
|
||||
PRBool ReflowLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus& aReflowResult);
|
||||
nsReflowStatus& aReflowResult);
|
||||
|
||||
PRBool PlaceLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus aReflowStatus);
|
||||
nsReflowStatus aReflowStatus);
|
||||
|
||||
void FindFloaters(LineData* aLine);
|
||||
|
||||
|
@ -339,7 +341,7 @@ public:
|
|||
PRBool ReflowInlineFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
nsresult SplitLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
|
@ -349,13 +351,13 @@ public:
|
|||
PRBool ReflowBlockFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
PRBool PullFrame(nsBlockReflowState& aState,
|
||||
LineData* aToLine,
|
||||
LineData** aFromList,
|
||||
PRBool aUpdateGeometricParent,
|
||||
nsInlineReflowStatus& aResult);
|
||||
nsReflowStatus& aResult);
|
||||
|
||||
void PushLines(nsBlockReflowState& aState);
|
||||
|
||||
|
@ -401,14 +403,11 @@ public:
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class BulletFrame : public nsFrame, private nsIInlineReflow {
|
||||
class BulletFrame : public nsFrame {
|
||||
public:
|
||||
BulletFrame(nsIContent* aContent, nsIFrame* aParentFrame);
|
||||
virtual ~BulletFrame();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame
|
||||
NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext);
|
||||
NS_IMETHOD Paint(nsIPresContext &aCX,
|
||||
|
@ -417,12 +416,15 @@ public:
|
|||
NS_IMETHOD ListTag(FILE* out) const;
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
||||
|
||||
// nsIInlineReflow
|
||||
// nsIHTMLReflow
|
||||
#if 0
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
#endif
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
void SetListItemOrdinal(nsBlockReflowState& aBlockState);
|
||||
|
||||
|
@ -448,20 +450,6 @@ BulletFrame::~BulletFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIInlineReflowIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIInlineReflow*)this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::DeleteFrame(nsIPresContext& aPresContext)
|
||||
{
|
||||
|
@ -840,12 +828,13 @@ BulletFrame::GetDesiredSize(nsIPresContext* aCX,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
BulletFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
// Get the base size
|
||||
GetDesiredSize(&aLineLayout.mPresContext, aReflowState, aMetrics);
|
||||
GetDesiredSize(&aPresContext, aReflowState, aMetrics);
|
||||
|
||||
// Add in the border and padding; split the top/bottom between the
|
||||
// ascent and descent to make things look nice
|
||||
|
@ -862,9 +851,11 @@ BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
aMetrics.maxElementSize->width = aMetrics.width;
|
||||
aMetrics.maxElementSize->height = aMetrics.height;
|
||||
}
|
||||
return NS_FRAME_COMPLETE;
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
BulletFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
|
@ -872,6 +863,7 @@ BulletFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
|||
aLineLayout.EndTextRun();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
@ -2105,11 +2097,13 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext,
|
|||
nsresult
|
||||
nsBlockFrame::InitialReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
#if 0
|
||||
// Generate text-run information
|
||||
nsresult rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Reflow everything
|
||||
aState.GetAvailableSpace();
|
||||
|
@ -2163,11 +2157,13 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
// impacted line will be marked dirty
|
||||
AppendNewFrames(aState.mPresContext, firstAppendedFrame);
|
||||
|
||||
#if 0
|
||||
// Generate text-run information
|
||||
rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Recover our reflow state
|
||||
LineData* firstDirtyLine = mLines;
|
||||
|
@ -2221,6 +2217,7 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
return ReflowLinesAt(aState, firstDirtyLine);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// XXX keep the text-run data in the first-in-flow of the block
|
||||
nsresult
|
||||
nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
||||
|
@ -2268,6 +2265,7 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState)
|
||||
|
@ -2432,12 +2430,14 @@ nsBlockFrame::FrameRemovedReflow(nsBlockReflowState& aState)
|
|||
nsresult
|
||||
nsBlockFrame::ChildIncrementalReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
#if 0
|
||||
// Generate text-run information; this will also "fluff out" any
|
||||
// inline children's frame tree.
|
||||
nsresult rv = FindTextRuns(aState);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// XXX temporary
|
||||
aState.GetAvailableSpace();
|
||||
|
@ -2475,7 +2475,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
{
|
||||
// Reflow the lines that are already ours
|
||||
while (nsnull != aLine) {
|
||||
nsInlineReflowStatus rs;
|
||||
nsReflowStatus rs;
|
||||
if (!ReflowLine(aState, aLine, rs)) {
|
||||
if (NS_IS_REFLOW_ERROR(rs)) {
|
||||
return nsresult(rs);
|
||||
|
@ -2543,7 +2543,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
|
||||
// Now reflow it and any lines that it makes during it's reflow.
|
||||
while (nsnull != aLine) {
|
||||
nsInlineReflowStatus rs;
|
||||
nsReflowStatus rs;
|
||||
if (!ReflowLine(aState, aLine, rs)) {
|
||||
if (NS_IS_REFLOW_ERROR(rs)) {
|
||||
return nsresult(rs);
|
||||
|
@ -2566,7 +2566,7 @@ nsBlockFrame::ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine)
|
|||
PRBool
|
||||
nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("nsBlockFrame::ReflowLine: line=%p", aLine));
|
||||
|
@ -2868,7 +2868,7 @@ PRBool
|
|||
nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
NS_PRECONDITION(0 == aState.mLineLayout.GetPlacedFrames(),
|
||||
"non-empty line with a block");
|
||||
|
@ -2993,7 +2993,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
aFrame,
|
||||
nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3003,7 +3003,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
(LINE_IS_BLOCK |
|
||||
LINE_LAST_CONTENT_IS_COMPLETE));
|
||||
if (nsnull == line) {
|
||||
aReflowResult = nsInlineReflowStatus(NS_ERROR_OUT_OF_MEMORY);
|
||||
aReflowResult = NS_ERROR_OUT_OF_MEMORY;
|
||||
return PR_FALSE;
|
||||
}
|
||||
line->mNext = aLine->mNext;
|
||||
|
@ -3031,7 +3031,7 @@ PRBool
|
|||
nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIFrame* nextInFlow;
|
||||
|
@ -3064,7 +3064,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
rv = nsHTMLContainerFrame::CreateNextInFlow(aState.mPresContext,
|
||||
this, aFrame, nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3088,7 +3088,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
this, aFrame,
|
||||
nextInFlow);
|
||||
if (NS_OK != rv) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (nsnull != nextInFlow) {
|
||||
|
@ -3106,7 +3106,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState,
|
|||
// Split line since we aren't going to keep going
|
||||
rv = SplitLine(aState, aLine, aFrame, lineWasComplete);
|
||||
if (NS_IS_REFLOW_ERROR(rv)) {
|
||||
aReflowResult = nsInlineReflowStatus(rv);
|
||||
aReflowResult = rv;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -3167,7 +3167,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState,
|
|||
LineData* aLine,
|
||||
LineData** aFromList,
|
||||
PRBool aUpdateGeometricParent,
|
||||
nsInlineReflowStatus& aReflowResult)
|
||||
nsReflowStatus& aReflowResult)
|
||||
{
|
||||
LineData* fromLine = *aFromList;
|
||||
NS_ASSERTION(nsnull != fromLine, "bad line to pull from");
|
||||
|
@ -3250,7 +3250,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState,
|
|||
PRBool
|
||||
nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
||||
LineData* aLine,
|
||||
nsInlineReflowStatus aReflowStatus)
|
||||
nsReflowStatus aReflowStatus)
|
||||
{
|
||||
// Align the children. This also determines the actual height and
|
||||
// width of the line.
|
||||
|
@ -3352,13 +3352,14 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||
nsSize availSize;
|
||||
availSize.width = NS_UNCONSTRAINEDSIZE;
|
||||
availSize.height = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState reflowState(mBullet, aState, availSize);
|
||||
nsHTMLReflowState reflowState(mBullet, aState, availSize, &aState.mLineLayout);
|
||||
nsHTMLReflowMetrics metrics(nsnull);
|
||||
nsIInlineReflow* iir;
|
||||
if (NS_OK == mBullet->QueryInterface(kIInlineReflowIID, (void**) &iir)) {
|
||||
mBullet->WillReflow(aState.mPresContext);
|
||||
iir->InlineReflow(aState.mLineLayout, metrics, reflowState);
|
||||
mBullet->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED);
|
||||
nsIHTMLReflow* htmlReflow;
|
||||
if (NS_OK == mBullet->QueryInterface(kIHTMLReflowIID, (void**) &htmlReflow)) {
|
||||
nsReflowStatus status;
|
||||
htmlReflow->WillReflow(aState.mPresContext);
|
||||
htmlReflow->Reflow(aState.mPresContext, metrics, reflowState, status);
|
||||
htmlReflow->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED);
|
||||
}
|
||||
|
||||
// Place the bullet now
|
||||
|
|
|
@ -20,12 +20,10 @@
|
|||
#include "nsIAbsoluteItems.h"
|
||||
#include "nsIAnchoredItems.h"
|
||||
#include "nsIFloaterContainer.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
#include "nsIHTMLReflow.h"
|
||||
|
||||
const nsIID kIAbsoluteItemsIID = NS_IABSOLUTE_ITEMS_IID;
|
||||
const nsIID kIAnchoredItemsIID = NS_IANCHORED_ITEMS_IID;
|
||||
const nsIID kIFloaterContainerIID = NS_IFLOATER_CONTAINER_IID;
|
||||
const nsIID kIHTMLContentIID = NS_IHTMLCONTENT_IID;
|
||||
const nsIID kIInlineReflowIID = NS_IINLINE_REFLOW_IID;
|
||||
const nsIID kIHTMLReflowIID = NS_IHTMLREFLOW_IID;
|
||||
|
|
|
@ -26,7 +26,6 @@ extern const nsIID kIAbsoluteItemsIID;
|
|||
extern const nsIID kIAnchoredItemsIID;
|
||||
extern const nsIID kIFloaterContainerIID;
|
||||
extern const nsIID kIHTMLContentIID;
|
||||
extern const nsIID kIInlineReflowIID;
|
||||
extern const nsIID kIRunaroundIID;
|
||||
extern const nsIID kIHTMLReflowIID;
|
||||
|
||||
|
|
|
@ -19,13 +19,17 @@
|
|||
#define nsIHTMLReflow_h___
|
||||
|
||||
#include "nsIFrameReflow.h"
|
||||
#include "nsStyleConsts.h"
|
||||
class nsISpaceManager;
|
||||
class nsLineLayout;
|
||||
|
||||
// IID for the nsIHTMLFrame interface
|
||||
// a6cf9069-15b3-11d2-932e-00805f8add32
|
||||
#define NS_IHTMLREFLOW_IID \
|
||||
{ 0xa6cf9069, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* HTML/CSS specific reflow metrics
|
||||
*/
|
||||
|
@ -43,6 +47,8 @@ struct nsHTMLReflowMetrics : nsReflowMetrics {
|
|||
}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* The type of size constraint that applies to a particular dimension.
|
||||
* For the fixed and fixed content cases the min size in the reflow state
|
||||
|
@ -59,8 +65,35 @@ enum nsReflowConstraint {
|
|||
eReflowSize_FixedContent = 3 // size of your content area is fixed
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Frame type. Included as part of the reflow state.
|
||||
*
|
||||
* @see nsHTMLReflowState
|
||||
*
|
||||
* XXX This requires some more thought. Are these the correct set?
|
||||
* XXX Should we treat 'replaced' as a bit flag instead of doubling the
|
||||
* number of enumerators?
|
||||
* XXX Should the name be nsCSSReflowFrameType?
|
||||
*/
|
||||
enum nsReflowFrameType {
|
||||
eReflowType_Inline = 0, // inline, non-replaced elements
|
||||
eReflowType_InlineReplaced = 1, // inline, replaced elements (e.g., image)
|
||||
eReflowType_Block = 2, // block-level, non-replaced elements in normal flow
|
||||
eReflowType_BlockReplaced = 3, // block-level, replaced elements in normal flow
|
||||
eReflowType_Floating = 4, // floating, non-replaced elements
|
||||
eReflowType_FloatingReplaced = 5, // floating, replaced elements
|
||||
eReflowType_Absolute = 6, // absolutely positioned, non-replaced elements
|
||||
eReflowType_AbsoluteReplaced = 7 // absolutely positioned, replaced elements
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
struct nsHTMLReflowState : nsReflowState {
|
||||
nsReflowFrameType frameType;
|
||||
nsISpaceManager* spaceManager;
|
||||
nsLineLayout* lineLayout; // only for inline reflow (set to NULL otherwise)
|
||||
|
||||
// XXX None of this is currently being used...
|
||||
#if 0
|
||||
|
@ -71,7 +104,7 @@ struct nsHTMLReflowState : nsReflowState {
|
|||
#endif
|
||||
|
||||
// Constructs an initial reflow state (no parent reflow state) for a
|
||||
// non-incremental reflow command
|
||||
// non-incremental reflow command. Sets reflowType to eReflowType_Block
|
||||
nsHTMLReflowState(nsIFrame* aFrame,
|
||||
nsReflowReason aReason,
|
||||
const nsSize& aMaxSize,
|
||||
|
@ -79,7 +112,7 @@ struct nsHTMLReflowState : nsReflowState {
|
|||
nsISpaceManager* aSpaceManager = nsnull);
|
||||
|
||||
// Constructs an initial reflow state (no parent reflow state) for an
|
||||
// incremental reflow command
|
||||
// incremental reflow command. Sets reflowType to eReflowType_Block
|
||||
nsHTMLReflowState(nsIFrame* aFrame,
|
||||
nsIReflowCommand& aReflowCommand,
|
||||
const nsSize& aMaxSize,
|
||||
|
@ -87,20 +120,83 @@ struct nsHTMLReflowState : nsReflowState {
|
|||
nsISpaceManager* aSpaceManager = nsnull);
|
||||
|
||||
// Construct a reflow state for the given frame, parent reflow state, and
|
||||
// max size. Uses the reflow reason and reflow command from the parent's
|
||||
// reflow state
|
||||
nsHTMLReflowState(nsIFrame* aFrame,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
const nsSize& aMaxSize);
|
||||
|
||||
// Constructs a reflow state that overrides the reflow reason of the parent
|
||||
// reflow state. Sets the reflow command to NULL
|
||||
// max size. Uses the reflow reason, space manager, reflow command, and
|
||||
// line layout from the parent's reflow state. Defaults to a reflow
|
||||
// frame type of eReflowType_Block
|
||||
nsHTMLReflowState(nsIFrame* aFrame,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowReason aReflowReason);
|
||||
nsReflowFrameType aFrameType = eReflowType_Block);
|
||||
|
||||
// Construct a reflow state for the given inline frame, parent reflow state,
|
||||
// and max size. Uses the reflow reason, space manager, and reflow command from
|
||||
// the parent's reflow state. Sets the reflow frame type to eReflowType_Inline
|
||||
nsHTMLReflowState(nsIFrame* aFrame,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsLineLayout* aLineLayout);
|
||||
|
||||
// Constructs a reflow state that overrides the reflow reason of the parent
|
||||
// reflow state. Uses the space manager from the parent's reflow state and
|
||||
// sets the reflow command to NULL. Sets lineLayout to NULL, and defaults to
|
||||
// a reflow frame type of eReflowType_Block
|
||||
nsHTMLReflowState(nsIFrame* aFrame,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowReason aReflowReason,
|
||||
nsReflowFrameType aFrameType = eReflowType_Block);
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Extensions to the reflow status bits defined by nsIFrameReflow
|
||||
*/
|
||||
|
||||
// This bit is set, when a break is requested. This bit is orthogonal
|
||||
// to the nsIFrame::nsReflowStatus completion bits.
|
||||
#define NS_INLINE_BREAK 0x0100
|
||||
|
||||
#define NS_INLINE_IS_BREAK(_status) \
|
||||
(0 != ((_status) & NS_INLINE_BREAK))
|
||||
|
||||
// When a break is requested, this bit when set indicates that the
|
||||
// break should occur after the frame just reflowed; when the bit is
|
||||
// clear the break should occur before the frame just reflowed.
|
||||
#define NS_INLINE_BREAK_BEFORE 0x0000
|
||||
#define NS_INLINE_BREAK_AFTER 0x0200
|
||||
|
||||
#define NS_INLINE_IS_BREAK_AFTER(_status) \
|
||||
(0 != ((_status) & NS_INLINE_BREAK_AFTER))
|
||||
|
||||
#define NS_INLINE_IS_BREAK_BEFORE(_status) \
|
||||
(NS_INLINE_BREAK == ((_status) & (NS_INLINE_BREAK|NS_INLINE_BREAK_AFTER)))
|
||||
|
||||
// The type of break requested can be found in these bits.
|
||||
#define NS_INLINE_BREAK_TYPE_MASK 0xF000
|
||||
|
||||
#define NS_INLINE_GET_BREAK_TYPE(_status) (((_status) >> 12) & 0xF)
|
||||
|
||||
#define NS_INLINE_MAKE_BREAK_TYPE(_type) ((_type) << 12)
|
||||
|
||||
// Construct a line-break-before status. Note that there is no
|
||||
// completion status for a line-break before because we *know* that
|
||||
// the frame will be reflowed later and hence it's current completion
|
||||
// status doesn't matter.
|
||||
#define NS_INLINE_LINE_BREAK_BEFORE() \
|
||||
(NS_INLINE_BREAK | NS_INLINE_BREAK_BEFORE | \
|
||||
NS_INLINE_MAKE_BREAK_TYPE(NS_STYLE_CLEAR_LINE))
|
||||
|
||||
// Take a completion status and add to it the desire to have a
|
||||
// line-break after. For this macro we do need the completion status
|
||||
// because the user of the status will need to know whether to
|
||||
// continue the frame or not.
|
||||
#define NS_INLINE_LINE_BREAK_AFTER(_completionStatus) \
|
||||
((_completionStatus) | NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER | \
|
||||
NS_INLINE_MAKE_BREAK_TYPE(NS_STYLE_CLEAR_LINE))
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Generate a reflow interface specific to HTML/CSS frame objects
|
||||
*/
|
||||
|
@ -108,8 +204,10 @@ class nsIHTMLReflow : public nsIFrameReflow<nsHTMLReflowState, nsHTMLReflowMetri
|
|||
{
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Constructs an initial reflow state (no parent reflow state) for a
|
||||
// non-incremental reflow command
|
||||
// non-incremental reflow command. Sets reflowType to eReflowType_Block
|
||||
inline
|
||||
nsHTMLReflowState::nsHTMLReflowState(nsIFrame* aFrame,
|
||||
nsReflowReason aReason,
|
||||
|
@ -118,11 +216,13 @@ nsHTMLReflowState::nsHTMLReflowState(nsIFrame* aFrame,
|
|||
nsISpaceManager* aSpaceManager)
|
||||
: nsReflowState(aFrame, aReason, aMaxSize, aContext)
|
||||
{
|
||||
frameType = eReflowType_Block;
|
||||
spaceManager = aSpaceManager;
|
||||
lineLayout = nsnull;
|
||||
}
|
||||
|
||||
// Constructs an initial reflow state (no parent reflow state) for an
|
||||
// incremental reflow command
|
||||
// incremental reflow command. Sets reflowType to eReflowType_Block
|
||||
inline
|
||||
nsHTMLReflowState::nsHTMLReflowState(nsIFrame* aFrame,
|
||||
nsIReflowCommand& aReflowCommand,
|
||||
|
@ -131,31 +231,57 @@ nsHTMLReflowState::nsHTMLReflowState(nsIFrame* aFrame,
|
|||
nsISpaceManager* aSpaceManager)
|
||||
: nsReflowState(aFrame, aReflowCommand, aMaxSize, aContext)
|
||||
{
|
||||
frameType = eReflowType_Block;
|
||||
spaceManager = aSpaceManager;
|
||||
lineLayout = nsnull;
|
||||
}
|
||||
|
||||
// Construct a reflow state for the given frame, parent reflow state, and
|
||||
// max size. Uses the reflow reason and reflow command from the parent's
|
||||
// reflow state
|
||||
inline
|
||||
nsHTMLReflowState::nsHTMLReflowState(nsIFrame* aFrame,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
const nsSize& aMaxSize)
|
||||
: nsReflowState(aFrame, aParentReflowState, aMaxSize)
|
||||
{
|
||||
spaceManager = aParentReflowState.spaceManager;
|
||||
}
|
||||
|
||||
// Constructs a reflow state that overrides the reflow reason of the parent
|
||||
// reflow state. Sets the reflow command to NULL
|
||||
// max size. Uses the reflow reason, space manager, reflow command, and
|
||||
// line layout from the parent's reflow state. Defaults to a reflow
|
||||
// frame type of eReflowType_Block
|
||||
inline
|
||||
nsHTMLReflowState::nsHTMLReflowState(nsIFrame* aFrame,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowReason aReflowReason)
|
||||
nsReflowFrameType aFrameType)
|
||||
: nsReflowState(aFrame, aParentReflowState, aMaxSize)
|
||||
{
|
||||
frameType = aFrameType;
|
||||
spaceManager = aParentReflowState.spaceManager;
|
||||
lineLayout = aParentReflowState.lineLayout;
|
||||
}
|
||||
|
||||
// Construct a reflow state for the given inline frame, parent reflow state,
|
||||
// and max size. Uses the reflow reason, space manager, and reflow command from
|
||||
// the parent's reflow state. Sets the reflow frame type to eReflowType_Inline
|
||||
inline
|
||||
nsHTMLReflowState::nsHTMLReflowState(nsIFrame* aFrame,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsLineLayout* aLineLayout)
|
||||
: nsReflowState(aFrame, aParentReflowState, aMaxSize)
|
||||
{
|
||||
frameType = eReflowType_Inline;
|
||||
spaceManager = aParentReflowState.spaceManager;
|
||||
lineLayout = aLineLayout;
|
||||
}
|
||||
|
||||
// Constructs a reflow state that overrides the reflow reason of the parent
|
||||
// reflow state. Uses the space manager from the parent's reflow state and
|
||||
// sets the reflow command to NULL. Sets lineLayout to NULL, and defaults to
|
||||
// a reflow frame type of eReflowType_Block
|
||||
inline
|
||||
nsHTMLReflowState::nsHTMLReflowState(nsIFrame* aFrame,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowReason aReflowReason,
|
||||
nsReflowFrameType aFrameType)
|
||||
: nsReflowState(aFrame, aParentReflowState, aMaxSize, aReflowReason)
|
||||
{
|
||||
frameType = aFrameType;
|
||||
spaceManager = aParentReflowState.spaceManager;
|
||||
lineLayout = nsnull;
|
||||
}
|
||||
|
||||
#endif /* nsIHTMLReflow_h___ */
|
||||
|
|
|
@ -1,106 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#ifndef nsIInlineReflow_h___
|
||||
#define nsIInlineReflow_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIHTMLReflow.h"
|
||||
class nsLineLayout;
|
||||
struct nsHTMLReflowMetrics;
|
||||
|
||||
/* d76e29b0-ff56-11d1-89e7-006008911b81 */
|
||||
#define NS_IINLINE_REFLOW_IID \
|
||||
{0xd76e29b0, 0xff56, 0x11d1, {0x89, 0xe7, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81}}
|
||||
|
||||
class nsIInlineReflow {
|
||||
public:
|
||||
/**
|
||||
* Recursively find all of the text runs contained in an outer
|
||||
* block container. Inline frames implement this by recursing over
|
||||
* their children; note that inlines frames may need to create
|
||||
* missing child frames before proceeding (e.g. when a tree
|
||||
* containing inlines is appended/inserted into a block container
|
||||
*/
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand) = 0;
|
||||
|
||||
/**
|
||||
* InlineReflow method. See below for how to interpret the return value.
|
||||
*/
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* For InlineReflow the return value (an nsresult) indicates the
|
||||
* status of the reflow operation. If the return value is negative
|
||||
* then some sort of catastrophic error has occured (e.g. out of memory).
|
||||
* If the return value is non-negative then the macros below can be
|
||||
* used to interpret it.
|
||||
*
|
||||
* This is an extension of the nsReflowStatus value; it's bits are used
|
||||
* in addition the bits that we add.
|
||||
*/
|
||||
typedef nsReflowStatus nsInlineReflowStatus;
|
||||
|
||||
// This bit is set, when a break is requested. This bit is orthogonal
|
||||
// to the nsIFrame::nsReflowStatus completion bits.
|
||||
#define NS_INLINE_BREAK 0x0100
|
||||
|
||||
#define NS_INLINE_IS_BREAK(_status) \
|
||||
(0 != ((_status) & NS_INLINE_BREAK))
|
||||
|
||||
// When a break is requested, this bit when set indicates that the
|
||||
// break should occur after the frame just reflowed; when the bit is
|
||||
// clear the break should occur before the frame just reflowed.
|
||||
#define NS_INLINE_BREAK_BEFORE 0x0000
|
||||
#define NS_INLINE_BREAK_AFTER 0x0200
|
||||
|
||||
#define NS_INLINE_IS_BREAK_AFTER(_status) \
|
||||
(0 != ((_status) & NS_INLINE_BREAK_AFTER))
|
||||
|
||||
#define NS_INLINE_IS_BREAK_BEFORE(_status) \
|
||||
(NS_INLINE_BREAK == ((_status) & (NS_INLINE_BREAK|NS_INLINE_BREAK_AFTER)))
|
||||
|
||||
// The type of break requested can be found in these bits.
|
||||
#define NS_INLINE_BREAK_TYPE_MASK 0xF000
|
||||
|
||||
#define NS_INLINE_GET_BREAK_TYPE(_status) (((_status) >> 12) & 0xF)
|
||||
|
||||
#define NS_INLINE_MAKE_BREAK_TYPE(_type) ((_type) << 12)
|
||||
|
||||
// Construct a line-break-before status. Note that there is no
|
||||
// completion status for a line-break before because we *know* that
|
||||
// the frame will be reflowed later and hence it's current completion
|
||||
// status doesn't matter.
|
||||
#define NS_INLINE_LINE_BREAK_BEFORE() \
|
||||
(NS_INLINE_BREAK | NS_INLINE_BREAK_BEFORE | \
|
||||
NS_INLINE_MAKE_BREAK_TYPE(NS_STYLE_CLEAR_LINE))
|
||||
|
||||
// Take a completion status and add to it the desire to have a
|
||||
// line-break after. For this macro we do need the completion status
|
||||
// because the user of the status will need to know whether to
|
||||
// continue the frame or not.
|
||||
#define NS_INLINE_LINE_BREAK_AFTER(_completionStatus) \
|
||||
((_completionStatus) | NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER | \
|
||||
NS_INLINE_MAKE_BREAK_TYPE(NS_STYLE_CLEAR_LINE))
|
||||
|
||||
#endif /* nsIInlineReflow_h___ */
|
|
@ -54,16 +54,12 @@ nsInlineReflowState::~nsInlineReflowState()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class nsInlineFrame : public nsHTMLContainerFrame,
|
||||
public nsIInlineReflow
|
||||
class nsInlineFrame : public nsHTMLContainerFrame
|
||||
{
|
||||
public:
|
||||
nsInlineFrame(nsIContent* aContent, nsIFrame* aParent);
|
||||
virtual ~nsInlineFrame();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame
|
||||
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList);
|
||||
NS_IMETHOD CreateContinuingFrame(nsIPresContext& aCX,
|
||||
|
@ -71,12 +67,15 @@ public:
|
|||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame*& aContinuingFrame);
|
||||
|
||||
// nsIInlineReflow
|
||||
// nsIHTMLReflow
|
||||
#if 0
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
#endif
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
virtual PRIntn GetSkipSides() const;
|
||||
|
||||
|
@ -93,8 +92,8 @@ public:
|
|||
nsresult FrameAppendedReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow);
|
||||
|
||||
nsresult FrameRemovedReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow);
|
||||
nsReflowStatus FrameRemovedReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow);
|
||||
|
||||
nsresult ChildIncrementalReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow);
|
||||
|
@ -108,15 +107,15 @@ public:
|
|||
|
||||
PRBool ReflowMapped(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow,
|
||||
nsInlineReflowStatus& aReflowStatus);
|
||||
nsReflowStatus& aReflowStatus);
|
||||
|
||||
PRBool ReflowFrame(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aReflowStatus);
|
||||
nsReflowStatus& aReflowStatus);
|
||||
|
||||
nsInlineReflowStatus PullUpChildren(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow);
|
||||
nsReflowStatus PullUpChildren(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow);
|
||||
|
||||
nsIFrame* PullOneChild(nsInlineFrame* aNextInFlow,
|
||||
nsIFrame* aLastChild);
|
||||
|
@ -159,20 +158,6 @@ nsInlineFrame::~nsInlineFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInlineFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIInlineReflowIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIInlineReflow*)this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
|
||||
}
|
||||
|
||||
PRIntn
|
||||
nsInlineFrame::GetSkipSides() const
|
||||
{
|
||||
|
@ -249,7 +234,7 @@ nsInlineFrame::CreateContinuingFrame(nsIPresContext& aCX,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
|
@ -284,6 +269,7 @@ nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
|||
("exit nsInlineFrame::FindTextRuns rv=%x", rv));
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
nsInlineFrame::InsertNewFrame(nsIPresContext& aPresContext,
|
||||
|
@ -316,9 +302,10 @@ nsInlineFrame::InsertNewFrame(nsIPresContext& aPresContext,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
nsInlineFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("enter nsInlineFrame::InlineReflow maxSize=%d,%d reason=%d nif=%p",
|
||||
|
@ -335,7 +322,7 @@ nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
}
|
||||
|
||||
// Prepare for reflow
|
||||
nsInlineReflowState state(aLineLayout.mPresContext, aReflowState, aMetrics);
|
||||
nsInlineReflowState state(aPresContext, aReflowState, aMetrics);
|
||||
|
||||
// If we're constrained adjust the available size so it excludes space
|
||||
// needed for border/padding
|
||||
|
@ -351,21 +338,22 @@ nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
|
||||
|
||||
// Prepare inline reflow engine
|
||||
nsInlineReflow inlineReflow(aLineLayout, state, this);
|
||||
NS_ASSERTION(nsnull != aReflowState.lineLayout, "no line layout");
|
||||
nsInlineReflow inlineReflow(*aReflowState.lineLayout, state, this);
|
||||
inlineReflow.Init(state.mBorderPadding.left, state.mBorderPadding.top,
|
||||
width, height);
|
||||
|
||||
// ListTag(stdout); printf(": enter isMarginRoot=%c\n", state.mIsMarginRoot?'T':'F');
|
||||
// Now translate in by our border and padding
|
||||
aLineLayout.mSpaceManager->Translate(state.mBorderPadding.left,
|
||||
NS_ASSERTION(nsnull != aReflowState.spaceManager, "no space manager");
|
||||
aReflowState.spaceManager->Translate(state.mBorderPadding.left,
|
||||
state.mBorderPadding.top);
|
||||
|
||||
// Based on the type of reflow, switch out to the appropriate
|
||||
// routine.
|
||||
nsresult rv = NS_OK;
|
||||
if (eReflowReason_Initial == state.reason) {
|
||||
DrainOverflowLists();
|
||||
rv = InitialReflow(state, inlineReflow);
|
||||
aStatus = InitialReflow(state, inlineReflow);
|
||||
mState &= ~NS_FRAME_FIRST_REFLOW;
|
||||
}
|
||||
else if (eReflowReason_Incremental == state.reason) {
|
||||
|
@ -385,7 +373,7 @@ nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
nsIFrame* prevSibling;
|
||||
switch (type) {
|
||||
case nsIReflowCommand::FrameAppended:
|
||||
rv = FrameAppendedReflow(state, inlineReflow);
|
||||
aStatus = FrameAppendedReflow(state, inlineReflow);
|
||||
break;
|
||||
|
||||
case nsIReflowCommand::FrameInserted:
|
||||
|
@ -394,16 +382,16 @@ nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
state.reflowCommand->GetPrevSiblingFrame(prevSibling);
|
||||
InsertNewFrame(state.mPresContext, newFrame, prevSibling);
|
||||
// XXX For now map into full reflow...
|
||||
rv = ResizeReflow(state, inlineReflow);
|
||||
aStatus = ResizeReflow(state, inlineReflow);
|
||||
break;
|
||||
|
||||
case nsIReflowCommand::FrameRemoved:
|
||||
rv = FrameRemovedReflow(state, inlineReflow);
|
||||
aStatus = FrameRemovedReflow(state, inlineReflow);
|
||||
break;
|
||||
|
||||
default:
|
||||
// XXX For now map the other incremental operations into full reflows
|
||||
rv = ResizeReflow(state, inlineReflow);
|
||||
aStatus = ResizeReflow(state, inlineReflow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -412,24 +400,24 @@ nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
state.reflowCommand->GetNext(state.mNextRCFrame);
|
||||
|
||||
// Continue the reflow
|
||||
rv = ChildIncrementalReflow(state, inlineReflow);
|
||||
aStatus = ChildIncrementalReflow(state, inlineReflow);
|
||||
}
|
||||
}
|
||||
else if (eReflowReason_Resize == state.reason) {
|
||||
DrainOverflowLists();
|
||||
rv = ResizeReflow(state, inlineReflow);
|
||||
aStatus = ResizeReflow(state, inlineReflow);
|
||||
}
|
||||
ComputeFinalSize(state, inlineReflow, aMetrics);
|
||||
// ListTag(stdout); printf(": exit carriedMargins=%d,%d\n", aMetrics.mCarriedOutTopMargin, aMetrics.mCarriedOutBottomMargin);
|
||||
|
||||
// Now translate in by our border and padding
|
||||
aLineLayout.mSpaceManager->Translate(-state.mBorderPadding.left,
|
||||
aReflowState.spaceManager->Translate(-state.mBorderPadding.left,
|
||||
-state.mBorderPadding.top);
|
||||
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("exit nsInlineFrame::InlineReflow size=%d,%d rv=%x nif=%p",
|
||||
aMetrics.width, aMetrics.height, rv, mNextInFlow));
|
||||
return rv;
|
||||
("exit nsInlineFrame::InlineReflow size=%d,%d status=%x nif=%p",
|
||||
aMetrics.width, aMetrics.height, aStatus, mNextInFlow));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX factor this (into nsFrameReflowState?) so that both block and
|
||||
|
@ -573,13 +561,13 @@ nsInlineFrame::ComputeFinalSize(nsInlineReflowState& aState,
|
|||
}
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
nsInlineFrame::InitialReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow)
|
||||
{
|
||||
NS_PRECONDITION(nsnull == mNextInFlow, "bad frame-appended-reflow");
|
||||
|
||||
nsInlineReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
nsReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
if (nsnull != mFirstChild) {
|
||||
if (!ReflowMapped(aState, aInlineReflow, rs)) {
|
||||
return rs;
|
||||
|
@ -588,7 +576,7 @@ nsInlineFrame::InitialReflow(nsInlineReflowState& aState,
|
|||
return rs;
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
nsInlineFrame::FrameAppendedReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow)
|
||||
{
|
||||
|
@ -601,7 +589,7 @@ nsInlineFrame::FrameAppendedReflow(nsInlineReflowState& aState,
|
|||
// Add the new frames
|
||||
AppendNewFrames(aState.mPresContext, firstAppendedFrame);
|
||||
|
||||
nsInlineReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
nsReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
if (nsnull != mFirstChild) {
|
||||
if (!ReflowMapped(aState, aInlineReflow, rs)) {
|
||||
return rs;
|
||||
|
@ -610,7 +598,7 @@ nsInlineFrame::FrameAppendedReflow(nsInlineReflowState& aState,
|
|||
return rs;
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
nsInlineFrame::FrameRemovedReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow)
|
||||
{
|
||||
|
@ -666,7 +654,7 @@ nsInlineFrame::FrameRemovedReflow(nsInlineReflowState& aState,
|
|||
return ResizeReflow(aState, aInlineReflow);
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
nsInlineFrame::ChildIncrementalReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow)
|
||||
{
|
||||
|
@ -674,11 +662,11 @@ nsInlineFrame::ChildIncrementalReflow(nsInlineReflowState& aState,
|
|||
return ResizeReflow(aState, aInlineReflow);
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
nsInlineFrame::ResizeReflow(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow)
|
||||
{
|
||||
nsInlineReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
nsReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
if (nsnull != mFirstChild) {
|
||||
if (!ReflowMapped(aState, aInlineReflow, rs)) {
|
||||
return rs;
|
||||
|
@ -695,7 +683,7 @@ nsInlineFrame::ResizeReflow(nsInlineReflowState& aState,
|
|||
PRBool
|
||||
nsInlineFrame::ReflowMapped(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow,
|
||||
nsInlineReflowStatus& aReflowStatus)
|
||||
nsReflowStatus& aReflowStatus)
|
||||
{
|
||||
PRBool keepGoing = PR_TRUE;
|
||||
aState.mLastChild = nsnull;
|
||||
|
@ -711,11 +699,11 @@ nsInlineFrame::ReflowMapped(nsInlineReflowState& aState,
|
|||
return keepGoing;
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
nsInlineFrame::PullUpChildren(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow)
|
||||
{
|
||||
nsInlineReflowStatus reflowStatus = NS_FRAME_COMPLETE;
|
||||
nsReflowStatus reflowStatus = NS_FRAME_COMPLETE;
|
||||
nsInlineFrame* nextInFlow = (nsInlineFrame*) mNextInFlow;
|
||||
while (nsnull != nextInFlow) {
|
||||
// Get child from our next-in-flow
|
||||
|
@ -751,7 +739,7 @@ PRBool
|
|||
nsInlineFrame::ReflowFrame(nsInlineReflowState& aState,
|
||||
nsInlineReflow& aInlineReflow,
|
||||
nsIFrame* aFrame,
|
||||
nsInlineReflowStatus& aReflowStatus)
|
||||
nsReflowStatus& aReflowStatus)
|
||||
{
|
||||
aInlineReflow.SetIsFirstChild(aFrame == mFirstChild);
|
||||
aReflowStatus = aInlineReflow.ReflowFrame(aFrame);
|
||||
|
@ -812,7 +800,7 @@ nsInlineFrame::ReflowFrame(nsInlineReflowState& aState,
|
|||
nsresult rv;
|
||||
rv = CreateNextInFlow(aState.mPresContext, this, aFrame, newFrame);
|
||||
if (NS_OK != rv) {
|
||||
aReflowStatus = nsInlineReflowStatus(rv);
|
||||
// XXX RETURN ERROR STATUS...
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ nsInlineReflow::SetFrame(nsIFrame* aFrame)
|
|||
mIsInlineAware = PR_FALSE;
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
nsInlineReflow::ReflowFrame(nsIFrame* aFrame)
|
||||
{
|
||||
nsReflowStatus result;
|
||||
|
@ -347,7 +347,7 @@ nsInlineReflow::ComputeAvailableSize()
|
|||
PRBool
|
||||
nsInlineReflow::ReflowFrame(nsHTMLReflowMetrics& aMetrics,
|
||||
nsRect& aBounds,
|
||||
nsInlineReflowStatus& aStatus)
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
// Get reflow reason set correctly. It's possible that a child was
|
||||
// created and then it was decided that it could not be reflowed
|
||||
|
@ -368,6 +368,11 @@ nsInlineReflow::ReflowFrame(nsHTMLReflowMetrics& aMetrics,
|
|||
|
||||
// Setup reflow state for reflowing the frame
|
||||
nsHTMLReflowState reflowState(mFrame, mOuterReflowState, mFrameAvailSize);
|
||||
if (!mTreatFrameAsBlock) {
|
||||
mIsInlineAware = PR_TRUE;
|
||||
reflowState.frameType = eReflowType_Inline;
|
||||
reflowState.lineLayout = &mLineLayout;
|
||||
}
|
||||
reflowState.reason = reason;
|
||||
|
||||
// Let frame know that are reflowing it
|
||||
|
@ -379,12 +384,6 @@ nsInlineReflow::ReflowFrame(nsHTMLReflowMetrics& aMetrics,
|
|||
htmlReflow->WillReflow(mPresContext);
|
||||
mFrame->MoveTo(x, y);
|
||||
|
||||
// There are two ways to reflow the child frame: using the
|
||||
// using the nsIInlineReflow interface or using the default Reflow
|
||||
// method in nsIHTMLReflow. The order of precedence is nsIInlineReflow
|
||||
// then nsIHTMLReflow. We map the reflow status into an
|
||||
// nsInlineReflowStatus.
|
||||
nsIInlineReflow* inlineReflow;
|
||||
aBounds.x = x;
|
||||
aBounds.y = y;
|
||||
|
||||
|
@ -399,17 +398,10 @@ nsInlineReflow::ReflowFrame(nsHTMLReflowMetrics& aMetrics,
|
|||
nscoord ty = y - mOuterReflowState.mBorderPadding.top;
|
||||
mSpaceManager->Translate(tx, ty);
|
||||
|
||||
if (NS_OK == mFrame->QueryInterface(kIInlineReflowIID, (void**)&inlineReflow)) {
|
||||
aStatus = inlineReflow->InlineReflow(mLineLayout, aMetrics, reflowState);
|
||||
mIsInlineAware = PR_TRUE;
|
||||
aBounds.width = aMetrics.width;
|
||||
aBounds.height = aMetrics.height;
|
||||
}
|
||||
else {
|
||||
htmlReflow->Reflow(mPresContext, aMetrics, reflowState, aStatus);
|
||||
aBounds.width = aMetrics.width;
|
||||
aBounds.height = aMetrics.height;
|
||||
}
|
||||
htmlReflow->Reflow(mPresContext, aMetrics, reflowState, aStatus);
|
||||
aBounds.width = aMetrics.width;
|
||||
aBounds.height = aMetrics.height;
|
||||
|
||||
mSpaceManager->Translate(-tx, -ty);
|
||||
|
||||
// Now that frame has been reflowed at least one time make sure that
|
||||
|
@ -458,7 +450,7 @@ nsInlineReflow::ReflowFrame(nsHTMLReflowMetrics& aMetrics,
|
|||
PRBool
|
||||
nsInlineReflow::CanPlaceFrame(nsHTMLReflowMetrics& aMetrics,
|
||||
nsRect& aBounds,
|
||||
nsInlineReflowStatus& aStatus)
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
// Compute right margin to use
|
||||
mRightMargin = 0;
|
||||
|
|
|
@ -20,11 +20,10 @@
|
|||
#define nsInlineReflow_h___
|
||||
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
#include "nsIHTMLReflow.h"
|
||||
|
||||
class nsFrameReflowState;
|
||||
class nsHTMLContainerFrame;
|
||||
class nsIRunaround;
|
||||
class nsLineLayout;
|
||||
struct nsStyleDisplay;
|
||||
struct nsStylePosition;
|
||||
|
@ -50,7 +49,7 @@ public:
|
|||
|
||||
void UpdateBand(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
|
||||
nsInlineReflowStatus ReflowFrame(nsIFrame* aFrame);
|
||||
nsReflowStatus ReflowFrame(nsIFrame* aFrame);
|
||||
|
||||
void VerticalAlignFrames(nsRect& aLineBox);
|
||||
|
||||
|
@ -102,11 +101,11 @@ protected:
|
|||
|
||||
PRBool ReflowFrame(nsHTMLReflowMetrics& aMetrics,
|
||||
nsRect& aBounds,
|
||||
nsInlineReflowStatus& aStatus);
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
PRBool CanPlaceFrame(nsHTMLReflowMetrics& aMetrics,
|
||||
nsRect& aBounds,
|
||||
nsInlineReflowStatus& aStatus);
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
void PlaceFrame(nsHTMLReflowMetrics& aMetrics, nsRect& aBounds);
|
||||
|
||||
|
|
|
@ -56,21 +56,7 @@ nsPlaceholderFrame::~nsPlaceholderFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlaceholderFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIInlineReflowIID)) {
|
||||
nsIInlineReflow* tmp = this;
|
||||
*aInstancePtrResult = (void*) tmp;
|
||||
return NS_OK;
|
||||
}
|
||||
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
|
||||
}
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
nsPlaceholderFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
|
@ -78,14 +64,14 @@ nsPlaceholderFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
|||
aLineLayout.EndTextRun();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlaceholderFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
nsPlaceholderFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
nsIPresContext& presContext = aLineLayout.mPresContext;
|
||||
|
||||
// Get the floater container in which we're inserted
|
||||
nsIFrame* containingBlock;
|
||||
nsIFloaterContainer* container = nsnull;
|
||||
|
@ -106,11 +92,12 @@ nsPlaceholderFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
NS_ASSERTION(nsnull != mAnchoredItem, "no anchored item");
|
||||
|
||||
// Notify our containing block that there's a new floater
|
||||
container->AddFloater(&presContext, aReflowState, mAnchoredItem, this);
|
||||
container->AddFloater(&aPresContext, aReflowState, mAnchoredItem, this);
|
||||
}
|
||||
|
||||
// Let line layout know about the floater
|
||||
aLineLayout.AddFloater(this);
|
||||
NS_ASSERTION(nsnull != aReflowState.lineLayout, "no line layout");
|
||||
aReflowState.lineLayout->AddFloater(this);
|
||||
|
||||
aDesiredSize.width = 0;
|
||||
aDesiredSize.height = 0;
|
||||
|
@ -120,7 +107,9 @@ nsPlaceholderFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
||||
aDesiredSize.maxElementSize->height = aDesiredSize.height;
|
||||
}
|
||||
return NS_FRAME_COMPLETE;
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -19,11 +19,10 @@
|
|||
#define nsPlaceholderFrame_h___
|
||||
|
||||
#include "nsFrame.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
|
||||
// Implementation of a frame that's used as a placeholder for an anchored item
|
||||
|
||||
class nsPlaceholderFrame : public nsFrame, public nsIInlineReflow {
|
||||
class nsPlaceholderFrame : public nsFrame {
|
||||
public:
|
||||
/**
|
||||
* Create a new placeholder frame
|
||||
|
@ -37,15 +36,17 @@ public:
|
|||
nsIFrame* GetAnchoredItem() const {return mAnchoredItem;}
|
||||
void SetAnchoredItem(nsIFrame* aAnchoredItem) {mAnchoredItem = aAnchoredItem;}
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame overrides
|
||||
// nsIHTMLReflow overrides
|
||||
#if 0
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
#endif
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
// nsIFrame overrides
|
||||
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nsHTMLParts.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
@ -33,19 +32,19 @@
|
|||
#define TYPE_LINE 1 // line-break + vertical space
|
||||
#define TYPE_IMAGE 2 // acts like a sized image with nothing to see
|
||||
|
||||
class SpacerFrame : public nsFrame, private nsIInlineReflow {
|
||||
class SpacerFrame : public nsFrame {
|
||||
public:
|
||||
SpacerFrame(nsIContent* aContent, nsIFrame* aParentFrame);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIInlineReflow
|
||||
// nsIHTMLReflow
|
||||
#if 0
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
#endif
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
PRUint8 GetType();
|
||||
|
||||
|
@ -76,25 +75,12 @@ SpacerFrame::~SpacerFrame()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SpacerFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
SpacerFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIInlineReflowIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIInlineReflow*)this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SpacerFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
nsresult rv = NS_FRAME_COMPLETE;
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
|
||||
// By default, we have no area
|
||||
aMetrics.width = 0;
|
||||
|
@ -133,7 +119,7 @@ SpacerFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
NS_RELEASE(hc);
|
||||
}
|
||||
|
||||
float p2t = aLineLayout.mPresContext.GetPixelsToTwips();
|
||||
float p2t = aPresContext.GetPixelsToTwips();
|
||||
switch (type) {
|
||||
case TYPE_WORD:
|
||||
if (0 != width) {
|
||||
|
@ -143,7 +129,7 @@ SpacerFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
|
||||
case TYPE_LINE:
|
||||
if (0 != width) {
|
||||
rv = NS_INLINE_LINE_BREAK_AFTER(0);
|
||||
aStatus = NS_INLINE_LINE_BREAK_AFTER(0);
|
||||
aMetrics.height = NSIntPixelsToTwips(width, p2t);
|
||||
aMetrics.ascent = aMetrics.height;
|
||||
}
|
||||
|
@ -161,9 +147,10 @@ SpacerFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
aMetrics.maxElementSize->height = aMetrics.height;
|
||||
}
|
||||
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
SpacerFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
|
@ -171,6 +158,7 @@ SpacerFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
|||
aLineLayout.EndTextRun();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
PRUint8
|
||||
SpacerFrame::GetType()
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nsHTMLParts.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsSplittableFrame.h"
|
||||
#include "nsIInlineReflow.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
@ -110,13 +109,10 @@ public:
|
|||
nsVoidArray mFrames;
|
||||
};
|
||||
|
||||
class TextFrame : public nsSplittableFrame, private nsIInlineReflow {
|
||||
class TextFrame : public nsSplittableFrame {
|
||||
public:
|
||||
TextFrame(nsIContent* aContent, nsIFrame* aParentFrame);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame
|
||||
NS_IMETHOD CreateContinuingFrame(nsIPresContext& aPresContext,
|
||||
nsIFrame* aParent,
|
||||
|
@ -148,13 +144,15 @@ public:
|
|||
PRUint32& aAcutalContentOffset,
|
||||
PRInt32& aOffset);
|
||||
|
||||
// nsIInlineReflow
|
||||
// nsIHTMLReflow
|
||||
#if 0
|
||||
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand);
|
||||
|
||||
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
#endif
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
// TextFrame methods
|
||||
struct SelectionInfo {
|
||||
|
@ -200,18 +198,18 @@ public:
|
|||
nscolor aSelectionBGColor,
|
||||
nscoord dx, nscoord dy);
|
||||
|
||||
nsInlineReflowStatus ReflowPre(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
const nsStyleFont& aFont,
|
||||
PRInt32 aStartingOffset);
|
||||
nsReflowStatus ReflowPre(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
const nsStyleFont& aFont,
|
||||
PRInt32 aStartingOffset);
|
||||
|
||||
nsInlineReflowStatus ReflowNormal(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
const nsStyleFont& aFontStyle,
|
||||
const nsStyleText& aTextStyle,
|
||||
PRInt32 aStartingOffset);
|
||||
nsReflowStatus ReflowNormal(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
const nsStyleFont& aFontStyle,
|
||||
const nsStyleText& aTextStyle,
|
||||
PRInt32 aStartingOffset);
|
||||
|
||||
protected:
|
||||
virtual ~TextFrame();
|
||||
|
@ -370,20 +368,6 @@ TextFrame::~TextFrame()
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIInlineReflowIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIInlineReflow*)this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextFrame::GetCursorAndContentAt(nsIPresContext& aPresContext,
|
||||
const nsPoint& aPoint,
|
||||
|
@ -1208,6 +1192,7 @@ TextFrame::PaintAsciiText(nsIPresContext& aPresContext,
|
|||
NS_RELEASE(doc);
|
||||
}
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
TextFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
||||
nsIReflowCommand* aReflowCommand)
|
||||
|
@ -1217,6 +1202,7 @@ TextFrame::FindTextRuns(nsLineLayout& aLineLayout,
|
|||
}
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------
|
||||
// Uses a binary search for find where the cursor falls in the line of text
|
||||
|
@ -1351,9 +1337,10 @@ TextFrame::GetPosition(nsIPresContext& aCX,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextFrame::InlineReflow(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
TextFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("enter TextFrame::Reflow: aMaxSize=%d,%d",
|
||||
|
@ -1382,28 +1369,28 @@ TextFrame::InlineReflow(nsLineLayout& aLineLayout,
|
|||
const nsStyleText* text =
|
||||
(const nsStyleText*)mStyleContext->GetStyleData(eStyleStruct_Text);
|
||||
|
||||
nsInlineReflowStatus rs;
|
||||
NS_ASSERTION(nsnull != aReflowState.lineLayout, "no line layout");
|
||||
if (NS_STYLE_WHITESPACE_PRE == text->mWhiteSpace) {
|
||||
// Use a specialized routine for pre-formatted text
|
||||
rs = ReflowPre(aLineLayout, aMetrics, aReflowState,
|
||||
*font, startingOffset);
|
||||
aStatus = ReflowPre(*aReflowState.lineLayout, aMetrics, aReflowState,
|
||||
*font, startingOffset);
|
||||
} else {
|
||||
// Use normal wrapping routine for non-pre text (this includes
|
||||
// text that is not wrapping)
|
||||
rs = ReflowNormal(aLineLayout, aMetrics, aReflowState,
|
||||
*font, *text, startingOffset);
|
||||
aStatus = ReflowNormal(*aReflowState.lineLayout, aMetrics, aReflowState,
|
||||
*font, *text, startingOffset);
|
||||
}
|
||||
|
||||
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
||||
("exit TextFrame::Reflow: rv=%x width=%d",
|
||||
rs, aMetrics.width));
|
||||
return rs;
|
||||
("exit TextFrame::Reflow: status=%x width=%d",
|
||||
aStatus, aMetrics.width));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Reflow normal text (stuff that doesn't have to deal with horizontal
|
||||
// tabs). Normal text reflow may or may not wrap depending on the
|
||||
// "whiteSpace" style property.
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
TextFrame::ReflowNormal(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
|
@ -1578,14 +1565,14 @@ TextFrame::ReflowNormal(nsLineLayout& aLineLayout,
|
|||
return (cp == end) ? NS_FRAME_COMPLETE : NS_FRAME_NOT_COMPLETE;
|
||||
}
|
||||
|
||||
nsInlineReflowStatus
|
||||
nsReflowStatus
|
||||
TextFrame::ReflowPre(nsLineLayout& aLineLayout,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
const nsStyleFont& aFont,
|
||||
PRInt32 aStartingOffset)
|
||||
{
|
||||
nsInlineReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
nsReflowStatus rs = NS_FRAME_COMPLETE;
|
||||
|
||||
PRInt32 textLength;
|
||||
const PRUnichar* cp = GetText(mContent, textLength);
|
||||
|
|
Загрузка…
Ссылка в новой задаче