| 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 "bindings/core/v8/ScriptCustomElementDefinition.h" | 5 #include "bindings/core/v8/ScriptCustomElementDefinition.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
| 8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/v8/V8Binding.h" |
| 9 #include "bindings/core/v8/V8BindingMacros.h" | 9 #include "bindings/core/v8/V8BindingMacros.h" |
| 10 #include "bindings/core/v8/V8CustomElementRegistry.h" | 10 #include "bindings/core/v8/V8CustomElementRegistry.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 } | 172 } |
| 173 | 173 |
| 174 HTMLElement* ScriptCustomElementDefinition::createElementSync( | 174 HTMLElement* ScriptCustomElementDefinition::createElementSync( |
| 175 Document& document, | 175 Document& document, |
| 176 const QualifiedName& tagName) { | 176 const QualifiedName& tagName) { |
| 177 if (!m_scriptState->contextIsValid()) | 177 if (!m_scriptState->contextIsValid()) |
| 178 return CustomElement::createFailedElement(document, tagName); | 178 return CustomElement::createFailedElement(document, tagName); |
| 179 ScriptState::Scope scope(m_scriptState.get()); | 179 ScriptState::Scope scope(m_scriptState.get()); |
| 180 v8::Isolate* isolate = m_scriptState->isolate(); | 180 v8::Isolate* isolate = m_scriptState->isolate(); |
| 181 | 181 |
| 182 ExceptionState exceptionState(ExceptionState::ConstructionContext, | 182 ExceptionState exceptionState(isolate, ExceptionState::ConstructionContext, |
| 183 "CustomElement", constructor(), isolate); | 183 "CustomElement"); |
| 184 | 184 |
| 185 // Create an element with the synchronous custom elements flag set. | 185 // Create an element with the synchronous custom elements flag set. |
| 186 // https://dom.spec.whatwg.org/#concept-create-element | 186 // https://dom.spec.whatwg.org/#concept-create-element |
| 187 | 187 |
| 188 // Create an element and push to the construction stack. | 188 // Create an element and push to the construction stack. |
| 189 // V8HTMLElement::constructorCustom() can only refer to | 189 // V8HTMLElement::constructorCustom() can only refer to |
| 190 // window.document(), but it is different from the document here | 190 // window.document(), but it is different from the document here |
| 191 // when it is an import document. This is not exactly what the | 191 // when it is an import document. This is not exactly what the |
| 192 // spec defines, but the non-imports behavior matches to the spec. | 192 // spec defines, but the non-imports behavior matches to the spec. |
| 193 Element* element = createElementForConstructor(document); | 193 Element* element = createElementForConstructor(document); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 v8::Local<v8::Value> argv[] = { | 343 v8::Local<v8::Value> argv[] = { |
| 344 v8String(isolate, name.localName()), v8StringOrNull(isolate, oldValue), | 344 v8String(isolate, name.localName()), v8StringOrNull(isolate, oldValue), |
| 345 v8StringOrNull(isolate, newValue), | 345 v8StringOrNull(isolate, newValue), |
| 346 v8StringOrNull(isolate, name.namespaceURI()), | 346 v8StringOrNull(isolate, name.namespaceURI()), |
| 347 }; | 347 }; |
| 348 runCallback(m_attributeChangedCallback.newLocal(isolate), element, | 348 runCallback(m_attributeChangedCallback.newLocal(isolate), element, |
| 349 WTF_ARRAY_LENGTH(argv), argv); | 349 WTF_ARRAY_LENGTH(argv), argv); |
| 350 } | 350 } |
| 351 | 351 |
| 352 } // namespace blink | 352 } // namespace blink |
| OLD | NEW |