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. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return true; | 187 return true; |
188 } | 188 } |
189 | 189 |
190 PassRefPtr<DocumentType> DOMImplementation::createDocumentType(const AtomicStrin
g& qualifiedName, | 190 PassRefPtr<DocumentType> DOMImplementation::createDocumentType(const AtomicStrin
g& qualifiedName, |
191 const String& publicId, const String& systemId, ExceptionState& exceptionSta
te) | 191 const String& publicId, const String& systemId, ExceptionState& exceptionSta
te) |
192 { | 192 { |
193 AtomicString prefix, localName; | 193 AtomicString prefix, localName; |
194 if (!Document::parseQualifiedName(qualifiedName, prefix, localName, exceptio
nState)) | 194 if (!Document::parseQualifiedName(qualifiedName, prefix, localName, exceptio
nState)) |
195 return nullptr; | 195 return nullptr; |
196 | 196 |
197 return DocumentType::create(&m_document, qualifiedName, publicId, systemId); | 197 return DocumentType::create(m_document, qualifiedName, publicId, systemId); |
198 } | 198 } |
199 | 199 |
200 PassRefPtr<XMLDocument> DOMImplementation::createDocument(const AtomicString& na
mespaceURI, | 200 PassRefPtr<XMLDocument> DOMImplementation::createDocument(const AtomicString& na
mespaceURI, |
201 const AtomicString& qualifiedName, DocumentType* doctype, ExceptionState& ex
ceptionState) | 201 const AtomicString& qualifiedName, DocumentType* doctype, ExceptionState& ex
ceptionState) |
202 { | 202 { |
203 RefPtr<XMLDocument> doc; | 203 RefPtr<XMLDocument> doc; |
204 DocumentInit init = DocumentInit::fromContext(m_document.contextDocument()); | 204 DocumentInit init = DocumentInit::fromContext(document().contextDocument()); |
205 if (namespaceURI == SVGNames::svgNamespaceURI) { | 205 if (namespaceURI == SVGNames::svgNamespaceURI) { |
206 doc = XMLDocument::createSVG(init); | 206 doc = XMLDocument::createSVG(init); |
207 } else if (namespaceURI == HTMLNames::xhtmlNamespaceURI) { | 207 } else if (namespaceURI == HTMLNames::xhtmlNamespaceURI) { |
208 doc = XMLDocument::createXHTML(init.withRegistrationContext(m_document.r
egistrationContext())); | 208 doc = XMLDocument::createXHTML(init.withRegistrationContext(document().r
egistrationContext())); |
209 } else { | 209 } else { |
210 doc = XMLDocument::create(init); | 210 doc = XMLDocument::create(init); |
211 } | 211 } |
212 | 212 |
213 doc->setSecurityOrigin(m_document.securityOrigin()->isolatedCopy()); | 213 doc->setSecurityOrigin(document().securityOrigin()->isolatedCopy()); |
214 doc->setContextFeatures(m_document.contextFeatures()); | 214 doc->setContextFeatures(document().contextFeatures()); |
215 | 215 |
216 RefPtr<Node> documentElement; | 216 RefPtr<Node> documentElement; |
217 if (!qualifiedName.isEmpty()) { | 217 if (!qualifiedName.isEmpty()) { |
218 documentElement = doc->createElementNS(namespaceURI, qualifiedName, exce
ptionState); | 218 documentElement = doc->createElementNS(namespaceURI, qualifiedName, exce
ptionState); |
219 if (exceptionState.hadException()) | 219 if (exceptionState.hadException()) |
220 return nullptr; | 220 return nullptr; |
221 } | 221 } |
222 | 222 |
223 if (doctype) | 223 if (doctype) |
224 doc->appendChild(doctype); | 224 doc->appendChild(doctype); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 || equalIgnoringCase(mimeType, "text/xsl")); | 313 || equalIgnoringCase(mimeType, "text/xsl")); |
314 } | 314 } |
315 | 315 |
316 bool DOMImplementation::isTextMIMEType(const String& mimeType) | 316 bool DOMImplementation::isTextMIMEType(const String& mimeType) |
317 { | 317 { |
318 return MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType) || isJSONMI
METype(mimeType) || isTextPlainType(mimeType); | 318 return MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType) || isJSONMI
METype(mimeType) || isTextPlainType(mimeType); |
319 } | 319 } |
320 | 320 |
321 PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const String& tit
le) | 321 PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const String& tit
le) |
322 { | 322 { |
323 DocumentInit init = DocumentInit::fromContext(m_document.contextDocument()) | 323 DocumentInit init = DocumentInit::fromContext(document().contextDocument()) |
324 .withRegistrationContext(m_document.registrationContext()); | 324 .withRegistrationContext(document().registrationContext()); |
325 RefPtr<HTMLDocument> d = HTMLDocument::create(init); | 325 RefPtr<HTMLDocument> d = HTMLDocument::create(init); |
326 d->open(); | 326 d->open(); |
327 d->write("<!doctype html><html><body></body></html>"); | 327 d->write("<!doctype html><html><body></body></html>"); |
328 if (!title.isNull()) | 328 if (!title.isNull()) |
329 d->setTitle(title); | 329 d->setTitle(title); |
330 d->setSecurityOrigin(m_document.securityOrigin()->isolatedCopy()); | 330 d->setSecurityOrigin(document().securityOrigin()->isolatedCopy()); |
331 d->setContextFeatures(m_document.contextFeatures()); | 331 d->setContextFeatures(document().contextFeatures()); |
332 return d.release(); | 332 return d.release(); |
333 } | 333 } |
334 | 334 |
335 PassRefPtr<Document> DOMImplementation::createDocument(const String& type, Local
Frame* frame, const KURL& url, bool inViewSourceMode) | 335 PassRefPtr<Document> DOMImplementation::createDocument(const String& type, Local
Frame* frame, const KURL& url, bool inViewSourceMode) |
336 { | 336 { |
337 return createDocument(type, DocumentInit(url, frame), inViewSourceMode); | 337 return createDocument(type, DocumentInit(url, frame), inViewSourceMode); |
338 } | 338 } |
339 | 339 |
340 PassRefPtr<Document> DOMImplementation::createDocument(const String& type, const
DocumentInit& init, bool inViewSourceMode) | 340 PassRefPtr<Document> DOMImplementation::createDocument(const String& type, const
DocumentInit& init, bool inViewSourceMode) |
341 { | 341 { |
(...skipping 29 matching lines...) Expand all Loading... |
371 if (isTextMIMEType(type)) | 371 if (isTextMIMEType(type)) |
372 return TextDocument::create(init); | 372 return TextDocument::create(init); |
373 if (type == "image/svg+xml") | 373 if (type == "image/svg+xml") |
374 return XMLDocument::createSVG(init); | 374 return XMLDocument::createSVG(init); |
375 if (isXMLMIMEType(type)) | 375 if (isXMLMIMEType(type)) |
376 return XMLDocument::create(init); | 376 return XMLDocument::create(init); |
377 | 377 |
378 return HTMLDocument::create(init); | 378 return HTMLDocument::create(init); |
379 } | 379 } |
380 | 380 |
| 381 void DOMImplementation::trace(Visitor* visitor) |
| 382 { |
| 383 visitor->trace(m_document); |
381 } | 384 } |
| 385 |
| 386 } |
OLD | NEW |