Commit 64b00e28 authored by bashi@chromium.org's avatar bashi@chromium.org

[V8] Add Uint8ClampedArray support

https://bugs.webkit.org/show_bug.cgi?id=76803

Reviewed by Kenneth Russell.

Source/JavaScriptCore:

* wtf/ArrayBufferView.h:
(WTF::ArrayBufferView::isUnsignedByteClampedArray): Added.
* wtf/Uint8ClampedArray.h:
(WTF::Uint8ClampedArray::isUnsignedByteClampedArray): Overridden to return true.

Source/WebCore:

No new tests. fast/js/script-tests/dfg-uint8clampedarray.js should pass on chromium port.

* WebCore.gypi: Added required files.
* bindings/scripts/CodeGeneratorV8.pm:
(IsTypedArrayType): Added Uint8ClampedArray.
* bindings/v8/SerializedScriptValue.cpp: Added the tag for Uint8ClampedArray.
(WebCore::V8ObjectMap::Writer::writeArrayBufferView): Appends the tag when buffer is Uint8ClampedArray.
(WebCore::V8ObjectMap::Reader::readArrayBufferView): Creates Uint8ClampedArray instance when the tag represents Uint8ClampedArray.
* bindings/v8/custom/V8ArrayBufferViewCustomScript.js:
* bindings/v8/custom/V8Uint8ClampedArrayCustom.cpp: Added.
(WebCore::V8Uint8ClampedArray::constructorCallback):
(WebCore::V8Uint8ClampedArray::setCallback):
(WebCore::toV8):
* page/Crypto.cpp: Added isUnsignedByteClampedArray() call to isIntegerArray().
* page/DOMWindow.idl: Removed ifdefs.
* workers/WorkerContext.idl: Added Uint8ArrayConstructor.

LayoutTests:

* platform/chromium/fast/canvas/webgl/array-unit-tests-expected.txt: Removed.
* platform/chromium/test_expectations.txt: Removed fast/js/dfg-uint8clampedarray.html.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 40aff68f
2012-01-24 Kenichi Ishibashi <bashi@chromium.org>
[V8] Add Uint8ClampedArray support
https://bugs.webkit.org/show_bug.cgi?id=76803
Reviewed by Kenneth Russell.
* platform/chromium/fast/canvas/webgl/array-unit-tests-expected.txt: Removed.
* platform/chromium/test_expectations.txt: Removed fast/js/dfg-uint8clampedarray.html.
2012-01-23 Csaba Osztrogonác <ossy@webkit.org>
[Qt][WK2] http/tests/navigation/anchor-frames-gbk.html fails
......@@ -3877,9 +3877,6 @@ BUGWK65711 : svg/text/remove-text-node-from-tspan.html = IMAGE+TEXT IMAGE
BUGWK65711 : svg/custom/js-late-pattern-and-object-creation.svg = IMAGE+TEXT IMAGE
BUGWK65711 : svg/text/append-text-node-to-tspan.html = IMAGE+TEXT IMAGE
// Uint8ClampedArray still not implemented.
BUGWK74455 : fast/js/dfg-uint8clampedarray.html = TEXT
// Needs baseline
BUGWK76118 : fast/css/text-overflow-input.html = MISSING
......
2012-01-24 Kenichi Ishibashi <bashi@chromium.org>
[V8] Add Uint8ClampedArray support
https://bugs.webkit.org/show_bug.cgi?id=76803
Reviewed by Kenneth Russell.
* wtf/ArrayBufferView.h:
(WTF::ArrayBufferView::isUnsignedByteClampedArray): Added.
* wtf/Uint8ClampedArray.h:
(WTF::Uint8ClampedArray::isUnsignedByteClampedArray): Overridden to return true.
2012-01-23 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Add WebKitDownload to WebKit2 GTK+ API
......@@ -40,6 +40,7 @@ class ArrayBufferView : public RefCounted<ArrayBufferView> {
public:
virtual bool isByteArray() const { return false; }
virtual bool isUnsignedByteArray() const { return false; }
virtual bool isUnsignedByteClampedArray() const { return false; }
virtual bool isShortArray() const { return false; }
virtual bool isUnsignedShortArray() const { return false; }
virtual bool isIntArray() const { return false; }
......
......@@ -51,6 +51,9 @@ private:
unsigned length);
// Make constructor visible to superclass.
friend class TypedArrayBase<unsigned char>;
// Overridden from ArrayBufferView.
virtual bool isUnsignedByteClampedArray() const { return true; }
};
PassRefPtr<Uint8ClampedArray> Uint8ClampedArray::create(unsigned length)
......
2012-01-24 Kenichi Ishibashi <bashi@chromium.org>
[V8] Add Uint8ClampedArray support
https://bugs.webkit.org/show_bug.cgi?id=76803
Reviewed by Kenneth Russell.
No new tests. fast/js/script-tests/dfg-uint8clampedarray.js should pass on chromium port.
* WebCore.gypi: Added required files.
* bindings/scripts/CodeGeneratorV8.pm:
(IsTypedArrayType): Added Uint8ClampedArray.
* bindings/v8/SerializedScriptValue.cpp: Added the tag for Uint8ClampedArray.
(WebCore::V8ObjectMap::Writer::writeArrayBufferView): Appends the tag when buffer is Uint8ClampedArray.
(WebCore::V8ObjectMap::Reader::readArrayBufferView): Creates Uint8ClampedArray instance when the tag represents Uint8ClampedArray.
* bindings/v8/custom/V8ArrayBufferViewCustomScript.js:
* bindings/v8/custom/V8Uint8ClampedArrayCustom.cpp: Added.
(WebCore::V8Uint8ClampedArray::constructorCallback):
(WebCore::V8Uint8ClampedArray::setCallback):
(WebCore::toV8):
* page/Crypto.cpp: Added isUnsignedByteClampedArray() call to isIntegerArray().
* page/DOMWindow.idl: Removed ifdefs.
* workers/WorkerContext.idl: Added Uint8ArrayConstructor.
2012-01-24 Ilya Tikhonovsky <loislo@chromium.org>
Unreviewed build fix for GTK Debug build after r105698.
......@@ -961,6 +961,7 @@
'html/canvas/Uint16Array.idl',
'html/canvas/Uint32Array.idl',
'html/canvas/Uint8Array.idl',
'html/canvas/Uint8ClampedArray.idl',
'html/canvas/WebGLActiveInfo.idl',
'html/canvas/WebGLBuffer.idl',
'html/canvas/WebGLCompressedTextures.idl',
......@@ -1873,6 +1874,7 @@
'bindings/v8/custom/V8Uint16ArrayCustom.cpp',
'bindings/v8/custom/V8Uint32ArrayCustom.cpp',
'bindings/v8/custom/V8Uint8ArrayCustom.cpp',
'bindings/v8/custom/V8Uint8ClampedArrayCustom.cpp',
'bindings/v8/custom/V8WebGLRenderingContextCustom.cpp',
'bindings/v8/custom/V8WebKitAnimationCustom.cpp',
'bindings/v8/custom/V8WebKitMutationObserverCustom.cpp',
......
......@@ -2243,7 +2243,7 @@ sub IsTypedArrayType
{
my $type = shift;
return 1 if (($type eq "ArrayBuffer") or ($type eq "ArrayBufferView"));
return 1 if (($type eq "Uint8Array") or ($type eq "Uint16Array") or ($type eq "Uint32Array"));
return 1 if (($type eq "Uint8Array") or ($type eq "Uint8ClampedArray") or ($type eq "Uint16Array") or ($type eq "Uint32Array"));
return 1 if (($type eq "Int8Array") or ($type eq "Int16Array") or ($type eq "Int32Array"));
return 1 if (($type eq "Float32Array") or ($type eq "Float64Array"));
return 0;
......
......@@ -51,6 +51,7 @@
#include "Uint16Array.h"
#include "Uint32Array.h"
#include "Uint8Array.h"
#include "Uint8ClampedArray.h"
#include "V8ArrayBuffer.h"
#include "V8ArrayBufferView.h"
#include "V8Binding.h"
......@@ -69,6 +70,7 @@
#include "V8Uint16Array.h"
#include "V8Uint32Array.h"
#include "V8Uint8Array.h"
#include "V8Uint8ClampedArray.h"
#include "V8Utilities.h"
#include <wtf/Assertions.h>
......@@ -214,6 +216,7 @@ enum SerializationTag {
enum ArrayBufferViewSubTag {
ByteArrayTag = 'b',
UnsignedByteArrayTag = 'B',
UnsignedByteClampedArrayTag = 'C',
ShortArrayTag = 'w',
UnsignedShortArrayTag = 'W',
IntArrayTag = 'd',
......@@ -396,6 +399,8 @@ public:
append(ByteArrayTag);
else if (arrayBufferView.isUnsignedByteArray())
append(UnsignedByteArrayTag);
else if (arrayBufferView.isUnsignedByteClampedArray())
append(UnsignedByteClampedArrayTag);
else if (arrayBufferView.isShortArray())
append(ShortArrayTag);
else if (arrayBufferView.isUnsignedShortArray())
......@@ -1628,6 +1633,9 @@ private:
case UnsignedByteArrayTag:
*value = toV8(Uint8Array::create(arrayBuffer.release(), byteOffset, byteLength));
break;
case UnsignedByteClampedArrayTag:
*value = toV8(Uint8ClampedArray::create(arrayBuffer.release(), byteOffset, byteLength));
break;
case ShortArrayTag: {
uint32_t shortLength = byteLength / sizeof(int16_t);
if (shortLength * sizeof(int16_t) != byteLength)
......
......@@ -56,6 +56,7 @@ optimizeSetMethod(Int8Array);
optimizeSetMethod(Int16Array);
optimizeSetMethod(Int32Array);
optimizeSetMethod(Uint8Array);
optimizeSetMethod(Uint8ClampedArray);
optimizeSetMethod(Uint16Array);
optimizeSetMethod(Uint32Array);
......
/*
* Copyright (C) 2012 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:
* 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 INC. AND ITS 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 APPLE
* INC. OR ITS 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"
#include "Uint8ClampedArray.h"
#include "ArrayBuffer.h"
#include "V8ArrayBuffer.h"
#include "V8ArrayBufferViewCustom.h"
#include "V8Binding.h"
#include "V8Proxy.h"
#include "V8Uint8ClampedArray.h"
namespace WebCore {
v8::Handle<v8::Value> V8Uint8ClampedArray::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Uint8ClampedArray.Contructor");
return constructWebGLArray<Uint8ClampedArray, unsigned char>(args, &info, v8::kExternalPixelArray);
}
v8::Handle<v8::Value> V8Uint8ClampedArray::setCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Uint8ClampedArray.set()");
return setWebGLArrayHelper<Uint8ClampedArray, V8Uint8ClampedArray>(args);
}
v8::Handle<v8::Value> toV8(Uint8ClampedArray* impl)
{
if (!impl)
return v8::Null();
v8::Handle<v8::Object> wrapper = V8Uint8ClampedArray::wrap(impl);
if (!wrapper.IsEmpty())
wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalPixelArray, impl->length());
return wrapper;
}
} // namespace WebCore
......@@ -42,6 +42,7 @@ bool isIntegerArray(ArrayBufferView* array)
{
return array->isByteArray()
|| array->isUnsignedByteArray()
|| array->isUnsignedByteClampedArray()
|| array->isShortArray()
|| array->isUnsignedShortArray()
|| array->isIntArray()
......
......@@ -495,9 +495,7 @@ module window {
attribute ArrayBufferConstructor ArrayBuffer; // Usable with new operator
attribute Int8ArrayConstructor Int8Array; // Usable with new operator
attribute Uint8ArrayConstructor Uint8Array; // Usable with new operator
#if !defined(V8_BINDING) || !V8_BINDING
attribute Uint8ClampedArrayConstructor Uint8ClampedArray; // Usable with new operator
#endif
attribute Int16ArrayConstructor Int16Array; // Usable with new operator
attribute Uint16ArrayConstructor Uint16Array; // Usable with new operator
attribute Int32ArrayConstructor Int32Array; // Usable with new operator
......
......@@ -118,6 +118,7 @@ module threads {
attribute ArrayBufferConstructor ArrayBuffer; // Usable with new operator
attribute Int8ArrayConstructor Int8Array; // Usable with new operator
attribute Uint8ArrayConstructor Uint8Array; // Usable with new operator
attribute Uint8ArrayConstructor Uint8ClampedArray; // Usable with new operator
attribute Int16ArrayConstructor Int16Array; // Usable with new operator
attribute Uint16ArrayConstructor Uint16Array; // Usable with new operator
attribute Int32ArrayConstructor Int32Array; // Usable with new operator
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment