mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out 71032d21e8b1e6955baa996d9555624252700c6e due to mac startup failures.
This commit is contained in:
parent
49d3fcc1ac
commit
927e7f0297
@ -1438,9 +1438,6 @@ nsPresContext::RebuildAllStyleData(nsChangeHint aExtraHint)
|
||||
// We must have been torn down. Nothing to do here.
|
||||
return;
|
||||
}
|
||||
|
||||
RebuildUserFontSet();
|
||||
|
||||
mShell->FrameConstructor()->RebuildAllStyleData(aExtraHint);
|
||||
}
|
||||
|
||||
@ -1699,68 +1696,24 @@ InsertFontFaceRule(nsCSSFontFaceRule *aRule, gfxUserFontSet* aFontSet)
|
||||
gfxUserFontSet*
|
||||
nsPresContext::GetUserFontSet()
|
||||
{
|
||||
// We want to initialize the user font set lazily the first time the
|
||||
// user asks for it, rather than building it too early and forcing
|
||||
// rule cascade creation. Thus we try to enforce the invariant that
|
||||
// we *never* build the user font set until the first call to
|
||||
// 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).
|
||||
if (mUserFontSetDirty) {
|
||||
// If this assertion fails, and there have actually been changes to
|
||||
// @font-face rules, then we will call StyleChangeReflow in
|
||||
// FlushUserFontSet. Since we're likely in the middle of reflow,
|
||||
// that's a bad thing to do.
|
||||
NS_ASSERTION(!mGetUserFontSetCalled,
|
||||
"FlushUserFontSet should have been called first");
|
||||
FlushUserFontSet();
|
||||
}
|
||||
NS_IF_RELEASE(mUserFontSet);
|
||||
|
||||
mGetUserFontSetCalled = PR_TRUE;
|
||||
return mUserFontSet;
|
||||
}
|
||||
|
||||
void
|
||||
nsPresContext::FlushUserFontSet()
|
||||
{
|
||||
if (!mShell)
|
||||
return; // we've been torn down
|
||||
|
||||
if (mUserFontSetDirty) {
|
||||
if (gfxPlatform::GetPlatform()->DownloadableFontsEnabled()) {
|
||||
nsRefPtr<gfxUserFontSet> oldUserFontSet = mUserFontSet;
|
||||
|
||||
nsTArray< nsRefPtr<nsCSSFontFaceRule> > rules;
|
||||
if (!mShell->StyleSet()->AppendFontFaceRules(this, rules))
|
||||
return;
|
||||
|
||||
PRBool differ;
|
||||
if (rules.Length() == mFontFaceRules.Length()) {
|
||||
differ = PR_FALSE;
|
||||
for (PRUint32 i = 0, i_end = rules.Length(); i < i_end; ++i) {
|
||||
if (rules[i] != mFontFaceRules[i]) {
|
||||
differ = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
differ = PR_TRUE;
|
||||
}
|
||||
|
||||
// Only rebuild things if the set of @font-face rules is different.
|
||||
if (differ) {
|
||||
NS_IF_RELEASE(mUserFontSet);
|
||||
return nsnull;
|
||||
|
||||
if (rules.Length() > 0) {
|
||||
nsFontFaceLoaderContext *loaderCtx =
|
||||
new nsFontFaceLoaderContext(this);
|
||||
if (!loaderCtx)
|
||||
return;
|
||||
return nsnull;
|
||||
gfxUserFontSet *fs = new gfxUserFontSet(loaderCtx);
|
||||
// user font set owns loader context
|
||||
if (!fs) {
|
||||
delete loaderCtx;
|
||||
return;
|
||||
return nsnull;
|
||||
}
|
||||
mUserFontSet = fs;
|
||||
NS_ADDREF(mUserFontSet);
|
||||
@ -1771,55 +1724,9 @@ nsPresContext::FlushUserFontSet()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
PRBool success =
|
||||
#endif
|
||||
rules.SwapElements(mFontFaceRules);
|
||||
NS_ASSERTION(success, "should never fail given both are heap arrays");
|
||||
|
||||
if (mGetUserFontSetCalled && oldUserFontSet != mUserFontSet) {
|
||||
// If we've changed, created, or destroyed a user font set, we
|
||||
// need to trigger a style change reflow.
|
||||
// We need to enqueue a style change reflow (for later) to
|
||||
// reflect that we're dropping @font-face rules. This is the
|
||||
// same thing nsFontFaceLoader does when font downloads
|
||||
// complete. (However, without a reflow, nothing will happen
|
||||
// to start any downloads that are needed.)
|
||||
mShell->StyleChangeReflow();
|
||||
}
|
||||
}
|
||||
|
||||
mUserFontSetDirty = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsPresContext::RebuildUserFontSet()
|
||||
{
|
||||
if (!mGetUserFontSetCalled) {
|
||||
// We want to lazily build the user font set the first time it's
|
||||
// requested (so we don't force creation of rule cascades too
|
||||
// early), so don't do anything now.
|
||||
return;
|
||||
}
|
||||
|
||||
mUserFontSetDirty = PR_TRUE;
|
||||
|
||||
// Somebody has already asked for the user font set, so we need to
|
||||
// post an event to rebuild it. Setting the user font set to be dirty
|
||||
// and lazily rebuilding it isn't sufficient, since it is only the act
|
||||
// of rebuilding it that will trigger the style change reflow that
|
||||
// calls GetUserFontSet. (This reflow causes rebuilding of text runs,
|
||||
// which starts font loads, whose completion causes another style
|
||||
// change reflow).
|
||||
if (!mPostedFlushUserFontSet) {
|
||||
nsCOMPtr<nsIRunnable> ev =
|
||||
new nsRunnableMethod<nsPresContext>(this,
|
||||
&nsPresContext::HandleRebuildUserFontSet);
|
||||
if (NS_SUCCEEDED(NS_DispatchToCurrentThread(ev))) {
|
||||
mPostedFlushUserFontSet = PR_TRUE;
|
||||
}
|
||||
}
|
||||
return mUserFontSet;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -66,8 +66,6 @@
|
||||
// This also pulls in gfxTypes.h, which we cannot include directly.
|
||||
#include "gfxRect.h"
|
||||
#include "nsRegion.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
class nsImageLoader;
|
||||
#ifdef IBMBIDI
|
||||
@ -95,7 +93,6 @@ struct nsStyleBackground;
|
||||
template <class T> class nsRunnableMethod;
|
||||
class nsIRunnable;
|
||||
class gfxUserFontSet;
|
||||
class nsCSSFontFaceRule;
|
||||
|
||||
#ifdef MOZ_REFLOW_PERF
|
||||
class nsIRenderingContext;
|
||||
@ -746,8 +743,6 @@ public:
|
||||
PRBool SupressingResizeReflow() const { return mSupressResizeReflow; }
|
||||
|
||||
gfxUserFontSet* GetUserFontSet();
|
||||
void FlushUserFontSet();
|
||||
void RebuildUserFontSet(); // asynchronously
|
||||
|
||||
void NotifyInvalidation(const nsRect& aRect, PRBool aIsCrossDoc);
|
||||
void FireDOMPaintEvent();
|
||||
@ -771,11 +766,6 @@ protected:
|
||||
|
||||
NS_HIDDEN_(void) UpdateCharSet(const nsAFlatCString& aCharSet);
|
||||
|
||||
void HandleRebuildUserFontSet() {
|
||||
mPostedFlushUserFontSet = PR_FALSE;
|
||||
FlushUserFontSet();
|
||||
}
|
||||
|
||||
// IMPORTANT: The ownership implicit in the following member variables
|
||||
// has been explicitly checked. If you add any members to this class,
|
||||
// please make the ownership explicit (pinkerton, scc).
|
||||
@ -822,8 +812,6 @@ protected:
|
||||
|
||||
// container for per-context fonts (downloadable, SVG, etc.)
|
||||
gfxUserFontSet* mUserFontSet;
|
||||
// The list of @font-face rules that we put into mUserFontSet
|
||||
nsTArray< nsRefPtr<nsCSSFontFaceRule> > mFontFaceRules;
|
||||
|
||||
PRInt32 mFontScaler;
|
||||
nscoord mMinimumFontSize;
|
||||
@ -882,13 +870,7 @@ protected:
|
||||
unsigned mPendingMediaFeatureValuesChanged : 1;
|
||||
unsigned mPrefChangePendingNeedsReflow : 1;
|
||||
unsigned mRenderedPositionVaryingContent : 1;
|
||||
|
||||
// Is the current mUserFontSet valid?
|
||||
unsigned mUserFontSetDirty : 1;
|
||||
// Has GetUserFontSet() been called?
|
||||
unsigned mGetUserFontSetCalled : 1;
|
||||
// Do we currently have an event posted to call FlushUserFontSet?
|
||||
unsigned mPostedFlushUserFontSet : 1;
|
||||
|
||||
// resize reflow is supressed when the only change has been to zoom
|
||||
// the document rather than to change the document's dimensions
|
||||
|
@ -4558,16 +4558,11 @@ PresShell::DoFlushPendingNotifications(mozFlushType aType,
|
||||
mFrameConstructor->ProcessPendingRestyles();
|
||||
}
|
||||
|
||||
|
||||
// There might be more pending constructors now, but we're not going to
|
||||
// worry about them. They can't be triggered during reflow, so we should
|
||||
// be good.
|
||||
|
||||
if (aType >= Flush_Layout && !mIsDestroying) {
|
||||
// Flush any pending update of the user font set, since that could
|
||||
// post a style change reflow.
|
||||
mPresContext->FlushUserFontSet();
|
||||
|
||||
mFrameConstructor->RecalcQuotesAndCounters();
|
||||
mViewManager->FlushDelayedResize();
|
||||
ProcessReflowCommands(aInterruptibleReflow);
|
||||
@ -4782,21 +4777,17 @@ nsIPresShell::ReconstructStyleDataInternal()
|
||||
{
|
||||
mStylesHaveChanged = PR_FALSE;
|
||||
|
||||
if (mIsDestroying) {
|
||||
// We don't want to mess with restyles at this point
|
||||
return;
|
||||
}
|
||||
|
||||
if (mPresContext) {
|
||||
mPresContext->RebuildUserFontSet();
|
||||
}
|
||||
|
||||
nsIContent* root = mDocument->GetRootContent();
|
||||
if (!mDidInitialReflow) {
|
||||
// Nothing to do here, since we have no frames yet
|
||||
return;
|
||||
}
|
||||
|
||||
if (mIsDestroying) {
|
||||
// We don't want to mess with restyles at this point
|
||||
return;
|
||||
}
|
||||
|
||||
nsIContent* root = mDocument->GetRootContent();
|
||||
if (!root) {
|
||||
// No content to restyle
|
||||
return;
|
||||
@ -6251,8 +6242,6 @@ PresShell::WillDoReflow()
|
||||
mCaret->UpdateCaretPosition();
|
||||
}
|
||||
|
||||
mPresContext->FlushUserFontSet();
|
||||
|
||||
mFrameConstructor->BeginUpdate();
|
||||
}
|
||||
|
||||
|
@ -2166,10 +2166,6 @@ nsCSSRuleProcessor::AppendFontFaceRules(
|
||||
nsresult
|
||||
nsCSSRuleProcessor::ClearRuleCascades()
|
||||
{
|
||||
// We rely on our caller (perhaps indirectly) to do something that
|
||||
// will rebuild style data and the user font set (either
|
||||
// nsIPresShell::ReconstructStyleData or
|
||||
// nsPresContext::RebuildAllStyleData).
|
||||
RuleCascadeData *data = mRuleCascades;
|
||||
mRuleCascades = nsnull;
|
||||
while (data) {
|
||||
|
@ -127,12 +127,7 @@ nsFontFaceLoader::OnStreamComplete(nsIStreamLoader* aLoader,
|
||||
|
||||
nsIPresShell *ps = loaderCtx->mPresContext->PresShell();
|
||||
if (ps) {
|
||||
// Update layout for the presence of the new font. Since this is
|
||||
// asynchronous, reflows will coalesce.
|
||||
// nsPresContext::FlushUserFontSet does the same thing when we
|
||||
// remove a user font set, for fonts becoming unavailable, or when
|
||||
// we add one, because if we change it dynamically we need to
|
||||
// trigger reflow to cause gfx to request the fonts.
|
||||
// reflow async so that reflows coalesce
|
||||
ps->StyleChangeReflow();
|
||||
LOG(("fontdownloader (%p) reflow\n", this));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user