From d16cf8e31c96ef83c6dab9d23c405c23843f22ee Mon Sep 17 00:00:00 2001 From: "smontagu@smontagu.org" Date: Mon, 28 May 2007 07:40:56 -0700 Subject: [PATCH] Do bidi resolution during GetPrefWidth() and GetMinWidth() as well as Reflow(). Bug 365130, r+sr=roc --- layout/generic/nsBlockFrame.cpp | 40 ++++++++++++++++++++++++--------- layout/generic/nsBlockFrame.h | 5 +++++ 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 04407f84aa2..b5454c1c901 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -637,6 +637,10 @@ nsBlockFrame::GetMinWidth(nsIRenderingContext *aRenderingContext) AutoNoisyIndenter indent(gNoisyIntrinsic); #endif +#ifdef IBMBIDI + ResolveBidi(); +#endif // IBMBIDI + PRInt32 lineNumber = 0; InlineMinWidthData data; for (line_iterator line = begin_lines(), line_end = end_lines(); @@ -694,6 +698,10 @@ nsBlockFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext) AutoNoisyIndenter indent(gNoisyIntrinsic); #endif +#ifdef IBMBIDI + ResolveBidi(); +#endif // IBMBIDI + PRInt32 lineNumber = 0; InlinePrefWidthData data; for (line_iterator line = begin_lines(), line_end = end_lines(); @@ -876,16 +884,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext, marginRoot, marginRoot, needSpaceManager); #ifdef IBMBIDI - if (! mLines.empty()) { - if (aPresContext->BidiEnabled()) { - nsBidiPresUtils* bidiUtils = aPresContext->GetBidiUtils(); - if (bidiUtils) { - bidiUtils->Resolve(aPresContext, this, - mLines.front()->mFirstChild, - IsVisualFormControl(aPresContext)); - } - } - } + ResolveBidi(); #endif // IBMBIDI if (RenumberLists(aPresContext)) { @@ -6347,6 +6346,27 @@ nsBlockFrame::BlockNeedsSpaceManager(nsIFrame* aBlock) // XXX keep the text-run data in the first-in-flow of the block #ifdef IBMBIDI +nsresult +nsBlockFrame::ResolveBidi() +{ + nsPresContext* presContext = PresContext(); + if (!presContext->BidiEnabled()) { + return NS_OK; + } + + if (mLines.empty()) { + return NS_OK; + } + + nsBidiPresUtils* bidiUtils = presContext->GetBidiUtils(); + if (!bidiUtils) + return NS_OK; + + return bidiUtils->Resolve(presContext, this, + mLines.front()->mFirstChild, + IsVisualFormControl(presContext)); +} + PRBool nsBlockFrame::IsVisualFormControl(nsPresContext* aPresContext) { diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h index f96d99a6c3a..fcae33d3489 100644 --- a/layout/generic/nsBlockFrame.h +++ b/layout/generic/nsBlockFrame.h @@ -355,6 +355,11 @@ protected: nsIFrame* aPrevSibling); #ifdef IBMBIDI + /** + * Perform Bidi resolution on this frame + */ + nsresult ResolveBidi(); + /** * Test whether the frame is a form control in a visual Bidi page. * This is necessary for backwards-compatibility, because most visual