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

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

Issue 2274883005: Fix ScriptCustomElementDefinition::createElementSync to use the given document (Closed)
Patch Set: Remove #if DCHECK_IS_ON() due to failure on CrOS Created 4 years, 3 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"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 ExceptionState exceptionState( 50 ExceptionState exceptionState(
51 ExceptionState::ConstructionContext, 51 ExceptionState::ConstructionContext,
52 "HTMLElement", 52 "HTMLElement",
53 info.Holder(), 53 info.Holder(),
54 isolate); 54 isolate);
55 55
56 Element* element; 56 Element* element;
57 if (definition->constructionStack().isEmpty()) { 57 if (definition->constructionStack().isEmpty()) {
58 // This is an element being created with 'new' from script 58 // This is an element being created with 'new' from script
59 // TODO(kojii): When HTMLElementFactory has an option not to queue 59 element = definition->createElementForConstructor(*window->document());
60 // upgrade, call that instead of HTMLElement. HTMLElement is enough
61 // for now, but type extension will require HTMLElementFactory.
62 element = HTMLElement::create(
63 QualifiedName(nullAtom, definition->descriptor().localName(), HTMLNa mes::xhtmlNamespaceURI),
64 *window->document());
65 // TODO(davaajav): write this as one call to setCustomElementState inste ad of two
66 element->setCustomElementState(CustomElementState::Undefined);
67 element->setCustomElementDefinition(definition);
68 } else { 60 } else {
69 element = definition->constructionStack().last(); 61 element = definition->constructionStack().last();
70 if (element) { 62 if (element) {
71 // This is an element being upgraded that has called super 63 // This is an element being upgraded that has called super
72 definition->constructionStack().last().clear(); 64 definition->constructionStack().last().clear();
73 } else { 65 } else {
74 // During upgrade an element has invoked the same constructor 66 // During upgrade an element has invoked the same constructor
75 // before calling 'super' and that invocation has poached the 67 // before calling 'super' and that invocation has poached the
76 // element. 68 // element.
77 exceptionState.throwDOMException( 69 exceptionState.throwDOMException(
(...skipping 10 matching lines...) Expand all
88 wrapperType, 80 wrapperType,
89 info.Holder()); 81 info.Holder());
90 // If the element had a wrapper, we now update and return that 82 // If the element had a wrapper, we now update and return that
91 // instead. 83 // instead.
92 v8SetReturnValue(info, wrapper); 84 v8SetReturnValue(info, wrapper);
93 85
94 wrapper->SetPrototype(scriptState->context(), definition->prototype()).ToChe cked(); 86 wrapper->SetPrototype(scriptState->context(), definition->prototype()).ToChe cked();
95 } 87 }
96 88
97 } // namespace blink 89 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698