Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp

Issue 2810843002: bindings: Make the sequence conversion code more complaint with WebIDL. (Closed)
Patch Set: Adjust even more tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/csspaint/PaintWorkletGlobalScope.h" 5 #include "modules/csspaint/PaintWorkletGlobalScope.h"
6 6
7 #include "bindings/core/v8/IDLTypes.h"
8 #include "bindings/core/v8/NativeValueTraitsImpl.h"
7 #include "bindings/core/v8/V8BindingMacros.h" 9 #include "bindings/core/v8/V8BindingMacros.h"
8 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" 10 #include "bindings/core/v8/WorkerOrWorkletScriptController.h"
9 #include "core/CSSPropertyNames.h" 11 #include "core/CSSPropertyNames.h"
10 #include "core/css/CSSSyntaxDescriptor.h" 12 #include "core/css/CSSSyntaxDescriptor.h"
11 #include "core/dom/ExceptionCode.h" 13 #include "core/dom/ExceptionCode.h"
12 #include "core/inspector/MainThreadDebugger.h" 14 #include "core/inspector/MainThreadDebugger.h"
13 #include "modules/csspaint/CSSPaintDefinition.h" 15 #include "modules/csspaint/CSSPaintDefinition.h"
14 #include "modules/csspaint/CSSPaintImageGeneratorImpl.h" 16 #include "modules/csspaint/CSSPaintImageGeneratorImpl.h"
15 17
16 namespace blink { 18 namespace blink {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 83
82 v8::Local<v8::Value> input_properties_value; 84 v8::Local<v8::Value> input_properties_value;
83 if (!V8Call(constructor->Get(context, V8String(isolate, "inputProperties")), 85 if (!V8Call(constructor->Get(context, V8String(isolate, "inputProperties")),
84 input_properties_value)) 86 input_properties_value))
85 return; 87 return;
86 88
87 Vector<CSSPropertyID> native_invalidation_properties; 89 Vector<CSSPropertyID> native_invalidation_properties;
88 Vector<AtomicString> custom_invalidation_properties; 90 Vector<AtomicString> custom_invalidation_properties;
89 91
90 if (!IsUndefinedOrNull(input_properties_value)) { 92 if (!IsUndefinedOrNull(input_properties_value)) {
91 Vector<String> properties = ToImplArray<Vector<String>>( 93 Vector<String> properties =
92 input_properties_value, 0, isolate, exception_state); 94 NativeValueTraits<IDLSequence<IDLString>>::NativeValue(
95 isolate, input_properties_value, exception_state);
93 96
94 if (exception_state.HadException()) 97 if (exception_state.HadException())
95 return; 98 return;
96 99
97 for (const auto& property : properties) { 100 for (const auto& property : properties) {
98 CSSPropertyID property_id = cssPropertyID(property); 101 CSSPropertyID property_id = cssPropertyID(property);
99 if (property_id == CSSPropertyVariable) { 102 if (property_id == CSSPropertyVariable) {
100 custom_invalidation_properties.push_back(property); 103 custom_invalidation_properties.push_back(property);
101 } else if (property_id != CSSPropertyInvalid) { 104 } else if (property_id != CSSPropertyInvalid) {
102 native_invalidation_properties.push_back(property_id); 105 native_invalidation_properties.push_back(property_id);
103 } 106 }
104 } 107 }
105 } 108 }
106 109
107 // Get input argument types. Parse the argument type values only when 110 // Get input argument types. Parse the argument type values only when
108 // cssPaintAPIArguments is enabled. 111 // cssPaintAPIArguments is enabled.
109 Vector<CSSSyntaxDescriptor> input_argument_types; 112 Vector<CSSSyntaxDescriptor> input_argument_types;
110 if (RuntimeEnabledFeatures::cssPaintAPIArgumentsEnabled()) { 113 if (RuntimeEnabledFeatures::cssPaintAPIArgumentsEnabled()) {
111 v8::Local<v8::Value> input_argument_type_values; 114 v8::Local<v8::Value> input_argument_type_values;
112 if (!V8Call(constructor->Get(context, V8String(isolate, "inputArguments")), 115 if (!V8Call(constructor->Get(context, V8String(isolate, "inputArguments")),
113 input_argument_type_values)) 116 input_argument_type_values))
114 return; 117 return;
115 118
116 if (!IsUndefinedOrNull(input_argument_type_values)) { 119 if (!IsUndefinedOrNull(input_argument_type_values)) {
117 Vector<String> argument_types = ToImplArray<Vector<String>>( 120 Vector<String> argument_types =
118 input_argument_type_values, 0, isolate, exception_state); 121 NativeValueTraits<IDLSequence<IDLString>>::NativeValue(
122 isolate, input_argument_type_values, exception_state);
119 123
120 if (exception_state.HadException()) 124 if (exception_state.HadException())
121 return; 125 return;
122 126
123 for (const auto& type : argument_types) { 127 for (const auto& type : argument_types) {
124 CSSSyntaxDescriptor syntax_descriptor(type); 128 CSSSyntaxDescriptor syntax_descriptor(type);
125 if (!syntax_descriptor.IsValid()) { 129 if (!syntax_descriptor.IsValid()) {
126 exception_state.ThrowTypeError("Invalid argument types."); 130 exception_state.ThrowTypeError("Invalid argument types.");
127 return; 131 return;
128 } 132 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 set->insert(generator); 220 set->insert(generator);
217 } 221 }
218 222
219 DEFINE_TRACE(PaintWorkletGlobalScope) { 223 DEFINE_TRACE(PaintWorkletGlobalScope) {
220 visitor->Trace(paint_definitions_); 224 visitor->Trace(paint_definitions_);
221 visitor->Trace(pending_generators_); 225 visitor->Trace(pending_generators_);
222 MainThreadWorkletGlobalScope::Trace(visitor); 226 MainThreadWorkletGlobalScope::Trace(visitor);
223 } 227 }
224 228
225 } // namespace blink 229 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698