Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp |
| index 0e9fb986ac4b248e3d095790b443e4d0ebf698e0..bf25a6c9fd338919082eab769427bc7500500445 100644 |
| --- a/third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp |
| +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp |
| @@ -16,4 +16,37 @@ CustomElementDefinition::~CustomElementDefinition() |
| { |
| } |
| +DEFINE_TRACE(CustomElementDefinition) |
| +{ |
| + visitor->trace(m_constructionStack); |
| +} |
| + |
| +// https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-element |
| +void CustomElementDefinition::upgrade(Element* element) |
| +{ |
| + size_t depth = m_constructionStack.size(); |
| + m_constructionStack.append(element); |
|
yosin_UTC9
2016/06/01 06:15:44
We should have DCHECK(!m_constructionStack.isEmpty
dominicc (has gone to gerrit)
2016/06/01 23:30:56
Why? How would anything get upgraded if there's an
yosin_UTC9
2016/06/02 02:02:18
Sorry, my comment is wrong.
|
| + |
| + bool succeeded = runConstructor(element); |
| + |
| + // Pop the construction stack. |
| + DCHECK(m_constructionStack.last() == element |
|
yosin_UTC9
2016/06/01 06:15:44
Better to use DCHECK_EQ
if (!m_consturctionStack.l
dominicc (has gone to gerrit)
2016/06/01 23:30:57
I don't think that's applicable because of the tes
yosin_UTC9
2016/06/02 02:02:18
Oh, typo
if (m_consturctionStack.last())
DCHEC
|
| + || !m_constructionStack.last()); |
| + m_constructionStack.removeLast(); |
| + DCHECK(m_constructionStack.size() == depth); // It's a *stack*. |
|
yosin_UTC9
2016/06/01 06:15:44
nit: DCHECK_EQ
|
| + |
| + if (!succeeded) |
| + return; |
| + |
| + // TODO(dominicc): Turn this into an assertion when setting |
| + // 'custom' moves to the HTMLElement constructor. We will need to |
| + // add a bit for MARQUEE to be custom-gets-callbacks-yet-not-custom. |
| + element->setCustomElementState(CustomElementState::Custom); |
| + |
| + // TODO(dominicc): When the attributeChangedCallback is implemented, |
| + // enqueue reactions for attributes here. |
| + // TODO(dominicc): When the connectedCallback is implemented, enqueue |
| + // reactions here, if applicable. |
| +} |
| + |
| } // namespace blink |