Bug 179935 - Add support for CanvasPattern.setTransform()
Summary: Add support for CanvasPattern.setTransform()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-11-21 20:59 PST by Simon Fraser (smfr)
Modified: 2017-11-24 09:13 PST (History)
12 users (show)

See Also:


Attachments
Patch (27.14 KB, patch)
2017-11-21 21:14 PST, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
Patch (28.06 KB, patch)
2017-11-21 21:21 PST, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
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 Details
Patch (28.47 KB, patch)
2017-11-23 07:56 PST, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
Patch (27.78 KB, patch)
2017-11-23 08:07 PST, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
Patch (27.96 KB, patch)
2017-11-23 09:02 PST, Simon Fraser (smfr)
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2017-11-21 20:59:07 PST
Add support for CanvasPattern.setTransform()
Comment 1 Simon Fraser (smfr) 2017-11-21 21:14:08 PST
Created attachment 327442 [details]
Patch
Comment 2 Simon Fraser (smfr) 2017-11-21 21:21:34 PST
Created attachment 327443 [details]
Patch
Comment 3 EWS Watchlist 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
Comment 4 EWS Watchlist 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
Comment 5 Sam Weinig 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.
Comment 6 Simon Fraser (smfr) 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.
Comment 7 Simon Fraser (smfr) 2017-11-23 07:56:13 PST
Created attachment 327503 [details]
Patch
Comment 8 Simon Fraser (smfr) 2017-11-23 08:07:55 PST
Created attachment 327504 [details]
Patch
Comment 9 Sam Weinig 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?
Comment 10 Simon Fraser (smfr) 2017-11-23 09:02:00 PST
Created attachment 327506 [details]
Patch
Comment 11 Darin Adler 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.
Comment 12 Simon Fraser (smfr) 2017-11-23 14:27:07 PST
Will fix via bug 179984.
Comment 13 Simon Fraser (smfr) 2017-11-24 09:12:22 PST
https://trac.webkit.org/r225121
Comment 14 Radar WebKit Bug Importer 2017-11-24 09:13:20 PST
<rdar://problem/35683926>