Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(906)

Unified Diff: Source/core/html/HTMLAnchorElement.cpp

Issue 22604008: Allow SVG images to not taint the canvas with drawImage/drawPattern (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLAnchorElement.cpp
diff --git a/Source/core/html/HTMLAnchorElement.cpp b/Source/core/html/HTMLAnchorElement.cpp
index efbacc2fa6dbdd9eb2523de19850e42628f0004e..61d4ce158e20e0ab81cb483bd34d62b6cc264aba 100644
--- a/Source/core/html/HTMLAnchorElement.cpp
+++ b/Source/core/html/HTMLAnchorElement.cpp
@@ -48,6 +48,7 @@
#include "core/platform/network/DNS.h"
#include "core/platform/network/ResourceRequest.h"
#include "core/rendering/RenderImage.h"
+#include "core/svg/graphics/SVGImage.h"
#include "public/platform/Platform.h"
#include "public/platform/WebPrescientNetworking.h"
#include "public/platform/WebURL.h"
@@ -281,7 +282,7 @@ void HTMLAnchorElement::parseAttribute(const QualifiedName& name, const AtomicSt
{
if (name == hrefAttr) {
bool wasLink = isLink();
- setIsLink(!value.isNull());
+ setIsLink(!value.isNull() && !shouldProhibitLinks(this));
if (wasLink != isLink()) {
didAffectSelector(AffectedSelectorLink | AffectedSelectorVisited | AffectedSelectorEnabled);
if (wasLink && treeScope()->adjustedFocusedElement() == this) {
@@ -649,6 +650,11 @@ bool isLinkClick(Event* event)
return event->type() == eventNames().clickEvent && (!event->isMouseEvent() || toMouseEvent(event)->button() != RightButton);
}
+bool shouldProhibitLinks(Element* element)
+{
+ return SVGImage::isInSVGImage(element);
+}
+
bool HTMLAnchorElement::willRespondToMouseClickEvents()
{
return isLink() || HTMLElement::willRespondToMouseClickEvents();

Powered by Google App Engine
This is Rietveld 408576698