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/dom/custom/CustomElementsRegistry.h" | 5 #include "core/dom/custom/CustomElementsRegistry.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/dom/Element.h" | 10 #include "core/dom/Element.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 { | 236 { |
237 return ScriptValue(); | 237 return ScriptValue(); |
238 } | 238 } |
239 | 239 |
240 bool runConstructor(Element* element) override | 240 bool runConstructor(Element* element) override |
241 { | 241 { |
242 if (constructionStack().isEmpty() | 242 if (constructionStack().isEmpty() |
243 || constructionStack().last() != element) | 243 || constructionStack().last() != element) |
244 return false; | 244 return false; |
245 constructionStack().last().clear(); | 245 constructionStack().last().clear(); |
246 element->setCustomElementState(CustomElementState::Custom); | |
247 return true; | 246 return true; |
248 } | 247 } |
249 }; | 248 }; |
250 | 249 |
251 // Classes which use trace macros cannot be local because of the | 250 // Classes which use trace macros cannot be local because of the |
252 // traceImpl template. | 251 // traceImpl template. |
253 class LogUpgradeDefinition : public TestCustomElementDefinition { | 252 class LogUpgradeDefinition : public TestCustomElementDefinition { |
254 WTF_MAKE_NONCOPYABLE(LogUpgradeDefinition); | 253 WTF_MAKE_NONCOPYABLE(LogUpgradeDefinition); |
255 public: | 254 public: |
256 LogUpgradeDefinition(const CustomElementDescriptor& descriptor) | 255 LogUpgradeDefinition(const CustomElementDescriptor& descriptor) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 EXPECT_EQ(1u, definition->m_invocationCount) | 310 EXPECT_EQ(1u, definition->m_invocationCount) |
312 << "defining the element should have 'upgraded' the existing element"; | 311 << "defining the element should have 'upgraded' the existing element"; |
313 EXPECT_EQ(element, definition->m_element) | 312 EXPECT_EQ(element, definition->m_element) |
314 << "the existing a-a element should have been upgraded"; | 313 << "the existing a-a element should have been upgraded"; |
315 } | 314 } |
316 | 315 |
317 // TODO(dominicc): Add tests which adjust the "is" attribute when type | 316 // TODO(dominicc): Add tests which adjust the "is" attribute when type |
318 // extensions are implemented. | 317 // extensions are implemented. |
319 | 318 |
320 } // namespace blink | 319 } // namespace blink |
OLD | NEW |