| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // This file has been auto-generated by code_generator_web_module.py. |
| 6 // DO NOT MODIFY! |
| 7 |
| 8 // This file has been generated from the Jinja2 template in |
| 9 // third_party/WebKit/Source/bindings/templates/web_module_interface.h.tmpl |
| 10 |
| 11 // clang-format off |
| 12 |
| 13 #include "web/api/document.h" |
| 14 |
| 15 #include "core/html/HTMLScriptElement.h" |
| 16 #include "core/svg/SVGScriptElement.h" |
| 17 #include "core/dom/Document.h" |
| 18 #include "core/dom/Element.h" |
| 19 #include "core/HTMLElementTypeHelpers.h" |
| 20 |
| 21 namespace web { |
| 22 |
| 23 HTMLScriptElement* HTMLScriptElement::Create(blink::HTMLScriptElement* html_scri
pt_element) { |
| 24 return html_script_element ? new HTMLScriptElement(html_script_element) : null
ptr; |
| 25 } |
| 26 |
| 27 blink::HTMLScriptElement* HTMLScriptElement::GetBlinkInstance() const { |
| 28 return toHTMLScriptElement(node()); |
| 29 } |
| 30 |
| 31 HTMLScriptElement::HTMLScriptElement(blink::HTMLScriptElement* html_script_eleme
nt) |
| 32 : Node(html_script_element) {} |
| 33 |
| 34 SVGScriptElement* SVGScriptElement::Create(blink::SVGScriptElement* svg_script_e
lement) { |
| 35 return svg_script_element ? new SVGScriptElement(svg_script_element) : nullptr
; |
| 36 } |
| 37 |
| 38 blink::SVGScriptElement* SVGScriptElement::GetBlinkInstance() const { |
| 39 return toSVGScriptElement(node()); |
| 40 } |
| 41 |
| 42 SVGScriptElement::SVGScriptElement(blink::SVGScriptElement* svg_script_element) |
| 43 : Node(svg_script_element) {} |
| 44 |
| 45 |
| 46 Document::Document(blink::Document* document) : Node(document) {} |
| 47 |
| 48 Document* Document::Create(blink::Document* document) { |
| 49 return document ? new Document(document) : nullptr; |
| 50 } |
| 51 |
| 52 // TODO(dglazkov): Logic copied from Document.cpp :( |
| 53 Optional<Document::CurrentScript> Document::GetCurrentScript() const { |
| 54 if (blink::Element* script = document()->currentScript()) { |
| 55 if (script->isInV1ShadowTree()) |
| 56 return WTF::nullopt; |
| 57 |
| 58 if (isHTMLScriptElement(script)) |
| 59 return CurrentScript { HTMLScriptElement::Create(toHTMLScriptElement(scrip
t)) }; |
| 60 else |
| 61 return CurrentScript { SVGScriptElement::Create(toSVGScriptElement(script)
) }; |
| 62 } |
| 63 return WTF::nullopt; |
| 64 } |
| 65 |
| 66 blink::Document* Document::document() const { |
| 67 return blink::toDocument(node()); |
| 68 } |
| 69 |
| 70 } // namespace web |
| OLD | NEW |