diff options
author | dongseong.hwang@intel.com <dongseong.hwang@intel.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2013-05-13 07:45:09 +0000 |
---|---|---|
committer | dongseong.hwang@intel.com <dongseong.hwang@intel.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2013-05-13 07:45:09 +0000 |
commit | 387235ad9ede48362282223739a5a23d1e10cb09 (patch) | |
tree | 9e1cdbce7fccb7ea84d9192b8a3a5728313d1a2e | |
parent | 52d3f8921e2d53e5a5320eae37959802ea58a95a (diff) | |
download | chromium_src-387235ad9ede48362282223739a5a23d1e10cb09.zip chromium_src-387235ad9ede48362282223739a5a23d1e10cb09.tar.gz chromium_src-387235ad9ede48362282223739a5a23d1e10cb09.tar.bz2 |
Remove an overloaded strokeRect in <canvas>
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/
BUG=
Review URL: https://chromiumcodereview.appspot.com/14972014
git-svn-id: svn://svn.chromium.org/blink/trunk@150200 bbb929c8-8fbe-4397-9dbb-9b2b20218538
7 files changed, 10 insertions, 52 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-strokeRect-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-strokeRect-expected.txt deleted file mode 100644 index 8e80703..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-strokeRect-expected.txt +++ /dev/null @@ -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 - diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-strokeRect.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-strokeRect.html deleted file mode 100644 index 6f2f1d6..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-strokeRect.html +++ /dev/null @@ -1,10 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../js/resources/js-test-pre.js"></script> -</head> -<body> -<script src="script-tests/canvas-overloads-strokeRect.js"></script> -<script src="../js/resources/js-test-post.js"></script> -</body> -</html> diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-overloads-strokeRect.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-overloads-strokeRect.js deleted file mode 100644 index d7bbd7c..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-overloads-strokeRect.js +++ /dev/null @@ -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"); diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-strokeRect.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-strokeRect.js index a1eabcf..75a6f5d 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-strokeRect.js +++ b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-strokeRect.js @@ -5,7 +5,8 @@ var ctx = document.createElement('canvas').getContext('2d'); 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.fillStyle = 'green'; 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 @@ var gradient = ctx.createLinearGradient(0, 0, 0, 100); 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; diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext2D.cpp index 5c8ee8a..07eae79 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext2D.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext2D.cpp @@ -1093,15 +1093,8 @@ void CanvasRenderingContext2D::strokeRect(float x, float y, float width, float h { 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)) + if (!(state().m_lineWidth >= 0)) return; GraphicsContext* c = drawingContext(); @@ -1118,9 +1111,9 @@ void CanvasRenderingContext2D::strokeRect(float x, float y, float width, float h 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); } diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext2D.h b/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext2D.h index cafba65..5873205 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext2D.h +++ b/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext2D.h @@ -149,7 +149,6 @@ public: 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); diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext2D.idl b/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext2D.idl index d1c3425..7e3d07f 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext2D.idl +++ b/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext2D.idl @@ -115,7 +115,7 @@ interface CanvasRenderingContext2D : CanvasRenderingContext { 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); [RaisesException] void drawImage(HTMLImageElement? image, float x, float y); [RaisesException] void drawImage(HTMLImageElement? image, float x, float y, float width, float height); |