mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1439954
- Make gfxPlatform::ForceGlobalReflow when called in a content process trigger reflows only within that process; it should not try (and fail, with an assertion) to affect the parent or other content processes. r=jrmuizel
This commit is contained in:
parent
abf91f5026
commit
d9de89cb70
@ -2177,10 +2177,21 @@ gfxPlatform::FlushFontAndWordCaches()
|
||||
/* static */ void
|
||||
gfxPlatform::ForceGlobalReflow()
|
||||
{
|
||||
// modify a preference that will trigger reflow everywhere
|
||||
static const char kPrefName[] = "font.internaluseonly.changed";
|
||||
bool fontInternalChange = Preferences::GetBool(kPrefName, false);
|
||||
Preferences::SetBool(kPrefName, !fontInternalChange);
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (XRE_IsParentProcess()) {
|
||||
// Modify a preference that will trigger reflow everywhere (in all
|
||||
// content processes, as well as the parent).
|
||||
static const char kPrefName[] = "font.internaluseonly.changed";
|
||||
bool fontInternalChange = Preferences::GetBool(kPrefName, false);
|
||||
Preferences::SetBool(kPrefName, !fontInternalChange);
|
||||
} else {
|
||||
// Send a notification that will be observed by PresShells in this
|
||||
// process only.
|
||||
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
||||
if (obs) {
|
||||
obs->NotifyObservers(nullptr, "font-info-updated", nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1023,6 +1023,7 @@ PresShell::Init(nsIDocument* aDocument,
|
||||
if (XRE_IsParentProcess() && !sProcessInteractable) {
|
||||
os->AddObserver(this, "sessionstore-one-or-no-tab-restored", false);
|
||||
}
|
||||
os->AddObserver(this, "font-info-updated", false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1260,6 +1261,7 @@ PresShell::Destroy()
|
||||
if (XRE_IsParentProcess()) {
|
||||
os->RemoveObserver(this, "sessionstore-one-or-no-tab-restored");
|
||||
}
|
||||
os->RemoveObserver(this, "font-info-updated");
|
||||
}
|
||||
}
|
||||
|
||||
@ -9326,6 +9328,11 @@ PresShell::Observe(nsISupports* aSubject,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!nsCRT::strcmp(aTopic, "font-info-updated")) {
|
||||
mPresContext->ForceReflowForFontInfoUpdate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_WARNING("unrecognized topic in PresShell::Observe");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -233,6 +233,15 @@ nsPresContext::PrefChangedUpdateTimerCallback(nsITimer *aTimer, void *aClosure)
|
||||
presContext->UpdateAfterPreferencesChanged();
|
||||
}
|
||||
|
||||
void
|
||||
nsPresContext::ForceReflowForFontInfoUpdate()
|
||||
{
|
||||
// We can trigger reflow by pretending a font.* preference has changed;
|
||||
// this is the same mechanism as gfxPlatform::ForceGlobalReflow() uses
|
||||
// if new fonts are installed during the session, for example.
|
||||
PreferenceChanged("font.internaluseonly.changed");
|
||||
}
|
||||
|
||||
static bool
|
||||
IsVisualCharset(NotNull<const Encoding*> aCharset)
|
||||
{
|
||||
|
@ -1250,6 +1250,10 @@ protected:
|
||||
static bool NotifyDidPaintSubdocumentCallback(nsIDocument* aDocument, void* aData);
|
||||
|
||||
public:
|
||||
// Used by the PresShell to force a reflow when some aspect of font info
|
||||
// has been updated, potentially affecting font selection and layout.
|
||||
void ForceReflowForFontInfoUpdate();
|
||||
|
||||
void DoChangeCharSet(NotNull<const Encoding*> aCharSet);
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user