RESOLVED FIXED 179935
Add support for CanvasPattern.setTransform()
https://bugs.webkit.org/show_bug.cgi?id=179935
Summary Add support for CanvasPattern.setTransform()
Simon Fraser (smfr)
Reported 2017-11-21 20:59:07 PST
Add support for CanvasPattern.setTransform()
Attachments
Patch (27.14 KB, patch)
2017-11-21 21:14 PST, Simon Fraser (smfr)
no flags
Patch (28.06 KB, patch)
2017-11-21 21:21 PST, Simon Fraser (smfr)
no flags
Archive of layout-test-results from ews122 for ios-simulator-wk2 (2.11 MB, application/zip)
2017-11-21 22:47 PST, EWS Watchlist
no flags
Patch (28.47 KB, patch)
2017-11-23 07:56 PST, Simon Fraser (smfr)
no flags
Patch (27.78 KB, patch)
2017-11-23 08:07 PST, Simon Fraser (smfr)
no flags
Patch (27.96 KB, patch)
2017-11-23 09:02 PST, Simon Fraser (smfr)
sam: review+
Simon Fraser (smfr)
Comment 1 2017-11-21 21:14:08 PST
Simon Fraser (smfr)
Comment 2 2017-11-21 21:21:34 PST
EWS Watchlist
Comment 3 2017-11-21 22:47:37 PST
Comment on attachment 327443 [details] Patch Attachment 327443 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/5326720 New failing tests: fast/canvas/canvas-pattern-transform.html
EWS Watchlist
Comment 4 2017-11-21 22:47:38 PST
Created attachment 327445 [details] Archive of layout-test-results from ews122 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews122 Port: ios-simulator-wk2 Platform: Mac OS X 10.12.6
Sam Weinig
Comment 5 2017-11-22 09:53:33 PST
Comment on attachment 327443 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=327443&action=review > Source/WebCore/ChangeLog:12 > + Unlike the spec I think this needs to throw exceptions just as CanvasTransform.setTransform() > + does. Did you file a bug on the spec? > Source/WebCore/html/canvas/CanvasPattern.h:28 > +#include "AffineTransform.h" Why is this needed? > LayoutTests/ChangeLog:29 > +2017-11-21 Simon Fraser <simon.fraser@apple.com> > + > + Add support for CanvasPattern.setTransform() > + https://bugs.webkit.org/show_bug.cgi?id=179935 > + > + Reviewed by NOBODY (OOPS!). > + > + * fast/canvas/canvas-pattern-transform-expected.txt: > + * fast/canvas/canvas-pattern-transform.html: > + * fast/canvas/canvas-pattern-with-transform-expected.txt: Copied from LayoutTests/fast/canvas/canvas-pattern-transform-expected.txt. > + * fast/canvas/canvas-pattern-with-transform.html: Copied from LayoutTests/fast/canvas/canvas-pattern-transform.html. > + * fast/canvas/canvas-pattern-with-transform.js: Renamed from LayoutTests/fast/canvas/canvas-pattern-transform.js. > + > +2017-11-21 Simon Fraser <simon.fraser@apple.com> > + > + Add support for CanvasPattern.setTransform() > + https://bugs.webkit.org/show_bug.cgi?id=179935 > + > + Reviewed by NOBODY (OOPS!). > + > + Moved the test previously known as canvas-pattern-transform.html to canvas-pattern-with-transform.html > + and added a new test. > + > + * fast/canvas/canvas-pattern-transform-expected.txt: > + * fast/canvas/canvas-pattern-transform.html: > + * fast/canvas/canvas-pattern-with-transform-expected.txt: Copied from LayoutTests/fast/canvas/canvas-pattern-transform-expected.txt. > + * fast/canvas/canvas-pattern-with-transform.html: Copied from LayoutTests/fast/canvas/canvas-pattern-transform.html. > + * fast/canvas/canvas-pattern-with-transform.js: Renamed from LayoutTests/fast/canvas/canvas-pattern-transform.js. > + Double changelog.
Simon Fraser (smfr)
Comment 6 2017-11-23 07:25:27 PST
(In reply to Sam Weinig from comment #5) > Comment on attachment 327443 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=327443&action=review > > > Source/WebCore/ChangeLog:12 > > + Unlike the spec I think this needs to throw exceptions just as CanvasTransform.setTransform() > > + does. > > Did you file a bug on the spec? There are existing issues: https://github.com/whatwg/html/issues/2845 https://github.com/whatwg/html/issues/3069 It seems like throwing should only happen for invalid combinations of arguments when initializing the matrix.
Simon Fraser (smfr)
Comment 7 2017-11-23 07:56:13 PST
Simon Fraser (smfr)
Comment 8 2017-11-23 08:07:55 PST
Sam Weinig
Comment 9 2017-11-23 09:01:03 PST
Comment on attachment 327504 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=327504&action=review > Source/WebCore/html/canvas/CanvasPattern.h:28 > +#include "AffineTransform.h" You sure this is needed?
Simon Fraser (smfr)
Comment 10 2017-11-23 09:02:00 PST
Darin Adler
Comment 11 2017-11-23 13:43:47 PST
Comment on attachment 327506 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=327506&action=review > Source/WebCore/html/canvas/CanvasPattern.cpp:82 > + auto checkValid = DOMMatrixReadOnly::validateAndFixup(matrixInit); > + if (checkValid.hasException()) > + return checkValid.releaseException(); > + > + m_pattern->setPatternSpaceTransform({ matrixInit.a.value_or(1), matrixInit.b.value_or(0), matrixInit.c.value_or(0), matrixInit.d.value_or(1), matrixInit.e.value_or(0), matrixInit.f.value_or(0) }); > + return { }; This looks wrong! DOMMatrixReadOnly::validateAndFixup moves values *from* a/b/c/d/e/f *to* m11/m12/m21/m22/m41/m42 but *not* in the other direction. So it’s critical that we use the latter names, not the former. We also need test cases that show using those instead of using a/b/c/d/e/f. This makes me think that DOMMatrixReadOnly::validateAndFixup should return a new structure without the redundancy so we can’t make this mistake in the future.
Simon Fraser (smfr)
Comment 12 2017-11-23 14:27:07 PST
Will fix via bug 179984.
Simon Fraser (smfr)
Comment 13 2017-11-24 09:12:22 PST
Radar WebKit Bug Importer
Comment 14 2017-11-24 09:13:20 PST
Note You need to log in before you can comment on or make changes to this bug.