зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1730456 - InitPlatformFontList should reframe. r=jfkthame
I don't know why it didn't broadcast the reflow request to child processes... Perhaps it doesn't have to? Differential Revision: https://phabricator.services.mozilla.com/D126128
This commit is contained in:
Родитель
b3c27b86d4
Коммит
e37caecb95
|
@ -2215,7 +2215,8 @@ void gfxPlatform::FlushFontAndWordCaches() {
|
|||
}
|
||||
|
||||
/* static */
|
||||
void gfxPlatform::ForceGlobalReflow(NeedsReframe aNeedsReframe) {
|
||||
void gfxPlatform::ForceGlobalReflow(NeedsReframe aNeedsReframe,
|
||||
BroadcastToChildren aBroadcastToChildren) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
const bool reframe = aNeedsReframe == NeedsReframe::Yes;
|
||||
// Send a notification that will be observed by PresShells in this process
|
||||
|
@ -2224,7 +2225,8 @@ void gfxPlatform::ForceGlobalReflow(NeedsReframe aNeedsReframe) {
|
|||
char16_t needsReframe[] = {char16_t(reframe), 0};
|
||||
obs->NotifyObservers(nullptr, "font-info-updated", needsReframe);
|
||||
}
|
||||
if (XRE_IsParentProcess()) {
|
||||
if (XRE_IsParentProcess() &&
|
||||
aBroadcastToChildren == BroadcastToChildren::Yes) {
|
||||
// Propagate the change to child processes.
|
||||
for (auto* process :
|
||||
dom::ContentParent::AllProcesses(dom::ContentParent::eLive)) {
|
||||
|
|
|
@ -607,13 +607,19 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
|
|||
int32_t GetBidiNumeralOption();
|
||||
|
||||
/**
|
||||
* This is a bit ugly, but useful... force all presContexts to reflow,
|
||||
* by toggling a preference that they observe. This is used when
|
||||
* something about platform settings changes that might have an effect
|
||||
* on layout, such as font rendering settings that influence metrics.
|
||||
* Force all presContexts to reflow (and reframe if needed).
|
||||
*
|
||||
* This is used when something about platform settings changes that might have
|
||||
* an effect on layout, such as font rendering settings that influence
|
||||
* metrics, or installed fonts.
|
||||
*
|
||||
* By default it also broadcast it to child processes, but some callers might
|
||||
* not need it if they implement their own notification.
|
||||
*/
|
||||
enum class NeedsReframe : bool { No, Yes };
|
||||
static void ForceGlobalReflow(NeedsReframe);
|
||||
enum class BroadcastToChildren : bool { No, Yes };
|
||||
static void ForceGlobalReflow(NeedsReframe,
|
||||
BroadcastToChildren = BroadcastToChildren::Yes);
|
||||
|
||||
static void FlushFontAndWordCaches();
|
||||
|
||||
|
|
|
@ -471,22 +471,17 @@ bool gfxPlatformFontList::InitFontList() {
|
|||
|
||||
gfxPlatform::PurgeSkiaFontCache();
|
||||
|
||||
// There's no need to broadcast this reflow request to child processes, as
|
||||
// ContentParent::NotifyUpdatedFonts deals with it by re-entering into this
|
||||
// function on child processes.
|
||||
if (NS_IsMainThread()) {
|
||||
nsCOMPtr<nsIObserverService> obs =
|
||||
mozilla::services::GetObserverService();
|
||||
if (obs) {
|
||||
// Notify any current presContexts that fonts are being updated, so
|
||||
// existing caches will no longer be valid.
|
||||
obs->NotifyObservers(nullptr, "font-info-updated", nullptr);
|
||||
}
|
||||
gfxPlatform::ForceGlobalReflow(gfxPlatform::NeedsReframe::Yes,
|
||||
gfxPlatform::BroadcastToChildren::No);
|
||||
} else {
|
||||
NS_DispatchToMainThread(
|
||||
NS_NewRunnableFunction("font-info-updated notification callback", [] {
|
||||
nsCOMPtr<nsIObserverService> obs =
|
||||
mozilla::services::GetObserverService();
|
||||
if (obs) {
|
||||
obs->NotifyObservers(nullptr, "font-info-updated", nullptr);
|
||||
}
|
||||
gfxPlatform::ForceGlobalReflow(gfxPlatform::NeedsReframe::Yes,
|
||||
gfxPlatform::BroadcastToChildren::No);
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче