diff options
Diffstat (limited to 'Source/WebCore/loader/cache/CachedSVGDocument.cpp')
-rw-r--r-- | Source/WebCore/loader/cache/CachedSVGDocument.cpp | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/Source/WebCore/loader/cache/CachedSVGDocument.cpp b/Source/WebCore/loader/cache/CachedSVGDocument.cpp index 15946263f..08b40169d 100644 --- a/Source/WebCore/loader/cache/CachedSVGDocument.cpp +++ b/Source/WebCore/loader/cache/CachedSVGDocument.cpp @@ -21,22 +21,16 @@ */ #include "config.h" - -#if ENABLE(SVG) #include "CachedSVGDocument.h" -#include "CachedResourceClient.h" -#include "CachedResourceHandle.h" -#include "ResourceBuffer.h" -#include <wtf/text/StringBuilder.h> +#include "SharedBuffer.h" namespace WebCore { -CachedSVGDocument::CachedSVGDocument(const ResourceRequest& request) - : CachedResource(request, SVGDocumentResource) +CachedSVGDocument::CachedSVGDocument(CachedResourceRequest&& request, SessionID sessionID) + : CachedResource(WTFMove(request), SVGDocumentResource, sessionID) , m_decoder(TextResourceDecoder::create("application/xml")) { - setAccept("image/svg+xml"); } CachedSVGDocument::~CachedSVGDocument() @@ -53,20 +47,14 @@ String CachedSVGDocument::encoding() const return m_decoder->encoding().name(); } -void CachedSVGDocument::finishLoading(ResourceBuffer* data) +void CachedSVGDocument::finishLoading(SharedBuffer* data) { if (data) { - StringBuilder decodedText; - decodedText.append(m_decoder->decode(data->data(), data->size())); - decodedText.append(m_decoder->flush()); // We don't need to create a new frame because the new document belongs to the parent UseElement. - m_document = SVGDocument::create(0, response().url()); - m_document->setContent(decodedText.toString()); + m_document = SVGDocument::create(nullptr, response().url()); + m_document->setContent(m_decoder->decodeAndFlush(data->data(), data->size())); } CachedResource::finishLoading(data); } } - -#endif - |