Bug 1578154 - Ensure all device contexts flush their nsFontCache when the platform font list is reinitialized. r=jwatt

Differential Revision: https://phabricator.services.mozilla.com/D45432

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jonathan Kew 2019-09-13 14:49:36 +00:00
Родитель 1b886ecee7
Коммит 4118072885
2 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -400,6 +400,13 @@ nsresult gfxPlatformFontList::InitFontList() {
gfxPlatform::PurgeSkiaFontCache();
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);
}
mAliasTable.Clear();
mLocalNameTable.Clear();

Просмотреть файл

@ -131,6 +131,10 @@ bool nsPresContext::IsDOMPaintEventPending() {
}
void nsPresContext::ForceReflowForFontInfoUpdate() {
// Flush the device context's font cache, so that we won't risk getting
// stale nsFontMetrics objects from it.
DeviceContext()->FlushFontCache();
// 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.