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 "core/css/PropertyRegistration.h" | 5 #include "core/css/PropertyRegistration.h" |
6 | 6 |
7 #include "core/css/CSSSyntaxDescriptor.h" | 7 #include "core/css/CSSSyntaxDescriptor.h" |
8 #include "core/css/CSSValueList.h" | 8 #include "core/css/CSSValueList.h" |
9 #include "core/css/CSSVariableReferenceValue.h" | 9 #include "core/css/CSSVariableReferenceValue.h" |
10 #include "core/css/PropertyDescriptor.h" | 10 #include "core/css/PropertyDescriptor.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 registry.registerProperty(atomicName, syntaxDescriptor, | 121 registry.registerProperty(atomicName, syntaxDescriptor, |
122 descriptor.inherits(), nullptr, nullptr); | 122 descriptor.inherits(), nullptr, nullptr); |
123 } | 123 } |
124 | 124 |
125 // TODO(timloh): Invalidate only elements with this custom property set | 125 // TODO(timloh): Invalidate only elements with this custom property set |
126 document->setNeedsStyleRecalc(SubtreeStyleChange, | 126 document->setNeedsStyleRecalc(SubtreeStyleChange, |
127 StyleChangeReasonForTracing::create( | 127 StyleChangeReasonForTracing::create( |
128 StyleChangeReason::PropertyRegistration)); | 128 StyleChangeReason::PropertyRegistration)); |
129 } | 129 } |
130 | 130 |
131 void PropertyRegistration::unregisterProperty( | |
132 ExecutionContext* executionContext, | |
133 const String& property, | |
134 ExceptionState& exceptionState) { | |
135 Document* document = toDocument(executionContext); | |
136 PropertyRegistry& registry = *document->propertyRegistry(); | |
137 AtomicString atomicProperty(property); | |
138 if (!registry.registration(atomicProperty)) { | |
139 exceptionState.throwDOMException( | |
140 NotFoundError, | |
141 "CSS.unregisterProperty() called with non-registered property " + | |
142 property); | |
143 return; | |
144 } | |
145 registry.unregisterProperty(atomicProperty); | |
146 | |
147 document->setNeedsStyleRecalc(SubtreeStyleChange, | |
148 StyleChangeReasonForTracing::create( | |
149 StyleChangeReason::PropertyUnregistration)); | |
150 } | |
151 | |
152 } // namespace blink | 131 } // namespace blink |
OLD | NEW |