Title: [247735] trunk
- Revision
- 247735
- Author
- [email protected]
- Date
- 2019-07-23 13:39:25 -0700 (Tue, 23 Jul 2019)
Log Message
CanvasRenderingContext2D.setTransfrom() reads only the aliases attributes of DOMMatrix2DInit
https://bugs.webkit.org/show_bug.cgi?id=199850
Patch by Said Abou-Hallawa <[email protected]> on 2019-07-23
Reviewed by Simon Fraser.
Source/WebCore:
The validateAndFixup step of DOMMatrix2DInit sets the matrix attributes
(m** fields) from the aliases attributes (a, b, c, d, e, f) if the former
ones do not exist and the later ones exist. See
https://www.w3.org/TR/geometry-1/#dommatrixinit-dictionary and
DOMMatrixReadOnly::validateAndFixup(DOMMatrix2DInit& init).
Since CanvasRenderingContext2DBase::setTransform() validates and fixes
the input DOMMatrix2DInit, it should rely on matrix attributes.
Test: fast/canvas/setTransfrom-aliases-transform.html
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::setTransform):
LayoutTests:
* fast/canvas/setTransfrom-aliases-transform-expected.html: Added.
* fast/canvas/setTransfrom-aliases-transform.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (247734 => 247735)
--- trunk/LayoutTests/ChangeLog 2019-07-23 19:50:17 UTC (rev 247734)
+++ trunk/LayoutTests/ChangeLog 2019-07-23 20:39:25 UTC (rev 247735)
@@ -1,3 +1,13 @@
+2019-07-23 Said Abou-Hallawa <[email protected]>
+
+ CanvasRenderingContext2D.setTransfrom() reads only the aliases attributes of DOMMatrix2DInit
+ https://bugs.webkit.org/show_bug.cgi?id=199850
+
+ Reviewed by Simon Fraser.
+
+ * fast/canvas/setTransfrom-aliases-transform-expected.html: Added.
+ * fast/canvas/setTransfrom-aliases-transform.html: Added.
+
2019-07-23 Tim Horton <[email protected]>
Long press hint of AirPods buy buttons are tall and narrow during animation
Added: trunk/LayoutTests/fast/canvas/setTransfrom-aliases-transform-expected.html (0 => 247735)
--- trunk/LayoutTests/fast/canvas/setTransfrom-aliases-transform-expected.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/setTransfrom-aliases-transform-expected.html 2019-07-23 20:39:25 UTC (rev 247735)
@@ -0,0 +1,24 @@
+<style>
+ canvas {
+ width: 100px;
+ height: 100px;
+ }
+</style>
+<body>
+ <canvas id="canvas1"></canvas>
+ <canvas id="canvas2"></canvas>
+ <script>
+ function drawRect(id) {
+ const canvas = document.getElementById(id);
+ canvas.width = canvas.clientWidth;
+ canvas.height = canvas.clientHeight;
+
+ const ctx = canvas.getContext('2d');
+ ctx.fillStyle = 'green';
+ ctx.fillRect(0, 0, 100, 100);
+ }
+
+ drawRect('canvas1');
+ drawRect('canvas2');
+ </script>
+</body>
Added: trunk/LayoutTests/fast/canvas/setTransfrom-aliases-transform.html (0 => 247735)
--- trunk/LayoutTests/fast/canvas/setTransfrom-aliases-transform.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/setTransfrom-aliases-transform.html 2019-07-23 20:39:25 UTC (rev 247735)
@@ -0,0 +1,25 @@
+<style>
+ canvas {
+ width: 100px;
+ height: 100px;
+ }
+</style>
+<body>
+ <canvas id="canvas1"></canvas>
+ <canvas id="canvas2"></canvas>
+ <script>
+ function drawRectWithSetTransform(id, transform) {
+ const canvas = document.getElementById(id);
+ canvas.width = canvas.clientWidth;
+ canvas.height = canvas.clientHeight;
+
+ const ctx = canvas.getContext('2d');
+ ctx.fillStyle = 'green';
+ ctx.setTransform(transform);
+ ctx.fillRect(0, 0, 50, 50);
+ }
+
+ drawRectWithSetTransform('canvas1', { a: 2, d: 2 });
+ drawRectWithSetTransform('canvas2', { m11: 2, m22: 2 });
+ </script>
+</body>
Modified: trunk/Source/WebCore/ChangeLog (247734 => 247735)
--- trunk/Source/WebCore/ChangeLog 2019-07-23 19:50:17 UTC (rev 247734)
+++ trunk/Source/WebCore/ChangeLog 2019-07-23 20:39:25 UTC (rev 247735)
@@ -1,3 +1,24 @@
+2019-07-23 Said Abou-Hallawa <[email protected]>
+
+ CanvasRenderingContext2D.setTransfrom() reads only the aliases attributes of DOMMatrix2DInit
+ https://bugs.webkit.org/show_bug.cgi?id=199850
+
+ Reviewed by Simon Fraser.
+
+ The validateAndFixup step of DOMMatrix2DInit sets the matrix attributes
+ (m** fields) from the aliases attributes (a, b, c, d, e, f) if the former
+ ones do not exist and the later ones exist. See
+ https://www.w3.org/TR/geometry-1/#dommatrixinit-dictionary and
+ DOMMatrixReadOnly::validateAndFixup(DOMMatrix2DInit& init).
+
+ Since CanvasRenderingContext2DBase::setTransform() validates and fixes
+ the input DOMMatrix2DInit, it should rely on matrix attributes.
+
+ Test: fast/canvas/setTransfrom-aliases-transform.html
+
+ * html/canvas/CanvasRenderingContext2DBase.cpp:
+ (WebCore::CanvasRenderingContext2DBase::setTransform):
+
2019-07-23 Tim Horton <[email protected]>
Long press hint of AirPods buy buttons are tall and narrow during animation
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp (247734 => 247735)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp 2019-07-23 19:50:17 UTC (rev 247734)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp 2019-07-23 20:39:25 UTC (rev 247735)
@@ -913,7 +913,7 @@
if (checkValid.hasException())
return checkValid.releaseException();
- setTransform(matrixInit.a.valueOr(1), matrixInit.b.valueOr(0), matrixInit.c.valueOr(0), matrixInit.d.valueOr(1), matrixInit.e.valueOr(0), matrixInit.f.valueOr(0));
+ setTransform(matrixInit.m11.value(), matrixInit.m12.value(), matrixInit.m21.value(), matrixInit.m22.value(), matrixInit.m41.value(), matrixInit.m42.value());
return { };
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes