Diff
Modified: trunk/LayoutTests/ChangeLog (87728 => 87729)
--- trunk/LayoutTests/ChangeLog 2011-05-31 16:05:31 UTC (rev 87728)
+++ trunk/LayoutTests/ChangeLog 2011-05-31 16:08:49 UTC (rev 87729)
@@ -1,3 +1,21 @@
+2011-05-31 Andreas Kling <[email protected]>
+
+ Reviewed by Antti Koivisto.
+
+ Canvas/JSC: Auto-generate overloads for fillText()
+ https://bugs.webkit.org/show_bug.cgi?id=61623
+
+ Add a test to verify the behavior of fillText() when called with different
+ numbers of arguments. There are two differences to the previous behavior:
+
+ - SyntaxError exceptions are now raised with the message "Not enough arguments."
+ - Calling fillText() with superfluous arguments now lets the call through
+ instead of raising a SyntaxError. This matches both Gecko and Presto.
+
+ * fast/canvas/canvas-overloads-fillText-expected.txt: Added.
+ * fast/canvas/canvas-overloads-fillText.html: Added.
+ * fast/canvas/script-tests/canvas-overloads-fillText.js: Added.
+
2011-05-31 Simon Fraser <[email protected]>
Reviewed by Kenneth Rohde Christiansen.
Added: trunk/LayoutTests/fast/canvas/canvas-overloads-fillText-expected.txt (0 => 87729)
--- trunk/LayoutTests/fast/canvas/canvas-overloads-fillText-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-overloads-fillText-expected.txt 2011-05-31 16:08:49 UTC (rev 87729)
@@ -0,0 +1,15 @@
+Test the behavior of CanvasRenderingContext2D.fillText() when called with different numbers of arguments.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS ctx.fillText() threw exception SyntaxError: Not enough arguments.
+PASS ctx.fillText('moo') threw exception SyntaxError: Not enough arguments.
+PASS ctx.fillText('moo',0) threw exception SyntaxError: Not enough arguments.
+PASS ctx.fillText('moo',0,0) is undefined
+PASS ctx.fillText('moo',0,0,0) is undefined
+PASS ctx.fillText('moo',0,0,0,0) is undefined
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/canvas-overloads-fillText.html (0 => 87729)
--- trunk/LayoutTests/fast/canvas/canvas-overloads-fillText.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-overloads-fillText.html 2011-05-31 16:08:49 UTC (rev 87729)
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-fillText.js (0 => 87729)
--- trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-fillText.js (rev 0)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-fillText.js 2011-05-31 16:08:49 UTC (rev 87729)
@@ -0,0 +1,15 @@
+description("Test the behavior of CanvasRenderingContext2D.fillText() when called with different numbers of arguments.");
+
+var ctx = document.createElement('canvas').getContext('2d');
+
+var SyntaxError = "SyntaxError: Not enough arguments";
+var TypeError = "TypeError: Type error";
+
+shouldThrow("ctx.fillText()", "SyntaxError");
+shouldThrow("ctx.fillText('moo')", "SyntaxError");
+shouldThrow("ctx.fillText('moo',0)", "SyntaxError");
+shouldBe("ctx.fillText('moo',0,0)", "undefined");
+shouldBe("ctx.fillText('moo',0,0,0)", "undefined");
+shouldBe("ctx.fillText('moo',0,0,0,0)", "undefined");
+
+var successfullyParsed = true;
Modified: trunk/Source/WebCore/ChangeLog (87728 => 87729)
--- trunk/Source/WebCore/ChangeLog 2011-05-31 16:05:31 UTC (rev 87728)
+++ trunk/Source/WebCore/ChangeLog 2011-05-31 16:08:49 UTC (rev 87729)
@@ -1,3 +1,19 @@
+2011-05-31 Andreas Kling <[email protected]>
+
+ Reviewed by Antti Koivisto.
+
+ Canvas/JSC: Auto-generate overloads for fillText()
+ https://bugs.webkit.org/show_bug.cgi?id=61623
+
+ Move CanvasRenderingContext2D.fillText() to auto-generated JSC bindings.
+ Make it [RequiresAllArguments=Raise] to match the old behavior.
+ This has the side-effect of aligning the behaviors of JSC and V8.
+
+ Test: fast/canvas/canvas-overloads-fillText.html
+
+ * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
+ * html/canvas/CanvasRenderingContext2D.idl:
+
2011-05-31 Yael Aharon <[email protected]>
Reviewed by Kenneth Rohde Christiansen.
Modified: trunk/Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp (87728 => 87729)
--- trunk/Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp 2011-05-31 16:05:31 UTC (rev 87728)
+++ trunk/Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp 2011-05-31 16:08:49 UTC (rev 87729)
@@ -409,24 +409,6 @@
return jsUndefined();
}
-JSValue JSCanvasRenderingContext2D::fillText(ExecState* exec)
-{
- CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl());
-
- // string arg = text to draw
- // number arg = x
- // number arg = y
- // optional number arg = maxWidth
- if (exec->argumentCount() < 3 || exec->argumentCount() > 4)
- return throwSyntaxError(exec);
-
- if (exec->argumentCount() == 4)
- context->fillText(ustringToString(exec->argument(0).toString(exec)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec));
- else
- context->fillText(ustringToString(exec->argument(0).toString(exec)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec));
- return jsUndefined();
-}
-
JSValue JSCanvasRenderingContext2D::strokeText(ExecState* exec)
{
CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl());
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl (87728 => 87729)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl 2011-05-31 16:05:31 UTC (rev 87728)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl 2011-05-31 16:08:49 UTC (rev 87729)
@@ -99,8 +99,9 @@
void clearShadow();
+ [RequiresAllArguments=Raise] void fillText(in DOMString text, in float x, in float y, in [Optional] float maxWidth);
+
#if defined(V8_BINDING) && V8_BINDING
- void fillText(in DOMString text, in float x, in float y, in [Optional] float maxWidth);
void strokeText(in DOMString text, in float x, in float y, in [Optional] float maxWidth);
void setStrokeColor(in DOMString color, in [Optional] float alpha);
@@ -156,7 +157,6 @@
raises (DOMException);
#else
// FIXME: Remove 'else' once JSC supports overloads too.
- [Custom] void fillText(/* 4 */);
[Custom] void strokeText(/* 4 */);
[Custom] void setStrokeColor(/* 1 */);
[Custom] void setFillColor(/* 1 */);