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

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp

Issue 2173623003: Add "Failed" custom element state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid multiple toElement Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/custom/CustomElement.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/dom/custom/CustomElementDefinition.h" 5 #include "core/dom/custom/CustomElementDefinition.h"
6 6
7 #include "core/dom/Attr.h" 7 #include "core/dom/Attr.h"
8 #include "core/dom/ExceptionCode.h" 8 #include "core/dom/ExceptionCode.h"
9 #include "core/dom/custom/CustomElement.h" 9 #include "core/dom/custom/CustomElement.h"
10 #include "core/dom/custom/CustomElementAttributeChangedCallbackReaction.h" 10 #include "core/dom/custom/CustomElementAttributeChangedCallbackReaction.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 size_t depth = m_constructionStack.size(); 115 size_t depth = m_constructionStack.size();
116 116
117 bool succeeded = runConstructor(element); 117 bool succeeded = runConstructor(element);
118 118
119 // Pop the construction stack. 119 // Pop the construction stack.
120 if (m_constructionStack.last().get()) 120 if (m_constructionStack.last().get())
121 DCHECK_EQ(m_constructionStack.last(), element); 121 DCHECK_EQ(m_constructionStack.last(), element);
122 DCHECK_EQ(m_constructionStack.size(), depth); // It's a *stack*. 122 DCHECK_EQ(m_constructionStack.size(), depth); // It's a *stack*.
123 m_constructionStack.removeLast(); 123 m_constructionStack.removeLast();
124 124
125 if (!succeeded) 125 if (!succeeded) {
126 element->setCustomElementState(CustomElementState::Failed);
126 return; 127 return;
128 }
127 129
128 CHECK(element->getCustomElementState() == CustomElementState::Custom); 130 CHECK(element->getCustomElementState() == CustomElementState::Custom);
129 } 131 }
130 132
131 bool CustomElementDefinition::hasAttributeChangedCallback( 133 bool CustomElementDefinition::hasAttributeChangedCallback(
132 const QualifiedName& name) const 134 const QualifiedName& name) const
133 { 135 {
134 return m_observedAttributes.contains(name.localName()); 136 return m_observedAttributes.contains(name.localName());
135 } 137 }
136 138
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 element->synchronizeAttribute(name); 178 element->synchronizeAttribute(name);
177 for (const auto& attribute : element->attributesWithoutUpdate()) { 179 for (const auto& attribute : element->attributesWithoutUpdate()) {
178 if (hasAttributeChangedCallback(attribute.name())) { 180 if (hasAttributeChangedCallback(attribute.name())) {
179 enqueueAttributeChangedCallback(element, attribute.name(), 181 enqueueAttributeChangedCallback(element, attribute.name(),
180 nullAtom, attribute.value()); 182 nullAtom, attribute.value());
181 } 183 }
182 } 184 }
183 } 185 }
184 186
185 } // namespace blink 187 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/custom/CustomElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698