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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 addString(svgFeatures, "Font"); | 154 addString(svgFeatures, "Font"); |
155 addString(svgFeatures, "BasicFont"); | 155 addString(svgFeatures, "BasicFont"); |
156 #endif | 156 #endif |
157 addString(svgFeatures, "Extensibility"); | 157 addString(svgFeatures, "Extensibility"); |
158 initialized = true; | 158 initialized = true; |
159 } | 159 } |
160 return feature.startsWith("http://www.w3.org/tr/svg11/feature#", false) | 160 return feature.startsWith("http://www.w3.org/tr/svg11/feature#", false) |
161 && svgFeatures.contains(feature.right(feature.length() - 35)); | 161 && svgFeatures.contains(feature.right(feature.length() - 35)); |
162 } | 162 } |
163 | 163 |
164 DOMImplementation::DOMImplementation(Document& document) | 164 DOMImplementation::DOMImplementation(Document* document) |
165 : m_document(document) | 165 : m_document(document) |
166 { | 166 { |
167 ScriptWrappable::init(this); | 167 ScriptWrappable::init(this); |
168 } | 168 } |
169 | 169 |
170 bool DOMImplementation::hasFeature(const String& feature, const String& version) | 170 bool DOMImplementation::hasFeature(const String& feature, const String& version) |
171 { | 171 { |
172 if (feature.startsWith("http://www.w3.org/TR/SVG", false) | 172 if (feature.startsWith("http://www.w3.org/TR/SVG", false) |
173 || feature.startsWith("org.w3c.dom.svg", false) | 173 || feature.startsWith("org.w3c.dom.svg", false) |
174 || feature.startsWith("org.w3c.svg", false)) { | 174 || feature.startsWith("org.w3c.svg", false)) { |
(...skipping 12 matching lines...) Expand all 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(m_document->contextDocument()) ; |
tkent
2014/05/07 23:43:20
Please use document() instead of m_document.
| |
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(m_document-> registrationContext())); |
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(m_document->securityOrigin()->isolatedCopy()); |
214 doc->setContextFeatures(m_document.contextFeatures()); | 214 doc->setContextFeatures(m_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(m_document->contextDocument()) |
324 .withRegistrationContext(m_document.registrationContext()); | 324 .withRegistrationContext(m_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(m_document->securityOrigin()->isolatedCopy()); |
331 d->setContextFeatures(m_document.contextFeatures()); | 331 d->setContextFeatures(m_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 |