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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLElementCustom.cpp

Issue 2170383002: CustomElements: adopt node (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: layout test went from bad to good, deleting failure expectation 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
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 "bindings/core/v8/V8HTMLElement.h" 5 #include "bindings/core/v8/V8HTMLElement.h"
6 6
7 #include "bindings/core/v8/DOMWrapperWorld.h" 7 #include "bindings/core/v8/DOMWrapperWorld.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ScriptCustomElementDefinition.h" 9 #include "bindings/core/v8/ScriptCustomElementDefinition.h"
10 #include "bindings/core/v8/V8Binding.h" 10 #include "bindings/core/v8/V8Binding.h"
11 #include "bindings/core/v8/V8BindingMacros.h" 11 #include "bindings/core/v8/V8BindingMacros.h"
12 #include "bindings/core/v8/V8DOMWrapper.h" 12 #include "bindings/core/v8/V8DOMWrapper.h"
13 #include "bindings/core/v8/V8ThrowException.h" 13 #include "bindings/core/v8/V8ThrowException.h"
14 #include "core/dom/Document.h" 14 #include "core/dom/Document.h"
15 #include "core/dom/Element.h"
15 #include "core/dom/ExceptionCode.h" 16 #include "core/dom/ExceptionCode.h"
16 #include "core/dom/custom/CustomElementsRegistry.h" 17 #include "core/dom/custom/CustomElementsRegistry.h"
17 #include "core/frame/LocalDOMWindow.h" 18 #include "core/frame/LocalDOMWindow.h"
18 #include "platform/RuntimeEnabledFeatures.h" 19 #include "platform/RuntimeEnabledFeatures.h"
19 20
20 namespace blink { 21 namespace blink {
21 22
22 void V8HTMLElement::constructorCustom( 23 void V8HTMLElement::constructorCustom(
23 const v8::FunctionCallbackInfo<v8::Value>& info) 24 const v8::FunctionCallbackInfo<v8::Value>& info)
24 { 25 {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // This is an element being created with 'new' from script 58 // This is an element being created with 'new' from script
58 // TODO(kojii): When HTMLElementFactory has an option not to queue 59 // TODO(kojii): When HTMLElementFactory has an option not to queue
59 // upgrade, call that instead of HTMLElement. HTMLElement is enough 60 // upgrade, call that instead of HTMLElement. HTMLElement is enough
60 // for now, but type extension will require HTMLElementFactory. 61 // for now, but type extension will require HTMLElementFactory.
61 element = HTMLElement::create( 62 element = HTMLElement::create(
62 QualifiedName(nullAtom, definition->descriptor().localName(), HTMLNa mes::xhtmlNamespaceURI), 63 QualifiedName(nullAtom, definition->descriptor().localName(), HTMLNa mes::xhtmlNamespaceURI),
63 *window->document()); 64 *window->document());
64 // TODO(davaajav): write this as one call to setCustomElementState inste ad of two 65 // TODO(davaajav): write this as one call to setCustomElementState inste ad of two
65 element->setCustomElementState(CustomElementState::Undefined); 66 element->setCustomElementState(CustomElementState::Undefined);
66 element->setCustomElementState(CustomElementState::Custom); 67 element->setCustomElementState(CustomElementState::Custom);
68 element->setCustomElementDefinition(definition);
dominicc (has gone to gerrit) 2016/08/03 07:56:56 What do you think about setting the state to custo
67 } else { 69 } else {
68 element = definition->constructionStack().last(); 70 element = definition->constructionStack().last();
69 if (element) { 71 if (element) {
70 // This is an element being upgraded that has called super 72 // This is an element being upgraded that has called super
71 definition->constructionStack().last().clear(); 73 definition->constructionStack().last().clear();
72 } else { 74 } else {
73 // During upgrade an element has invoked the same constructor 75 // During upgrade an element has invoked the same constructor
74 // before calling 'super' and that invocation has poached the 76 // before calling 'super' and that invocation has poached the
75 // element. 77 // element.
76 exceptionState.throwDOMException( 78 exceptionState.throwDOMException(
(...skipping 12 matching lines...) Expand all
89 // If the element had a wrapper, we now update and return that 91 // If the element had a wrapper, we now update and return that
90 // instead. 92 // instead.
91 v8SetReturnValue(info, wrapper); 93 v8SetReturnValue(info, wrapper);
92 94
93 v8CallOrCrash(wrapper->SetPrototype( 95 v8CallOrCrash(wrapper->SetPrototype(
94 scriptState->context(), 96 scriptState->context(),
95 definition->prototype())); 97 definition->prototype()));
96 } 98 }
97 99
98 } // namespace blink 100 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698