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

Side by Side Diff: third_party/WebKit/Source/core/css/PropertyRegistration.cpp

Issue 2656343002: Replace [CallWith=ExecutionContext] with [CallWith=ScriptState] (Closed)
Patch Set: Few more Created 3 years, 10 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 "core/css/PropertyRegistration.h" 5 #include "core/css/PropertyRegistration.h"
6 6
7 #include "core/css/CSSStyleSheet.h" 7 #include "core/css/CSSStyleSheet.h"
8 #include "core/css/CSSSyntaxDescriptor.h" 8 #include "core/css/CSSSyntaxDescriptor.h"
9 #include "core/css/CSSValueList.h" 9 #include "core/css/CSSValueList.h"
10 #include "core/css/CSSVariableReferenceValue.h" 10 #include "core/css/CSSVariableReferenceValue.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return true; 54 return true;
55 } 55 }
56 56
57 // TODO(timloh): Images and transform-function values can also contain 57 // TODO(timloh): Images and transform-function values can also contain
58 // lengths. 58 // lengths.
59 59
60 return true; 60 return true;
61 } 61 }
62 62
63 void PropertyRegistration::registerProperty( 63 void PropertyRegistration::registerProperty(
64 ExecutionContext* executionContext, 64 ScriptState* scriptState,
65 const PropertyDescriptor& descriptor, 65 const PropertyDescriptor& descriptor,
66 ExceptionState& exceptionState) { 66 ExceptionState& exceptionState) {
67 // Bindings code ensures these are set. 67 // Bindings code ensures these are set.
68 DCHECK(descriptor.hasName()); 68 DCHECK(descriptor.hasName());
69 DCHECK(descriptor.hasInherits()); 69 DCHECK(descriptor.hasInherits());
70 DCHECK(descriptor.hasSyntax()); 70 DCHECK(descriptor.hasSyntax());
71 71
72 String name = descriptor.name(); 72 String name = descriptor.name();
73 if (!CSSVariableParser::isValidVariableName(name)) { 73 if (!CSSVariableParser::isValidVariableName(name)) {
74 exceptionState.throwDOMException( 74 exceptionState.throwDOMException(
75 SyntaxError, "Custom property names must start with '--'."); 75 SyntaxError, "Custom property names must start with '--'.");
76 return; 76 return;
77 } 77 }
78 AtomicString atomicName(name); 78 AtomicString atomicName(name);
79 Document* document = toDocument(executionContext); 79 Document* document = toDocument(scriptState->getExecutionContext());
80 PropertyRegistry& registry = *document->propertyRegistry(); 80 PropertyRegistry& registry = *document->propertyRegistry();
81 if (registry.registration(atomicName)) { 81 if (registry.registration(atomicName)) {
82 exceptionState.throwDOMException( 82 exceptionState.throwDOMException(
83 InvalidModificationError, 83 InvalidModificationError,
84 "The name provided has already been registered."); 84 "The name provided has already been registered.");
85 return; 85 return;
86 } 86 }
87 87
88 CSSSyntaxDescriptor syntaxDescriptor(descriptor.syntax()); 88 CSSSyntaxDescriptor syntaxDescriptor(descriptor.syntax());
89 if (!syntaxDescriptor.isValid()) { 89 if (!syntaxDescriptor.isValid()) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 std::move(interpolationTypes)); 134 std::move(interpolationTypes));
135 } 135 }
136 136
137 // TODO(timloh): Invalidate only elements with this custom property set 137 // TODO(timloh): Invalidate only elements with this custom property set
138 document->setNeedsStyleRecalc(SubtreeStyleChange, 138 document->setNeedsStyleRecalc(SubtreeStyleChange,
139 StyleChangeReasonForTracing::create( 139 StyleChangeReasonForTracing::create(
140 StyleChangeReason::PropertyRegistration)); 140 StyleChangeReason::PropertyRegistration));
141 } 141 }
142 142
143 } // namespace blink 143 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/PropertyRegistration.h ('k') | third_party/WebKit/Source/core/css/PropertyRegistration.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698