Index: Source/core/html/ImageData.cpp |
diff --git a/Source/core/html/ImageData.cpp b/Source/core/html/ImageData.cpp |
index a1f8e2e5fa936dd2c183dfa65c01ec0a738eb079..47210e9334dfc11919cc6f91dbc233b93d299402 100644 |
--- a/Source/core/html/ImageData.cpp |
+++ b/Source/core/html/ImageData.cpp |
@@ -30,6 +30,7 @@ |
#include "core/html/ImageData.h" |
#include "bindings/core/v8/ExceptionState.h" |
+#include "bindings/core/v8/custom/V8Uint8ClampedArrayCustom.h" |
#include "core/dom/ExceptionCode.h" |
#include "platform/RuntimeEnabledFeatures.h" |
@@ -124,6 +125,21 @@ PassRefPtrWillBeRawPtr<ImageData> ImageData::create(Uint8ClampedArray* data, uns |
return adoptRefWillBeNoop(new ImageData(IntSize(width, height), data)); |
} |
+v8::Handle<v8::Object> ImageData::wrap(v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
+{ |
+ v8::Handle<v8::Object> wrapper = ScriptWrappable::wrap(creationContext, isolate); |
+ if (!wrapper.IsEmpty()) { |
+ // Create a V8 Uint8ClampedArray object. |
+ v8::Handle<v8::Value> pixelArray = toV8(data(), creationContext, isolate); |
+ // Set the "data" property of the ImageData object to |
+ // the created v8 object, eliminating the C++ callback |
+ // when accessing the "data" property. |
+ if (!pixelArray.IsEmpty()) |
+ wrapper->ForceSet(v8AtomicString(isolate, "data"), pixelArray, v8::ReadOnly); |
+ } |
+ return wrapper; |
+} |
+ |
ImageData::ImageData(const IntSize& size) |
: m_size(size) |
, m_data(Uint8ClampedArray::create(size.width() * size.height() * 4)) |
@@ -140,4 +156,3 @@ ImageData::ImageData(const IntSize& size, PassRefPtr<Uint8ClampedArray> byteArra |
} |
} |
- |