Bug 1937096 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Currently, our font protection uses [`nsPresContext::GetFontVisibility()`](https://searchfox.org/mozilla-central/rev/d1e731d931b7b46237175de1701849a7cf5c8579/layout/base/nsPresContext.h#175) to determine whether to block a font or not. [Most (all?)](https://searchfox.org/mozilla-central/search?q=GetfontVisibility%28%29+%3A&path=&case=false&regexp=false) of our font visibility checks default to [`FontVisibility::User`](https://searchfox.org/mozilla-central/rev/d1e731d931b7b46237175de1701849a7cf5c8579/gfx/thebes/gfxTypes.h#141).

With offscreen canvases, we don't have a prescontext if it is running in a worker thread. [`CanvasRenderingContext2D::SetFontInternal`](https://searchfox.org/mozilla-central/rev/d1e731d931b7b46237175de1701849a7cf5c8579/dom/canvas/CanvasRenderingContext2D.cpp#3996) calls  `SetFontInternalDisconnected` for offscreen canvases, which [creates gfxFontGroup with a null prescontext](https://searchfox.org/mozilla-central/rev/d1e731d931b7b46237175de1701849a7cf5c8579/dom/canvas/CanvasRenderingContext2D.cpp#4327). As a result, we default to user level visibility when finding/resolving fonts.
Currently, our font protection uses [`nsPresContext::GetFontVisibility()`](https://searchfox.org/mozilla-central/rev/d1e731d931b7b46237175de1701849a7cf5c8579/layout/base/nsPresContext.h#175) to determine whether to block a font or not. [Most (all?)](https://searchfox.org/mozilla-central/search?q=GetfontVisibility%28%29+%3A&path=&case=false&regexp=false) of our font visibility checks default to [`FontVisibility::User`](https://searchfox.org/mozilla-central/rev/d1e731d931b7b46237175de1701849a7cf5c8579/gfx/thebes/gfxTypes.h#141).

With offscreen canvases, we don't have a prescontext if it is running in a worker thread. [`CanvasRenderingContext2D::SetFontInternal`](https://searchfox.org/mozilla-central/rev/d1e731d931b7b46237175de1701849a7cf5c8579/dom/canvas/CanvasRenderingContext2D.cpp#3996) calls  `SetFontInternalDisconnected` for offscreen canvases, which [creates gfxFontGroup with a null prescontext](https://searchfox.org/mozilla-central/rev/d1e731d931b7b46237175de1701849a7cf5c8579/dom/canvas/CanvasRenderingContext2D.cpp#4327). As a result, we default to user level visibility when finding/resolving fonts.

Edit: I will upload a patch soon.

Back to Bug 1937096 Comment 0