Allow SVG images to be drawn into canvas without tainting.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Aug 2013 06:39:52 +0000 (06:39 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Aug 2013 06:39:52 +0000 (06:39 +0000)
commit8a2247215b82c4e1693f3efe1bb7a2e31ce7c03b
tree5bcde7ec994c9dec2ac220b0925bfe4d5ad8d448
parent82a3a9f1c3517dcd2a33fa35dd0685808b1036d4
Allow SVG images to be drawn into canvas without tainting.
https://bugs.webkit.org/show_bug.cgi?id=119492

Reviewed by Darin Adler.

Source/WebCore:

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:

LayoutTests:

* 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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153876 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/canvas/svg-taint-expected.txt [deleted file]
LayoutTests/fast/canvas/svg-taint.html [deleted file]
LayoutTests/http/tests/security/canvas-remote-read-data-url-svg-image-expected.txt [deleted file]
LayoutTests/http/tests/security/canvas-remote-read-data-url-svg-image.html [deleted file]
LayoutTests/http/tests/security/canvas-remote-read-svg-image.html [deleted file]
LayoutTests/svg/as-image/resources/link-xhtml.svg [new file with mode: 0644]
LayoutTests/svg/as-image/resources/link.svg [new file with mode: 0644]
LayoutTests/svg/as-image/svg-canvas-link-not-colored-expected.txt [new file with mode: 0644]
LayoutTests/svg/as-image/svg-canvas-link-not-colored.html [new file with mode: 0644]
LayoutTests/svg/as-image/svg-canvas-not-tainted-expected.txt [new file with mode: 0644]
LayoutTests/svg/as-image/svg-canvas-not-tainted.html [new file with mode: 0644]
LayoutTests/svg/as-image/svg-canvas-xhtml-tainted-expected.txt [moved from LayoutTests/http/tests/security/canvas-remote-read-svg-image-expected.txt with 50% similarity]
LayoutTests/svg/as-image/svg-canvas-xhtml-tainted.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLAnchorElement.cpp
Source/WebCore/html/HTMLAnchorElement.h
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/rendering/svg/RenderSVGRoot.cpp
Source/WebCore/svg/SVGAElement.cpp
Source/WebCore/svg/graphics/SVGImage.cpp
Source/WebCore/svg/graphics/SVGImage.h