Diff
Modified: trunk/LayoutTests/ChangeLog (179625 => 179626)
--- trunk/LayoutTests/ChangeLog 2015-02-04 20:51:29 UTC (rev 179625)
+++ trunk/LayoutTests/ChangeLog 2015-02-04 20:55:21 UTC (rev 179626)
@@ -1,3 +1,42 @@
+2015-02-04 Said Abou-Hallawa <[email protected]>
+
+ When using SVG as an image, we should load datauri images when these images are not in the image cache.
+ https://bugs.webkit.org/show_bug.cgi?id=99677.
+
+ Reviewed by Darin Adler.
+
+ * svg/as-image/resources/image-with-nested-data-uri-images.svg: Added.
+ This SVG has a tree of depth = 5 of nested data URI images. All the data URI images are
+ SVG images expect the innermost one which is a png data URI image.
+
+ * svg/as-image/resources/image-with-nested-rects.svg: Added.
+ This SVG produces the same drawing as image-with-nested-data-uri-images.svg does but
+ it uses <rect> SVG elements instead.
+
+ * svg/as-image/svg-image-with-data-uri-background-expected.html: Added.
+ * svg/as-image/svg-image-with-data-uri-background.html: Added.
+ Test the data URI SVG as a css background image.
+
+ * svg/as-image/svg-image-with-data-uri-from-canvas-expected.html: Added.
+ * svg/as-image/svg-image-with-data-uri-from-canvas.html: Added.
+ Test the data URI image when it is the result of drawing an SVG image on a canvas object.
+
+ * svg/as-image/svg-image-with-data-uri-images-disabled-expected.html: Added.
+ * svg/as-image/svg-image-with-data-uri-images-disabled.html: Added.
+ Ensure the data uri images are not loaded if imagesEnabled is turned off.
+
+ * svg/as-image/svg-image-with-data-uri-reloading-expected.html: Added.
+ * svg/as-image/svg-image-with-data-uri-reloading.html: Added.
+ Test the data URI SVG when reloading the page.
+
+ * svg/as-image/svg-image-with-data-uri-use-data-uri-expected.svg: Added.
+ * svg/as-image/svg-image-with-data-uri-use-data-uri.svg: Added.
+ Test the data URI image when it is referenced from an SVG <use> tag.
+
+ * svg/as-image/svg-image-with-svg-data-uri-expected.html: Added.
+ * svg/as-image/svg-image-with-svg-data-uri.html: Added.
+ Test the data URI image when it is referenced from an HTML <img> tag.
+
2015-02-04 Zalan Bujtas <[email protected]>
[Mac] Unreviewed gardening.
Added: trunk/LayoutTests/svg/as-image/resources/image-with-nested-data-uri-images.svg (0 => 179626)
--- trunk/LayoutTests/svg/as-image/resources/image-with-nested-data-uri-images.svg (rev 0)
+++ trunk/LayoutTests/svg/as-image/resources/image-with-nested-data-uri-images.svg 2015-02-04 20:55:21 UTC (rev 179626)
@@ -0,0 +1,63 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200">
+ <defs>
+ <g id="nested-images">
+ <rect x="20" y="20" width="100%" height="100%" fill="red"/>
+ <image x="20" y="20" width="100%" height="100%"
+ xlink:href=""
+ PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRw
+ Oi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwJSIg
+ aGVpZ2h0PSIxMDAlIiBmaWxsPSJMaWdodFNlYUdyZWVuIi8+PHJlY3QgeD0iMjAiIHk9IjIwIiB3
+ aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJyZWQiLz48aW1hZ2UgeD0iMjAiIHk9IjIw
+ IiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bGluazpocmVmPSJkYXRhOmltYWdlL3N2Zyt4
+ bWw7YmFzZTY0LFBITjJaeUI0Yld4dWN6MGlhSFIwY0RvdkwzZDNkeTUzTXk1dmNtY3ZNakF3TUM5
+ emRtY2lJSGh0Ykc1ek9uaHNhVzVyUFNKb2RIUncNCk9pOHZkM2QzTG5jekxtOXlaeTh4T1RrNUwz
+ aHNhVzVySWo0OGNtVmpkQ0I0UFNJd0lpQjVQU0l3SWlCM2FXUjBhRDBpTVRBd0pTSWcNCmFHVnBa
+ MmgwUFNJeE1EQWxJaUJtYVd4c1BTSm5jbVZsYmlJdlBqeHlaV04wSUhnOUlqSXdJaUI1U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2hoUm05NVZsTjANClVW
+ RjZiRFphUnpGcVN6QlNVbUl3TlVSYWVqQTVEUXBKYWpRNFRESnNkRmxYWkd4UWFuZDJZek5hYmxC
+ blBUMGlQand2YVcxaFoyVSsNClBDOXpkbWMrIj48L2ltYWdlPjwvc3ZnPg==">
+ </image>
+ </g>
+ </defs>
+ <rect x="0" y="0" width="100%" height="100%" fill="DarkGreen"/>
+ <use xlink:href=''/>
+</svg>
Added: trunk/LayoutTests/svg/as-image/resources/image-with-nested-rects.svg (0 => 179626)
--- trunk/LayoutTests/svg/as-image/resources/image-with-nested-rects.svg (rev 0)
+++ trunk/LayoutTests/svg/as-image/resources/image-with-nested-rects.svg 2015-02-04 20:55:21 UTC (rev 179626)
@@ -0,0 +1,18 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200">
+ <rect x="0" y="0" width="100%" height="100%" fill="DarkGreen"/>
+ <g transform="translate(20,20)">
+ <rect x="0" y="0" width="100%" height="100%" fill="LightSeaGreen"/>
+ <g transform="translate(20,20)">
+ <rect x="0" y="0" width="100%" height="100%" fill="Green"/>
+ <g transform="translate(20,20)">
+ <rect x="0" y="0" width="100%" height="100%" fill="LightGreen"/>
+ <g transform="translate(20,20)">
+ <rect x="0" y="0" width="100%" height="100%" fill="LimeGreen"/>
+ <g transform="translate(20,20)">
+ <rect x="0" y="0" width="100%" height="100%" fill="Lime"/>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg>
Added: trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-background-expected.html (0 => 179626)
--- trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-background-expected.html (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-background-expected.html 2015-02-04 20:55:21 UTC (rev 179626)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ div {
+ width: 200px;
+ height: 200px;
+ background-color:red;
+ background-image:url("resources/image-with-nested-rects.svg");
+ }
+ </style>
+</head>
+<body>
+ <div></div>
+</body>
+</html>
Added: trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-background.html (0 => 179626)
--- trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-background.html (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-background.html 2015-02-04 20:55:21 UTC (rev 179626)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ div {
+ width: 200px;
+ height: 200px;
+ background-color:red;
+ background-image:url("resources/image-with-nested-data-uri-images.svg");
+ }
+ </style>
+</head>
+<body>
+ <div>
+ </div>
+ <script>
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ // window load event fires when the the page and its resources are loaded.
+ // However it does not wait till the sub-resources are loaded. And this is
+ // why we need to wait a little bit before we call notifyDone().
+ window.addEventListener("load", function() {
+ setTimeout(function () {
+ testRunner.notifyDone();
+ }, 200);
+ });
+ }
+ </script>
+</body>
+</html>
Added: trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-from-canvas-expected.html (0 => 179626)
--- trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-from-canvas-expected.html (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-from-canvas-expected.html 2015-02-04 20:55:21 UTC (rev 179626)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ img {
+ width: 200px;
+ height: 200px;
+ background-color: red;
+ }
+ </style>
+</head>
+<body>
+ <img src=""
+</body>
+</html>
Added: trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-from-canvas.html (0 => 179626)
--- trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-from-canvas.html (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-from-canvas.html 2015-02-04 20:55:21 UTC (rev 179626)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ img {
+ width: 200px;
+ height: 200px;
+ background-color: red;
+ }
+ </style>
+</head>
+<body>
+ <img id="container" src=""
+ <script>
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+
+ var canvas = document.createElement('canvas');
+ canvas.width = 200;
+ canvas.height = 200;
+ var context = canvas.getContext('2d');
+
+ context.fillStyle = "red";
+ context.fillRect(0, 0, canvas.width, canvas.height);
+
+ var image = new Image();
+ image.src = ""
+
+ // We need to wait till the image is loaded.
+ image._onload_ = function() {
+ // But we need to wait a little more till its sub-resources are loaded
+ setTimeout(function () {
+ context.drawImage(image, 0, 0, canvas.width, canvas.height);
+ var img = document.getElementById("container");
+ img.src = ""
+ var forceLayout = document.body.offsetWidth;
+ // Then we need to wait a litlle more till the page layout is complete
+ setTimeout(function () {
+ testRunner.notifyDone();
+ }, 200);
+ }, 200);
+ }
+ </script>
+</body>
+</html>
Added: trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-images-disabled-expected.html (0 => 179626)
--- trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-images-disabled-expected.html (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-images-disabled-expected.html 2015-02-04 20:55:21 UTC (rev 179626)
@@ -0,0 +1,14 @@
+<html>
+<head>
+ <style>
+ div {
+ width: 200px;
+ height: 200px;
+ background-color: lime;
+ }
+ </style>
+</head>
+<body>
+ <div></div>
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-images-disabled.html (0 => 179626)
--- trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-images-disabled.html (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-images-disabled.html 2015-02-04 20:55:21 UTC (rev 179626)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ div {
+ width: 200px;
+ height: 200px;
+ background-color:lime;
+ }
+ </style>
+ <script>
+ if (window.testRunner) {
+ window.internals.settings.setImagesEnabled(false);
+ testRunner.overridePreference('WebKitDisplayImagesKey', 0);
+ testRunner.queueReload();
+ }
+ </script>
+</head>
+<body>
+ <div>
+ <img src=""
+ </div>
+</body>
+</html>
Added: trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-reloading-expected.html (0 => 179626)
--- trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-reloading-expected.html (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-reloading-expected.html 2015-02-04 20:55:21 UTC (rev 179626)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ img {
+ width: 200px;
+ height: 200px;
+ background-color: red;
+ }
+ </style>
+</head>
+<body>
+ <img src=""
+</body>
+</html>
Added: trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-reloading.html (0 => 179626)
--- trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-reloading.html (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-reloading.html 2015-02-04 20:55:21 UTC (rev 179626)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ img {
+ width: 200px;
+ height: 200px;
+ background-color: red;
+ }
+ </style>
+</head>
+<body>
+ <img src=""
+ <script>
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+
+ window.addEventListener("load", function() {
+ setTimeout(function () {
+ if (location.hash == "") {
+ location.hash = "#reloading";
+ location.reload(true);
+ } else if (location.hash == "#reloading") {
+ location.hash = "#finished";
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+ }, 200);
+ });
+ </script>
+</body>
+</html>
Added: trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-use-data-uri-expected.svg (0 => 179626)
--- trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-use-data-uri-expected.svg (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-use-data-uri-expected.svg 2015-02-04 20:55:21 UTC (rev 179626)
@@ -0,0 +1,4 @@
+<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='200' height='200'>
+ <rect x='0' y='0' width='100%' height='100%' fill='red'/>
+ <image x="0" y="0" width="100%" height="100%" xlink:href=""
+</svg>
Added: trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-use-data-uri.svg (0 => 179626)
--- trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-use-data-uri.svg (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-use-data-uri.svg 2015-02-04 20:55:21 UTC (rev 179626)
@@ -0,0 +1,4 @@
+<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='200' height='200'>
+ <rect x='0' y='0' width='100%' height='100%' fill='DarkGreen'/>
+ <use xlink:href=''/>
+</svg>
Added: trunk/LayoutTests/svg/as-image/svg-image-with-svg-data-uri-expected.html (0 => 179626)
--- trunk/LayoutTests/svg/as-image/svg-image-with-svg-data-uri-expected.html (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-image-with-svg-data-uri-expected.html 2015-02-04 20:55:21 UTC (rev 179626)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ img {
+ width: 200px;
+ height: 200px;
+ background-color: red;
+ }
+ </style>
+
+</head>
+<body>
+ <img src=""
+</body>
+</html>
Added: trunk/LayoutTests/svg/as-image/svg-image-with-svg-data-uri.html (0 => 179626)
--- trunk/LayoutTests/svg/as-image/svg-image-with-svg-data-uri.html (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-image-with-svg-data-uri.html 2015-02-04 20:55:21 UTC (rev 179626)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ img {
+ width: 200px;
+ height: 200px;
+ background-color: red;
+ }
+ </style>
+</head>
+<body>
+ <img src=""
+ <script>
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ // window load event fires when the the page and its resources are loaded.
+ // However it does not wait till the sub-resources are loaded. And this is
+ // why we need to wait a little bit before we call notifyDone().
+ window.addEventListener("load", function() {
+ setTimeout(function () {
+ testRunner.notifyDone();
+ }, 200);
+ });
+ }
+ </script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (179625 => 179626)
--- trunk/Source/WebCore/ChangeLog 2015-02-04 20:51:29 UTC (rev 179625)
+++ trunk/Source/WebCore/ChangeLog 2015-02-04 20:55:21 UTC (rev 179626)
@@ -1,3 +1,72 @@
+2015-02-04 Said Abou-Hallawa <[email protected]>
+
+ When using SVG as an image, we should load datauri images when these images are not in the image cache.
+ https://bugs.webkit.org/show_bug.cgi?id=99677.
+
+ Reviewed by Darin Adler.
+
+ Data URI sub-resources are not loaded because the networking context of FrameLoader
+ attached to the SubResourceLoader is set to null. This is done intentionally to
+ disallow any resource from loading external sub-resources. For example if an <img>
+ tag has its 'src' attribute points to an svg file, this svg is not allowed to load
+ an external image through the 'xlink' attribute of an <image> element. This restriction
+ is not valid if the value of the 'xlink' attribute is a data URI. In this case the image
+ should be loaded into memory since there is no network traffic involved. All we need
+ to do is to decode the data part of the URI.
+
+ The fix is to pass the root FrameLoader, which has a valid NetworkingContext, through
+ the FrameLoaderClient, to the ResourceHandle::create() which uses the NetworkingContext
+ to decode the data and fire the load events of the data URI resources.
+
+ Tests: svg/as-image/svg-image-with-data-uri-background.html
+ svg/as-image/svg-image-with-data-uri-from-canvas.html
+ svg/as-image/svg-image-with-data-uri-images-disabled.html
+ svg/as-image/svg-image-with-data-uri-reloading.html
+ svg/as-image/svg-image-with-data-uri-use-data-uri.svg
+ svg/as-image/svg-image-with-svg-data-uri.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ Remove unreferenced header file.
+
+ * loader/FrameLoaderClient.h:
+ Define the null virtual function dataProtocolLoader() which should return the FrameLoader
+ for loading data URI resources.
+
+ * loader/ResourceLoader.cpp:
+ (WebCore::ResourceLoader::start):
+ (WebCore::ResourceLoader::dataProtocolFrameLoader):
+ * loader/ResourceLoader.h:
+ Add ResourceLoader::dataProtocolFrameLoader() which returns the root FrameLoader. The
+ root FrameLoader is used to get a valid NetworkingContext which can be passed to
+ ResourceHandle::create() when url().protocolIsData().
+
+ * loader/cache/CachedImage.cpp:
+ (WebCore::CachedImage::load):
+ (WebCore::CachedImage::finishLoading):
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::shouldPerformImageLoad):
+ (WebCore::CachedResourceLoader::shouldDeferImageLoad):
+ * loader/cache/CachedResourceLoader.h:
+ Allow loading data URI sub-resources as long as loading images is not disabled. Also we
+ need to call setDataProtocolLoader() before calling setData() for the isSVGImage case,
+ setData() will create a page by calling Page::createPageFromBuffer() via SVGImage::dataChanged(),
+ and we need to pass the correct FrameLoaderClient to the created FrameLoader of the main
+ frame of this page.
+
+ * svg/graphics/SVGImage.cpp:
+ (WebCore::SVGImage::SVGImage):
+ (WebCore::SVGImage::dataChanged):
+ * svg/graphics/SVGImage.h:
+ Create a new FrameLoaderClient of type SVGFrameLoaderClient and set it in pageConfiguration
+ which is used when creating the page from the SVG data URI.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * svg/graphics/SVGImageChromeClient.h: Removed.
+ * svg/graphics/SVGImageClients.h: Added.
+ Add a new class SVGImageChromeClient which overrides the function dataProtocolLoader().
+ Rename the header file SVGImageChromeClient.h to be SVGImageClients.h since it now
+ includes the classes SVGImageChromeClient and SVGFrameLoaderClient.
+
2015-02-04 Timothy Horton <[email protected]>
Fix a misplaced include in CaptionUserPreferencesMediaAF
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (179625 => 179626)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-02-04 20:51:29 UTC (rev 179625)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-02-04 20:55:21 UTC (rev 179626)
@@ -4336,7 +4336,6 @@
AAA728F716D1D8BC00D3BBC6 /* WebAccessibilityObjectWrapperIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = AAA728F116D1D8BC00D3BBC6 /* WebAccessibilityObjectWrapperIOS.h */; };
AAA728F816D1D8BC00D3BBC6 /* WebAccessibilityObjectWrapperIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = AAA728F216D1D8BC00D3BBC6 /* WebAccessibilityObjectWrapperIOS.mm */; };
AAA728F916D1D8BC00D3BBC6 /* AXObjectCacheIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = AAA728F316D1D8BC00D3BBC6 /* AXObjectCacheIOS.mm */; };
- AAC08CEF15F933D600F1E188 /* SVGImageChromeClient.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC08CED15F933D600F1E188 /* SVGImageChromeClient.h */; };
AAC08CF315F941FD00F1E188 /* AccessibilitySVGRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC08CF115F941FC00F1E188 /* AccessibilitySVGRoot.h */; };
AAF5B7B71524B6C50004CB49 /* WebSocketFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AAF5B7B11524B4BD0004CB49 /* WebSocketFrame.cpp */; };
AB23A32709BBA7D00067CC53 /* BeforeTextInsertedEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB23A32509BBA7D00067CC53 /* BeforeTextInsertedEvent.cpp */; };
@@ -9221,6 +9220,7 @@
53EF766A16530A61004CBE49 /* SettingsMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsMacros.h; sourceTree = "<group>"; };
550A0BC7085F6039007353D6 /* QualifiedName.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QualifiedName.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+ 55D408F71A7C631800C78450 /* SVGImageClients.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageClients.h; sourceTree = "<group>"; };
57B7919F14C6A62900F202D1 /* ContentDistributor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentDistributor.cpp; sourceTree = "<group>"; };
57B791A014C6A62900F202D1 /* ContentDistributor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentDistributor.h; sourceTree = "<group>"; };
57CF497214EE36D700ECFF14 /* InsertionPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InsertionPoint.cpp; sourceTree = "<group>"; };
@@ -11587,7 +11587,6 @@
AAA728F116D1D8BC00D3BBC6 /* WebAccessibilityObjectWrapperIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAccessibilityObjectWrapperIOS.h; sourceTree = "<group>"; };
AAA728F216D1D8BC00D3BBC6 /* WebAccessibilityObjectWrapperIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebAccessibilityObjectWrapperIOS.mm; sourceTree = "<group>"; };
AAA728F316D1D8BC00D3BBC6 /* AXObjectCacheIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AXObjectCacheIOS.mm; sourceTree = "<group>"; };
- AAC08CED15F933D600F1E188 /* SVGImageChromeClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageChromeClient.h; sourceTree = "<group>"; };
AAC08CF015F941FC00F1E188 /* AccessibilitySVGRoot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilitySVGRoot.cpp; sourceTree = "<group>"; };
AAC08CF115F941FC00F1E188 /* AccessibilitySVGRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilitySVGRoot.h; sourceTree = "<group>"; };
AAE27B7416CBFC0D00623043 /* PlatformSpeechSynthesizerMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformSpeechSynthesizerMock.cpp; sourceTree = "<group>"; };
@@ -20376,7 +20375,7 @@
B255990C0D00D8B900BB825C /* SVGImage.h */,
08F859D21463F9CD0067D933 /* SVGImageCache.cpp */,
08F859D31463F9CD0067D933 /* SVGImageCache.h */,
- AAC08CED15F933D600F1E188 /* SVGImageChromeClient.h */,
+ 55D408F71A7C631800C78450 /* SVGImageClients.h */,
08F859D21463F9CD0067D934 /* SVGImageForContainer.cpp */,
08F859D31463F9CD0067D934 /* SVGImageForContainer.h */,
);
@@ -26343,7 +26342,6 @@
650FBF2B0D9AF047008FC292 /* SVGHKernElement.h in Headers */,
B25599A40D00D8BA00BB825C /* SVGImage.h in Headers */,
08F859D51463F9CD0067D933 /* SVGImageCache.h in Headers */,
- AAC08CEF15F933D600F1E188 /* SVGImageChromeClient.h in Headers */,
B2227A2D0D00BF220071B782 /* SVGImageElement.h in Headers */,
08F859D51463F9CD0067D934 /* SVGImageForContainer.h in Headers */,
B28C6A2A0D00C44800334AA4 /* SVGImageLoader.h in Headers */,
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (179625 => 179626)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2015-02-04 20:51:29 UTC (rev 179625)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2015-02-04 20:55:21 UTC (rev 179626)
@@ -96,7 +96,6 @@
#include "RenderedPosition.h"
#include "SVGDocument.h"
#include "SVGImage.h"
-#include "SVGImageChromeClient.h"
#include "SVGNames.h"
#include "SVGSVGElement.h"
#include "Text.h"
Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (179625 => 179626)
--- trunk/Source/WebCore/loader/FrameLoaderClient.h 2015-02-04 20:51:29 UTC (rev 179625)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h 2015-02-04 20:55:21 UTC (rev 179626)
@@ -332,6 +332,8 @@
// FIXME (bug 116233): We need to get rid of EmptyFrameLoaderClient completely, then this will no longer be needed.
virtual bool isEmptyFrameLoaderClient() { return false; }
+ virtual FrameLoader* dataProtocolLoader() const { return nullptr; }
+
#if USE(QUICK_LOOK)
virtual void didCreateQuickLookHandle(QuickLookHandle&) { }
#endif
Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (179625 => 179626)
--- trunk/Source/WebCore/loader/ResourceLoader.cpp 2015-02-04 20:51:29 UTC (rev 179625)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp 2015-02-04 20:55:21 UTC (rev 179626)
@@ -161,6 +161,7 @@
ASSERT(!m_handle);
ASSERT(!m_request.isNull());
ASSERT(m_deferredRequest.isNull());
+ ASSERT(frameLoader());
#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
if (m_documentLoader->scheduleArchiveLoad(this, m_request))
@@ -175,8 +176,10 @@
return;
}
- if (!m_reachedTerminalState)
- m_handle = ResourceHandle::create(m_frame->loader().networkingContext(), m_request, this, m_defersLoading, m_options.sniffContent() == SniffContent);
+ if (!m_reachedTerminalState) {
+ FrameLoader& loader = m_request.url().protocolIsData() ? dataProtocolFrameLoader() : *frameLoader();
+ m_handle = ResourceHandle::create(loader.networkingContext(), m_request, this, m_defersLoading, m_options.sniffContent() == SniffContent);
+ }
}
void ResourceLoader::setDefersLoading(bool defers)
@@ -200,6 +203,15 @@
return &m_frame->loader();
}
+// This function should only be called when frameLoader() is non-null.
+FrameLoader& ResourceLoader::dataProtocolFrameLoader() const
+{
+ FrameLoader* loader = frameLoader();
+ ASSERT(loader);
+ FrameLoader* dataProtocolLoader = loader->client().dataProtocolLoader();
+ return *(dataProtocolLoader ? dataProtocolLoader : loader);
+}
+
void ResourceLoader::setDataBufferingPolicy(DataBufferingPolicy dataBufferingPolicy)
{
m_options.setDataBufferingPolicy(dataBufferingPolicy);
Modified: trunk/Source/WebCore/loader/ResourceLoader.h (179625 => 179626)
--- trunk/Source/WebCore/loader/ResourceLoader.h 2015-02-04 20:51:29 UTC (rev 179625)
+++ trunk/Source/WebCore/loader/ResourceLoader.h 2015-02-04 20:55:21 UTC (rev 179626)
@@ -71,6 +71,7 @@
#endif
WEBCORE_EXPORT FrameLoader* frameLoader() const;
+ FrameLoader& dataProtocolFrameLoader() const;
DocumentLoader* documentLoader() const { return m_documentLoader.get(); }
WEBCORE_EXPORT const ResourceRequest& originalRequest() const { return m_originalRequest; }
Modified: trunk/Source/WebCore/loader/cache/CachedImage.cpp (179625 => 179626)
--- trunk/Source/WebCore/loader/cache/CachedImage.cpp 2015-02-04 20:51:29 UTC (rev 179625)
+++ trunk/Source/WebCore/loader/cache/CachedImage.cpp 2015-02-04 20:55:21 UTC (rev 179626)
@@ -109,7 +109,7 @@
void CachedImage::load(CachedResourceLoader& cachedResourceLoader, const ResourceLoaderOptions& options)
{
- if (cachedResourceLoader.autoLoadImages())
+ if (cachedResourceLoader.shouldPerformImageLoad(resourceRequest().url()))
CachedResource::load(cachedResourceLoader, options);
else
setLoading(false);
@@ -415,8 +415,11 @@
if (!m_image && data)
createImage();
- if (m_image)
+ if (m_image) {
+ if (m_loader && m_image->isSVGImage())
+ downcast<SVGImage>(*m_image).setDataProtocolLoader(&m_loader->dataProtocolFrameLoader());
m_image->setData(data, true);
+ }
if (!m_image || m_image->isNull()) {
// Image decoding failed; the image data is malformed.
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (179625 => 179626)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2015-02-04 20:51:29 UTC (rev 179625)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2015-02-04 20:55:21 UTC (rev 179626)
@@ -754,9 +754,14 @@
return !m_imagesEnabled;
}
+bool CachedResourceLoader::shouldPerformImageLoad(const URL& url) const
+{
+ return m_autoLoadImages || url.protocolIsData();
+}
+
bool CachedResourceLoader::shouldDeferImageLoad(const URL& url) const
{
- return clientDefersImage(url) || !m_autoLoadImages;
+ return clientDefersImage(url) || !shouldPerformImageLoad(url);
}
void CachedResourceLoader::reloadImagesIfNotDeferred()
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.h (179625 => 179626)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.h 2015-02-04 20:51:29 UTC (rev 179625)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.h 2015-02-04 20:55:21 UTC (rev 179626)
@@ -104,6 +104,7 @@
void setImagesEnabled(bool);
bool shouldDeferImageLoad(const URL&) const;
+ bool shouldPerformImageLoad(const URL&) const;
CachePolicy cachePolicy(CachedResource::Type) const;
Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (179625 => 179626)
--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2015-02-04 20:51:29 UTC (rev 179625)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2015-02-04 20:55:21 UTC (rev 179626)
@@ -31,6 +31,7 @@
#include "Chrome.h"
#include "DocumentLoader.h"
#include "ElementIterator.h"
+#include "FrameLoader.h"
#include "FrameView.h"
#include "ImageBuffer.h"
#include "ImageObserver.h"
@@ -41,7 +42,7 @@
#include "RenderStyle.h"
#include "SVGDocument.h"
#include "SVGForeignObjectElement.h"
-#include "SVGImageChromeClient.h"
+#include "SVGImageClients.h"
#include "SVGSVGElement.h"
#include "Settings.h"
@@ -344,6 +345,9 @@
fillWithEmptyClients(pageConfiguration);
m_chromeClient = std::make_unique<SVGImageChromeClient>(this);
pageConfiguration.chromeClient = m_chromeClient.get();
+ m_loaderClient = std::make_unique<SVGFrameLoaderClient>(m_dataProtocolLoader);
+ pageConfiguration.loaderClientForMainFrame = m_loaderClient.get();
+
bool canHaveScrollbars = false; // SVG Images will always synthesize a viewBox, if it's not available, and thus never see scrollbars.
bool transparent = true; // SVG Images are transparent.
Modified: trunk/Source/WebCore/svg/graphics/SVGImage.h (179625 => 179626)
--- trunk/Source/WebCore/svg/graphics/SVGImage.h 2015-02-04 20:51:29 UTC (rev 179625)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.h 2015-02-04 20:55:21 UTC (rev 179626)
@@ -33,11 +33,13 @@
namespace WebCore {
class Element;
+class FrameLoader;
class FrameView;
class ImageBuffer;
class Page;
class RenderBox;
class SVGSVGElement;
+class SVGFrameLoaderClient;
class SVGImageChromeClient;
class SVGImageForContainer;
@@ -55,6 +57,7 @@
virtual FloatSize size() const override { return m_intrinsicSize; }
void setURL(const URL& url) { m_url = url; }
+ void setDataProtocolLoader(FrameLoader* dataProtocolLoader) { m_dataProtocolLoader = dataProtocolLoader; }
virtual bool hasSingleSecurityOrigin() const override;
@@ -98,10 +101,12 @@
SVGSVGElement* rootElement() const;
+ std::unique_ptr<SVGFrameLoaderClient> m_loaderClient;
std::unique_ptr<SVGImageChromeClient> m_chromeClient;
std::unique_ptr<Page> m_page;
FloatSize m_intrinsicSize;
URL m_url;
+ FrameLoader* m_dataProtocolLoader { nullptr };
};
bool isInSVGImage(const Element*);
Deleted: trunk/Source/WebCore/svg/graphics/SVGImageChromeClient.h (179625 => 179626)
--- trunk/Source/WebCore/svg/graphics/SVGImageChromeClient.h 2015-02-04 20:51:29 UTC (rev 179625)
+++ trunk/Source/WebCore/svg/graphics/SVGImageChromeClient.h 2015-02-04 20:55:21 UTC (rev 179626)
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SVGImageChromeClient_h
-#define SVGImageChromeClient_h
-
-#include "EmptyClients.h"
-
-namespace WebCore {
-
-class SVGImageChromeClient : public EmptyChromeClient {
- WTF_MAKE_NONCOPYABLE(SVGImageChromeClient); WTF_MAKE_FAST_ALLOCATED;
-public:
- SVGImageChromeClient(SVGImage* image)
- : m_image(image)
- {
- }
-
- virtual bool isSVGImageChromeClient() const override { return true; }
- SVGImage* image() const { return m_image; }
-
-private:
- virtual void chromeDestroyed() override
- {
- m_image = 0;
- }
-
- virtual void invalidateContentsAndRootView(const IntRect& r) override
- {
- // If m_image->m_page is null, we're being destructed, don't fire changedInRect() in that case.
- if (m_image && m_image->imageObserver() && m_image->m_page)
- m_image->imageObserver()->changedInRect(m_image, r);
- }
-
- SVGImage* m_image;
-};
-
-inline SVGImageChromeClient* toSVGImageChromeClient(ChromeClient* client)
-{
- ASSERT_WITH_SECURITY_IMPLICATION(!client || client->isSVGImageChromeClient());
- return static_cast<SVGImageChromeClient*>(client);
-}
-
-}
-
-#endif // SVGImageChromeClient_h
Copied: trunk/Source/WebCore/svg/graphics/SVGImageClients.h (from rev 179625, trunk/Source/WebCore/svg/graphics/SVGImageChromeClient.h) (0 => 179626)
--- trunk/Source/WebCore/svg/graphics/SVGImageClients.h (rev 0)
+++ trunk/Source/WebCore/svg/graphics/SVGImageClients.h 2015-02-04 20:55:21 UTC (rev 179626)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SVGImageClients_h
+#define SVGImageClients_h
+
+#include "EmptyClients.h"
+
+namespace WebCore {
+
+class SVGImageChromeClient final : public EmptyChromeClient {
+ WTF_MAKE_NONCOPYABLE(SVGImageChromeClient); WTF_MAKE_FAST_ALLOCATED;
+public:
+ SVGImageChromeClient(SVGImage* image)
+ : m_image(image)
+ {
+ }
+
+ virtual bool isSVGImageChromeClient() const override { return true; }
+ SVGImage* image() const { return m_image; }
+
+private:
+ virtual void chromeDestroyed() override
+ {
+ m_image = nullptr;
+ }
+
+ virtual void invalidateContentsAndRootView(const IntRect& r) override
+ {
+ // If m_image->m_page is null, we're being destructed, don't fire changedInRect() in that case.
+ if (m_image && m_image->imageObserver() && m_image->m_page)
+ m_image->imageObserver()->changedInRect(m_image, r);
+ }
+
+ SVGImage* m_image;
+};
+
+class SVGFrameLoaderClient final : public EmptyFrameLoaderClient {
+public:
+ SVGFrameLoaderClient(FrameLoader* dataProtocolLoader)
+ : m_dataProtocolLoader(dataProtocolLoader)
+ {
+ }
+
+ virtual FrameLoader* dataProtocolLoader() const override { return m_dataProtocolLoader; }
+private:
+ FrameLoader* m_dataProtocolLoader;
+};
+
+}
+
+#endif // SVGImageClients_h