Title: [209005] trunk/Source/WebCore
Revision
209005
Author
bfulg...@apple.com
Date
2016-11-28 12:27:39 -0800 (Mon, 28 Nov 2016)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (209004 => 209005)


--- trunk/Source/WebCore/ChangeLog	2016-11-28 20:18:01 UTC (rev 209004)
+++ trunk/Source/WebCore/ChangeLog	2016-11-28 20:27:39 UTC (rev 209005)
@@ -1,3 +1,25 @@
+2016-11-28  Brent Fulgham  <bfulg...@apple.com>
+
+        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.
+
 2016-11-28  Dave Hyatt  <hy...@apple.com>
 
         [CSS Parser] flex-basis should be pixel units not percentages.

Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (209004 => 209005)


--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp	2016-11-28 20:18:01 UTC (rev 209004)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp	2016-11-28 20:27:39 UTC (rev 209005)
@@ -2264,10 +2264,10 @@
             return getJSValue(FileList::create(WTFMove(files)).get());
         }
         case ImageDataTag: {
-            int32_t width;
+            uint32_t width;
             if (!read(width))
                 return JSValue();
-            int32_t height;
+            uint32_t height;
             if (!read(height))
                 return JSValue();
             uint32_t length;

Modified: trunk/Source/WebCore/html/ImageData.idl (209004 => 209005)


--- trunk/Source/WebCore/html/ImageData.idl	2016-11-28 20:18:01 UTC (rev 209004)
+++ trunk/Source/WebCore/html/ImageData.idl	2016-11-28 20:27:39 UTC (rev 209005)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2009, 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -34,7 +34,7 @@
     Exposed=(Window,Worker),
     ImplementationLacksVTable,
 ] interface ImageData {
-    readonly attribute long width;
-    readonly attribute long height;
+    readonly attribute unsigned long width;
+    readonly attribute unsigned long height;
     readonly attribute Uint8ClampedArray data;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to