OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 2010 Rob Buis <rwlbuis@gmail.com> | 2 Copyright (C) 2010 Rob Buis <rwlbuis@gmail.com> |
3 Copyright (C) 2011 Cosmin Truta <ctruta@gmail.com> | 3 Copyright (C) 2011 Cosmin Truta <ctruta@gmail.com> |
4 Copyright (C) 2012 University of Szeged | 4 Copyright (C) 2012 University of Szeged |
5 Copyright (C) 2012 Renata Hodovan <reni@webkit.org> | 5 Copyright (C) 2012 Renata Hodovan <reni@webkit.org> |
6 | 6 |
7 This library is free software; you can redistribute it and/or | 7 This library is free software; you can redistribute it and/or |
8 modify it under the terms of the GNU Library General Public | 8 modify it under the terms of the GNU Library General Public |
9 License as published by the Free Software Foundation; either | 9 License as published by the Free Software Foundation; either |
10 version 2 of the License, or (at your option) any later version. | 10 version 2 of the License, or (at your option) any later version. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 DocumentResource::~DocumentResource() {} | 51 DocumentResource::~DocumentResource() {} |
52 | 52 |
53 DEFINE_TRACE(DocumentResource) { | 53 DEFINE_TRACE(DocumentResource) { |
54 visitor->trace(m_document); | 54 visitor->trace(m_document); |
55 Resource::trace(visitor); | 55 Resource::trace(visitor); |
56 } | 56 } |
57 | 57 |
58 void DocumentResource::checkNotify() { | 58 void DocumentResource::checkNotify() { |
59 if (data() && mimeTypeAllowed()) { | 59 if (data() && mimeTypeAllowed()) { |
60 // We don't need to create a new frame because the new document belongs to t
he parent UseElement. | 60 // We don't need to create a new frame because the new document belongs to |
| 61 // the parent UseElement. |
61 m_document = createDocument(response().url()); | 62 m_document = createDocument(response().url()); |
62 m_document->setContent(decodedText()); | 63 m_document->setContent(decodedText()); |
63 } | 64 } |
64 Resource::checkNotify(); | 65 Resource::checkNotify(); |
65 } | 66 } |
66 | 67 |
67 bool DocumentResource::mimeTypeAllowed() const { | 68 bool DocumentResource::mimeTypeAllowed() const { |
68 DCHECK_EQ(getType(), SVGDocument); | 69 DCHECK_EQ(getType(), SVGDocument); |
69 AtomicString mimeType = response().mimeType(); | 70 AtomicString mimeType = response().mimeType(); |
70 if (response().isHTTP()) | 71 if (response().isHTTP()) |
71 mimeType = httpContentType(); | 72 mimeType = httpContentType(); |
72 return mimeType == "image/svg+xml" || mimeType == "text/xml" || | 73 return mimeType == "image/svg+xml" || mimeType == "text/xml" || |
73 mimeType == "application/xml" || mimeType == "application/xhtml+xml"; | 74 mimeType == "application/xml" || mimeType == "application/xhtml+xml"; |
74 } | 75 } |
75 | 76 |
76 Document* DocumentResource::createDocument(const KURL& url) { | 77 Document* DocumentResource::createDocument(const KURL& url) { |
77 switch (getType()) { | 78 switch (getType()) { |
78 case SVGDocument: | 79 case SVGDocument: |
79 return XMLDocument::createSVG(DocumentInit(url)); | 80 return XMLDocument::createSVG(DocumentInit(url)); |
80 default: | 81 default: |
81 // FIXME: We'll add more types to support HTMLImports. | 82 // FIXME: We'll add more types to support HTMLImports. |
82 NOTREACHED(); | 83 NOTREACHED(); |
83 return nullptr; | 84 return nullptr; |
84 } | 85 } |
85 } | 86 } |
86 | 87 |
87 } // namespace blink | 88 } // namespace blink |
OLD | NEW |