Title: [150137] trunk
Revision
150137
Author
[email protected]
Date
2013-05-15 12:37:07 -0700 (Wed, 15 May 2013)

Log Message

Remove an overloaded strokeRect in <canvas>
https://bugs.webkit.org/show_bug.cgi?id=116017

Patch by Dongseong Hwang <[email protected]> on 2013-05-15
Reviewed by Benjamin Poulain.

Source/WebCore:

The canvas spec [1] does not define strokeRect with 5 arguments, so this issue
remains only strokeRect with 4 arguments.

[1] http://www.w3.org/TR/2dcontext2/

Covered by existing tests: canvas/philip/tests/2d.missingargs.html

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::strokeRect):
* html/canvas/CanvasRenderingContext2D.h:
(CanvasRenderingContext2D):
* html/canvas/CanvasRenderingContext2D.idl:

LayoutTests:

canvas/philip/tests/2d.missingargs.html can cover
fast/canvas/canvas-overloads-strokeRect.html, so this patch removed it.

* fast/canvas/canvas-overloads-strokeRect-expected.txt: Removed.
* fast/canvas/canvas-overloads-strokeRect.html: Removed.
* fast/canvas/script-tests/canvas-overloads-strokeRect.js: Removed.
* fast/canvas/script-tests/canvas-strokeRect.js:

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (150136 => 150137)


--- trunk/LayoutTests/ChangeLog	2013-05-15 19:15:20 UTC (rev 150136)
+++ trunk/LayoutTests/ChangeLog	2013-05-15 19:37:07 UTC (rev 150137)
@@ -1,3 +1,18 @@
+2013-05-15  Dongseong Hwang  <[email protected]>
+
+        Remove an overloaded strokeRect in <canvas>
+        https://bugs.webkit.org/show_bug.cgi?id=116017
+
+        Reviewed by Benjamin Poulain.
+
+        canvas/philip/tests/2d.missingargs.html can cover
+        fast/canvas/canvas-overloads-strokeRect.html, so this patch removed it.
+
+        * fast/canvas/canvas-overloads-strokeRect-expected.txt: Removed.
+        * fast/canvas/canvas-overloads-strokeRect.html: Removed.
+        * fast/canvas/script-tests/canvas-overloads-strokeRect.js: Removed.
+        * fast/canvas/script-tests/canvas-strokeRect.js:
+
 2013-05-15  Bruno de Oliveira Abinader  <[email protected]>
 
         [css3-text] text-decoration-line now accepts "blink" as valid value

Deleted: trunk/LayoutTests/fast/canvas/canvas-overloads-strokeRect-expected.txt (150136 => 150137)


--- trunk/LayoutTests/fast/canvas/canvas-overloads-strokeRect-expected.txt	2013-05-15 19:15:20 UTC (rev 150136)
+++ trunk/LayoutTests/fast/canvas/canvas-overloads-strokeRect-expected.txt	2013-05-15 19:37:07 UTC (rev 150137)
@@ -1,15 +0,0 @@
-Test the behavior of CanvasRenderingContext2D.strokeRect() when called with different numbers of arguments.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS ctx.strokeRect() threw exception TypeError: Not enough arguments.
-PASS ctx.strokeRect(0) threw exception TypeError: Not enough arguments.
-PASS ctx.strokeRect(0, 0) threw exception TypeError: Not enough arguments.
-PASS ctx.strokeRect(0, 0, 0) threw exception TypeError: Not enough arguments.
-PASS ctx.strokeRect(0, 0, 0, 0) is undefined
-PASS ctx.strokeRect(0, 0, 0, 0, 0) is undefined
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/fast/canvas/canvas-overloads-strokeRect.html (150136 => 150137)


--- trunk/LayoutTests/fast/canvas/canvas-overloads-strokeRect.html	2013-05-15 19:15:20 UTC (rev 150136)
+++ trunk/LayoutTests/fast/canvas/canvas-overloads-strokeRect.html	2013-05-15 19:37:07 UTC (rev 150137)
@@ -1,10 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src=""
-</head>
-<body>
-<script src=""
-<script src=""
-</body>
-</html>

Deleted: trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-strokeRect.js (150136 => 150137)


--- trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-strokeRect.js	2013-05-15 19:15:20 UTC (rev 150136)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-strokeRect.js	2013-05-15 19:37:07 UTC (rev 150137)
@@ -1,12 +0,0 @@
-description("Test the behavior of CanvasRenderingContext2D.strokeRect() when called with different numbers of arguments.");
-
-var ctx = document.createElement('canvas').getContext('2d');
-
-var TypeErrorNotEnoughArguments = "TypeError: Not enough arguments";
-
-shouldThrow("ctx.strokeRect()", "TypeErrorNotEnoughArguments");
-shouldThrow("ctx.strokeRect(0)", "TypeErrorNotEnoughArguments");
-shouldThrow("ctx.strokeRect(0, 0)", "TypeErrorNotEnoughArguments");
-shouldThrow("ctx.strokeRect(0, 0, 0)", "TypeErrorNotEnoughArguments");
-shouldBe("ctx.strokeRect(0, 0, 0, 0)", "undefined");
-shouldBe("ctx.strokeRect(0, 0, 0, 0, 0)", "undefined");

Modified: trunk/LayoutTests/fast/canvas/script-tests/canvas-strokeRect.js (150136 => 150137)


--- trunk/LayoutTests/fast/canvas/script-tests/canvas-strokeRect.js	2013-05-15 19:15:20 UTC (rev 150136)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-strokeRect.js	2013-05-15 19:37:07 UTC (rev 150137)
@@ -5,7 +5,8 @@
 debug("Test canvas.strokeRect() with solid green.");
 ctx.beginPath();
 ctx.strokeStyle = 'green';
-ctx.strokeRect(50, 0, 100, 100, 100);
+ctx.lineWidth = 100;
+ctx.strokeRect(50, 0, 100, 100);
 
 var imageData = ctx.getImageData(1, 1, 98, 98);
 var imgdata = imageData.data;
@@ -25,7 +26,8 @@
 ctx2.fillRect(0, 0, 100, 100);
 var pattern = ctx.createPattern(canvas2, 'repeat');
 ctx.strokeStyle = 'pattern';
-ctx.strokeRect(50, 0, 100, 100, 100);
+ctx.lineWidth = 100;
+ctx.strokeRect(50, 0, 100, 100);
 
 imageData = ctx.getImageData(1, 1, 98, 98);
 imgdata = imageData.data;
@@ -41,7 +43,8 @@
 gradient.addColorStop(0, "green");
 gradient.addColorStop(1, "green");
 ctx.strokeStyle = 'gradient';
-ctx.strokeRect(50, 0, 100, 100, 100);
+ctx.lineWidth = 100;
+ctx.strokeRect(50, 0, 100, 100);
 
 imageData = ctx.getImageData(1, 1, 98, 98);
 imgdata = imageData.data;

Modified: trunk/Source/WebCore/ChangeLog (150136 => 150137)


--- trunk/Source/WebCore/ChangeLog	2013-05-15 19:15:20 UTC (rev 150136)
+++ trunk/Source/WebCore/ChangeLog	2013-05-15 19:37:07 UTC (rev 150137)
@@ -1,3 +1,23 @@
+2013-05-15  Dongseong Hwang  <[email protected]>
+
+        Remove an overloaded strokeRect in <canvas>
+        https://bugs.webkit.org/show_bug.cgi?id=116017
+
+        Reviewed by Benjamin Poulain.
+
+        The canvas spec [1] does not define strokeRect with 5 arguments, so this issue
+        remains only strokeRect with 4 arguments.
+
+        [1] http://www.w3.org/TR/2dcontext2/
+
+        Covered by existing tests: canvas/philip/tests/2d.missingargs.html
+
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::strokeRect):
+        * html/canvas/CanvasRenderingContext2D.h:
+        (CanvasRenderingContext2D):
+        * html/canvas/CanvasRenderingContext2D.idl:
+
 2013-05-15  Bruno de Oliveira Abinader  <[email protected]>
 
         [css3-text] text-decoration-line now accepts "blink" as valid value

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (150136 => 150137)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2013-05-15 19:15:20 UTC (rev 150136)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2013-05-15 19:37:07 UTC (rev 150137)
@@ -1112,22 +1112,14 @@
 {
     if (!validateRectForCanvas(x, y, width, height))
         return;
-    strokeRect(x, y, width, height, state().m_lineWidth);
-}
 
-void CanvasRenderingContext2D::strokeRect(float x, float y, float width, float height, float lineWidth)
-{
-    if (!validateRectForCanvas(x, y, width, height))
-        return;
-
-    if (!(lineWidth >= 0))
-        return;
-
     GraphicsContext* c = drawingContext();
     if (!c)
         return;
     if (!state().m_invertibleCTM)
         return;
+    if (!(state().m_lineWidth >= 0))
+        return;
 
     // If gradient size is zero, then paint nothing.
     Gradient* gradient = c->strokeGradient();
@@ -1137,9 +1129,9 @@
     FloatRect rect(x, y, width, height);
 
     FloatRect boundingRect = rect;
-    boundingRect.inflate(lineWidth / 2);
+    boundingRect.inflate(state().m_lineWidth / 2);
 
-    c->strokeRect(rect, lineWidth);
+    c->strokeRect(rect, state().m_lineWidth);
     didDraw(boundingRect);
 }
 

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h (150136 => 150137)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h	2013-05-15 19:15:20 UTC (rev 150136)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h	2013-05-15 19:37:07 UTC (rev 150137)
@@ -154,7 +154,6 @@
     void clearRect(float x, float y, float width, float height);
     void fillRect(float x, float y, float width, float height);
     void strokeRect(float x, float y, float width, float height);
-    void strokeRect(float x, float y, float width, float height, float lineWidth);
 
     void setShadow(float width, float height, float blur);
     void setShadow(float width, float height, float blur, const String& color);

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl (150136 => 150137)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl	2013-05-15 19:15:20 UTC (rev 150136)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl	2013-05-15 19:37:07 UTC (rev 150137)
@@ -122,7 +122,7 @@
     void setFillColor(float r, float g, float b, float a);
     void setFillColor(float c, float m, float y, float k, float a);
 
-    void strokeRect(float x, float y, float width, float height, optional float lineWidth);
+    void strokeRect(float x, float y, float width, float height);
 
     void drawImage(HTMLImageElement? image, float x, float y)
         raises (DOMException);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to