mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 13:55:43 +00:00
Bug 906643. Part 6: Add gfxFontEntry::NotifyGlyphsChanged, which calls new gfxFont::NotifyGlyphsChanged, which calls new gfxGlyphExtents::NotifyGlyphsChanged; these methods flush out existing glyph extents and notify all affected gfxUserFontGroups of the glyph changes. r=jfkthame
This commit is contained in:
parent
97e8e67a9e
commit
1c69a44bd3
@ -282,6 +282,15 @@ gfxFontEntry::NotifyFontDestroyed(gfxFont* aFont)
|
||||
mFontsUsingSVGGlyphs.RemoveElement(aFont);
|
||||
}
|
||||
|
||||
void
|
||||
gfxFontEntry::NotifyGlyphsChanged()
|
||||
{
|
||||
for (uint32_t i = 0, count = mFontsUsingSVGGlyphs.Length(); i < count; ++i) {
|
||||
gfxFont* font = mFontsUsingSVGGlyphs[i];
|
||||
font->NotifyGlyphsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* FontTableBlobData
|
||||
*
|
||||
@ -2959,6 +2968,28 @@ gfxFont::Measure(gfxTextRun *aTextRun,
|
||||
return metrics;
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
NotifyGlyphChangeObservers(nsPtrHashKey<gfxFont::GlyphChangeObserver>* aKey,
|
||||
void* aClosure)
|
||||
{
|
||||
aKey->GetKey()->NotifyGlyphsChanged();
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
void
|
||||
gfxFont::NotifyGlyphsChanged()
|
||||
{
|
||||
uint32_t i, count = mGlyphExtentsArray.Length();
|
||||
for (i = 0; i < count; ++i) {
|
||||
// Flush cached extents array
|
||||
mGlyphExtentsArray[i]->NotifyGlyphsChanged();
|
||||
}
|
||||
|
||||
if (mGlyphChangeObservers) {
|
||||
mGlyphChangeObservers->EnumerateEntries(NotifyGlyphChangeObservers, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
IsBoundarySpace(PRUnichar aChar, PRUnichar aNextChar)
|
||||
{
|
||||
|
@ -330,6 +330,9 @@ public:
|
||||
gfxRect *aResult);
|
||||
bool RenderSVGGlyph(gfxContext *aContext, uint32_t aGlyphId, int aDrawMode,
|
||||
gfxTextContextPaint *aContextPaint);
|
||||
// Call this when glyph geometry or rendering has changed
|
||||
// (e.g. animated SVG glyphs)
|
||||
void NotifyGlyphsChanged();
|
||||
|
||||
virtual bool MatchesGenericFamily(const nsACString& aGeneric) const {
|
||||
return true;
|
||||
@ -1165,6 +1168,10 @@ public:
|
||||
|
||||
enum { INVALID_WIDTH = 0xFFFF };
|
||||
|
||||
void NotifyGlyphsChanged() {
|
||||
mTightGlyphExtents.Clear();
|
||||
}
|
||||
|
||||
// returns INVALID_WIDTH => not a contained glyph
|
||||
// Otherwise the glyph has no before-bearing or vertical bearings,
|
||||
// and the result is its width measured from the baseline origin, in
|
||||
@ -1700,6 +1707,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// Glyph rendering/geometry has changed, so invalidate data as necessary.
|
||||
void NotifyGlyphsChanged();
|
||||
|
||||
virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
FontCacheSizes* aSizes) const;
|
||||
virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
|
Loading…
Reference in New Issue
Block a user