Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (108784 => 108785)
--- trunk/Source/WebCore/CMakeLists.txt 2012-02-24 14:16:55 UTC (rev 108784)
+++ trunk/Source/WebCore/CMakeLists.txt 2012-02-24 14:31:59 UTC (rev 108785)
@@ -995,6 +995,7 @@
loader/cache/CachedResourceHandle.cpp
loader/cache/CachedResourceLoader.cpp
loader/cache/CachedScript.cpp
+ loader/cache/CachedSVGDocument.cpp
loader/cache/CachedXSLStyleSheet.cpp
loader/cache/MemoryCache.cpp
Modified: trunk/Source/WebCore/ChangeLog (108784 => 108785)
--- trunk/Source/WebCore/ChangeLog 2012-02-24 14:16:55 UTC (rev 108784)
+++ trunk/Source/WebCore/ChangeLog 2012-02-24 14:31:59 UTC (rev 108785)
@@ -1,3 +1,51 @@
+2012-02-24 Renata Hodovan <[email protected]>
+
+ External <use> xlink:href references do not work
+ https://bugs.webkit.org/show_bug.cgi?id=12499
+
+ Reviewed by Nikolas Zimmermann.
+
+ Support external references on <use> by introducing CachedSVGDocument.
+ CachedSVGDocument is a CachedResource specialized for SVGDocuments.
+ This CachedSVGDocument will be stored for every use element with external reference.
+ This first patch only contains the new classes to test whether it works on every platform.
+ So they aren't used anywhere and just a follow-up patch will bind them into the caching system.
+
+ No new tests - no change in functionality.
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * loader/cache/CachedResource.cpp:
+ (WebCore::defaultPriorityForResourceType):
+ (WebCore::cachedResourceTypeToTargetType):
+ * loader/cache/CachedResource.h:
+ * loader/cache/CachedResourceClient.h:
+ (CachedResourceClient):
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::createResource):
+ (WebCore::CachedResourceLoader::checkInsecureContent):
+ (WebCore::CachedResourceLoader::canRequest):
+ * loader/cache/CachedSVGDocument.cpp: Added.
+ (WebCore):
+ (WebCore::CachedSVGDocument::CachedSVGDocument):
+ (WebCore::CachedSVGDocument::~CachedSVGDocument):
+ (WebCore::CachedSVGDocument::setEncoding):
+ (WebCore::CachedSVGDocument::encoding):
+ (WebCore::CachedSVGDocument::data):
+ * loader/cache/CachedSVGDocument.h: Added.
+ (WebCore):
+ (CachedSVGDocument):
+ (WebCore::CachedSVGDocument::document):
+ (WebCore::CachedSVGDocument::schedule):
+ (CachedSVGDocumentClient):
+ (WebCore::CachedSVGDocumentClient::~CachedSVGDocumentClient):
+ (WebCore::CachedSVGDocumentClient::expectedType):
+ (WebCore::CachedSVGDocumentClient::resourceClientType):
+
2012-02-24 Alexis Menard <[email protected]>
Little optimization in CSSParser::parseShorthand.
Modified: trunk/Source/WebCore/GNUmakefile.list.am (108784 => 108785)
--- trunk/Source/WebCore/GNUmakefile.list.am 2012-02-24 14:16:55 UTC (rev 108784)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2012-02-24 14:31:59 UTC (rev 108785)
@@ -2531,6 +2531,8 @@
Source/WebCore/loader/cache/CachedShader.cpp \
Source/WebCore/loader/cache/CachedShader.h \
Source/WebCore/loader/cache/CachedStyleSheetClient.h \
+ Source/WebCore/loader/cache/CachedSVGDocument.cpp \
+ Source/WebCore/loader/cache/CachedSVGDocument.h \
Source/WebCore/loader/cache/CachedTextTrack.cpp \
Source/WebCore/loader/cache/CachedTextTrack.h \
Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp \
Modified: trunk/Source/WebCore/Target.pri (108784 => 108785)
--- trunk/Source/WebCore/Target.pri 2012-02-24 14:16:55 UTC (rev 108784)
+++ trunk/Source/WebCore/Target.pri 2012-02-24 14:31:59 UTC (rev 108785)
@@ -929,6 +929,8 @@
loader/cache/CachedResource.cpp \
loader/cache/CachedScript.cpp \
loader/cache/CachedShader.cpp \
+ loader/cache/CachedSVGDocument.cpp \
+ loader/cache/CachedSVGDocument.h \
loader/cache/CachedXSLStyleSheet.cpp \
loader/CrossOriginAccessControl.cpp \
loader/CrossOriginPreflightResultCache.cpp \
@@ -2006,6 +2008,7 @@
loader/cache/CachedResourceHandle.h \
loader/cache/CachedScript.h \
loader/cache/CachedShader.h \
+ loader/cache/CachedSVGDocument.h \
loader/cache/CachedXSLStyleSheet.h \
loader/cache/MemoryCache.h \
loader/CrossOriginAccessControl.h \
Modified: trunk/Source/WebCore/WebCore.gypi (108784 => 108785)
--- trunk/Source/WebCore/WebCore.gypi 2012-02-24 14:16:55 UTC (rev 108784)
+++ trunk/Source/WebCore/WebCore.gypi 2012-02-24 14:31:59 UTC (rev 108785)
@@ -2544,6 +2544,8 @@
'loader/cache/CachedScript.h',
'loader/cache/CachedShader.cpp',
'loader/cache/CachedShader.h',
+ 'loader/cache/CachedSVGDocument.cpp',
+ 'loader/cache/CachedSVGDocument.h',
'loader/cache/CachedTextTrack.cpp',
'loader/cache/CachedTextTrack.h',
'loader/cache/CachedXSLStyleSheet.cpp',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (108784 => 108785)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-02-24 14:16:55 UTC (rev 108784)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-02-24 14:31:59 UTC (rev 108785)
@@ -26509,6 +26509,14 @@
>
</File>
<File
+ RelativePath="..\loader\cache\CachedSVGDocument.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\loader\cache\CachedSVGDocument.h"
+ >
+ </File>
+ <File
RelativePath="..\loader\cache\CachedXSLStyleSheet.cpp"
>
</File>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (108784 => 108785)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-02-24 14:16:55 UTC (rev 108784)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-02-24 14:31:59 UTC (rev 108785)
@@ -3521,6 +3521,8 @@
A0EE0DF6144F825500F80B0D /* WebGLDebugRendererInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = A0EE0DF2144F825500F80B0D /* WebGLDebugRendererInfo.h */; };
A0EE0DF7144F825500F80B0D /* WebGLDebugShaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0EE0DF3144F825500F80B0D /* WebGLDebugShaders.cpp */; };
A0EE0DF8144F825500F80B0D /* WebGLDebugShaders.h in Headers */ = {isa = PBXBuildFile; fileRef = A0EE0DF4144F825500F80B0D /* WebGLDebugShaders.h */; };
+ A104F24314C71F7A009E2C23 /* CachedSVGDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A104F24114C71F7A009E2C23 /* CachedSVGDocument.cpp */; };
+ A104F24414C71F7A009E2C23 /* CachedSVGDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = A104F24214C71F7A009E2C23 /* CachedSVGDocument.h */; };
A10BB5851484E3A700B2E87A /* RenderSVGRect.h in Headers */ = {isa = PBXBuildFile; fileRef = A10BB5831484E3A700B2E87A /* RenderSVGRect.h */; };
A10BB58B1484E3B300B2E87A /* RenderSVGShape.h in Headers */ = {isa = PBXBuildFile; fileRef = A10BB5891484E3B300B2E87A /* RenderSVGShape.h */; };
A10DC76A14747BAB005E2471 /* StyleGridData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A10DC76814747BAB005E2471 /* StyleGridData.cpp */; };
@@ -10406,6 +10408,8 @@
A0EE0DF2144F825500F80B0D /* WebGLDebugRendererInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLDebugRendererInfo.h; path = canvas/WebGLDebugRendererInfo.h; sourceTree = "<group>"; };
A0EE0DF3144F825500F80B0D /* WebGLDebugShaders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLDebugShaders.cpp; path = canvas/WebGLDebugShaders.cpp; sourceTree = "<group>"; };
A0EE0DF4144F825500F80B0D /* WebGLDebugShaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLDebugShaders.h; path = canvas/WebGLDebugShaders.h; sourceTree = "<group>"; };
+ A104F24114C71F7A009E2C23 /* CachedSVGDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedSVGDocument.cpp; sourceTree = "<group>"; };
+ A104F24214C71F7A009E2C23 /* CachedSVGDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedSVGDocument.h; sourceTree = "<group>"; };
A10BB5821484E3A700B2E87A /* RenderSVGRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGRect.cpp; sourceTree = "<group>"; };
A10BB5831484E3A700B2E87A /* RenderSVGRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGRect.h; sourceTree = "<group>"; };
A10BB5881484E3B300B2E87A /* RenderSVGShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGShape.cpp; sourceTree = "<group>"; };
@@ -18244,6 +18248,8 @@
A8D2B2521287A56000AF4DDA /* cache */ = {
isa = PBXGroup;
children = (
+ A104F24114C71F7A009E2C23 /* CachedSVGDocument.cpp */,
+ A104F24214C71F7A009E2C23 /* CachedSVGDocument.h */,
BCB16C000979C3BD00467741 /* CachedCSSStyleSheet.cpp */,
BCB16C010979C3BD00467741 /* CachedCSSStyleSheet.h */,
BC64B4C90CB4295D005F2B62 /* CachedFont.cpp */,
@@ -21373,6 +21379,7 @@
BCD533640ED6848900887468 /* CachedScriptSourceProvider.h in Headers */,
5038BE411472AD980095E0D1 /* CachedShader.h in Headers */,
D0BC54491443AC4A00E105DA /* CachedStyleSheetClient.h in Headers */,
+ A104F24414C71F7A009E2C23 /* CachedSVGDocument.h in Headers */,
0753860314489E9800B78452 /* CachedTextTrack.h in Headers */,
BCB16C280979C3BD00467741 /* CachedXSLStyleSheet.h in Headers */,
93F1995008245E59001E9ABC /* CachePolicy.h in Headers */,
@@ -24811,6 +24818,7 @@
BCB16C290979C3BD00467741 /* CachedResourceLoader.cpp in Sources */,
BCB16C230979C3BD00467741 /* CachedScript.cpp in Sources */,
5038BE401472AD980095E0D1 /* CachedShader.cpp in Sources */,
+ A104F24314C71F7A009E2C23 /* CachedSVGDocument.cpp in Sources */,
0753860214489E9800B78452 /* CachedTextTrack.cpp in Sources */,
BCB16C270979C3BD00467741 /* CachedXSLStyleSheet.cpp in Sources */,
49AE2D96134EE5F90072920A /* CalculationValue.cpp in Sources */,
Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (108784 => 108785)
--- trunk/Source/WebCore/loader/cache/CachedResource.cpp 2012-02-24 14:16:55 UTC (rev 108784)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp 2012-02-24 14:31:59 UTC (rev 108785)
@@ -61,6 +61,10 @@
#endif
return ResourceLoadPriorityHigh;
case CachedResource::Script:
+#if ENABLE(SVG)
+ case CachedResource::SVGDocumentResource:
+ return ResourceLoadPriorityLow;
+#endif
case CachedResource::FontResource:
case CachedResource::RawResource:
return ResourceLoadPriorityMedium;
@@ -116,6 +120,10 @@
case CachedResource::TextTrackResource:
return ResourceRequest::TargetIsTextTrack;
#endif
+#if ENABLE(SVG)
+ case CachedResource::SVGDocumentResource:
+ return ResourceRequest::TargetIsImage;
+#endif
}
ASSERT_NOT_REACHED();
return ResourceRequest::TargetIsSubresource;
Property changes on: trunk/Source/WebCore/loader/cache/CachedResource.cpp
___________________________________________________________________
Added: svn:executable
Modified: trunk/Source/WebCore/loader/cache/CachedResource.h (108784 => 108785)
--- trunk/Source/WebCore/loader/cache/CachedResource.h 2012-02-24 14:16:55 UTC (rev 108784)
+++ trunk/Source/WebCore/loader/cache/CachedResource.h 2012-02-24 14:31:59 UTC (rev 108785)
@@ -66,6 +66,9 @@
Script,
FontResource,
RawResource
+#if ENABLE(SVG)
+ , SVGDocumentResource
+#endif
#if ENABLE(XSLT)
, XSLStyleSheet
#endif
Modified: trunk/Source/WebCore/loader/cache/CachedResourceClient.h (108784 => 108785)
--- trunk/Source/WebCore/loader/cache/CachedResourceClient.h 2012-02-24 14:16:55 UTC (rev 108784)
+++ trunk/Source/WebCore/loader/cache/CachedResourceClient.h 2012-02-24 14:31:59 UTC (rev 108785)
@@ -39,6 +39,9 @@
ImageType,
FontType,
StyleSheetType,
+#if ENABLE(SVG)
+ SVGDocumentType,
+#endif
RawResourceType
};
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (108784 => 108785)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2012-02-24 14:16:55 UTC (rev 108784)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2012-02-24 14:31:59 UTC (rev 108785)
@@ -28,6 +28,7 @@
#include "CachedResourceLoader.h"
#include "CachedCSSStyleSheet.h"
+#include "CachedSVGDocument.h"
#include "CachedFont.h"
#include "CachedImage.h"
#include "CachedRawResource.h"
@@ -72,6 +73,10 @@
return new CachedCSSStyleSheet(request, charset);
case CachedResource::Script:
return new CachedScript(request, charset);
+#if ENABLE(SVG)
+ case CachedResource::SVGDocumentResource:
+ return new CachedSVGDocument(request);
+#endif
case CachedResource::FontResource:
return new CachedFont(request);
case CachedResource::RawResource:
@@ -246,6 +251,9 @@
#if ENABLE(XSLT)
case CachedResource::XSLStyleSheet:
#endif
+#if ENABLE(SVG)
+ case CachedResource::SVGDocumentResource:
+#endif
case CachedResource::CSSStyleSheet:
// These resource can inject script into the current document (Script,
// XSL) or exfiltrate the content of the current document (CSS).
@@ -313,6 +321,9 @@
// These types of resources can be loaded from any origin.
// FIXME: Are we sure about CachedResource::FontResource?
break;
+#if ENABLE(SVG)
+ case CachedResource::SVGDocumentResource:
+#endif
#if ENABLE(XSLT)
case CachedResource::XSLStyleSheet:
if (!m_document->securityOrigin()->canRequest(url)) {
@@ -347,6 +358,9 @@
if (!m_document->contentSecurityPolicy()->allowStyleFromSource(url))
return false;
break;
+#if ENABLE(SVG)
+ case CachedResource::SVGDocumentResource:
+#endif
case CachedResource::ImageResource:
if (!m_document->contentSecurityPolicy()->allowImageFromSource(url))
return false;
Added: trunk/Source/WebCore/loader/cache/CachedSVGDocument.cpp (0 => 108785)
--- trunk/Source/WebCore/loader/cache/CachedSVGDocument.cpp (rev 0)
+++ trunk/Source/WebCore/loader/cache/CachedSVGDocument.cpp 2012-02-24 14:31:59 UTC (rev 108785)
@@ -0,0 +1,77 @@
+/*
+ Copyright (C) 2010 Rob Buis <[email protected]>
+ Copyright (C) 2011 Cosmin Truta <[email protected]>
+ Copyright (C) 2012 University of Szeged
+ Copyright (C) 2012 Renata Hodovan <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "CachedSVGDocument.h"
+
+#include "CachedResourceClient.h"
+#include "CachedResourceHandle.h"
+#include "SharedBuffer.h"
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+CachedSVGDocument::CachedSVGDocument(const ResourceRequest& request)
+ : CachedResource(request, SVGDocumentResource)
+ , m_decoder(TextResourceDecoder::create("application/xml"))
+{
+ setAccept("image/svg+xml");
+}
+
+CachedSVGDocument::~CachedSVGDocument()
+{
+}
+
+void CachedSVGDocument::setEncoding(const String& chs)
+{
+ m_decoder->setEncoding(chs, TextResourceDecoder::EncodingFromHTTPHeader);
+}
+
+String CachedSVGDocument::encoding() const
+{
+ return m_decoder->encoding().name();
+}
+
+void CachedSVGDocument::data(PassRefPtr<SharedBuffer> data, bool allDataReceived)
+{
+ if (!allDataReceived)
+ return;
+
+ 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());
+ }
+
+ setLoading(false);
+ checkNotify();
+}
+
+}
+
+#endif
+
Property changes on: trunk/Source/WebCore/loader/cache/CachedSVGDocument.cpp
___________________________________________________________________
Added: svn:executable
Added: svn:eol-style
Added: trunk/Source/WebCore/loader/cache/CachedSVGDocument.h (0 => 108785)
--- trunk/Source/WebCore/loader/cache/CachedSVGDocument.h (rev 0)
+++ trunk/Source/WebCore/loader/cache/CachedSVGDocument.h 2012-02-24 14:31:59 UTC (rev 108785)
@@ -0,0 +1,62 @@
+/*
+ Copyright (C) 2010 Rob Buis <[email protected]>
+ Copyright (C) 2011 Cosmin Truta <[email protected]>
+ Copyright (C) 2012 University of Szeged
+ Copyright (C) 2012 Renata Hodovan <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef CachedSVGDocument_h
+#define CachedSVGDocument_h
+
+#if ENABLE(SVG)
+#include "CachedResource.h"
+#include "CachedResourceClient.h"
+#include "CachedResourceHandle.h"
+#include "SVGDocument.h"
+#include "TextResourceDecoder.h"
+
+namespace WebCore {
+
+class CachedSVGDocument : public CachedResource {
+public:
+ explicit CachedSVGDocument(const ResourceRequest&);
+ virtual ~CachedSVGDocument();
+
+ SVGDocument* document() const { return m_document.get(); }
+
+ virtual void setEncoding(const String&);
+ virtual String encoding() const;
+ virtual void data(PassRefPtr<SharedBuffer> data, bool allDataReceived);
+
+protected:
+ RefPtr<SVGDocument> m_document;
+ RefPtr<TextResourceDecoder> m_decoder;
+};
+
+class CachedSVGDocumentClient : public CachedResourceClient {
+public:
+ virtual ~CachedSVGDocumentClient() { }
+ static CachedResourceClientType expectedType() { return SVGDocumentType; }
+ virtual CachedResourceClientType resourceClientType() { return expectedType(); }
+};
+
+}
+
+#endif
+
+#endif // CachedSVGDocument_h
Property changes on: trunk/Source/WebCore/loader/cache/CachedSVGDocument.h
___________________________________________________________________
Added: svn:executable