From 2f6a9ffa9fa74b2b9e29968a3d16a801b59b2492 Mon Sep 17 00:00:00 2001 From: "roc+@cs.cmu.edu" Date: Thu, 21 Jun 2007 17:14:34 -0700 Subject: [PATCH] Bug 385234. Iterate through textframe continuations properly in AddInlinePref/MinWidth. r=smontagu --- layout/generic/nsTextFrameThebes.cpp | 48 ++++++++++++++-------------- layout/reftests/bugs/reftest.list | 2 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp index 13da4033f18..972648a7368 100644 --- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -4960,18 +4960,18 @@ nsTextFrame::AddInlineMinWidthForFlow(nsIRenderingContext *aRenderingContext, nsTextFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext, nsIFrame::InlineMinWidthData *aData) { - AddInlineMinWidthForFlow(aRenderingContext, aData); - if (mTextRun && !(mTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW)) { - // mTextRun did not cover all continuations of this frame. - // Measure all additional flows associated with this frame's content. - nsTextFrame* f = this; - for (;;) { - f = NS_STATIC_CAST(nsTextFrame*, f->GetNextContinuation()); - if (!f) - break; - if (f->GetStateBits() & TEXT_IS_RUN_OWNER) { - f->AddInlineMinWidthForFlow(aRenderingContext, aData); - } + nsTextFrame* f; + gfxTextRun* lastTextRun = nsnull; + // nsContinuingTextFrame does nothing for AddInlineMinWidth; all text frames + // in the flow are handled right here. + for (f = this; f; f = NS_STATIC_CAST(nsTextFrame*, f->GetNextContinuation())) { + // f->mTextRun could be null if we haven't set up textruns yet for f. + // Except in OOM situations, lastTextRun will only be null for the first + // text frame. + if (f == this || f->mTextRun != lastTextRun) { + // This will process all the text frames that share the same textrun as f. + f->AddInlineMinWidthForFlow(aRenderingContext, aData); + lastTextRun = f->mTextRun; } } } @@ -5049,18 +5049,18 @@ nsTextFrame::AddInlinePrefWidthForFlow(nsIRenderingContext *aRenderingContext, nsTextFrame::AddInlinePrefWidth(nsIRenderingContext *aRenderingContext, nsIFrame::InlinePrefWidthData *aData) { - AddInlinePrefWidthForFlow(aRenderingContext, aData); - if (mTextRun && !(mTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW)) { - // mTextRun did not cover all continuations of this frame. - // Measure all additional flows associated with this frame's content. - nsTextFrame* f = this; - for (;;) { - f = NS_STATIC_CAST(nsTextFrame*, f->GetNextContinuation()); - if (!f) - break; - if (f->GetStateBits() & TEXT_IS_RUN_OWNER) { - f->AddInlinePrefWidthForFlow(aRenderingContext, aData); - } + nsTextFrame* f; + gfxTextRun* lastTextRun = nsnull; + // nsContinuingTextFrame does nothing for AddInlineMinWidth; all text frames + // in the flow are handled right here. + for (f = this; f; f = NS_STATIC_CAST(nsTextFrame*, f->GetNextContinuation())) { + // f->mTextRun could be null if we haven't set up textruns yet for f. + // Except in OOM situations, lastTextRun will only be null for the first + // text frame. + if (f == this || f->mTextRun != lastTextRun) { + // This will process all the text frames that share the same textrun as f. + f->AddInlinePrefWidthForFlow(aRenderingContext, aData); + lastTextRun = f->mTextRun; } } } diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index a581ad70776..347a383cdc4 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -121,7 +121,7 @@ random == 328829-1.xhtml 328829-1-ref.xhtml # bug 369046 (intermittent) == 335628-1.html 335628-1-ref.html != 335628-2.xul 335628-2-ref.xul == 336147-1.html 336147-1-ref.html -fails == 336736-1.html 336736-1-ref.html # something wrong with subpixel horizontal alignment (tracked in bug 336736) +fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 336736-1.html 336736-1-ref.html # something wrong with subpixel horizontal alignment (tracked in bug 336736) == 339289-1.html 339289-1-ref.html == 341043-1a.html 341043-1-ref.html != 341043-1b.html 341043-1-ref.html