diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index 27f4796ebe2..eb33103ce78 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -3028,13 +3028,7 @@ NS_IMETHODIMP DocumentViewerImpl::GetBidiCharacterSet(PRUint8* aCharacterSet) NS_IMETHODIMP DocumentViewerImpl::SetBidiOptions(PRUint32 aBidiOptions) { if (mPresContext) { -#if 1 - // forcing reflow will cause bug 80352. Temp turn off force reflow and - // wait for simon@softel.co.il to find the real solution - mPresContext->SetBidi(aBidiOptions, PR_FALSE); -#else - mPresContext->SetBidi(aBidiOptions, PR_TRUE); // force reflow -#endif + mPresContext->SetBidi(aBidiOptions, PR_TRUE); // could cause reflow } // now set bidi on all children of mContainer CallChildren(SetChildBidiOptions, (void*) aBidiOptions); diff --git a/mozilla/layout/base/nsPresContext.cpp b/mozilla/layout/base/nsPresContext.cpp index 06ccd82542b..460d44ec9aa 100644 --- a/mozilla/layout/base/nsPresContext.cpp +++ b/mozilla/layout/base/nsPresContext.cpp @@ -610,9 +610,10 @@ nsPresContext::GetUserPreferences() GET_BIDI_OPTION_CHARACTERSET(bidiOptions)); SET_BIDI_OPTION_CHARACTERSET(bidiOptions, prefInt); - // Set on the document, not on ourselves so we don't do the various - // extra SetBidi() work. - GetDocument()->SetBidiOptions(bidiOptions); + // We don't need to force reflow: either we are initializing a new + // prescontext or we are being called from UpdateAfterPreferencesChanged() + // which triggers a reflow anyway. + SetBidi(bidiOptions, PR_FALSE); #endif } @@ -1155,6 +1156,14 @@ nsPresContext::GetBidiUtils() void nsPresContext::SetBidi(PRUint32 aSource, PRBool aForceReflow) { + // Don't do all this stuff unless the options have changed. + if (aSource == GetBidi()) { + return; + } + + NS_ASSERTION(!(aForceReflow && (GetBidi() == 0)), + "ForceReflow on new prescontext"); + GetDocument()->SetBidiOptions(aSource); if (IBMBIDI_TEXTDIRECTION_RTL == GET_BIDI_OPTION_DIRECTION(aSource) || IBMBIDI_NUMERAL_HINDI == GET_BIDI_OPTION_NUMERAL(aSource)) { @@ -1172,7 +1181,7 @@ nsPresContext::SetBidi(PRUint32 aSource, PRBool aForceReflow) SetVisualMode(IsVisualCharset(doc->GetDocumentCharacterSet())); } } - if (mShell && aForceReflow) { + if (aForceReflow) { ClearStyleDataAndReflow(); } }