Changeset 209005 in webkit


Ignore:
Timestamp:
Nov 28, 2016 12:27:39 PM (7 years ago)
Author:
Brent Fulgham
Message:

ImageData does not match specification
https://bugs.webkit.org/show_bug.cgi?id=164663

Reviewed by Simon Fraser.

The W3C specification https://www.w3.org/TR/2dcontext/ clearly states that
the width and height attributes of the ImageData type should be unsigned.
Our current implementation has signed integer values.

In practice, we have enforced the unsigned requirement by throwing a TypeError
if you attempt to construct an ImageData with negative width or height.

This change simply updates the IDL and impelemntation to match the spec.

Test coverage is already provided by fast/canvas/canvas-imageData.html

  • bindings/js/SerializedScriptValue.cpp:

(WebCore::CloneDeserializer::readTerminal): Serialize as uint32_t values.

  • html/ImageData.idl: Revise width and height to be unsigned long.
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r209003 r209005  
     12016-11-28  Brent Fulgham  <bfulgham@apple.com>
     2
     3        ImageData does not match specification
     4        https://bugs.webkit.org/show_bug.cgi?id=164663
     5
     6        Reviewed by Simon Fraser.
     7
     8        The W3C specification https://www.w3.org/TR/2dcontext/ clearly states that
     9        the width and height attributes of the ImageData type should be unsigned.
     10        Our current implementation has signed integer values.
     11
     12        In practice, we have enforced the unsigned requirement by throwing a TypeError
     13        if you attempt to construct an ImageData with negative width or height.
     14
     15        This change simply updates the IDL and impelemntation to match the spec.
     16
     17        Test coverage is already provided by fast/canvas/canvas-imageData.html
     18
     19        * bindings/js/SerializedScriptValue.cpp:
     20        (WebCore::CloneDeserializer::readTerminal): Serialize as uint32_t values.
     21        * html/ImageData.idl: Revise width and height to be unsigned long.
     22
    1232016-11-28  Dave Hyatt  <hyatt@apple.com>
    224
  • trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp

    r208688 r209005  
    22652265        }
    22662266        case ImageDataTag: {
    2267             int32_t width;
     2267            uint32_t width;
    22682268            if (!read(width))
    22692269                return JSValue();
    2270             int32_t height;
     2270            uint32_t height;
    22712271            if (!read(height))
    22722272                return JSValue();
  • trunk/Source/WebCore/html/ImageData.idl

    r208096 r209005  
    11/*
    2  * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008-2009, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3535    ImplementationLacksVTable,
    3636] interface ImageData {
    37     readonly attribute long width;
    38     readonly attribute long height;
     37    readonly attribute unsigned long width;
     38    readonly attribute unsigned long height;
    3939    readonly attribute Uint8ClampedArray data;
    4040};
Note: See TracChangeset for help on using the changeset viewer.