Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp |
| index 4792bf41027b54fac07061241ce2125ea2324e29..5485f21659145e2a05ded31b3129a46d301766d2 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp |
| +++ b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp |
| @@ -14,6 +14,14 @@ |
| #include "core/fileapi/File.h" |
| #include "core/fileapi/FileList.h" |
| #include "core/frame/ImageBitmap.h" |
| +#include "core/geometry/DOMMatrix.h" |
| +#include "core/geometry/DOMMatrixReadOnly.h" |
| +#include "core/geometry/DOMPoint.h" |
| +#include "core/geometry/DOMPointInit.h" |
| +#include "core/geometry/DOMPointReadOnly.h" |
| +#include "core/geometry/DOMQuad.h" |
| +#include "core/geometry/DOMRect.h" |
| +#include "core/geometry/DOMRectReadOnly.h" |
| #include "core/html/ImageData.h" |
| #include "core/offscreencanvas/OffscreenCanvas.h" |
| #include "platform/RuntimeEnabledFeatures.h" |
| @@ -297,6 +305,112 @@ ScriptWrappable* V8ScriptValueDeserializer::ReadDOMObject( |
| memcpy(pixel_array->Data(), pixels, pixel_length); |
| return image_data; |
| } |
| + case kDOMPointTag: { |
| + double x = 0, y = 0, z = 0, w = 1; |
| + if (!ReadDouble(&x) || !ReadDouble(&y) || !ReadDouble(&z) || |
| + !ReadDouble(&w)) |
| + return nullptr; |
| + DOMPoint* point = DOMPoint::Create(x, y, z, w); |
| + if (!point) |
|
jbroman
2017/05/15 18:00:30
nit: These null checks don't really add much (exce
fserb
2017/05/15 18:27:28
yep. done.
|
| + return nullptr; |
| + return point; |
| + } |
| + case kDOMPointReadOnlyTag: { |
| + double x = 0, y = 0, z = 0, w = 1; |
| + if (!ReadDouble(&x) || !ReadDouble(&y) || !ReadDouble(&z) || |
| + !ReadDouble(&w)) |
| + return nullptr; |
| + DOMPointReadOnly* point = DOMPointReadOnly::Create(x, y, z, w); |
| + if (!point) |
| + return nullptr; |
| + return point; |
| + } |
| + case kDOMRectTag: { |
| + double x = 0, y = 0, width = 0, height = 0; |
| + if (!ReadDouble(&x) || !ReadDouble(&y) || !ReadDouble(&width) || |
| + !ReadDouble(&height)) |
| + return nullptr; |
| + DOMRect* rect = DOMRect::Create(x, y, width, height); |
| + if (!rect) |
| + return nullptr; |
| + return rect; |
| + } |
| + case kDOMRectReadOnlyTag: { |
| + double x = 0, y = 0, width = 0, height = 0; |
| + if (!ReadDouble(&x) || !ReadDouble(&y) || !ReadDouble(&width) || |
| + !ReadDouble(&height)) |
| + return nullptr; |
| + DOMRectReadOnly* rect = DOMRectReadOnly::Create(x, y, width, height); |
| + if (!rect) |
| + return nullptr; |
| + return rect; |
| + } |
| + case kDOMQuadTag: { |
| + DOMPointInit pointInits[4]; |
| + for (DOMPointInit& init : pointInits) { |
| + double x = 0, y = 0, z = 0, w = 0; |
| + if (!ReadDouble(&x) || !ReadDouble(&y) || !ReadDouble(&z) || |
| + !ReadDouble(&w)) |
| + return nullptr; |
| + init.setX(x); |
| + init.setY(y); |
| + init.setZ(z); |
| + init.setW(w); |
| + } |
| + DOMQuad* quad = DOMQuad::Create(pointInits[0], pointInits[1], |
| + pointInits[2], pointInits[3]); |
| + if (!quad) |
| + return nullptr; |
| + return quad; |
| + } |
| + case kDOMMatrix2DTag: { |
| + double values[6]; |
| + for (double& d : values) { |
| + if (!ReadDouble(&d)) |
| + return nullptr; |
| + } |
| + DOMMatrix* matrix = |
| + DOMMatrix::CreateForSerialization(values, WTF_ARRAY_LENGTH(values)); |
| + if (!matrix) |
| + return nullptr; |
| + return matrix; |
| + } |
| + case kDOMMatrix2DReadOnlyTag: { |
| + double values[6]; |
| + for (double& d : values) { |
| + if (!ReadDouble(&d)) |
| + return nullptr; |
| + } |
| + DOMMatrixReadOnly* matrix = DOMMatrixReadOnly::CreateForSerialization( |
| + values, WTF_ARRAY_LENGTH(values)); |
| + if (!matrix) |
| + return nullptr; |
| + return matrix; |
| + } |
| + case kDOMMatrixTag: { |
| + double values[16]; |
| + for (double& d : values) { |
| + if (!ReadDouble(&d)) |
| + return nullptr; |
| + } |
| + DOMMatrix* matrix = |
| + DOMMatrix::CreateForSerialization(values, WTF_ARRAY_LENGTH(values)); |
| + if (!matrix) |
| + return nullptr; |
| + return matrix; |
| + } |
| + case kDOMMatrixReadOnlyTag: { |
| + double values[16]; |
| + for (double& d : values) { |
| + if (!ReadDouble(&d)) |
| + return nullptr; |
| + } |
| + DOMMatrixReadOnly* matrix = DOMMatrixReadOnly::CreateForSerialization( |
| + values, WTF_ARRAY_LENGTH(values)); |
| + if (!matrix) |
| + return nullptr; |
| + return matrix; |
| + } |
| case kMessagePortTag: { |
| uint32_t index = 0; |
| if (!ReadUint32(&index) || !transferred_message_ports_ || |