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)) { |
175 // FIXME: SVG 2.0 support? | 175 // FIXME: SVG 2.0 support? |
176 return isSupportedSVG10Feature(feature, version) || isSupportedSVG11Feat ure(feature, version); | 176 return isSupportedSVG10Feature(feature, version) || isSupportedSVG11Feat ure(feature, version); |
177 } | 177 } |
178 return true; | 178 return true; |
179 } | 179 } |
180 | 180 |
181 PassRefPtr<DocumentType> DOMImplementation::createDocumentType(const String& qua lifiedName, | 181 PassRefPtr<DocumentType> DOMImplementation::createDocumentType(const String& qua lifiedName, |
182 const String& publicId, const String& systemId, ExceptionState& es) | 182 const String& publicId, const String& systemId, ExceptionState& es) |
183 { | 183 { |
184 String prefix, localName; | 184 String prefix, localName; |
185 if (!Document::parseQualifiedName(qualifiedName, prefix, localName, es)) | 185 if (!Document::parseQualifiedName(qualifiedName, prefix, localName, es)) |
186 return 0; | 186 return 0; |
187 | 187 |
188 return DocumentType::create(m_document, qualifiedName, publicId, systemId); | 188 return DocumentType::create(&m_document, qualifiedName, publicId, systemId); |
eseidel
2013/11/15 08:53:03
I don't thnik you meant &m_doc... just m_doc
Inactive
2013/11/15 13:16:33
For now, the DocumentType constructor takes Docume
| |
189 } | 189 } |
190 | 190 |
191 DOMImplementation* DOMImplementation::getInterface(const String& /*feature*/) | 191 DOMImplementation* DOMImplementation::getInterface(const String& /*feature*/) |
192 { | 192 { |
193 return 0; | 193 return 0; |
194 } | 194 } |
195 | 195 |
196 PassRefPtr<Document> DOMImplementation::createDocument(const String& namespaceUR I, | 196 PassRefPtr<Document> DOMImplementation::createDocument(const String& namespaceUR I, |
197 const String& qualifiedName, DocumentType* doctype, ExceptionState& es) | 197 const String& qualifiedName, DocumentType* doctype, ExceptionState& es) |
198 { | 198 { |
199 RefPtr<Document> doc; | 199 RefPtr<Document> doc; |
200 DocumentInit init = DocumentInit::fromContext(m_document->contextDocument()) ; | 200 DocumentInit init = DocumentInit::fromContext(m_document.contextDocument()); |
201 if (namespaceURI == SVGNames::svgNamespaceURI) { | 201 if (namespaceURI == SVGNames::svgNamespaceURI) { |
202 doc = SVGDocument::create(init); | 202 doc = SVGDocument::create(init); |
203 } else if (namespaceURI == HTMLNames::xhtmlNamespaceURI) { | 203 } else if (namespaceURI == HTMLNames::xhtmlNamespaceURI) { |
204 doc = Document::createXHTML(init.withRegistrationContext(m_document->reg istrationContext())); | 204 doc = Document::createXHTML(init.withRegistrationContext(m_document.regi strationContext())); |
205 } else { | 205 } else { |
206 doc = Document::create(init); | 206 doc = Document::create(init); |
207 } | 207 } |
208 | 208 |
209 doc->setSecurityOrigin(m_document->securityOrigin()->isolatedCopy()); | 209 doc->setSecurityOrigin(m_document.securityOrigin()->isolatedCopy()); |
210 doc->setContextFeatures(m_document->contextFeatures()); | 210 doc->setContextFeatures(m_document.contextFeatures()); |
211 | 211 |
212 RefPtr<Node> documentElement; | 212 RefPtr<Node> documentElement; |
213 if (!qualifiedName.isEmpty()) { | 213 if (!qualifiedName.isEmpty()) { |
214 documentElement = doc->createElementNS(namespaceURI, qualifiedName, es); | 214 documentElement = doc->createElementNS(namespaceURI, qualifiedName, es); |
215 if (es.hadException()) | 215 if (es.hadException()) |
216 return 0; | 216 return 0; |
217 } | 217 } |
218 | 218 |
219 if (doctype) | 219 if (doctype) |
220 doc->appendChild(doctype); | 220 doc->appendChild(doctype); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
300 || mimeType == "application/json" // Render JSON as text/plain. | 300 || mimeType == "application/json" // Render JSON as text/plain. |
301 || (mimeType.startsWith("text/") && mimeType != "text/html" | 301 || (mimeType.startsWith("text/") && mimeType != "text/html" |
302 && mimeType != "text/xml" && mimeType != "text/xsl")) | 302 && mimeType != "text/xml" && mimeType != "text/xsl")) |
303 return true; | 303 return true; |
304 | 304 |
305 return false; | 305 return false; |
306 } | 306 } |
307 | 307 |
308 PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const String& tit le) | 308 PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const String& tit le) |
309 { | 309 { |
310 DocumentInit init = DocumentInit::fromContext(m_document->contextDocument()) | 310 DocumentInit init = DocumentInit::fromContext(m_document.contextDocument()) |
311 .withRegistrationContext(m_document->registrationContext()); | 311 .withRegistrationContext(m_document.registrationContext()); |
312 RefPtr<HTMLDocument> d = HTMLDocument::create(init); | 312 RefPtr<HTMLDocument> d = HTMLDocument::create(init); |
313 d->open(); | 313 d->open(); |
314 d->write("<!doctype html><html><body></body></html>"); | 314 d->write("<!doctype html><html><body></body></html>"); |
315 if (!title.isNull()) | 315 if (!title.isNull()) |
316 d->setTitle(title); | 316 d->setTitle(title); |
317 d->setSecurityOrigin(m_document->securityOrigin()->isolatedCopy()); | 317 d->setSecurityOrigin(m_document.securityOrigin()->isolatedCopy()); |
318 d->setContextFeatures(m_document->contextFeatures()); | 318 d->setContextFeatures(m_document.contextFeatures()); |
319 return d.release(); | 319 return d.release(); |
320 } | 320 } |
321 | 321 |
322 PassRefPtr<Document> DOMImplementation::createDocument(const String& type, Frame * frame, const KURL& url, bool inViewSourceMode) | 322 PassRefPtr<Document> DOMImplementation::createDocument(const String& type, Frame * frame, const KURL& url, bool inViewSourceMode) |
323 { | 323 { |
324 return createDocument(type, DocumentInit(url, frame), inViewSourceMode); | 324 return createDocument(type, DocumentInit(url, frame), inViewSourceMode); |
325 } | 325 } |
326 | 326 |
327 PassRefPtr<Document> DOMImplementation::createDocument(const String& type, const DocumentInit& init, bool inViewSourceMode) | 327 PassRefPtr<Document> DOMImplementation::createDocument(const String& type, const DocumentInit& init, bool inViewSourceMode) |
328 { | 328 { |
(...skipping 30 matching lines...) Expand all Loading... | |
359 return TextDocument::create(init); | 359 return TextDocument::create(init); |
360 if (type == "image/svg+xml") | 360 if (type == "image/svg+xml") |
361 return SVGDocument::create(init); | 361 return SVGDocument::create(init); |
362 if (isXMLMIMEType(type)) | 362 if (isXMLMIMEType(type)) |
363 return Document::create(init); | 363 return Document::create(init); |
364 | 364 |
365 return HTMLDocument::create(init); | 365 return HTMLDocument::create(init); |
366 } | 366 } |
367 | 367 |
368 } | 368 } |
OLD | NEW |