Reflow when Bidi options are changed. Bug 80352, r+sr=bzbarsky

git-svn-id: svn://10.0.0.236/trunk@184540 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
smontagu%smontagu.org
2005-11-13 09:55:09 +00:00
parent 5a895f13d2
commit cedba21351
2 changed files with 14 additions and 11 deletions

View File

@@ -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);

View File

@@ -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();
}
}