зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1331737 - Expose a pref to control the validation of OpenType Layout tables, so that Nightly/Aurora users can choose to bypass validation (like we do on Beta/Release) if they really want out-of-spec fonts to be loaded. r=jrmuizel
This commit is contained in:
Родитель
650bb0a9e4
Коммит
8121d39a0b
|
@ -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.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);
|
||||
DECL_GFX_PREF(Live, "gfx.layerscope.enabled", LayerScopeEnabled, bool, false);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "gfxUserFontSet.h"
|
||||
#include "gfxPlatform.h"
|
||||
#include "gfxPrefs.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
@ -176,17 +177,19 @@ gfxUserFontEntry::CreateFontInstance(const gfxFontStyle* aFontStyle, bool aNeeds
|
|||
class gfxOTSContext : public ots::OTSContext {
|
||||
public:
|
||||
explicit gfxOTSContext(gfxUserFontEntry* aUserFontEntry)
|
||||
: mUserFontEntry(aUserFontEntry) {}
|
||||
: mUserFontEntry(aUserFontEntry)
|
||||
{
|
||||
// Whether to apply OTS validation to OpenType Layout tables
|
||||
mCheckOTLTables = gfxPrefs::ValidateOTLTables();
|
||||
}
|
||||
|
||||
virtual ots::TableAction GetTableAction(uint32_t aTag) override {
|
||||
// Preserve Graphite, color glyph and SVG tables
|
||||
if (
|
||||
#ifdef RELEASE_OR_BETA // For Beta/Release, also allow OT Layout tables through
|
||||
// unchecked, and rely on harfbuzz to handle them safely.
|
||||
aTag == TRUETYPE_TAG('G', 'D', 'E', 'F') ||
|
||||
aTag == TRUETYPE_TAG('G', 'P', 'O', 'S') ||
|
||||
aTag == TRUETYPE_TAG('G', 'S', 'U', 'B') ||
|
||||
#endif
|
||||
// Preserve Graphite, color glyph and SVG tables,
|
||||
// and possibly OTL tables (depending on pref)
|
||||
if ((!mCheckOTLTables &&
|
||||
(aTag == TRUETYPE_TAG('G', 'D', 'E', 'F') ||
|
||||
aTag == TRUETYPE_TAG('G', 'P', 'O', 'S') ||
|
||||
aTag == TRUETYPE_TAG('G', 'S', 'U', 'B'))) ||
|
||||
aTag == TRUETYPE_TAG('S', 'i', 'l', 'f') ||
|
||||
aTag == TRUETYPE_TAG('S', 'i', 'l', 'l') ||
|
||||
aTag == TRUETYPE_TAG('G', 'l', 'o', 'c') ||
|
||||
|
@ -225,6 +228,7 @@ public:
|
|||
private:
|
||||
gfxUserFontEntry* mUserFontEntry;
|
||||
nsTHashtable<nsCStringHashKey> mWarningsIssued;
|
||||
bool mCheckOTLTables;
|
||||
};
|
||||
|
||||
// Call the OTS library to sanitize an sfnt before attempting to use it.
|
||||
|
|
|
@ -742,6 +742,13 @@ pref("gfx.downloadable_fonts.disable_cache", false);
|
|||
|
||||
pref("gfx.downloadable_fonts.woff2.enabled", true);
|
||||
|
||||
// Whether OTS validation should be applied to OpenType Layout (OTL) tables
|
||||
#ifdef RELEASE_OR_BETA
|
||||
pref("gfx.downloadable_fonts.otl_validation", false);
|
||||
#else
|
||||
pref("gfx.downloadable_fonts.otl_validation", true);
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
pref("gfx.bundled_fonts.enabled", true);
|
||||
pref("gfx.bundled_fonts.force-enabled", false);
|
||||
|
|
Загрузка…
Ссылка в новой задаче