Changeset 87730 in webkit


Ignore:
Timestamp:
May 31, 2011 9:10:39 AM (13 years ago)
Author:
andreas.kling@nokia.com
Message:

2011-05-31 Andreas Kling <kling@webkit.org>

Reviewed by Antti Koivisto.

Canvas/JSC: Auto-generate overloads for strokeText()
https://bugs.webkit.org/show_bug.cgi?id=61626

Move CanvasRenderingContext2D.strokeText() 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-strokeText.html

  • bindings/js/JSCanvasRenderingContext2DCustom.cpp:
  • html/canvas/CanvasRenderingContext2D.idl:

2011-05-31 Andreas Kling <kling@webkit.org>

Reviewed by Antti Koivisto.

Canvas/JSC: Auto-generate overloads for strokeText()
https://bugs.webkit.org/show_bug.cgi?id=61626

Add a test to verify the behavior of strokeText() 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 strokeText() with superfluous arguments now lets the call through instead of raising a SyntaxError. This matches both Gecko and Presto.
  • fast/canvas/canvas-overloads-strokeText-expected.txt: Added.
  • fast/canvas/canvas-overloads-strokeText.html: Added.
  • fast/canvas/script-tests/canvas-overloads-strokeText.js: Added.
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r87729 r87730  
     12011-05-31  Andreas Kling  <kling@webkit.org>
     2
     3        Reviewed by Antti Koivisto.
     4
     5        Canvas/JSC: Auto-generate overloads for strokeText()
     6        https://bugs.webkit.org/show_bug.cgi?id=61626
     7
     8        Add a test to verify the behavior of strokeText() when called with different
     9        numbers of arguments. There are two differences to the previous behavior:
     10
     11        - SyntaxError exceptions are now raised with the message "Not enough arguments."
     12        - Calling strokeText() with superfluous arguments now lets the call through
     13          instead of raising a SyntaxError. This matches both Gecko and Presto.
     14
     15        * fast/canvas/canvas-overloads-strokeText-expected.txt: Added.
     16        * fast/canvas/canvas-overloads-strokeText.html: Added.
     17        * fast/canvas/script-tests/canvas-overloads-strokeText.js: Added.
     18
    1192011-05-31  Andreas Kling  <kling@webkit.org>
    220
  • trunk/Source/WebCore/ChangeLog

    r87729 r87730  
     12011-05-31  Andreas Kling  <kling@webkit.org>
     2
     3        Reviewed by Antti Koivisto.
     4
     5        Canvas/JSC: Auto-generate overloads for strokeText()
     6        https://bugs.webkit.org/show_bug.cgi?id=61626
     7
     8        Move CanvasRenderingContext2D.strokeText() to auto-generated JSC bindings.
     9        Make it [RequiresAllArguments=Raise] to match the old behavior.
     10        This has the side-effect of aligning the behaviors of JSC and V8.
     11
     12        Test: fast/canvas/canvas-overloads-strokeText.html
     13
     14        * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
     15        * html/canvas/CanvasRenderingContext2D.idl:
     16
    1172011-05-31  Andreas Kling  <kling@webkit.org>
    218
  • trunk/Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp

    r87729 r87730  
    410410}
    411411
    412 JSValue JSCanvasRenderingContext2D::strokeText(ExecState* exec)
    413 {
    414     CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl());
    415 
    416     // string arg = text to draw
    417     // number arg = x
    418     // number arg = y
    419     // optional number arg = maxWidth
    420     if (exec->argumentCount() < 3 || exec->argumentCount() > 4)
    421         return throwSyntaxError(exec);
    422    
    423     if (exec->argumentCount() == 4)
    424         context->strokeText(ustringToString(exec->argument(0).toString(exec)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec));
    425     else
    426         context->strokeText(ustringToString(exec->argument(0).toString(exec)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec));
    427     return jsUndefined();
    428 }
    429 
    430412} // namespace WebCore
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl

    r87729 r87730  
    101101
    102102        [RequiresAllArguments=Raise] void fillText(in DOMString text, in float x, in float y, in [Optional] float maxWidth);
     103        [RequiresAllArguments=Raise] void strokeText(in DOMString text, in float x, in float y, in [Optional] float maxWidth);
    103104
    104105#if defined(V8_BINDING) && V8_BINDING
    105         void strokeText(in DOMString text, in float x, in float y, in [Optional] float maxWidth);
    106 
    107106        void setStrokeColor(in DOMString color, in [Optional] float alpha);
    108107        void setStrokeColor(in float grayLevel, in [Optional] float alpha);
     
    158157#else
    159158        // FIXME: Remove 'else' once JSC supports overloads too.
    160         [Custom] void strokeText(/* 4 */);
    161159        [Custom] void setStrokeColor(/* 1  */);
    162160        [Custom] void setFillColor(/* 1 */);
Note: See TracChangeset for help on using the changeset viewer.