Changeset 87732 in webkit
- Timestamp:
- May 31, 2011 9:15:27 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r87731 r87732 1 2011-05-31 Andreas Kling <kling@webkit.org> 2 3 Reviewed by Antti Koivisto. 4 5 Canvas/JSC: Auto-generate overloads for setFillColor() 6 https://bugs.webkit.org/show_bug.cgi?id=61635 7 8 Add a test to verify the behavior of setFillColor() when called with 9 different numbers of arguments. 10 11 * fast/canvas/canvas-overloads-setFillColor-expected.txt: Added. 12 * fast/canvas/canvas-overloads-setFillColor.html: Added. 13 * fast/canvas/script-tests/canvas-overloads-setFillColor.js: Added. 14 1 15 2011-05-31 Andreas Kling <kling@webkit.org> 2 16 -
trunk/Source/WebCore/ChangeLog
r87731 r87732 1 2011-05-31 Andreas Kling <kling@webkit.org> 2 3 Reviewed by Antti Koivisto. 4 5 Canvas/JSC: Auto-generate overloads for setFillColor() 6 https://bugs.webkit.org/show_bug.cgi?id=61635 7 8 Move CanvasRenderingContext2D.setStrokeColor() to auto-generated JSC bindings. 9 10 There is a subtle difference to the previous behavior: invalid numbers of 11 arguments now raise TypeError instead of SyntaxError. This is in accordance 12 with Web IDL, but doesn't matter much anyway since this method is WebKit-only. 13 14 Test: fast/canvas/canvas-overloads-setFillColor.html 15 16 * bindings/js/JSCanvasRenderingContext2DCustom.cpp: 17 * html/canvas/CanvasRenderingContext2D.idl: 18 1 19 2011-05-31 Andreas Kling <kling@webkit.org> 2 20 -
trunk/Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp
r87731 r87732 95 95 context->setFillStyle(toHTMLCanvasStyle(exec, value)); 96 96 } 97 98 JSValue JSCanvasRenderingContext2D::setFillColor(ExecState* exec)99 {100 CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl());101 102 // string arg = named color103 // number arg = gray color104 // string arg, number arg = named color, alpha105 // number arg, number arg = gray color, alpha106 // 4 args = r, g, b, a107 // 5 args = c, m, y, k, a108 switch (exec->argumentCount()) {109 case 1:110 if (exec->argument(0).isString())111 context->setFillColor(ustringToString(asString(exec->argument(0))->value(exec)));112 else113 context->setFillColor(exec->argument(0).toFloat(exec));114 break;115 case 2:116 if (exec->argument(0).isString())117 context->setFillColor(ustringToString(asString(exec->argument(0))->value(exec)), exec->argument(1).toFloat(exec));118 else119 context->setFillColor(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec));120 break;121 case 4:122 context->setFillColor(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec),123 exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec));124 break;125 case 5:126 context->setFillColor(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec),127 exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec));128 break;129 default:130 return throwSyntaxError(exec);131 }132 return jsUndefined();133 }134 97 135 98 JSValue JSCanvasRenderingContext2D::strokeRect(ExecState* exec) -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl
r87731 r87732 108 108 void setStrokeColor(in float c, in float m, in float y, in float k, in float a); 109 109 110 #if defined(V8_BINDING) && V8_BINDING111 110 void setFillColor(in DOMString color, in [Optional] float alpha); 112 111 void setFillColor(in float grayLevel, in [Optional] float alpha); … … 114 113 void setFillColor(in float c, in float m, in float y, in float k, in float a); 115 114 115 #if defined(V8_BINDING) && V8_BINDING 116 116 void strokeRect(in float x, in float y, in float width, in float height, in [Optional] float lineWidth); 117 117 … … 157 157 #else 158 158 // FIXME: Remove 'else' once JSC supports overloads too. 159 [Custom] void setFillColor(/* 1 */);160 159 [Custom] void strokeRect(/* 4 */); 161 160 [Custom] void drawImage(/* 3 */);
Note: See TracChangeset
for help on using the changeset viewer.