Diff
Modified: trunk/LayoutTests/ChangeLog (153875 => 153876)
--- trunk/LayoutTests/ChangeLog 2013-08-09 02:40:10 UTC (rev 153875)
+++ trunk/LayoutTests/ChangeLog 2013-08-09 06:39:52 UTC (rev 153876)
@@ -1,3 +1,26 @@
+2013-08-08 Timothy Hatcher <[email protected]>
+
+ Allow SVG images to be drawn into canvas without tainting.
+ https://bugs.webkit.org/show_bug.cgi?id=119492
+
+ Reviewed by Darin Adler.
+
+ * fast/canvas/svg-taint-expected.txt: Removed.
+ * fast/canvas/svg-taint.html: Removed. Obsolete.
+ * http/tests/security/canvas-remote-read-data-url-svg-image-expected.txt: Removed.
+ * http/tests/security/canvas-remote-read-data-url-svg-image.html: Removed. Obsolete.
+ * http/tests/security/canvas-remote-read-svg-image-expected.txt: Removed.
+ * http/tests/security/canvas-remote-read-svg-image.html: Removed. Obsolete.
+ * svg/as-image/resources/link-xhtml-svg.svg: Added.
+ * svg/as-image/resources/link-xhtml.svg: Added.
+ * svg/as-image/resources/link.svg: Added.
+ * svg/as-image/svg-canvas-link-not-colored-expected.txt: Added.
+ * svg/as-image/svg-canvas-link-not-colored.html: Added.
+ * svg/as-image/svg-canvas-not-tainted-expected.txt: Added.
+ * svg/as-image/svg-canvas-not-tainted.html: Added.
+ * svg/as-image/svg-canvas-xhtml-tainted-expected.txt: Added.
+ * svg/as-image/svg-canvas-xhtml-tainted.html: Added.
+
2013-08-08 Commit Queue <[email protected]>
Unreviewed, rolling out r153847.
Deleted: trunk/LayoutTests/fast/canvas/svg-taint-expected.txt (153875 => 153876)
--- trunk/LayoutTests/fast/canvas/svg-taint-expected.txt 2013-08-09 02:40:10 UTC (rev 153875)
+++ trunk/LayoutTests/fast/canvas/svg-taint-expected.txt 2013-08-09 06:39:52 UTC (rev 153876)
@@ -1,7 +0,0 @@
-CONSOLE MESSAGE: Unable to get image data from canvas because the canvas has been tainted by cross-origin data.
-Let's check that rendering an SVG pattern to a canvas taints it!
-See https://bugs.webkit.org/show_bug.cgi?id=36838
-
-Starting...
-Exception: SecurityError
-
Deleted: trunk/LayoutTests/fast/canvas/svg-taint.html (153875 => 153876)
--- trunk/LayoutTests/fast/canvas/svg-taint.html 2013-08-09 02:40:10 UTC (rev 153875)
+++ trunk/LayoutTests/fast/canvas/svg-taint.html 2013-08-09 06:39:52 UTC (rev 153876)
@@ -1,46 +0,0 @@
-<html>
-<head>
-<script>
-if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.waitUntilDone();
-}
-
-function log(message) {
- var console = document.getElementById('log');
- console.appendChild(document.createTextNode(message));
- console.appendChild(document.createElement('br'));
-}
-
-function loaded() {
- var canvas = document.getElementById('canvas');
- var ctx = canvas.getContext("2d");
- var img = document.getElementById('img');
- log('Starting...');
-
- // This should taint the canvas by rendering an SVG on to it via the pattern
- // route.
- var p = ctx.createPattern(img, 'repeat');
- ctx.fillStyle = p;
- ctx.fillRect(0, 0, 100, 100);
-
- try {
- // This should fail as the canvas should be tainted.
- var data = "" 0, 10, 10);
- log('Oh dear -- missing exception!');
- } catch (e) {
- log('Exception: ' + e.name);
- if (window.testRunner)
- testRunner.notifyDone();
- }
-}
-</script>
-</head>
-<body>
-Let's check that rendering an SVG pattern to a canvas taints it!
-<p>
-See https://bugs.webkit.org/show_bug.cgi?id=36838
-<div id="log"></div>
-<canvas id="canvas" width="100" height="100"></canvas>
-<img id="img" _onload_="loaded()" src=""
-</body>
Deleted: trunk/LayoutTests/http/tests/security/canvas-remote-read-data-url-svg-image-expected.txt (153875 => 153876)
--- trunk/LayoutTests/http/tests/security/canvas-remote-read-data-url-svg-image-expected.txt 2013-08-09 02:40:10 UTC (rev 153875)
+++ trunk/LayoutTests/http/tests/security/canvas-remote-read-data-url-svg-image-expected.txt 2013-08-09 06:39:52 UTC (rev 153876)
@@ -1,5 +0,0 @@
-CONSOLE MESSAGE: Unable to get image data from canvas because the canvas has been tainted by cross-origin data.
-This tests that drawing a remote SVG image onto a canvas from a data URL taints the canvas
-
-PASS: getImageData failed. Canvas tainted.
-
Deleted: trunk/LayoutTests/http/tests/security/canvas-remote-read-data-url-svg-image.html (153875 => 153876)
--- trunk/LayoutTests/http/tests/security/canvas-remote-read-data-url-svg-image.html 2013-08-09 02:40:10 UTC (rev 153875)
+++ trunk/LayoutTests/http/tests/security/canvas-remote-read-data-url-svg-image.html 2013-08-09 06:39:52 UTC (rev 153876)
@@ -1,40 +0,0 @@
-<html>
-<head>
-<script>
-if (window.testRunner)
- testRunner.dumpAsText();
-
-function log(msg)
-{
- document.getElementById('console').appendChild(document.createTextNode(msg + "\n"));
-}
-
-function draw()
-{
- var canvas = document.getElementById("canvas");
- var ctx = canvas.getContext("2d");
- ctx.drawImage(document.getElementById("img"), 0, 0);
-
- try {
- var data = "" 20, 290, 75);
- log("FAIL: getImageData succeeded. Canvas not tainted.");
- } catch (e) {
- log("PASS: getImageData failed. Canvas tainted.");
- }
-}
-</script>
-</head>
-<body>
- <p>This tests that drawing a remote SVG image onto a canvas from a data URL
- taints the canvas</p>
- <pre id="console"></pre>
- <canvas id="canvas" width="330" height="115"></canvas>
- <img id="img" _onload_="draw()" src=''>
-</body>
-</html>
Deleted: trunk/LayoutTests/http/tests/security/canvas-remote-read-svg-image-expected.txt (153875 => 153876)
--- trunk/LayoutTests/http/tests/security/canvas-remote-read-svg-image-expected.txt 2013-08-09 02:40:10 UTC (rev 153875)
+++ trunk/LayoutTests/http/tests/security/canvas-remote-read-svg-image-expected.txt 2013-08-09 06:39:52 UTC (rev 153876)
@@ -1,5 +0,0 @@
-CONSOLE MESSAGE: Unable to get image data from canvas because the canvas has been tainted by cross-origin data.
-This tests that drawing a SVG image to a canvas taints the canvas
-
-PASS: getImageData failed. Canvas tainted.
-
Deleted: trunk/LayoutTests/http/tests/security/canvas-remote-read-svg-image.html (153875 => 153876)
--- trunk/LayoutTests/http/tests/security/canvas-remote-read-svg-image.html 2013-08-09 02:40:10 UTC (rev 153875)
+++ trunk/LayoutTests/http/tests/security/canvas-remote-read-svg-image.html 2013-08-09 06:39:52 UTC (rev 153876)
@@ -1,33 +0,0 @@
-<html>
-<head>
-<script>
-if (window.testRunner)
- testRunner.dumpAsText();
-
-function log(msg)
-{
- document.getElementById('console').appendChild(document.createTextNode(msg + "\n"));
-}
-
-function draw()
-{
- var canvas = document.getElementById("canvas");
- var ctx = canvas.getContext("2d");
- ctx.drawImage(document.getElementById("img"), 0, 0);
-
- try {
- var data = "" 20, 290, 75);
- log("FAIL: getImageData succeeded. Canvas not tainted.");
- } catch (e) {
- log("PASS: getImageData failed. Canvas tainted.");
- }
-}
-</script>
-</head>
-<body>
- <p>This tests that drawing a SVG image to a canvas taints the canvas</p>
- <pre id="console"></pre>
- <canvas id="canvas" width="330" height="115"></canvas>
- <img id="img" _onload_="draw()" src=""
-</body>
-</html>
Added: trunk/LayoutTests/svg/as-image/resources/link-xhtml.svg (0 => 153876)
--- trunk/LayoutTests/svg/as-image/resources/link-xhtml.svg (rev 0)
+++ trunk/LayoutTests/svg/as-image/resources/link-xhtml.svg 2013-08-09 06:39:52 UTC (rev 153876)
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xhtml="http://www.w3.org/1999/xhtml" viewBox="0 0 100 100">
+ <foreignObject width="100" height="100">
+ <style>a div { background-color: green; width: 100px; height: 100px } a:link div, a:visited div { background-color: red }</style>
+ <xhtml:a href=""
+ </foreignObject>
+</svg>
Added: trunk/LayoutTests/svg/as-image/resources/link.svg (0 => 153876)
--- trunk/LayoutTests/svg/as-image/resources/link.svg (rev 0)
+++ trunk/LayoutTests/svg/as-image/resources/link.svg 2013-08-09 06:39:52 UTC (rev 153876)
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100">
+ <style>a rect { fill: green } a:link rect, a:visited rect { fill: red }</style>
+ <a xlink:href=""
+ <rect x="0" y="0" width="100" height="100"/>
+ </a>
+</svg>
Added: trunk/LayoutTests/svg/as-image/svg-canvas-link-not-colored-expected.txt (0 => 153876)
--- trunk/LayoutTests/svg/as-image/svg-canvas-link-not-colored-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-canvas-link-not-colored-expected.txt 2013-08-09 06:39:52 UTC (rev 153876)
@@ -0,0 +1,7 @@
+PASS window.colorChannels[0] is 0
+PASS window.colorChannels[1] is 0
+PASS window.colorChannels[2] is 0
+PASS window.colorChannels[0] is 0
+PASS window.colorChannels[1] is 128
+PASS window.colorChannels[2] is 0
+
Added: trunk/LayoutTests/svg/as-image/svg-canvas-link-not-colored.html (0 => 153876)
--- trunk/LayoutTests/svg/as-image/svg-canvas-link-not-colored.html (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-canvas-link-not-colored.html 2013-08-09 06:39:52 UTC (rev 153876)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+</head>
+<body>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ var svg = new Image();
+ svg.src = ""
+
+ svg._onload_ = function() {
+ var canvas = document.createElement("canvas");
+ var ctx = canvas.getContext("2d");
+
+ window.colorChannels = ctx.getImageData(0, 0, 1, 1).data;
+
+ shouldBe("window.colorChannels[0]", "0");
+ shouldBe("window.colorChannels[1]", "0");
+ shouldBe("window.colorChannels[2]", "0");
+
+ ctx.drawImage(svg, 0, 0);
+
+ window.colorChannels = ctx.getImageData(0, 0, 1, 1).data;
+
+ shouldBe("window.colorChannels[0]", "0");
+ shouldBe("window.colorChannels[1]", "128");
+ shouldBe("window.colorChannels[2]", "0");
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+ };
+ </script>
+</body>
+</html>
Added: trunk/LayoutTests/svg/as-image/svg-canvas-not-tainted-expected.txt (0 => 153876)
--- trunk/LayoutTests/svg/as-image/svg-canvas-not-tainted-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-canvas-not-tainted-expected.txt 2013-08-09 06:39:52 UTC (rev 153876)
@@ -0,0 +1,3 @@
+This test passes if there is a green box and no security errors.
+
+
Added: trunk/LayoutTests/svg/as-image/svg-canvas-not-tainted.html (0 => 153876)
--- trunk/LayoutTests/svg/as-image/svg-canvas-not-tainted.html (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-canvas-not-tainted.html 2013-08-09 06:39:52 UTC (rev 153876)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<body>
+ This test passes if there is a green box and no security errors.<br><br>
+ <canvas id="canvas" width="100" height="100"></canvas>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ var svg = new Image();
+ svg.src = ""
+
+ svg._onload_ = function() {
+ var canvas = document.getElementById("canvas");
+ var ctx = canvas.getContext("2d");
+
+ ctx.drawImage(svg, 0, 0);
+ ctx.getImageData(0, 0, 100, 100);
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+ };
+ </script>
+</body>
+</html>
Copied: trunk/LayoutTests/svg/as-image/svg-canvas-xhtml-tainted-expected.txt (from rev 153875, trunk/LayoutTests/http/tests/security/canvas-remote-read-svg-image-expected.txt) (0 => 153876)
--- trunk/LayoutTests/svg/as-image/svg-canvas-xhtml-tainted-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-canvas-xhtml-tainted-expected.txt 2013-08-09 06:39:52 UTC (rev 153876)
@@ -0,0 +1,3 @@
+CONSOLE MESSAGE: Unable to get image data from canvas because the canvas has been tainted by cross-origin data.
+PASS window.ctx.getImageData(0, 0, 1, 1) threw exception Error: SecurityError: DOM Exception 18.
+
Added: trunk/LayoutTests/svg/as-image/svg-canvas-xhtml-tainted.html (0 => 153876)
--- trunk/LayoutTests/svg/as-image/svg-canvas-xhtml-tainted.html (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-canvas-xhtml-tainted.html 2013-08-09 06:39:52 UTC (rev 153876)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+</head>
+<body>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ var svg = new Image();
+ svg.src = ""
+
+ svg._onload_ = function() {
+ var canvas = document.createElement("canvas");
+ window.ctx = canvas.getContext("2d");
+
+ ctx.getImageData(0, 0, 1, 1);
+
+ ctx.drawImage(svg, 0, 0);
+
+ shouldThrow("window.ctx.getImageData(0, 0, 1, 1)");
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+ };
+ </script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (153875 => 153876)
--- trunk/Source/WebCore/ChangeLog 2013-08-09 02:40:10 UTC (rev 153875)
+++ trunk/Source/WebCore/ChangeLog 2013-08-09 06:39:52 UTC (rev 153876)
@@ -1,3 +1,29 @@
+2013-08-08 Timothy Hatcher <[email protected]>
+
+ Allow SVG images to be drawn into canvas without tainting.
+ https://bugs.webkit.org/show_bug.cgi?id=119492
+
+ Reviewed by Darin Adler.
+
+ Tests: svg/as-image/svg-canvas-not-tainted.html
+ svg/as-image/svg-canvas-link-not-colored.html
+ svg/as-image/svg-canvas-xhtml-tainted.html
+
+ * html/HTMLAnchorElement.cpp:
+ (WebCore::HTMLAnchorElement::parseAttribute): Call shouldProhibitLinks.
+ (WebCore::shouldProhibitLinks): Added.
+ * html/HTMLAnchorElement.h:
+ * html/HTMLImageElement.cpp:
+ (WebCore::HTMLImageElement::parseAttribute): Call shouldProhibitLinks.
+ * rendering/svg/RenderSVGRoot.cpp:
+ (WebCore::RenderSVGRoot::isEmbeddedThroughSVGImage): Use isInSVGImage.
+ * svg/SVGAElement.cpp:
+ (WebCore::SVGAElement::svgAttributeChanged): Call shouldProhibitLinks.
+ * svg/graphics/SVGImage.cpp:
+ (WebCore::SVGImage::hasSingleSecurityOrigin): Added.
+ (WebCore::isInSVGImage): Added.
+ * svg/graphics/SVGImage.h:
+
2013-08-08 Simon Fraser <[email protected]>
Fix ASSERT(m_contentsSolidColor.isValid()) assertion on iOS at nytimes.com
Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (153875 => 153876)
--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2013-08-09 02:40:10 UTC (rev 153875)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2013-08-09 06:39:52 UTC (rev 153876)
@@ -42,6 +42,7 @@
#include "PlatformMouseEvent.h"
#include "RenderImage.h"
#include "ResourceRequest.h"
+#include "SVGImage.h"
#include "SecurityOrigin.h"
#include "SecurityPolicy.h"
#include "Settings.h"
@@ -245,7 +246,7 @@
{
if (name == hrefAttr) {
bool wasLink = isLink();
- setIsLink(!value.isNull());
+ setIsLink(!value.isNull() && !shouldProhibitLinks(this));
if (wasLink != isLink())
didAffectSelector(AffectedSelectorLink | AffectedSelectorVisited | AffectedSelectorEnabled);
if (isLink()) {
@@ -599,6 +600,15 @@
return event->type() == eventNames().clickEvent && (!event->isMouseEvent() || static_cast<MouseEvent*>(event)->button() != RightButton);
}
+bool shouldProhibitLinks(Element* element)
+{
+#if ENABLE(SVG)
+ return isInSVGImage(element);
+#else
+ return false;
+#endif
+}
+
bool HTMLAnchorElement::willRespondToMouseClickEvents()
{
return isLink() || HTMLElement::willRespondToMouseClickEvents();
Modified: trunk/Source/WebCore/html/HTMLAnchorElement.h (153875 => 153876)
--- trunk/Source/WebCore/html/HTMLAnchorElement.h 2013-08-09 02:40:10 UTC (rev 153875)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.h 2013-08-09 06:39:52 UTC (rev 153876)
@@ -169,6 +169,7 @@
bool isEnterKeyKeydownEvent(Event*);
bool isLinkClick(Event*);
+bool shouldProhibitLinks(Element*);
} // namespace WebCore
Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (153875 => 153876)
--- trunk/Source/WebCore/html/HTMLImageElement.cpp 2013-08-09 02:40:10 UTC (rev 153875)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp 2013-08-09 06:39:52 UTC (rev 153876)
@@ -29,6 +29,7 @@
#include "CachedImage.h"
#include "EventNames.h"
#include "FrameView.h"
+#include "HTMLAnchorElement.h"
#include "HTMLDocument.h"
#include "HTMLFormElement.h"
#include "HTMLNames.h"
@@ -126,9 +127,8 @@
deviceScaleFactor = page->deviceScaleFactor();
m_bestFitImageURL = bestFitSourceForImageAttributes(deviceScaleFactor, fastGetAttribute(srcAttr), fastGetAttribute(srcsetAttr));
m_imageLoader.updateFromElementIgnoringPreviousError();
- }
- else if (name == usemapAttr)
- setIsLink(!value.isNull());
+ } else if (name == usemapAttr)
+ setIsLink(!value.isNull() && !shouldProhibitLinks(this));
else if (name == onbeforeloadAttr)
setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, name, value));
else if (name == compositeAttr) {
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (153875 => 153876)
--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2013-08-09 02:40:10 UTC (rev 153875)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2013-08-09 06:39:52 UTC (rev 153876)
@@ -38,6 +38,7 @@
#include "RenderSVGResource.h"
#include "RenderSVGResourceContainer.h"
#include "RenderView.h"
+#include "SVGImage.h"
#include "SVGLength.h"
#include "SVGRenderingContext.h"
#include "SVGResources.h"
@@ -124,20 +125,7 @@
{
if (!node())
return false;
-
- Frame* frame = node()->document()->frame();
- if (!frame)
- return false;
-
- // Test whether we're embedded through an img.
- if (!frame->page())
- return false;
-
- ChromeClient* chromeClient = frame->page()->chrome().client();
- if (!chromeClient || !chromeClient->isSVGImageChromeClient())
- return false;
-
- return true;
+ return isInSVGImage(toSVGSVGElement(node()));
}
bool RenderSVGRoot::isEmbeddedThroughFrameContainingSVGDocument() const
Modified: trunk/Source/WebCore/svg/SVGAElement.cpp (153875 => 153876)
--- trunk/Source/WebCore/svg/SVGAElement.cpp 2013-08-09 02:40:10 UTC (rev 153875)
+++ trunk/Source/WebCore/svg/SVGAElement.cpp 2013-08-09 06:39:52 UTC (rev 153876)
@@ -134,8 +134,7 @@
// as none of the other properties changes the linking behaviour for our <a> element.
if (SVGURIReference::isKnownAttribute(attrName)) {
bool wasLink = isLink();
- setIsLink(!href().isNull());
-
+ setIsLink(!href().isNull() && !shouldProhibitLinks(this));
if (wasLink != isLink())
setNeedsStyleRecalc();
}
Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (153875 => 153876)
--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2013-08-09 02:40:10 UTC (rev 153875)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2013-08-09 06:39:52 UTC (rev 153876)
@@ -30,11 +30,13 @@
#if ENABLE(SVG)
#include "SVGImage.h"
+#include "Chrome.h"
#include "DocumentLoader.h"
#include "FrameView.h"
#include "ImageBuffer.h"
#include "ImageObserver.h"
#include "IntRect.h"
+#include "NodeTraversal.h"
#include "RenderSVGRoot.h"
#include "RenderStyle.h"
#include "SVGDocument.h"
@@ -61,6 +63,27 @@
ASSERT(!m_chromeClient || !m_chromeClient->image());
}
+bool SVGImage::hasSingleSecurityOrigin() const
+{
+ if (!m_page)
+ return true;
+
+ Frame* frame = m_page->mainFrame();
+ SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement();
+ if (!rootElement)
+ return true;
+
+ // Don't allow foreignObject elements since they can leak information with arbitrary HTML (like spellcheck or control theme).
+ for (Element* current = ElementTraversal::firstWithin(rootElement); current; current = ElementTraversal::next(current, rootElement)) {
+ if (current->hasTagName(SVGNames::foreignObjectTag))
+ return false;
+ }
+
+ // Because SVG image rendering disallows external resources and links,
+ // these images effectively are restricted to a single security origin.
+ return true;
+}
+
void SVGImage::setContainerSize(const IntSize& size)
{
if (!m_page || !usesContainerSize())
@@ -371,6 +394,18 @@
return "svg";
}
+bool isInSVGImage(const Element* element)
+{
+ ASSERT(element);
+
+ Page* page = element->document()->page();
+ if (!page)
+ return false;
+
+ ChromeClient* chromeClient = page->chrome().client();
+ return chromeClient && chromeClient->isSVGImageChromeClient();
}
+}
+
#endif // ENABLE(SVG)
Modified: trunk/Source/WebCore/svg/graphics/SVGImage.h (153875 => 153876)
--- trunk/Source/WebCore/svg/graphics/SVGImage.h 2013-08-09 02:40:10 UTC (rev 153875)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.h 2013-08-09 06:39:52 UTC (rev 153876)
@@ -33,6 +33,7 @@
namespace WebCore {
+class Element;
class FrameView;
class ImageBuffer;
class Page;
@@ -53,6 +54,8 @@
virtual bool isSVGImage() const { return true; }
virtual IntSize size() const OVERRIDE { return m_intrinsicSize; }
+ virtual bool hasSingleSecurityOrigin() const OVERRIDE;
+
virtual bool hasRelativeWidth() const;
virtual bool hasRelativeHeight() const;
@@ -97,6 +100,9 @@
OwnPtr<Page> m_page;
IntSize m_intrinsicSize;
};
+
+bool isInSVGImage(const Element*);
+
}
#endif // ENABLE(SVG)