Avoid all rendering breaking completely when CanvasPattern.setTransform()
is unsupported
#13725
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please note: This patch doesn't fix rendering of (various) patterns in browsers/environments without full
CanvasPattern.setTransform()
support, but it at least prevents outright failures and thus allows the rest of the page to render.This patch provides a temporary work-around for Firefox 78 ESR[1], and for Node.js environments (see issue #13724), where rendering is currently completely broken.
[1] Please note that the
createMatrix
helper function doesn't actually work as intended. The reason is that it's notDOMMatrix
itself which is unsupported in older Firefox versions, but rather callingCanvasPattern.setTransform(...)
with aDOMMatrix
-argument.Furthermore, the
createSVGMatrix
fallback won't actually help either since that method doesn't accept any parameters and would thus require manually specifying the matrix-state; see e.g. https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern/setTransform#examplesFinally, given that it's less than a month to the Firefox 91 ESR release and that as-is all patterns are completely broken e.g. when using the latest viewer in Firefox 78 ESR, I'm just not convinced that it's worth the "hassle" of providing a more proper work-around.