From 9e8d8775fceeaf9ae9c76b4e93ebba035929fa81 Mon Sep 17 00:00:00 2001 From: "smontagu%smontagu.org" Date: Mon, 28 May 2007 14:40:56 +0000 Subject: [PATCH] Do bidi resolution during GetPrefWidth() and GetMinWidth() as well as Reflow(). Bug 365130, r+sr=roc git-svn-id: svn://10.0.0.236/trunk@227109 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsBlockFrame.cpp | 40 ++++++++++++++++++------- mozilla/layout/generic/nsBlockFrame.h | 5 ++++ 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 04407f84aa2..b5454c1c901 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/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/mozilla/layout/generic/nsBlockFrame.h b/mozilla/layout/generic/nsBlockFrame.h index f96d99a6c3a..fcae33d3489 100644 --- a/mozilla/layout/generic/nsBlockFrame.h +++ b/mozilla/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