Bug 1341085 - Implement a pref that allows OpenType Variation tables to bypass the sanitizer, as it doesn't know about them. r=jrmuizel

This commit is contained in:
Jonathan Kew 2017-02-20 18:00:54 +00:00
Родитель dbd7f41a1b
Коммит a43a48e31a
3 изменённых файлов: 16 добавлений и 1 удалений

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

@ -383,6 +383,7 @@ private:
DECL_GFX_PREF(Once, "gfx.direct2d.force-enabled", Direct2DForceEnabled, bool, false);
DECL_GFX_PREF(Live, "gfx.direct3d11.reuse-decoder-device", Direct3D11ReuseDecoderDevice, int32_t, -1);
DECL_GFX_PREF(Live, "gfx.direct3d11.allow-intel-mutex", Direct3D11AllowIntelMutex, bool, true);
DECL_GFX_PREF(Live, "gfx.downloadable_fonts.keep_variation_tables", KeepVariationTables, bool, false);
DECL_GFX_PREF(Live, "gfx.downloadable_fonts.otl_validation", ValidateOTLTables, bool, true);
DECL_GFX_PREF(Live, "gfx.draw-color-bars", CompositorDrawColorBars, bool, false);
DECL_GFX_PREF(Once, "gfx.e10s.hide-plugins-for-scroll", HidePluginsForScroll, bool, true);

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

@ -181,15 +181,25 @@ public:
{
// Whether to apply OTS validation to OpenType Layout tables
mCheckOTLTables = gfxPrefs::ValidateOTLTables();
// Whether to preserve Variation tables in downloaded fonts
mKeepVariationTables = gfxPrefs::KeepVariationTables();
}
virtual ots::TableAction GetTableAction(uint32_t aTag) override {
// Preserve Graphite, color glyph and SVG tables,
// and possibly OTL tables (depending on pref)
// and possibly OTL and Variation tables (depending on prefs)
if ((!mCheckOTLTables &&
(aTag == TRUETYPE_TAG('G', 'D', 'E', 'F') ||
aTag == TRUETYPE_TAG('G', 'P', 'O', 'S') ||
aTag == TRUETYPE_TAG('G', 'S', 'U', 'B'))) ||
(mKeepVariationTables &&
(aTag == TRUETYPE_TAG('a', 'v', 'a', 'r') ||
aTag == TRUETYPE_TAG('c', 'v', 'a', 'r') ||
aTag == TRUETYPE_TAG('f', 'v', 'a', 'r') ||
aTag == TRUETYPE_TAG('g', 'v', 'a', 'r') ||
aTag == TRUETYPE_TAG('H', 'V', 'A', 'R') ||
aTag == TRUETYPE_TAG('M', 'V', 'A', 'R') ||
aTag == TRUETYPE_TAG('V', 'V', 'A', 'R'))) ||
aTag == TRUETYPE_TAG('S', 'i', 'l', 'f') ||
aTag == TRUETYPE_TAG('S', 'i', 'l', 'l') ||
aTag == TRUETYPE_TAG('G', 'l', 'o', 'c') ||
@ -229,6 +239,7 @@ private:
gfxUserFontEntry* mUserFontEntry;
nsTHashtable<nsCStringHashKey> mWarningsIssued;
bool mCheckOTLTables;
bool mKeepVariationTables;
};
// Call the OTS library to sanitize an sfnt before attempting to use it.

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

@ -748,6 +748,9 @@ pref("gfx.downloadable_fonts.otl_validation", false);
pref("gfx.downloadable_fonts.otl_validation", true);
#endif
// Whether to preserve OpenType variation tables in fonts (bypassing OTS)
pref("gfx.downloadable_fonts.keep_variation_tables", false);
#ifdef ANDROID
pref("gfx.bundled_fonts.enabled", true);
pref("gfx.bundled_fonts.force-enabled", false);