Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
git-svn-id: svn://10.0.0.236/trunk@216738 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -66,12 +66,18 @@ public:
|
||||
virtual nsIAtom* GetType() const;
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||
|
||||
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
|
||||
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
|
||||
virtual void AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
|
||||
InlineMinWidthData *aData);
|
||||
virtual void AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
|
||||
InlinePrefWidthData *aData);
|
||||
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const;
|
||||
virtual PRBool CanContinueTextRun() const;
|
||||
|
||||
NS_IMETHOD SetSelected(nsPresContext* aPresContext, nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread);
|
||||
|
||||
@@ -185,13 +191,45 @@ nsFirstLetterFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset,
|
||||
return nsFrame::GetChildFrameContainingOffset(inContentOffset, inHint, outFrameContentOffset, outChildFrame);
|
||||
}
|
||||
|
||||
// Needed for non-floating first-letter frames and for the continuations
|
||||
// following the first-letter that we also use nsFirstLetterFrame for.
|
||||
/* virtual */ void
|
||||
nsFirstLetterFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
|
||||
nsIFrame::InlineMinWidthData *aData)
|
||||
{
|
||||
DoInlineIntrinsicWidth(aRenderingContext, aData, nsLayoutUtils::MIN_WIDTH);
|
||||
}
|
||||
|
||||
// Needed for non-floating first-letter frames and for the continuations
|
||||
// following the first-letter that we also use nsFirstLetterFrame for.
|
||||
/* virtual */ void
|
||||
nsFirstLetterFrame::AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
|
||||
nsIFrame::InlinePrefWidthData *aData)
|
||||
{
|
||||
DoInlineIntrinsicWidth(aRenderingContext, aData, nsLayoutUtils::PREF_WIDTH);
|
||||
}
|
||||
|
||||
// Needed for floating first-letter frames.
|
||||
/* virtual */ nscoord
|
||||
nsFirstLetterFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
|
||||
{
|
||||
return nsLayoutUtils::MinWidthFromInline(this, aRenderingContext);
|
||||
}
|
||||
|
||||
// Needed for floating first-letter frames.
|
||||
/* virtual */ nscoord
|
||||
nsFirstLetterFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
|
||||
{
|
||||
return nsLayoutUtils::PrefWidthFromInline(this, aRenderingContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aReflowStatus)
|
||||
{
|
||||
DO_GLOBAL_REFLOW_COUNT("nsFirstLetterFrame", aReflowState.reason);
|
||||
DO_GLOBAL_REFLOW_COUNT("nsFirstLetterFrame");
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aReflowStatus);
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
@@ -218,8 +256,7 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
|
||||
// only time that the first-letter-frame is not reflowing in a
|
||||
// line context is when its floating.
|
||||
nsHTMLReflowState rs(aPresContext, aReflowState, kid, availSize);
|
||||
nsLineLayout ll(aPresContext, nsnull, &aReflowState,
|
||||
aMetrics.mComputeMEW);
|
||||
nsLineLayout ll(aPresContext, nsnull, &aReflowState);
|
||||
ll.BeginLineReflow(0, 0, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE,
|
||||
PR_FALSE, PR_TRUE);
|
||||
rs.mLineLayout = ≪
|
||||
@@ -238,8 +275,7 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
|
||||
ll->BeginSpan(this, &aReflowState, bp.left, availSize.width);
|
||||
ll->ReflowFrame(kid, aReflowStatus, &aMetrics, pushedFrame);
|
||||
nsSize size;
|
||||
ll->EndSpan(this, size,
|
||||
aMetrics.mComputeMEW ? &aMetrics.mMaxElementWidth : nsnull);
|
||||
ll->EndSpan(this, size);
|
||||
}
|
||||
|
||||
// Place and size the child and update the output metrics
|
||||
@@ -249,9 +285,6 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
|
||||
aMetrics.height += tb;
|
||||
aMetrics.ascent += bp.top;
|
||||
aMetrics.descent += bp.bottom;
|
||||
if (aMetrics.mComputeMEW) {
|
||||
aMetrics.mMaxElementWidth += lr;
|
||||
}
|
||||
|
||||
// Create a continuation or remove existing continuations based on
|
||||
// the reflow completion status.
|
||||
@@ -290,12 +323,11 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFirstLetterFrame::CanContinueTextRun(PRBool& aContinueTextRun) const
|
||||
/* virtual */ PRBool
|
||||
nsFirstLetterFrame::CanContinueTextRun() const
|
||||
{
|
||||
// We can continue a text run through a first-letter frame.
|
||||
aContinueTextRun = PR_TRUE;
|
||||
return NS_OK;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user