[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

jianli at chromium.org jianli at chromium.org
Wed Dec 22 16:08:35 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit dd35f9afb4001e2e83b9e8ed8d0b73ebf7203cf8
Author: jianli at chromium.org <jianli at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 19 00:12:06 2010 +0000

    Move length and slice out of ArrayBufferView interface
    https://bugs.webkit.org/show_bug.cgi?id=49697
    
    Reviewed by Kenneth Russell.
    
    No functionality change. Covered by existing ArrayBuffer tests.
    
    * WebCore.gypi:
    * WebCore.pro:
    * WebCore.xcodeproj/project.pbxproj:
    * bindings/js/JSArrayBufferViewCustom.cpp: Removed.
    * bindings/v8/custom/V8ArrayBufferViewCustom.cpp: Removed.
    * html/canvas/ArrayBufferView.h:
    * html/canvas/ArrayBufferView.idl:
    * html/canvas/Float32Array.cpp:
    (WebCore::Float32Array::slice):
    * html/canvas/Float32Array.h:
    * html/canvas/Float32Array.idl:
    * html/canvas/Int16Array.cpp:
    (WebCore::Int16Array::slice):
    * html/canvas/Int16Array.h:
    * html/canvas/Int16Array.idl:
    * html/canvas/Int32Array.cpp:
    (WebCore::Int32Array::slice):
    * html/canvas/Int32Array.h:
    * html/canvas/Int32Array.idl:
    * html/canvas/Int8Array.cpp:
    (WebCore::Int8Array::slice):
    * html/canvas/Int8Array.h:
    * html/canvas/Int8Array.idl:
    * html/canvas/TypedArrayBase.h:
    (WebCore::TypedArrayBase::length):
    * html/canvas/Uint16Array.cpp:
    (WebCore::Uint16Array::slice):
    * html/canvas/Uint16Array.h:
    * html/canvas/Uint16Array.idl:
    * html/canvas/Uint32Array.cpp:
    (WebCore::Uint32Array::slice):
    * html/canvas/Uint32Array.h:
    * html/canvas/Uint32Array.idl:
    * html/canvas/Uint8Array.cpp:
    (WebCore::Uint8Array::slice):
    * html/canvas/Uint8Array.h:
    * html/canvas/Uint8Array.idl:
    * html/canvas/WebGLRenderingContext.cpp:
    (WebCore::WebGLRenderingContext::readPixels):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72343 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e0f6a2e..fefe174 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,52 @@
+2010-11-18  Jian Li  <jianli at chromium.org>
+
+        Reviewed by Kenneth Russell.
+
+        Move length and slice out of ArrayBufferView interface
+        https://bugs.webkit.org/show_bug.cgi?id=49697
+
+        No functionality change. Covered by existing ArrayBuffer tests.
+
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSArrayBufferViewCustom.cpp: Removed.
+        * bindings/v8/custom/V8ArrayBufferViewCustom.cpp: Removed.
+        * html/canvas/ArrayBufferView.h:
+        * html/canvas/ArrayBufferView.idl:
+        * html/canvas/Float32Array.cpp:
+        (WebCore::Float32Array::slice):
+        * html/canvas/Float32Array.h:
+        * html/canvas/Float32Array.idl:
+        * html/canvas/Int16Array.cpp:
+        (WebCore::Int16Array::slice):
+        * html/canvas/Int16Array.h:
+        * html/canvas/Int16Array.idl:
+        * html/canvas/Int32Array.cpp:
+        (WebCore::Int32Array::slice):
+        * html/canvas/Int32Array.h:
+        * html/canvas/Int32Array.idl:
+        * html/canvas/Int8Array.cpp:
+        (WebCore::Int8Array::slice):
+        * html/canvas/Int8Array.h:
+        * html/canvas/Int8Array.idl:
+        * html/canvas/TypedArrayBase.h:
+        (WebCore::TypedArrayBase::length):
+        * html/canvas/Uint16Array.cpp:
+        (WebCore::Uint16Array::slice):
+        * html/canvas/Uint16Array.h:
+        * html/canvas/Uint16Array.idl:
+        * html/canvas/Uint32Array.cpp:
+        (WebCore::Uint32Array::slice):
+        * html/canvas/Uint32Array.h:
+        * html/canvas/Uint32Array.idl:
+        * html/canvas/Uint8Array.cpp:
+        (WebCore::Uint8Array::slice):
+        * html/canvas/Uint8Array.h:
+        * html/canvas/Uint8Array.idl:
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::readPixels):
+
 2010-11-17  Zhenyao Mo  <zmo at google.com>
 
         Reviewed by Kenneth Russell.
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 4dfefc0..615f40a 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -736,7 +736,6 @@
             'bindings/v8/IDBBindingUtilities.h',
             'bindings/v8/custom/V8CanvasPixelArrayCustom.cpp',
             'bindings/v8/custom/V8ArrayBufferViewCustom.h',
-            'bindings/v8/custom/V8ArrayBufferViewCustom.cpp',
             'bindings/v8/custom/V8ArrayBufferCustom.cpp',
             'bindings/v8/custom/V8Int8ArrayCustom.cpp',
             'bindings/v8/custom/V8Int32ArrayCustom.cpp',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 3d0626a..74f2cac 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -3714,7 +3714,6 @@ HEADERS += \
     !v8 {
         SOURCES += \
                 bindings/js/JSArrayBufferCustom.cpp \
-                bindings/js/JSArrayBufferViewCustom.cpp \
                 bindings/js/JSInt8ArrayCustom.cpp \
                 bindings/js/JSFloat32ArrayCustom.cpp \
                 bindings/js/JSInt32ArrayCustom.cpp \
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 8ac2d7e..c3a8626 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -985,7 +985,6 @@
 		46F9D5DF0B0D60170028EE36 /* progressCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 46F9D5DC0B0D60170028EE36 /* progressCursor.png */; };
 		490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */; };
 		490707E71219C04300D90E51 /* ANGLEWebKitBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */; };
-		492273A31083B3B100EE5C84 /* JSArrayBufferViewCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 492273A21083B3B100EE5C84 /* JSArrayBufferViewCustom.cpp */; };
 		492863991253B8FC00F792D6 /* ResourceRawHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 492863981253B8FC00F792D6 /* ResourceRawHeaders.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		49484FC1102CF23C00187DD3 /* CanvasGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49484FB3102CF23C00187DD3 /* CanvasGradient.cpp */; };
 		49484FC2102CF23C00187DD3 /* CanvasGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 49484FB4102CF23C00187DD3 /* CanvasGradient.h */; };
@@ -7078,7 +7077,6 @@
 		46F9D5DC0B0D60170028EE36 /* progressCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = progressCursor.png; sourceTree = "<group>"; };
 		490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ANGLEWebKitBridge.cpp; sourceTree = "<group>"; };
 		490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANGLEWebKitBridge.h; sourceTree = "<group>"; };
-		492273A21083B3B100EE5C84 /* JSArrayBufferViewCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSArrayBufferViewCustom.cpp; sourceTree = "<group>"; };
 		492863981253B8FC00F792D6 /* ResourceRawHeaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceRawHeaders.h; sourceTree = "<group>"; };
 		49484FB3102CF23C00187DD3 /* CanvasGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CanvasGradient.cpp; path = canvas/CanvasGradient.cpp; sourceTree = "<group>"; };
 		49484FB4102CF23C00187DD3 /* CanvasGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CanvasGradient.h; path = canvas/CanvasGradient.h; sourceTree = "<group>"; };
@@ -17046,7 +17044,6 @@
 			isa = PBXGroup;
 			children = (
 				BC275CB211C5E85C00C9206C /* JSArrayBufferCustom.cpp */,
-				492273A21083B3B100EE5C84 /* JSArrayBufferViewCustom.cpp */,
 				86243D0011BC31F700CC006A /* JSArrayBufferViewHelper.h */,
 				BC2ED6BB0C6BD2F000920BFF /* JSAttrCustom.cpp */,
 				49EED14B1051971900099FAB /* JSCanvasRenderingContext2DCustom.cpp */,
@@ -22541,7 +22538,6 @@
 				49EECF00105070C400099FAB /* JSArrayBuffer.cpp in Sources */,
 				BC275CB311C5E85C00C9206C /* JSArrayBufferCustom.cpp in Sources */,
 				49EECF1B105072F300099FAB /* JSArrayBufferView.cpp in Sources */,
-				492273A31083B3B100EE5C84 /* JSArrayBufferViewCustom.cpp in Sources */,
 				65DF31DA09D1C123000BE325 /* JSAttr.cpp in Sources */,
 				BC2ED6BC0C6BD2F000920BFF /* JSAttrCustom.cpp in Sources */,
 				E4EEFFC80D34550C00469A58 /* JSAudioConstructor.cpp in Sources */,
diff --git a/WebCore/bindings/js/JSArrayBufferViewCustom.cpp b/WebCore/bindings/js/JSArrayBufferViewCustom.cpp
deleted file mode 100644
index ccbddd2..0000000
--- a/WebCore/bindings/js/JSArrayBufferViewCustom.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
-#include "config.h"
-#include "JSArrayBufferView.h"
-#include "JSInt8Array.h"
-#include "JSUint8Array.h"
-#include "JSInt16Array.h"
-#include "JSUint16Array.h"
-#include "JSInt32Array.h"
-#include "JSUint32Array.h"
-#include "JSFloat32Array.h"
-
-#include "ArrayBufferView.h"
-
-using namespace JSC;
-
-namespace WebCore {
-
-JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, ArrayBufferView* object)
-{
-    if (!object)
-        return jsUndefined();
-        
-    if (object) {
-        if (object->isFloatArray())
-            return getDOMObjectWrapper<JSFloat32Array>(exec, globalObject, static_cast<Float32Array*>(object));
-        if (object->isUnsignedByteArray())
-            return getDOMObjectWrapper<JSUint8Array>(exec, globalObject, static_cast<Uint8Array*>(object));
-        if (object->isByteArray())
-            return getDOMObjectWrapper<JSInt8Array>(exec, globalObject, static_cast<Int8Array*>(object));
-        if (object->isIntArray())
-            return getDOMObjectWrapper<JSInt32Array>(exec, globalObject, static_cast<Int32Array*>(object));
-        if (object->isUnsignedIntArray())
-            return getDOMObjectWrapper<JSUint32Array>(exec, globalObject, static_cast<Uint32Array*>(object));
-        if (object->isShortArray())
-            return getDOMObjectWrapper<JSInt16Array>(exec, globalObject, static_cast<Int16Array*>(object));
-        if (object->isUnsignedShortArray())
-            return getDOMObjectWrapper<JSUint16Array>(exec, globalObject, static_cast<Uint16Array*>(object));
-    }
-    return jsUndefined();
-}
-
-JSValue JSArrayBufferView::slice(ExecState* exec)
-{
-    ArrayBufferView* array = reinterpret_cast<ArrayBufferView*>(impl());
-
-    int start, end;
-    switch (exec->argumentCount()) {
-    case 0:
-        start = 0;
-        end = array->length();
-        break;
-    case 1:
-        start = exec->argument(0).toInt32(exec);
-        end = array->length();
-        break;
-    default:
-        start = exec->argument(0).toInt32(exec);
-        end = exec->argument(1).toInt32(exec);
-    }
-    return toJS(exec, globalObject(), array->slice(start, end));
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
deleted file mode 100644
index 4671c61..0000000
--- a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-#include "V8ArrayBufferView.h"
-
-#include "V8Binding.h"
-#include "V8Proxy.h"
-#include "V8Int8Array.h"
-#include "V8Float32Array.h"
-#include "V8Int32Array.h"
-#include "V8Int16Array.h"
-#include "V8Uint8Array.h"
-#include "V8Uint32Array.h"
-#include "V8Uint16Array.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(ArrayBufferView* impl)
-{
-    if (!impl)
-        return v8::Null();
-    if (impl->isByteArray())
-        return toV8(static_cast<Int8Array*>(impl));
-    if (impl->isFloatArray())
-        return toV8(static_cast<Float32Array*>(impl));
-    if (impl->isIntArray())
-        return toV8(static_cast<Int32Array*>(impl));
-    if (impl->isShortArray())
-        return toV8(static_cast<Int16Array*>(impl));
-    if (impl->isUnsignedByteArray())
-        return toV8(static_cast<Uint8Array*>(impl));
-    if (impl->isUnsignedIntArray())
-        return toV8(static_cast<Uint32Array*>(impl));
-    if (impl->isUnsignedShortArray())
-        return toV8(static_cast<Uint16Array*>(impl));
-    return v8::Handle<v8::Value>();
-}
-
-v8::Handle<v8::Value> V8ArrayBufferView::sliceCallback(const v8::Arguments& args)
-{
-    INC_STATS("DOM.ArrayBufferView.slice");
-    // Forms:
-    // * slice(long start, long end);
-
-    ArrayBufferView* imp = V8ArrayBufferView::toNative(args.Holder());
-    int start, end;
-    switch (args.Length()) {
-    case 0:
-        start = 0;
-        end = imp->length();
-        break;
-    case 1:
-        start = toInt32(args[0]);
-        end = imp->length();
-        break;
-    default:
-        start = toInt32(args[0]);
-        end = toInt32(args[1]);
-    }
-    return toV8(imp->slice(start, end));
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/html/canvas/ArrayBufferView.h b/WebCore/html/canvas/ArrayBufferView.h
index ee685b1..d37bada 100644
--- a/WebCore/html/canvas/ArrayBufferView.h
+++ b/WebCore/html/canvas/ArrayBufferView.h
@@ -62,9 +62,7 @@ class ArrayBufferView : public RefCounted<ArrayBufferView> {
         return m_byteOffset;
     }
 
-    virtual unsigned length() const = 0;
     virtual unsigned byteLength() const = 0;
-    virtual PassRefPtr<ArrayBufferView> slice(int start, int end) const = 0;
 
     virtual ~ArrayBufferView();
 
diff --git a/WebCore/html/canvas/ArrayBufferView.idl b/WebCore/html/canvas/ArrayBufferView.idl
index 74a3fe3..be217c1 100644
--- a/WebCore/html/canvas/ArrayBufferView.idl
+++ b/WebCore/html/canvas/ArrayBufferView.idl
@@ -28,8 +28,5 @@ module html {
         readonly attribute ArrayBuffer buffer;
         readonly attribute unsigned long byteOffset;
         readonly attribute unsigned long byteLength;
-        readonly attribute unsigned long length;
-
-        [Custom] ArrayBufferView slice(in long start, in long end);
     };
 }
diff --git a/WebCore/html/canvas/Float32Array.cpp b/WebCore/html/canvas/Float32Array.cpp
index e918d8f..1b26aef 100644
--- a/WebCore/html/canvas/Float32Array.cpp
+++ b/WebCore/html/canvas/Float32Array.cpp
@@ -52,7 +52,12 @@ Float32Array::Float32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset,
 {
 }
 
-PassRefPtr<ArrayBufferView> Float32Array::slice(int start, int end) const
+PassRefPtr<Float32Array> Float32Array::slice(int start) const
+{
+    return slice(start, length());
+}
+
+PassRefPtr<Float32Array> Float32Array::slice(int start, int end) const
 {
     return sliceImpl<Float32Array>(start, end);
 }
diff --git a/WebCore/html/canvas/Float32Array.h b/WebCore/html/canvas/Float32Array.h
index ab57087..c03fcc3 100644
--- a/WebCore/html/canvas/Float32Array.h
+++ b/WebCore/html/canvas/Float32Array.h
@@ -33,7 +33,7 @@
 namespace WebCore {
 
 class Float32Array : public TypedArrayBase<float> {
-  public:
+public:
     static PassRefPtr<Float32Array> create(unsigned length);
     static PassRefPtr<Float32Array> create(const float* array, unsigned length);
     static PassRefPtr<Float32Array> create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length);
@@ -62,7 +62,10 @@ class Float32Array : public TypedArrayBase<float> {
         return result;
     }
 
-  private:
+    PassRefPtr<Float32Array> slice(int start) const;
+    PassRefPtr<Float32Array> slice(int start, int end) const;
+
+private:
     Float32Array(PassRefPtr<ArrayBuffer> buffer,
                     unsigned byteOffset,
                     unsigned length);
@@ -71,7 +74,6 @@ class Float32Array : public TypedArrayBase<float> {
 
     // Overridden from ArrayBufferView.
     virtual bool isFloatArray() const { return true; }
-    virtual PassRefPtr<ArrayBufferView> slice(int start, int end) const;
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/canvas/Float32Array.idl b/WebCore/html/canvas/Float32Array.idl
index c3c0a2d..b979d29 100644
--- a/WebCore/html/canvas/Float32Array.idl
+++ b/WebCore/html/canvas/Float32Array.idl
@@ -39,6 +39,9 @@ module html {
     ] Float32Array : ArrayBufferView {
         const unsigned int BYTES_PER_ELEMENT = 4;
 
+        readonly attribute unsigned long length;
+        Float32Array slice(in long start, in [Optional] long end);
+
         // void set(in Float32Array array, [Optional] in unsigned long offset);
         // void set(in sequence<long> array, [Optional] in unsigned long offset);
         [Custom] void set();
diff --git a/WebCore/html/canvas/Int16Array.cpp b/WebCore/html/canvas/Int16Array.cpp
index 635ea5e..a3d04bc 100644
--- a/WebCore/html/canvas/Int16Array.cpp
+++ b/WebCore/html/canvas/Int16Array.cpp
@@ -51,7 +51,12 @@ Int16Array::Int16Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsi
 {
 }
 
-PassRefPtr<ArrayBufferView> Int16Array::slice(int start, int end) const
+PassRefPtr<Int16Array> Int16Array::slice(int start) const
+{
+    return slice(start, length());
+}
+
+PassRefPtr<Int16Array> Int16Array::slice(int start, int end) const
 {
     return sliceImpl<Int16Array>(start, end);
 }
diff --git a/WebCore/html/canvas/Int16Array.h b/WebCore/html/canvas/Int16Array.h
index 00877ef..a6286c6 100644
--- a/WebCore/html/canvas/Int16Array.h
+++ b/WebCore/html/canvas/Int16Array.h
@@ -33,7 +33,7 @@ namespace WebCore {
 class ArrayBuffer;
 
 class Int16Array : public IntegralTypedArrayBase<short> {
-  public:
+public:
     static PassRefPtr<Int16Array> create(unsigned length);
     static PassRefPtr<Int16Array> create(short* array, unsigned length);
     static PassRefPtr<Int16Array> create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length);
@@ -41,7 +41,10 @@ class Int16Array : public IntegralTypedArrayBase<short> {
     using TypedArrayBase<short>::set;
     using IntegralTypedArrayBase<short>::set;
 
-  private:
+    PassRefPtr<Int16Array> slice(int start) const;
+    PassRefPtr<Int16Array> slice(int start, int end) const;
+
+private:
     Int16Array(PassRefPtr<ArrayBuffer> buffer,
                     unsigned byteOffset,
                     unsigned length);
@@ -50,7 +53,6 @@ class Int16Array : public IntegralTypedArrayBase<short> {
 
     // Overridden from ArrayBufferView.
     virtual bool isShortArray() const { return true; }
-    virtual PassRefPtr<ArrayBufferView> slice(int start, int end) const;
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/canvas/Int16Array.idl b/WebCore/html/canvas/Int16Array.idl
index 7980a69..f1f5c8b 100644
--- a/WebCore/html/canvas/Int16Array.idl
+++ b/WebCore/html/canvas/Int16Array.idl
@@ -38,6 +38,9 @@ module html {
     ] Int16Array : ArrayBufferView {
         const unsigned int BYTES_PER_ELEMENT = 2;
 
+        readonly attribute unsigned long length;
+        Int16Array slice(in long start, in [Optional] long end);
+
         // void set(in Int16Array array, [Optional] in unsigned long offset);
         // void set(in sequence<long> array, [Optional] in unsigned long offset);
         [Custom] void set();
diff --git a/WebCore/html/canvas/Int32Array.cpp b/WebCore/html/canvas/Int32Array.cpp
index cc926a3..266c941 100644
--- a/WebCore/html/canvas/Int32Array.cpp
+++ b/WebCore/html/canvas/Int32Array.cpp
@@ -52,7 +52,12 @@ Int32Array::Int32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsi
 {
 }
 
-PassRefPtr<ArrayBufferView> Int32Array::slice(int start, int end) const
+PassRefPtr<Int32Array> Int32Array::slice(int start) const
+{
+    return slice(start, length());
+}
+
+PassRefPtr<Int32Array> Int32Array::slice(int start, int end) const
 {
     return sliceImpl<Int32Array>(start, end);
 }
diff --git a/WebCore/html/canvas/Int32Array.h b/WebCore/html/canvas/Int32Array.h
index bd05450..068a677 100644
--- a/WebCore/html/canvas/Int32Array.h
+++ b/WebCore/html/canvas/Int32Array.h
@@ -32,7 +32,7 @@
 namespace WebCore {
 
 class Int32Array : public IntegralTypedArrayBase<int> {
-  public:
+public:
     static PassRefPtr<Int32Array> create(unsigned length);
     static PassRefPtr<Int32Array> create(int* array, unsigned length);
     static PassRefPtr<Int32Array> create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length);
@@ -42,7 +42,10 @@ class Int32Array : public IntegralTypedArrayBase<int> {
     using IntegralTypedArrayBase<int>::set;
 #endif
 
-  private:
+    PassRefPtr<Int32Array> slice(int start) const;
+    PassRefPtr<Int32Array> slice(int start, int end) const;
+
+private:
     Int32Array(PassRefPtr<ArrayBuffer> buffer,
                   unsigned byteOffset,
                   unsigned length);
@@ -51,7 +54,6 @@ class Int32Array : public IntegralTypedArrayBase<int> {
 
     // Overridden from ArrayBufferView.
     virtual bool isIntArray() const { return true; }
-    virtual PassRefPtr<ArrayBufferView> slice(int start, int end) const;
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/canvas/Int32Array.idl b/WebCore/html/canvas/Int32Array.idl
index bd1554d..f96b53c 100644
--- a/WebCore/html/canvas/Int32Array.idl
+++ b/WebCore/html/canvas/Int32Array.idl
@@ -39,6 +39,9 @@ module html {
     ] Int32Array : ArrayBufferView {
         const unsigned int BYTES_PER_ELEMENT = 4;
 
+        readonly attribute unsigned long length;
+        Int32Array slice(in long start, in [Optional] long end);
+
         // void set(in Int32Array array, [Optional] in unsigned long offset);
         // void set(in sequence<long> array, [Optional] in unsigned long offset);
         [Custom] void set();
diff --git a/WebCore/html/canvas/Int8Array.cpp b/WebCore/html/canvas/Int8Array.cpp
index c2dd2fa..89ed316 100644
--- a/WebCore/html/canvas/Int8Array.cpp
+++ b/WebCore/html/canvas/Int8Array.cpp
@@ -52,7 +52,12 @@ Int8Array::Int8Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsign
 {
 }
 
-PassRefPtr<ArrayBufferView> Int8Array::slice(int start, int end) const
+PassRefPtr<Int8Array> Int8Array::slice(int start) const
+{
+    return slice(start, length());
+}
+
+PassRefPtr<Int8Array> Int8Array::slice(int start, int end) const
 {
     return sliceImpl<Int8Array>(start, end);
 }
diff --git a/WebCore/html/canvas/Int8Array.h b/WebCore/html/canvas/Int8Array.h
index d267f7f..a5df302 100644
--- a/WebCore/html/canvas/Int8Array.h
+++ b/WebCore/html/canvas/Int8Array.h
@@ -34,7 +34,7 @@ namespace WebCore {
 class ArrayBuffer;
 
 class Int8Array : public IntegralTypedArrayBase<signed char> {
-  public:
+public:
     static PassRefPtr<Int8Array> create(unsigned length);
     static PassRefPtr<Int8Array> create(signed char* array, unsigned length);
     static PassRefPtr<Int8Array> create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length);
@@ -42,7 +42,10 @@ class Int8Array : public IntegralTypedArrayBase<signed char> {
     using TypedArrayBase<signed char>::set;
     using IntegralTypedArrayBase<signed char>::set;
 
-  private:
+    PassRefPtr<Int8Array> slice(int start) const;
+    PassRefPtr<Int8Array> slice(int start, int end) const;
+
+private:
     Int8Array(PassRefPtr<ArrayBuffer> buffer,
                    unsigned byteOffset,
                    unsigned length);
@@ -51,7 +54,6 @@ class Int8Array : public IntegralTypedArrayBase<signed char> {
 
     // Overridden from ArrayBufferView.
     virtual bool isByteArray() const { return true; }
-    virtual PassRefPtr<ArrayBufferView> slice(int start, int end) const;
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/canvas/Int8Array.idl b/WebCore/html/canvas/Int8Array.idl
index ec0bdb7..08a608b 100644
--- a/WebCore/html/canvas/Int8Array.idl
+++ b/WebCore/html/canvas/Int8Array.idl
@@ -39,6 +39,9 @@ module html {
     ] Int8Array : ArrayBufferView {
         const unsigned int BYTES_PER_ELEMENT = 1;
 
+        readonly attribute unsigned long length;
+        Int8Array slice(in long start, in [Optional] long end);
+
         // void set(in Int8Array array, [Optional] in unsigned long offset);
         // void set(in sequence<long> array, [Optional] in unsigned long offset);
         [Custom] void set();
diff --git a/WebCore/html/canvas/TypedArrayBase.h b/WebCore/html/canvas/TypedArrayBase.h
index 77283df..2bef6f0 100644
--- a/WebCore/html/canvas/TypedArrayBase.h
+++ b/WebCore/html/canvas/TypedArrayBase.h
@@ -55,12 +55,12 @@ class TypedArrayBase : public ArrayBufferView {
     // Overridden from ArrayBufferView. This must be public because of
     // rules about inheritance of members in template classes, and
     // because it is accessed via pointers to subclasses.
-    virtual unsigned length() const
+    unsigned length() const
     {
         return m_length;
     }
 
-  protected:
+ protected:
     TypedArrayBase(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
         : ArrayBufferView(buffer, byteOffset)
         , m_length(length)
diff --git a/WebCore/html/canvas/Uint16Array.cpp b/WebCore/html/canvas/Uint16Array.cpp
index a0f891c..5312888 100644
--- a/WebCore/html/canvas/Uint16Array.cpp
+++ b/WebCore/html/canvas/Uint16Array.cpp
@@ -52,7 +52,12 @@ Uint16Array::Uint16Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, un
 {
 }
 
-PassRefPtr<ArrayBufferView> Uint16Array::slice(int start, int end) const
+PassRefPtr<Uint16Array> Uint16Array::slice(int start) const
+{
+    return slice(start, length());
+}
+
+PassRefPtr<Uint16Array> Uint16Array::slice(int start, int end) const
 {
     return sliceImpl<Uint16Array>(start, end);
 }
diff --git a/WebCore/html/canvas/Uint16Array.h b/WebCore/html/canvas/Uint16Array.h
index fee31f6..f63b67d 100644
--- a/WebCore/html/canvas/Uint16Array.h
+++ b/WebCore/html/canvas/Uint16Array.h
@@ -34,7 +34,7 @@ namespace WebCore {
 class ArrayBuffer;
 
 class Uint16Array : public IntegralTypedArrayBase<unsigned short> {
-  public:
+public:
     static PassRefPtr<Uint16Array> create(unsigned length);
     static PassRefPtr<Uint16Array> create(unsigned short* array, unsigned length);
     static PassRefPtr<Uint16Array> create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length);
@@ -42,7 +42,10 @@ class Uint16Array : public IntegralTypedArrayBase<unsigned short> {
     using TypedArrayBase<unsigned short>::set;
     using IntegralTypedArrayBase<unsigned short>::set;
 
-  private:
+    PassRefPtr<Uint16Array> slice(int start) const;
+    PassRefPtr<Uint16Array> slice(int start, int end) const;
+
+private:
     Uint16Array(PassRefPtr<ArrayBuffer> buffer,
                             unsigned byteOffset,
                             unsigned length);
@@ -51,7 +54,6 @@ class Uint16Array : public IntegralTypedArrayBase<unsigned short> {
 
     // Overridden from ArrayBufferView.
     virtual bool isUnsignedShortArray() const { return true; }
-    virtual PassRefPtr<ArrayBufferView> slice(int start, int end) const;
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/canvas/Uint16Array.idl b/WebCore/html/canvas/Uint16Array.idl
index 75a7499..8e778b4 100644
--- a/WebCore/html/canvas/Uint16Array.idl
+++ b/WebCore/html/canvas/Uint16Array.idl
@@ -39,6 +39,9 @@ module html {
     ] Uint16Array : ArrayBufferView {
         const unsigned int BYTES_PER_ELEMENT = 2;
 
+        readonly attribute unsigned long length;
+        Uint16Array slice(in long start, in [Optional] long end);
+
         // void set(in Uint16Array array, [Optional] in unsigned long offset);
         // void set(in sequence<long> array, [Optional] in unsigned long offset);
         [Custom] void set();
diff --git a/WebCore/html/canvas/Uint32Array.cpp b/WebCore/html/canvas/Uint32Array.cpp
index f49a83a..f5bd959 100644
--- a/WebCore/html/canvas/Uint32Array.cpp
+++ b/WebCore/html/canvas/Uint32Array.cpp
@@ -52,7 +52,12 @@ Uint32Array::Uint32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, un
 {
 }
 
-PassRefPtr<ArrayBufferView> Uint32Array::slice(int start, int end) const
+PassRefPtr<Uint32Array> Uint32Array::slice(int start) const
+{
+    return slice(start, length());
+}
+
+PassRefPtr<Uint32Array> Uint32Array::slice(int start, int end) const
 {
     return sliceImpl<Uint32Array>(start, end);
 }
diff --git a/WebCore/html/canvas/Uint32Array.h b/WebCore/html/canvas/Uint32Array.h
index db23088..9c0f137 100644
--- a/WebCore/html/canvas/Uint32Array.h
+++ b/WebCore/html/canvas/Uint32Array.h
@@ -34,7 +34,7 @@ namespace WebCore {
 class ArrayBuffer;
 
 class Uint32Array : public IntegralTypedArrayBase<unsigned int> {
-  public:
+public:
     static PassRefPtr<Uint32Array> create(unsigned length);
     static PassRefPtr<Uint32Array> create(unsigned int* array, unsigned length);
     static PassRefPtr<Uint32Array> create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length);
@@ -42,7 +42,10 @@ class Uint32Array : public IntegralTypedArrayBase<unsigned int> {
     using TypedArrayBase<unsigned int>::set;
     using IntegralTypedArrayBase<unsigned int>::set;
 
-  private:
+    PassRefPtr<Uint32Array> slice(int start) const;
+    PassRefPtr<Uint32Array> slice(int start, int end) const;
+
+private:
     Uint32Array(PassRefPtr<ArrayBuffer> buffer,
                           unsigned byteOffset,
                           unsigned length);
@@ -51,7 +54,6 @@ class Uint32Array : public IntegralTypedArrayBase<unsigned int> {
 
     // Overridden from ArrayBufferView.
     virtual bool isUnsignedIntArray() const { return true; }
-    virtual PassRefPtr<ArrayBufferView> slice(int start, int end) const;
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/canvas/Uint32Array.idl b/WebCore/html/canvas/Uint32Array.idl
index 06e17c6..9fbf30c 100644
--- a/WebCore/html/canvas/Uint32Array.idl
+++ b/WebCore/html/canvas/Uint32Array.idl
@@ -39,6 +39,9 @@ module html {
     ] Uint32Array : ArrayBufferView {
         const unsigned int BYTES_PER_ELEMENT = 4;
 
+        readonly attribute unsigned long length;
+        Uint32Array slice(in long start, in [Optional] long end);
+
         // void set(in Uint32Array array, [Optional] in unsigned long offset);
         // void set(in sequence<long> array, [Optional] in unsigned long offset);
         [Custom] void set();
diff --git a/WebCore/html/canvas/Uint8Array.cpp b/WebCore/html/canvas/Uint8Array.cpp
index 6c785f9..99b8a09 100644
--- a/WebCore/html/canvas/Uint8Array.cpp
+++ b/WebCore/html/canvas/Uint8Array.cpp
@@ -52,7 +52,12 @@ Uint8Array::Uint8Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsi
 {
 }
 
-PassRefPtr<ArrayBufferView> Uint8Array::slice(int start, int end) const
+PassRefPtr<Uint8Array> Uint8Array::slice(int start) const
+{
+    return slice(start, length());
+}
+
+PassRefPtr<Uint8Array> Uint8Array::slice(int start, int end) const
 {
     return sliceImpl<Uint8Array>(start, end);
 }
diff --git a/WebCore/html/canvas/Uint8Array.h b/WebCore/html/canvas/Uint8Array.h
index fce63da..66154b5 100644
--- a/WebCore/html/canvas/Uint8Array.h
+++ b/WebCore/html/canvas/Uint8Array.h
@@ -34,7 +34,7 @@ namespace WebCore {
 class ArrayBuffer;
 
 class Uint8Array : public IntegralTypedArrayBase<unsigned char> {
-  public:
+public:
     static PassRefPtr<Uint8Array> create(unsigned length);
     static PassRefPtr<Uint8Array> create(unsigned char* array, unsigned length);
     static PassRefPtr<Uint8Array> create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length);
@@ -44,7 +44,10 @@ class Uint8Array : public IntegralTypedArrayBase<unsigned char> {
     using IntegralTypedArrayBase<unsigned char>::set;
 #endif
 
-  private:
+    PassRefPtr<Uint8Array> slice(int start) const;
+    PassRefPtr<Uint8Array> slice(int start, int end) const;
+
+private:
     Uint8Array(PassRefPtr<ArrayBuffer> buffer,
                            unsigned byteOffset,
                            unsigned length);
@@ -53,7 +56,6 @@ class Uint8Array : public IntegralTypedArrayBase<unsigned char> {
 
     // Overridden from ArrayBufferView.
     virtual bool isUnsignedByteArray() const { return true; }
-    virtual PassRefPtr<ArrayBufferView> slice(int start, int end) const;
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/canvas/Uint8Array.idl b/WebCore/html/canvas/Uint8Array.idl
index bd28023..7fe7e21 100644
--- a/WebCore/html/canvas/Uint8Array.idl
+++ b/WebCore/html/canvas/Uint8Array.idl
@@ -39,6 +39,9 @@ module html {
     ] Uint8Array : ArrayBufferView {
         const unsigned int BYTES_PER_ELEMENT = 1;
 
+        readonly attribute unsigned long length;
+        Uint8Array slice(in long start, in [Optional] long end);
+
         // void set(in Uint8Array array, [Optional] in unsigned long offset);
         // void set(in sequence<long> array, [Optional] in unsigned long offset);
         [Custom] void set();
diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp
index 0cbbc8e..7d20afe 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -2258,7 +2258,7 @@ void WebGLRenderingContext::readPixels(long x, long y, long width, long height,
     // The last row needs no padding.
     unsigned long totalBytes = bytesPerRow * height - padding;
     unsigned long num = totalBytes / bytesPerComponent;
-    if (pixels->length() < num) {
+    if (pixels->byteLength() / bytesPerComponent < num) {
         m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
         return;
     }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list