From 9c63c0a6e1cac0bb8e01e71f0b8d645795eb461c Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 27 Jan 2009 19:31:26 -0500 Subject: [PATCH] Bug 475419. Make sure to set up our user font set no matter what the ordering of flushes and font loading is. r+sr=dbaron, a=bsmedberg --- layout/base/nsPresContext.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 5269c46959..9e33e488fe 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -1780,6 +1780,12 @@ nsPresContext::GetUserFontSetInternal() // GetUserFontSet. However, once it's been requested, we can't wait // for somebody to call GetUserFontSet in order to rebuild it (see // comments below in RebuildUserFontSet for why). +#ifdef DEBUG + PRBool userFontSetGottenBefore = mGetUserFontSetCalled; +#endif + // Set mGetUserFontSetCalled up front, so that FlushUserFontSet will actually + // flush. + mGetUserFontSetCalled = PR_TRUE; if (mUserFontSetDirty) { // If this assertion fails, and there have actually been changes to // @font-face rules, then we will call StyleChangeReflow in @@ -1790,7 +1796,7 @@ nsPresContext::GetUserFontSetInternal() #ifdef DEBUG { PRBool inReflow; - NS_ASSERTION(!mGetUserFontSetCalled || + NS_ASSERTION(!userFontSetGottenBefore || (NS_SUCCEEDED(mShell->IsReflowLocked(&inReflow)) && !inReflow), "FlushUserFontSet should have been called first"); @@ -1799,7 +1805,6 @@ nsPresContext::GetUserFontSetInternal() FlushUserFontSet(); } - mGetUserFontSetCalled = PR_TRUE; return mUserFontSet; } @@ -1815,6 +1820,12 @@ nsPresContext::FlushUserFontSet() if (!mShell) return; // we've been torn down + if (!mGetUserFontSetCalled) { + return; // No one cares about this font set yet, but we want to be careful + // to not unset our mUserFontSetDirty bit, so when someone really + // does we'll create it. + } + if (mUserFontSetDirty) { if (gfxPlatform::GetPlatform()->DownloadableFontsEnabled()) { nsRefPtr oldUserFontSet = mUserFontSet; -- 2.11.4.GIT