OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
6 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) | 6 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
8 * (http://www.torchmobile.com/) | 8 * (http://www.torchmobile.com/) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 ExceptionState& exception_state) { | 70 ExceptionState& exception_state) { |
71 AtomicString prefix, local_name; | 71 AtomicString prefix, local_name; |
72 if (!Document::ParseQualifiedName(qualified_name, prefix, local_name, | 72 if (!Document::ParseQualifiedName(qualified_name, prefix, local_name, |
73 exception_state)) | 73 exception_state)) |
74 return nullptr; | 74 return nullptr; |
75 | 75 |
76 return DocumentType::Create(document_, qualified_name, public_id, system_id); | 76 return DocumentType::Create(document_, qualified_name, public_id, system_id); |
77 } | 77 } |
78 | 78 |
79 XMLDocument* DOMImplementation::createDocument( | 79 XMLDocument* DOMImplementation::createDocument( |
| 80 const LocalDOMWindow* window, |
80 const AtomicString& namespace_uri, | 81 const AtomicString& namespace_uri, |
81 const AtomicString& qualified_name, | 82 const AtomicString& qualified_name, |
82 DocumentType* doctype, | 83 DocumentType* doctype, |
83 ExceptionState& exception_state) { | 84 ExceptionState& exception_state) { |
84 XMLDocument* doc = nullptr; | 85 XMLDocument* doc = nullptr; |
85 DocumentInit init = | 86 DocumentInit init = |
86 DocumentInit::FromContext(GetDocument().ContextDocument()); | 87 DocumentInit::FromContext(GetDocument().ContextDocument()); |
87 if (namespace_uri == SVGNames::svgNamespaceURI) { | 88 if (namespace_uri == SVGNames::svgNamespaceURI) { |
88 doc = XMLDocument::CreateSVG(init); | 89 doc = XMLDocument::CreateSVG(init); |
89 } else if (namespace_uri == HTMLNames::xhtmlNamespaceURI) { | 90 } else if (namespace_uri == HTMLNames::xhtmlNamespaceURI) { |
90 doc = XMLDocument::CreateXHTML( | 91 doc = XMLDocument::CreateXHTML( |
91 init.WithRegistrationContext(GetDocument().RegistrationContext())); | 92 init.WithRegistrationContext(GetDocument().RegistrationContext())); |
92 } else { | 93 } else { |
93 doc = XMLDocument::Create(init); | 94 doc = XMLDocument::Create(init); |
94 } | 95 } |
95 | 96 |
96 doc->SetSecurityOrigin(GetDocument().GetSecurityOrigin()); | 97 doc->SetSecurityOrigin(GetDocument().GetSecurityOrigin()); |
97 doc->SetContextFeatures(GetDocument().GetContextFeatures()); | 98 doc->SetContextFeatures(GetDocument().GetContextFeatures()); |
98 | 99 |
99 Node* document_element = nullptr; | 100 Node* document_element = nullptr; |
100 if (!qualified_name.IsEmpty()) { | 101 if (!qualified_name.IsEmpty()) { |
101 document_element = | 102 document_element = doc->createElementNS(window, namespace_uri, |
102 doc->createElementNS(namespace_uri, qualified_name, exception_state); | 103 qualified_name, exception_state); |
103 if (exception_state.HadException()) | 104 if (exception_state.HadException()) |
104 return nullptr; | 105 return nullptr; |
105 } | 106 } |
106 | 107 |
107 if (doctype) | 108 if (doctype) |
108 doc->AppendChild(doctype); | 109 doc->AppendChild(doctype); |
109 if (document_element) | 110 if (document_element) |
110 doc->AppendChild(document_element); | 111 doc->AppendChild(document_element); |
111 | 112 |
112 return doc; | 113 return doc; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 return XMLDocument::Create(init); | 283 return XMLDocument::Create(init); |
283 | 284 |
284 return HTMLDocument::Create(init); | 285 return HTMLDocument::Create(init); |
285 } | 286 } |
286 | 287 |
287 DEFINE_TRACE(DOMImplementation) { | 288 DEFINE_TRACE(DOMImplementation) { |
288 visitor->Trace(document_); | 289 visitor->Trace(document_); |
289 } | 290 } |
290 | 291 |
291 } // namespace blink | 292 } // namespace blink |
OLD | NEW |