Chromium Code Reviews| Index: third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp |
| diff --git a/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp |
| index e8b53dbc12661dec5cd34064fa434c41dba2baa9..59fd6648b983e23a4a20cd3cbe36be8a60475dc9 100644 |
| --- a/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp |
| +++ b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp |
| @@ -7,6 +7,7 @@ |
| #include "bindings/core/v8/V8BindingMacros.h" |
| #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| #include "core/CSSPropertyNames.h" |
| +#include "core/css/CSSSyntaxDescriptor.h" |
| #include "core/dom/ExceptionCode.h" |
| #include "core/inspector/MainThreadDebugger.h" |
| #include "modules/csspaint/CSSPaintDefinition.h" |
| @@ -103,6 +104,28 @@ void PaintWorkletGlobalScope::registerPaint(const String& name, |
| } |
| } |
| + // Get input argument types. |
| + v8::Local<v8::Value> inputArgumentTypeValues; |
|
ikilpatrick
2017/01/12 18:17:03
we should also only attempt to parse this if the r
renjieliu1
2017/01/13 04:18:23
Done.
|
| + if (!v8Call(constructor->Get(context, v8String(isolate, "inputArguments")), |
| + inputArgumentTypeValues)) |
| + return; |
| + |
| + Vector<CSSSyntaxDescriptor> inputArgumentTypes; |
| + if (!isUndefinedOrNull(inputArgumentTypeValues)) { |
| + Vector<String> argumentTypes = toImplArray<Vector<String>>( |
| + inputArgumentTypeValues, 0, isolate, exceptionState); |
| + |
| + if (exceptionState.hadException()) |
| + return; |
| + |
| + for (const auto& type : argumentTypes) { |
| + CSSSyntaxDescriptor syntaxDescriptor(type); |
| + if (!syntaxDescriptor.isValid()) |
|
ikilpatrick
2017/01/12 05:36:04
It would be good to throw a TypeError here.
renjieliu1
2017/01/13 04:18:23
Done.
|
| + return; |
| + inputArgumentTypes.append(syntaxDescriptor); |
| + } |
| + } |
| + |
| // Parse 'alpha' AKA hasAlpha property. |
| v8::Local<v8::Value> alphaValue; |
| if (!v8Call(constructor->Get(context, v8String(isolate, "alpha")), |
| @@ -156,7 +179,8 @@ void PaintWorkletGlobalScope::registerPaint(const String& name, |
| CSSPaintDefinition* definition = CSSPaintDefinition::create( |
| scriptController()->getScriptState(), constructor, paint, |
| - nativeInvalidationProperties, customInvalidationProperties, hasAlpha); |
| + nativeInvalidationProperties, customInvalidationProperties, |
| + inputArgumentTypes, hasAlpha); |
| m_paintDefinitions.set(name, definition); |
| // Set the definition on any pending generators. |