зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
5429cb6065
Коммит
2d0337cf6f
|
@ -62,6 +62,8 @@ public:
|
||||||
void Compact();
|
void Compact();
|
||||||
void Flush();
|
void Flush();
|
||||||
|
|
||||||
|
void UpdateUserFonts(gfxUserFontSet* aUserFontSet);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~nsFontCache() {}
|
~nsFontCache() {}
|
||||||
|
|
||||||
|
@ -146,6 +148,17 @@ nsFontCache::GetMetricsFor(const nsFont& aFont,
|
||||||
return fm.forget();
|
return fm.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsFontCache::UpdateUserFonts(gfxUserFontSet* aUserFontSet)
|
||||||
|
{
|
||||||
|
for (nsFontMetrics* fm : mFontMetrics) {
|
||||||
|
gfxFontGroup* fg = fm->GetThebesFontGroup();
|
||||||
|
if (fg->GetUserFontSet() == aUserFontSet) {
|
||||||
|
fg->UpdateUserFonts();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsFontCache::FontMetricsDeleted(const nsFontMetrics* aFontMetrics)
|
nsFontCache::FontMetricsDeleted(const nsFontMetrics* aFontMetrics)
|
||||||
{
|
{
|
||||||
|
@ -215,6 +228,14 @@ nsDeviceContext::InitFontCache()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDeviceContext::UpdateFontCacheUserFonts(gfxUserFontSet* aUserFontSet)
|
||||||
|
{
|
||||||
|
if (mFontCache) {
|
||||||
|
mFontCache->UpdateUserFonts(aUserFontSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
already_AddRefed<nsFontMetrics>
|
already_AddRefed<nsFontMetrics>
|
||||||
nsDeviceContext::GetMetricsFor(const nsFont& aFont,
|
nsDeviceContext::GetMetricsFor(const nsFont& aFont,
|
||||||
const nsFontMetrics::Params& aParams)
|
const nsFontMetrics::Params& aParams)
|
||||||
|
|
|
@ -61,6 +61,8 @@ public:
|
||||||
*/
|
*/
|
||||||
void InitFontCache();
|
void InitFontCache();
|
||||||
|
|
||||||
|
void UpdateFontCacheUserFonts(gfxUserFontSet* aUserFontSet);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the device context from a device context spec
|
* Initialize the device context from a device context spec
|
||||||
* @param aDevSpec the specification of the printing device
|
* @param aDevSpec the specification of the printing device
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "nsSMILAnimationController.h"
|
#include "nsSMILAnimationController.h"
|
||||||
#include "nsStyleContext.h"
|
#include "nsStyleContext.h"
|
||||||
#include "nsStyleSet.h"
|
#include "nsStyleSet.h"
|
||||||
|
#include "gfxUserFontSet.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
@ -43,6 +44,7 @@ ServoStyleSet::ServoStyleSet()
|
||||||
, mAllowResolveStaleStyles(false)
|
, mAllowResolveStaleStyles(false)
|
||||||
, mAuthorStyleDisabled(false)
|
, mAuthorStyleDisabled(false)
|
||||||
, mStylistState(StylistState::NotDirty)
|
, mStylistState(StylistState::NotDirty)
|
||||||
|
, mUserFontSetUpdateGeneration(0)
|
||||||
, mNeedsRestyleAfterEnsureUniqueInner(false)
|
, mNeedsRestyleAfterEnsureUniqueInner(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -322,7 +324,13 @@ ServoStyleSet::PreTraverseSync()
|
||||||
mPresContext->Document()->GetDocumentState();
|
mPresContext->Document()->GetDocumentState();
|
||||||
|
|
||||||
// Ensure that the @font-face data is not stale
|
// 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();
|
UpdateStylistIfNeeded();
|
||||||
mPresContext->CacheAllLangs();
|
mPresContext->CacheAllLangs();
|
||||||
|
|
|
@ -543,6 +543,7 @@ private:
|
||||||
bool mAllowResolveStaleStyles;
|
bool mAllowResolveStaleStyles;
|
||||||
bool mAuthorStyleDisabled;
|
bool mAuthorStyleDisabled;
|
||||||
StylistState mStylistState;
|
StylistState mStylistState;
|
||||||
|
uint64_t mUserFontSetUpdateGeneration;
|
||||||
|
|
||||||
bool mNeedsRestyleAfterEnsureUniqueInner;
|
bool mNeedsRestyleAfterEnsureUniqueInner;
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,6 @@ support-files = file_transitions_replacement_on_busy_frame.html
|
||||||
support-files = file_transitions_with_disabled_properties.html
|
support-files = file_transitions_with_disabled_properties.html
|
||||||
[test_unclosed_parentheses.html]
|
[test_unclosed_parentheses.html]
|
||||||
[test_unicode_range_loading.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
|
support-files = ../../reftests/fonts/markA.woff ../../reftests/fonts/markB.woff ../../reftests/fonts/markC.woff ../../reftests/fonts/markD.woff
|
||||||
[test_units_angle.html]
|
[test_units_angle.html]
|
||||||
[test_units_frequency.html]
|
[test_units_frequency.html]
|
||||||
|
|
Загрузка…
Ссылка в новой задаче