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

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

Issue 2032373002: Revert of Implement the script parts of custom element upgrade steps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ce-upgrade-in-document-dom-merge2
Patch Set: Created 4 years, 6 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/dom/custom/CustomElementDefinition.h" 5 #include "core/dom/custom/CustomElementDefinition.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 CustomElementDefinition::CustomElementDefinition( 9 CustomElementDefinition::CustomElementDefinition(
10 const CustomElementDescriptor& descriptor) 10 const CustomElementDescriptor& descriptor)
11 : m_descriptor(descriptor) 11 : m_descriptor(descriptor)
12 { 12 {
13 } 13 }
14 14
15 CustomElementDefinition::~CustomElementDefinition() 15 CustomElementDefinition::~CustomElementDefinition()
16 { 16 {
17 } 17 }
18 18
19 DEFINE_TRACE(CustomElementDefinition) 19 DEFINE_TRACE(CustomElementDefinition)
20 { 20 {
21 visitor->trace(m_constructionStack); 21 visitor->trace(m_constructionStack);
22 } 22 }
23 23
24 // https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-elem ent 24 // https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-elem ent
25 void CustomElementDefinition::upgrade(Element* element) 25 void CustomElementDefinition::upgrade(Element* element)
26 { 26 {
27 // TODO(dominicc): When the attributeChangedCallback is implemented,
28 // enqueue reactions for attributes here.
29 // TODO(dominicc): When the connectedCallback is implemented, enqueue
30 // reactions here, if applicable.
31
32 m_constructionStack.append(element); 27 m_constructionStack.append(element);
33 size_t depth = m_constructionStack.size(); 28 size_t depth = m_constructionStack.size();
34 29
35 bool succeeded = runConstructor(element); 30 bool succeeded = runConstructor(element);
36 31
37 // Pop the construction stack. 32 // Pop the construction stack.
38 if (m_constructionStack.last().get()) 33 if (m_constructionStack.last().get())
39 DCHECK_EQ(m_constructionStack.last(), element); 34 DCHECK_EQ(m_constructionStack.last(), element);
40 DCHECK_EQ(m_constructionStack.size(), depth); // It's a *stack*. 35 DCHECK_EQ(m_constructionStack.size(), depth); // It's a *stack*.
41 m_constructionStack.removeLast(); 36 m_constructionStack.removeLast();
42 37
43 if (!succeeded) 38 if (!succeeded)
44 return; 39 return;
45 40
46 CHECK(element->getCustomElementState() == CustomElementState::Custom); 41 // TODO(dominicc): Turn this into an assertion when setting
42 // 'custom' moves to the HTMLElement constructor. We will need to
43 // add a bit for MARQUEE to be custom-gets-callbacks-yet-not-custom.
44 element->setCustomElementState(CustomElementState::Custom);
45
46 // TODO(dominicc): When the attributeChangedCallback is implemented,
47 // enqueue reactions for attributes here.
48 // TODO(dominicc): When the connectedCallback is implemented, enqueue
49 // reactions here, if applicable.
50 }
51
52 bool CustomElementDefinition::runConstructor(Element*)
53 {
54 return true;
47 } 55 }
48 56
49 } // namespace blink 57 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698