Closed themmj closed 18 hours ago
Nothing here seems to indicate that it's experimental: https://developer.mozilla.org/en-US/docs/Web/API/TextMetrics/fontBoundingBoxDescent
However, it seems like Firefox implemented it fairly late, so maybe Waterfox is lagging behind?
Yes I worded that a bit misleading. Waterfox has marked these features as experimental. I assume it is just lagging behind. Though it should be noted that specific users/browsers may disable this feature by default because it can be used for fingerprinting. I still think it makes sense to safeguard this so a gradient doesn't potentially break everything. What's your stance on this?
Generally I'm somewhat against implementing workarounds for all sorts of special browsers. If you use a special browser, you know what you are getting yourself into. However, I would want to fix it if the following are true:
That's fair. After checking futher, it seems Waterfox also enabled this feature: https://github.com/BrowserWorks/Waterfox/commit/b459c274bc75b420755c8c70b708c40c1da0ab1f So I assume, these settings are not updated as part of the regular update process.. Considering point 1 is not true, it's not worth checking the rest. Let me close this issue then. This has a workaround documented here for those few that are affected. Thanks for taking the time to look at this!
Symptom: A blank page after the initial loading screen with
Uncaught TypeError: CanvasRenderingContext2D.createLinearGradient: Argument 2 is not a finite floating-point value.
in the console.Steps to reproduce Using Waterfox as the browser, open https://one.livesplit.org/ Alternatively, disable
dom.textMetrics.fontBoundingBox.enabled
inabout:config
and open https://one.livesplit.org/Root cause
CanvasFont
'stop
andbottom
attribute are determined by TextMetrics.fontBoundingBoxAscend/Descend. This is an experimental feature that is disabled by default for some browsers (e.g. Waterfox). If they are disabled, the Javascript-Structure for TextMetrics does not containfontBoundingBoxAscend/Descend
properties. As a resulttop
andbottom
are populated withNaN
s. These values are eventually used to set the y-bounds on a CanvasLabel which will be passed to createLinearGradient.Workaround Set
dom.textMetrics.fontBoundingBox.enabled
inabout:config
totrue
.Comments The easiest solution would be to set
top
andbottom
to 0 if they are NaN. Optionally, fall back onactualBoundingBoxAscend/Descend
beforehand which seem to be enabled by default on a lot more browsers. The FIXME above these calls suggests that it shouldn't be done like that anyway. Let me know if I should proceed with the simple fix as a PR or if a more elaborate fix is preferred.