From 32a3b83c42dcd36d960b5f3768a4cee38fa64af9 Mon Sep 17 00:00:00 2001 From: "roc+@cs.cmu.edu" Date: Wed, 18 Jul 2007 21:29:59 -0700 Subject: [PATCH] Bug 381703. First-letter frames that are wrapping non-first-letter-content should behave like spans and not compute their size. r+sr=dbaron --- layout/generic/nsFirstLetterFrame.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/layout/generic/nsFirstLetterFrame.cpp b/layout/generic/nsFirstLetterFrame.cpp index c0e258d527b3..1edadbb3ec6c 100644 --- a/layout/generic/nsFirstLetterFrame.cpp +++ b/layout/generic/nsFirstLetterFrame.cpp @@ -78,6 +78,10 @@ public: InlineMinWidthData *aData); virtual void AddInlinePrefWidth(nsIRenderingContext *aRenderingContext, InlinePrefWidthData *aData); + virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext, + nsSize aCBSize, nscoord aAvailableWidth, + nsSize aMargin, nsSize aBorder, nsSize aPadding, + PRBool aShrinkWrap); NS_IMETHOD Reflow(nsPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, @@ -223,6 +227,21 @@ nsFirstLetterFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext) return nsLayoutUtils::PrefWidthFromInline(this, aRenderingContext); } +/* virtual */ nsSize +nsFirstLetterFrame::ComputeSize(nsIRenderingContext *aRenderingContext, + nsSize aCBSize, nscoord aAvailableWidth, + nsSize aMargin, nsSize aBorder, nsSize aPadding, + PRBool aShrinkWrap) +{ + if (GetPrevInFlow()) { + // We're wrapping the text *after* the first letter, so behave like an + // inline frame. + return nsSize(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE); + } + return nsFirstLetterFrameSuper::ComputeSize(aRenderingContext, + aCBSize, aAvailableWidth, aMargin, aBorder, aPadding, aShrinkWrap); +} + NS_IMETHODIMP nsFirstLetterFrame::Reflow(nsPresContext* aPresContext, nsHTMLReflowMetrics& aMetrics,