| 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 12 matching lines...) Expand all Loading... |
| 23 #include "core/fetch/DocumentResource.h" | 23 #include "core/fetch/DocumentResource.h" |
| 24 | 24 |
| 25 #include "core/dom/XMLDocument.h" | 25 #include "core/dom/XMLDocument.h" |
| 26 #include "core/fetch/FetchRequest.h" | 26 #include "core/fetch/FetchRequest.h" |
| 27 #include "core/fetch/ResourceFetcher.h" | 27 #include "core/fetch/ResourceFetcher.h" |
| 28 #include "platform/SharedBuffer.h" | 28 #include "platform/SharedBuffer.h" |
| 29 #include "wtf/text/StringBuilder.h" | 29 #include "wtf/text/StringBuilder.h" |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 PassRefPtrWillBeRawPtr<DocumentResource> DocumentResource::fetchSVGDocument(Fetc
hRequest& request, ResourceFetcher* fetcher) | 33 RawPtr<DocumentResource> DocumentResource::fetchSVGDocument(FetchRequest& reques
t, ResourceFetcher* fetcher) |
| 34 { | 34 { |
| 35 ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone
); | 35 ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone
); |
| 36 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon
textImage); | 36 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon
textImage); |
| 37 return toDocumentResource(fetcher->requestResource(request, SVGDocumentResou
rceFactory())); | 37 return toDocumentResource(fetcher->requestResource(request, SVGDocumentResou
rceFactory())); |
| 38 } | 38 } |
| 39 | 39 |
| 40 DocumentResource::DocumentResource(const ResourceRequest& request, Type type, co
nst ResourceLoaderOptions& options) | 40 DocumentResource::DocumentResource(const ResourceRequest& request, Type type, co
nst ResourceLoaderOptions& options) |
| 41 : Resource(request, type, options) | 41 : Resource(request, type, options) |
| 42 , m_decoder(TextResourceDecoder::create("application/xml")) | 42 , m_decoder(TextResourceDecoder::create("application/xml")) |
| 43 { | 43 { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 ASSERT(getType() == SVGDocument); | 83 ASSERT(getType() == SVGDocument); |
| 84 AtomicString mimeType = response().mimeType(); | 84 AtomicString mimeType = response().mimeType(); |
| 85 if (response().isHTTP()) | 85 if (response().isHTTP()) |
| 86 mimeType = httpContentType(); | 86 mimeType = httpContentType(); |
| 87 return mimeType == "image/svg+xml" | 87 return mimeType == "image/svg+xml" |
| 88 || mimeType == "text/xml" | 88 || mimeType == "text/xml" |
| 89 || mimeType == "application/xml" | 89 || mimeType == "application/xml" |
| 90 || mimeType == "application/xhtml+xml"; | 90 || mimeType == "application/xhtml+xml"; |
| 91 } | 91 } |
| 92 | 92 |
| 93 PassRefPtrWillBeRawPtr<Document> DocumentResource::createDocument(const KURL& ur
l) | 93 RawPtr<Document> DocumentResource::createDocument(const KURL& url) |
| 94 { | 94 { |
| 95 switch (getType()) { | 95 switch (getType()) { |
| 96 case SVGDocument: | 96 case SVGDocument: |
| 97 return XMLDocument::createSVG(DocumentInit(url)); | 97 return XMLDocument::createSVG(DocumentInit(url)); |
| 98 default: | 98 default: |
| 99 // FIXME: We'll add more types to support HTMLImports. | 99 // FIXME: We'll add more types to support HTMLImports. |
| 100 ASSERT_NOT_REACHED(); | 100 ASSERT_NOT_REACHED(); |
| 101 return nullptr; | 101 return nullptr; |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace blink | 105 } // namespace blink |
| OLD | NEW |