Changeset 47398 in webkit


Ignore:
Timestamp:
Aug 17, 2009 5:05:55 PM (15 years ago)
Author:
eric@webkit.org
Message:

2009-08-17 Benjamin C Meyer <benjamin.meyer@torchmobile.com>

Reviewed by Darin Adler.

Fix createImageData to raise the NOT_SUPPORTED_ERR exception when
either of the arguments are not finite.

According to
http://www.whatwg.org/specs/web-apps/current-work/#pixel-manipulation:
"If any of the arguments to createImageData() or getImageData() are
infinite or NaN, or if the createImageData() method is invoked with
only one argument but that argument is null, the method must instead
raise a NOT_SUPPORTED_ERR exception."

Test: http://philip.html5.org/tests/canvas/suite/tests/2d.imageData.create.nonfinite.html

  • fast/canvas/canvas-2d-imageData-create-nonfinite-expected.txt: Added.
  • fast/canvas/canvas-2d-imageData-create-nonfinite.html: Added.
  • fast/canvas/resources/canvas-2d-imageData-create-nonfinite.js: Added.

2009-08-17 Benjamin C Meyer <benjamin.meyer@torchmobile.com>

Reviewed by Darin Adler.

Fix createImageData to raise the NOT_SUPPORTED_ERR exception when
either of the arguments are not finite.

According to
http://www.whatwg.org/specs/web-apps/current-work/#pixel-manipulation:
"If any of the arguments to createImageData() or getImageData() are
infinite or NaN, or if the createImageData() method is invoked with
only one argument but that argument is null, the method must instead
raise a NOT_SUPPORTED_ERR exception."

Test: http://philip.html5.org/tests/canvas/suite/tests/2d.imageData.create.nonfinite.html

  • html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::createImageData):
  • html/canvas/CanvasRenderingContext2D.h:
  • html/canvas/CanvasRenderingContext2D.idl:
Location:
trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r47397 r47398  
     12009-08-17  Benjamin C Meyer  <benjamin.meyer@torchmobile.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Fix createImageData to raise the NOT_SUPPORTED_ERR exception when
     6        either of the arguments are not finite.
     7
     8        According to
     9        http://www.whatwg.org/specs/web-apps/current-work/#pixel-manipulation:
     10        "If any of the arguments to createImageData() or getImageData() are
     11        infinite or NaN, or if the createImageData()  method is invoked with
     12        only one argument but that argument is null, the method must instead
     13        raise a NOT_SUPPORTED_ERR  exception."
     14
     15        Test: http://philip.html5.org/tests/canvas/suite/tests/2d.imageData.create.nonfinite.html
     16
     17        * fast/canvas/canvas-2d-imageData-create-nonfinite-expected.txt: Added.
     18        * fast/canvas/canvas-2d-imageData-create-nonfinite.html: Added.
     19        * fast/canvas/resources/canvas-2d-imageData-create-nonfinite.js: Added.
     20
    1212009-08-17  Jeremy Orlow  <jorlow@chromium.org>
    222
  • trunk/WebCore/ChangeLog

    r47397 r47398  
     12009-08-17  Benjamin C Meyer  <benjamin.meyer@torchmobile.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Fix createImageData to raise the NOT_SUPPORTED_ERR exception when
     6        either of the arguments are not finite.
     7
     8        According to
     9        http://www.whatwg.org/specs/web-apps/current-work/#pixel-manipulation:
     10        "If any of the arguments to createImageData() or getImageData() are
     11        infinite or NaN, or if the createImageData()  method is invoked with
     12        only one argument but that argument is null, the method must instead
     13        raise a NOT_SUPPORTED_ERR  exception."
     14
     15        Test: http://philip.html5.org/tests/canvas/suite/tests/2d.imageData.create.nonfinite.html
     16
     17        * html/canvas/CanvasRenderingContext2D.cpp:
     18        (WebCore::CanvasRenderingContext2D::createImageData):
     19        * html/canvas/CanvasRenderingContext2D.h:
     20        * html/canvas/CanvasRenderingContext2D.idl:
     21
    1222009-08-17  Jeremy Orlow  <jorlow@chromium.org>
    223
  • trunk/WebCore/html/canvas/CanvasRenderingContext2D.cpp

    r47099 r47398  
    12791279}
    12801280
    1281 PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(float sw, float sh) const
    1282 {
     1281PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(float sw, float sh, ExceptionCode& ec) const
     1282{
     1283    ec = 0;
     1284    if (!isfinite(sw) || !isfinite(sh)) {
     1285        ec = NOT_SUPPORTED_ERR;
     1286        return 0;
     1287    }
    12831288    FloatSize unscaledSize(sw, sh);
    12841289    IntSize scaledSize = m_canvas->convertLogicalToDevice(unscaledSize);
  • trunk/WebCore/html/canvas/CanvasRenderingContext2D.h

    r46937 r47398  
    179179        PassRefPtr<CanvasPattern> createPattern(HTMLCanvasElement*, const String& repetitionType, ExceptionCode&);
    180180       
    181         PassRefPtr<ImageData> createImageData(float width, float height) const;
     181        PassRefPtr<ImageData> createImageData(float width, float height, ExceptionCode&) const;
    182182        PassRefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, ExceptionCode&) const;
    183183        void putImageData(ImageData*, float dx, float dy, ExceptionCode&);
  • trunk/WebCore/html/canvas/CanvasRenderingContext2D.idl

    r46937 r47398  
    114114       
    115115        // pixel manipulation
    116         ImageData createImageData(in float sw, in float sh);
     116        ImageData createImageData(in float sw, in float sh)
     117            raises (DOMException);
    117118        ImageData getImageData(in float sx, in float sy, in float sw, in float sh)
    118119            raises(DOMException);
Note: See TracChangeset for help on using the changeset viewer.