Closed Bug 1565997 Opened 5 years ago Closed 4 years ago

CanvasPattern.setTransform does not support DOMMatrix

Categories

(Core :: Graphics: Canvas2D, defect, P3)

70 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox70 --- wontfix
firefox79 --- fixed

People

(Reporter: saschanaz, Assigned: longsonr)

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

// Assuming `$0` refers to a valid HTMLImageElement
document.createElement("canvas").getContext("2d").createPattern($0, "no-repeat").setTransform(new DOMMatrix());

Currently this code throws: TypeError: Argument 1 of CanvasPattern.setTransform does not implement interface SVGMatrix.

Relevant spec: https://html.spec.whatwg.org/multipage/canvas.html#2dcontext:dom-canvaspattern-settransform

Component: DOM: Core & HTML → Canvas: 2D
Priority: -- → P3

Do other browsers support it?

Flags: needinfo?(saschanaz)

Chrome supports it. Example: https://codepen.io/SaschaNaz/pen/zVgjrM

Flags: needinfo?(saschanaz)

Does WebKit/Safari?

Flags: needinfo?(saschanaz)

Confirmed that it also works on WK, tested on epiphany-browser.

Flags: needinfo?(saschanaz)

I'm stuck trying to create the new tests

./build.sh

Traceback (most recent call last):
File "gentest.py", line 1, in <module>
from gentestutils import genTestUtils
File "/moz2/mozilla-central/testing/web-platform/tests/html/canvas/tools/gentestutils.py", line 47, in <module>
import cairocffi as cairo
File "/moz2/mozilla-central/testing/web-platform/tests/html/canvas/tools/.virtualenv/lib/python2.7/site-packages/cairocffi/init.py", line 41, in <module>
cairo = dlopen(ffi, 'cairo', 'cairo-2', 'cairo-gobject-2')
File "/moz2/mozilla-central/testing/web-platform/tests/html/canvas/tools/.virtualenv/lib/python2.7/site-packages/cairocffi/init.py", line 38, in dlopen
raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names))
OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2

Flags: needinfo?(lsalzman)

I am not really familiar with the WPT test setup as I've not messed with it much at all. Probably better to ping someone more familiar with the WPT tooling. Emilio, ideas about who might have suitable knowledge to help here?

Flags: needinfo?(lsalzman) → needinfo?(emilio)

James, Sam, is any of you familiar with the build setup for the canvas tests?

Though off-hand it seems you may need cairo installed or something on your machine.

Flags: needinfo?(james)
Flags: needinfo?(geoffers+mozilla)
Flags: needinfo?(emilio)

Fixed things via

brew install cairo

Thank you.

Flags: needinfo?(james)
Flags: needinfo?(geoffers+mozilla)
Assignee: nobody → longsonr

Did you want to review this or are you happy with emilio's review alone?

Flags: needinfo?(lsalzman)
Flags: needinfo?(lsalzman)
Pushed by longsonr@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/3a67e6a4d23d
CanvasPattern.setTransform should take a DOMMatrix2DInit r=emilio,lsalzman
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/24330 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
Upstream PR merged by moz-wptsync-bot

I've finished the documentation for this; see https://github.com/mdn/sprints/issues/3424#issuecomment-652956306 for full details.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: