| OLD | NEW |
| 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/V8BindingMacros.h" | 7 #include "bindings/core/v8/V8BindingMacros.h" |
| 8 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 8 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| 9 #include "core/CSSPropertyNames.h" | 9 #include "core/CSSPropertyNames.h" |
| 10 #include "core/css/parser/CSSVariableParser.h" | |
| 11 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
| 12 #include "core/inspector/MainThreadDebugger.h" | 11 #include "core/inspector/MainThreadDebugger.h" |
| 13 #include "modules/csspaint/CSSPaintDefinition.h" | 12 #include "modules/csspaint/CSSPaintDefinition.h" |
| 14 #include "modules/csspaint/CSSPaintImageGeneratorImpl.h" | 13 #include "modules/csspaint/CSSPaintImageGeneratorImpl.h" |
| 15 | 14 |
| 16 namespace blink { | 15 namespace blink { |
| 17 | 16 |
| 18 // static | 17 // static |
| 19 PaintWorkletGlobalScope* PaintWorkletGlobalScope::create(LocalFrame* frame, cons
t KURL& url, const String& userAgent, PassRefPtr<SecurityOrigin> securityOrigin,
v8::Isolate* isolate) | 18 PaintWorkletGlobalScope* PaintWorkletGlobalScope::create(LocalFrame* frame, cons
t KURL& url, const String& userAgent, PassRefPtr<SecurityOrigin> securityOrigin,
v8::Isolate* isolate) |
| 20 { | 19 { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 Vector<AtomicString> customInvalidationProperties; | 67 Vector<AtomicString> customInvalidationProperties; |
| 69 | 68 |
| 70 if (!isUndefinedOrNull(inputPropertiesValue)) { | 69 if (!isUndefinedOrNull(inputPropertiesValue)) { |
| 71 Vector<String> properties = toImplArray<Vector<String>>(inputPropertiesV
alue, 0, isolate, exceptionState); | 70 Vector<String> properties = toImplArray<Vector<String>>(inputPropertiesV
alue, 0, isolate, exceptionState); |
| 72 | 71 |
| 73 if (exceptionState.hadException()) | 72 if (exceptionState.hadException()) |
| 74 return; | 73 return; |
| 75 | 74 |
| 76 for (const auto& property : properties) { | 75 for (const auto& property : properties) { |
| 77 CSSPropertyID propertyID = cssPropertyID(property); | 76 CSSPropertyID propertyID = cssPropertyID(property); |
| 78 if (propertyID == CSSPropertyInvalid) { | 77 if (propertyID == CSSPropertyVariable) { |
| 79 if (CSSVariableParser::isValidVariableName(property)) | 78 customInvalidationProperties.append(property); |
| 80 customInvalidationProperties.append(property); | 79 } else if (propertyID != CSSPropertyInvalid) { |
| 81 } else { | |
| 82 nativeInvalidationProperties.append(propertyID); | 80 nativeInvalidationProperties.append(propertyID); |
| 83 } | 81 } |
| 84 } | 82 } |
| 85 } | 83 } |
| 86 | 84 |
| 87 // Parse 'alpha' AKA hasAlpha property. | 85 // Parse 'alpha' AKA hasAlpha property. |
| 88 v8::Local<v8::Value> alphaValue; | 86 v8::Local<v8::Value> alphaValue; |
| 89 if (!v8Call(constructor->Get(context, v8String(isolate, "alpha")), alphaValu
e)) | 87 if (!v8Call(constructor->Get(context, v8String(isolate, "alpha")), alphaValu
e)) |
| 90 return; | 88 return; |
| 91 if (!isUndefinedOrNull(alphaValue) && !alphaValue->IsBoolean()) { | 89 if (!isUndefinedOrNull(alphaValue) && !alphaValue->IsBoolean()) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 153 } |
| 156 | 154 |
| 157 DEFINE_TRACE(PaintWorkletGlobalScope) | 155 DEFINE_TRACE(PaintWorkletGlobalScope) |
| 158 { | 156 { |
| 159 visitor->trace(m_paintDefinitions); | 157 visitor->trace(m_paintDefinitions); |
| 160 visitor->trace(m_pendingGenerators); | 158 visitor->trace(m_pendingGenerators); |
| 161 MainThreadWorkletGlobalScope::trace(visitor); | 159 MainThreadWorkletGlobalScope::trace(visitor); |
| 162 } | 160 } |
| 163 | 161 |
| 164 } // namespace blink | 162 } // namespace blink |
| OLD | NEW |