Loading gfx/thebes/gfxFont.cpp +24 −20 Original line number Diff line number Diff line Loading @@ -1528,11 +1528,12 @@ tainted_boolean_hint gfxFont::SpaceMayParticipateInShaping( } } if (FontCanSupportGraphite()) { if (gfxPlatform::GetPlatform()->UseGraphiteShaping()) { // Note that Graphite shaping is only available on the main thread. // `UseGraphiteShaping` will always be false in workers. if (gfxPlatform::GetPlatform()->UseGraphiteShaping() && FontCanSupportGraphite()) { return mFontEntry->HasGraphiteSpaceContextuals(); } } // We record the presence of space-dependent features in the font entry // so that subsequent instantiations for the same font face won't Loading Loading @@ -1566,6 +1567,9 @@ tainted_boolean_hint gfxFont::SpaceMayParticipateInShaping( } bool gfxFont::SupportsFeature(Script aScript, uint32_t aFeatureTag) { // mGraphiteShaper may be observed non-null on a worker thread, but workers // shape via harfbuzz regardless, because graphite shaping is only available // on the main thread. if (mGraphiteShaper && gfxPlatform::GetPlatform()->UseGraphiteShaping()) { return GetFontEntry()->SupportsGraphiteFeature(aFeatureTag); } Loading Loading @@ -3448,9 +3452,10 @@ bool gfxFont::ShapeText(DrawTarget* aDrawTarget, const char16_t* aText, // XXX Currently, we do all vertical shaping through harfbuzz. // Vertical graphite support may be wanted as a future enhancement. // XXX Graphite shaping currently only supported on the main thread! // Worker-thread shaping (offscreen canvas) will always go via harfbuzz. if (FontCanSupportGraphite() && !aVertical && NS_IsMainThread()) { if (gfxPlatform::GetPlatform()->UseGraphiteShaping()) { // On workers (offscreen canvas), `UseGraphiteShaping` always returns false, // and shaping uses harfbuzz. if (gfxPlatform::GetPlatform()->UseGraphiteShaping() && FontCanSupportGraphite() && !aVertical) { gfxGraphiteShaper* shaper = mGraphiteShaper; if (!shaper) { shaper = new gfxGraphiteShaper(this); Loading @@ -3466,7 +3471,6 @@ bool gfxFont::ShapeText(DrawTarget* aDrawTarget, const char16_t* aText, return true; } } } gfxHarfBuzzShaper* shaper = GetHarfBuzzShaper(); if (shaper && Loading gfx/thebes/gfxFontEntry.cpp +5 −6 Original line number Diff line number Diff line Loading @@ -571,13 +571,10 @@ gfxFontEntry::GetGrSandboxAdvanceCallbackHandle() { } tainted_opaque_gr<gr_face*> gfxFontEntry::GetGrFace() { if (!mGrFaceInitialized) { // When possible, the below code will use WASM as a sandboxing mechanism. // At this time the wasm sandbox does not support threads. // If Thebes is updated to make callst to the sandbox on multiple threaads, // we need to make sure the underlying sandbox supports threading. MOZ_ASSERT(NS_IsMainThread()); // Graphite shaping is only available on the main thread. MOZ_RELEASE_ASSERT(NS_IsMainThread()); if (!mGrFaceInitialized) { mSandboxData = new GrSandboxData(); auto p_faceOps = mSandboxData->sandbox.malloc_in_sandbox<gr_face_ops>(); Loading Loading @@ -646,6 +643,8 @@ bool gfxFontEntry::HasFontTable(uint32_t aTableTag) { } tainted_boolean_hint gfxFontEntry::HasGraphiteSpaceContextuals() { // Graphite shaping is only available on the main thread. MOZ_RELEASE_ASSERT(NS_IsMainThread()); LazyFlag flag = mHasGraphiteSpaceContextuals; if (flag == LazyFlag::Uninitialized) { auto face = GetGrFace(); Loading gfx/thebes/gfxPlatform.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -1852,7 +1852,9 @@ uint32_t gfxPlatform::WordCacheMaxEntries() { } bool gfxPlatform::UseGraphiteShaping() { return StaticPrefs::gfx_font_rendering_graphite_enabled(); // Graphite shaping is only available on the main thread. return StaticPrefs::gfx_font_rendering_graphite_enabled() && NS_IsMainThread(); } bool gfxPlatform::IsFontFormatSupported( Loading Loading
gfx/thebes/gfxFont.cpp +24 −20 Original line number Diff line number Diff line Loading @@ -1528,11 +1528,12 @@ tainted_boolean_hint gfxFont::SpaceMayParticipateInShaping( } } if (FontCanSupportGraphite()) { if (gfxPlatform::GetPlatform()->UseGraphiteShaping()) { // Note that Graphite shaping is only available on the main thread. // `UseGraphiteShaping` will always be false in workers. if (gfxPlatform::GetPlatform()->UseGraphiteShaping() && FontCanSupportGraphite()) { return mFontEntry->HasGraphiteSpaceContextuals(); } } // We record the presence of space-dependent features in the font entry // so that subsequent instantiations for the same font face won't Loading Loading @@ -1566,6 +1567,9 @@ tainted_boolean_hint gfxFont::SpaceMayParticipateInShaping( } bool gfxFont::SupportsFeature(Script aScript, uint32_t aFeatureTag) { // mGraphiteShaper may be observed non-null on a worker thread, but workers // shape via harfbuzz regardless, because graphite shaping is only available // on the main thread. if (mGraphiteShaper && gfxPlatform::GetPlatform()->UseGraphiteShaping()) { return GetFontEntry()->SupportsGraphiteFeature(aFeatureTag); } Loading Loading @@ -3448,9 +3452,10 @@ bool gfxFont::ShapeText(DrawTarget* aDrawTarget, const char16_t* aText, // XXX Currently, we do all vertical shaping through harfbuzz. // Vertical graphite support may be wanted as a future enhancement. // XXX Graphite shaping currently only supported on the main thread! // Worker-thread shaping (offscreen canvas) will always go via harfbuzz. if (FontCanSupportGraphite() && !aVertical && NS_IsMainThread()) { if (gfxPlatform::GetPlatform()->UseGraphiteShaping()) { // On workers (offscreen canvas), `UseGraphiteShaping` always returns false, // and shaping uses harfbuzz. if (gfxPlatform::GetPlatform()->UseGraphiteShaping() && FontCanSupportGraphite() && !aVertical) { gfxGraphiteShaper* shaper = mGraphiteShaper; if (!shaper) { shaper = new gfxGraphiteShaper(this); Loading @@ -3466,7 +3471,6 @@ bool gfxFont::ShapeText(DrawTarget* aDrawTarget, const char16_t* aText, return true; } } } gfxHarfBuzzShaper* shaper = GetHarfBuzzShaper(); if (shaper && Loading
gfx/thebes/gfxFontEntry.cpp +5 −6 Original line number Diff line number Diff line Loading @@ -571,13 +571,10 @@ gfxFontEntry::GetGrSandboxAdvanceCallbackHandle() { } tainted_opaque_gr<gr_face*> gfxFontEntry::GetGrFace() { if (!mGrFaceInitialized) { // When possible, the below code will use WASM as a sandboxing mechanism. // At this time the wasm sandbox does not support threads. // If Thebes is updated to make callst to the sandbox on multiple threaads, // we need to make sure the underlying sandbox supports threading. MOZ_ASSERT(NS_IsMainThread()); // Graphite shaping is only available on the main thread. MOZ_RELEASE_ASSERT(NS_IsMainThread()); if (!mGrFaceInitialized) { mSandboxData = new GrSandboxData(); auto p_faceOps = mSandboxData->sandbox.malloc_in_sandbox<gr_face_ops>(); Loading Loading @@ -646,6 +643,8 @@ bool gfxFontEntry::HasFontTable(uint32_t aTableTag) { } tainted_boolean_hint gfxFontEntry::HasGraphiteSpaceContextuals() { // Graphite shaping is only available on the main thread. MOZ_RELEASE_ASSERT(NS_IsMainThread()); LazyFlag flag = mHasGraphiteSpaceContextuals; if (flag == LazyFlag::Uninitialized) { auto face = GetGrFace(); Loading
gfx/thebes/gfxPlatform.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -1852,7 +1852,9 @@ uint32_t gfxPlatform::WordCacheMaxEntries() { } bool gfxPlatform::UseGraphiteShaping() { return StaticPrefs::gfx_font_rendering_graphite_enabled(); // Graphite shaping is only available on the main thread. return StaticPrefs::gfx_font_rendering_graphite_enabled() && NS_IsMainThread(); } bool gfxPlatform::IsFontFormatSupported( Loading