Changeset 87729 in webkit


Ignore:
Timestamp:
May 31, 2011 9:08:49 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 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 Andreas Kling <kling@webkit.org>

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:
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r87726 r87729  
     12011-05-31  Andreas Kling  <kling@webkit.org>
     2
     3        Reviewed by Antti Koivisto.
     4
     5        Canvas/JSC: Auto-generate overloads for fillText()
     6        https://bugs.webkit.org/show_bug.cgi?id=61623
     7
     8        Add a test to verify the behavior of fillText() 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 fillText() 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-fillText-expected.txt: Added.
     16        * fast/canvas/canvas-overloads-fillText.html: Added.
     17        * fast/canvas/script-tests/canvas-overloads-fillText.js: Added.
     18
    1192011-05-31  Simon Fraser  <simon.fraser@apple.com>
    220
  • trunk/Source/WebCore/ChangeLog

    r87726 r87729  
     12011-05-31  Andreas Kling  <kling@webkit.org>
     2
     3        Reviewed by Antti Koivisto.
     4
     5        Canvas/JSC: Auto-generate overloads for fillText()
     6        https://bugs.webkit.org/show_bug.cgi?id=61623
     7
     8        Move CanvasRenderingContext2D.fillText() 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-fillText.html
     13
     14        * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
     15        * html/canvas/CanvasRenderingContext2D.idl:
     16
    1172011-05-31  Yael Aharon  <yael.aharon@nokia.com>
    218
  • trunk/Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp

    r84641 r87729  
    410410}
    411411
    412 JSValue JSCanvasRenderingContext2D::fillText(ExecState* exec)
     412JSValue JSCanvasRenderingContext2D::strokeText(ExecState* exec)
    413413{
    414414    CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl());
     
    422422   
    423423    if (exec->argumentCount() == 4)
    424         context->fillText(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->fillText(ustringToString(exec->argument(0).toString(exec)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec));
    427     return jsUndefined();
    428 }
    429 
    430 JSValue JSCanvasRenderingContext2D::strokeText(ExecState* exec)
    431 {
    432     CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl());
    433 
    434     // string arg = text to draw
    435     // number arg = x
    436     // number arg = y
    437     // optional number arg = maxWidth
    438     if (exec->argumentCount() < 3 || exec->argumentCount() > 4)
    439         return throwSyntaxError(exec);
    440    
    441     if (exec->argumentCount() == 4)
    442424        context->strokeText(ustringToString(exec->argument(0).toString(exec)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec));
    443425    else
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl

    r60784 r87729  
    100100        void clearShadow();
    101101
     102        [RequiresAllArguments=Raise] void fillText(in DOMString text, in float x, in float y, in [Optional] float maxWidth);
     103
    102104#if defined(V8_BINDING) && V8_BINDING
    103         void fillText(in DOMString text, in float x, in float y, in [Optional] float maxWidth);
    104105        void strokeText(in DOMString text, in float x, in float y, in [Optional] float maxWidth);
    105106
     
    157158#else
    158159        // FIXME: Remove 'else' once JSC supports overloads too.
    159         [Custom] void fillText(/* 4 */);
    160160        [Custom] void strokeText(/* 4 */);
    161161        [Custom] void setStrokeColor(/* 1  */);
Note: See TracChangeset for help on using the changeset viewer.