Bug 1366921 - stylo: Update user fonts in cached font metrics' gfxFontGroups in the pre-traversal step. r=bholley,jfkthame

MozReview-Commit-ID: DAhhWyAjxku

--HG--
extra : rebase_source : a1a9f4530a500c3d8edf6caeb2a91f91425d9b5a
This commit is contained in:
Cameron McCormack 2017-05-26 22:29:10 +08:00
Родитель 5429cb6065
Коммит 2d0337cf6f
5 изменённых файлов: 33 добавлений и 2 удалений

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

@ -62,6 +62,8 @@ public:
void Compact();
void Flush();
void UpdateUserFonts(gfxUserFontSet* aUserFontSet);
protected:
~nsFontCache() {}
@ -146,6 +148,17 @@ nsFontCache::GetMetricsFor(const nsFont& aFont,
return fm.forget();
}
void
nsFontCache::UpdateUserFonts(gfxUserFontSet* aUserFontSet)
{
for (nsFontMetrics* fm : mFontMetrics) {
gfxFontGroup* fg = fm->GetThebesFontGroup();
if (fg->GetUserFontSet() == aUserFontSet) {
fg->UpdateUserFonts();
}
}
}
void
nsFontCache::FontMetricsDeleted(const nsFontMetrics* aFontMetrics)
{
@ -215,6 +228,14 @@ nsDeviceContext::InitFontCache()
}
}
void
nsDeviceContext::UpdateFontCacheUserFonts(gfxUserFontSet* aUserFontSet)
{
if (mFontCache) {
mFontCache->UpdateUserFonts(aUserFontSet);
}
}
already_AddRefed<nsFontMetrics>
nsDeviceContext::GetMetricsFor(const nsFont& aFont,
const nsFontMetrics::Params& aParams)

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

@ -61,6 +61,8 @@ public:
*/
void InitFontCache();
void UpdateFontCacheUserFonts(gfxUserFontSet* aUserFontSet);
/**
* Initialize the device context from a device context spec
* @param aDevSpec the specification of the printing device

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

@ -25,6 +25,7 @@
#include "nsSMILAnimationController.h"
#include "nsStyleContext.h"
#include "nsStyleSet.h"
#include "gfxUserFontSet.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -43,6 +44,7 @@ ServoStyleSet::ServoStyleSet()
, mAllowResolveStaleStyles(false)
, mAuthorStyleDisabled(false)
, mStylistState(StylistState::NotDirty)
, mUserFontSetUpdateGeneration(0)
, mNeedsRestyleAfterEnsureUniqueInner(false)
{
}
@ -322,7 +324,13 @@ ServoStyleSet::PreTraverseSync()
mPresContext->Document()->GetDocumentState();
// Ensure that the @font-face data is not stale
mPresContext->Document()->GetUserFontSet();
if (gfxUserFontSet* userFontSet = mPresContext->Document()->GetUserFontSet()) {
uint64_t generation = userFontSet->GetGeneration();
if (generation != mUserFontSetUpdateGeneration) {
mPresContext->DeviceContext()->UpdateFontCacheUserFonts(userFontSet);
mUserFontSetUpdateGeneration = generation;
}
}
UpdateStylistIfNeeded();
mPresContext->CacheAllLangs();

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

@ -543,6 +543,7 @@ private:
bool mAllowResolveStaleStyles;
bool mAuthorStyleDisabled;
StylistState mStylistState;
uint64_t mUserFontSetUpdateGeneration;
bool mNeedsRestyleAfterEnsureUniqueInner;

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

@ -296,7 +296,6 @@ support-files = file_transitions_replacement_on_busy_frame.html
support-files = file_transitions_with_disabled_properties.html
[test_unclosed_parentheses.html]
[test_unicode_range_loading.html]
skip-if = stylo # bug 1366921
support-files = ../../reftests/fonts/markA.woff ../../reftests/fonts/markB.woff ../../reftests/fonts/markC.woff ../../reftests/fonts/markD.woff
[test_units_angle.html]
[test_units_frequency.html]