Index: Source/core/svg/SVGAElement.cpp |
diff --git a/Source/core/svg/SVGAElement.cpp b/Source/core/svg/SVGAElement.cpp |
index 7cb84f81f84681390520a21c97e0d0a3f474d8cf..dba0af195d2baeb4efabb30283cece4e092790e5 100644 |
--- a/Source/core/svg/SVGAElement.cpp |
+++ b/Source/core/svg/SVGAElement.cpp |
@@ -57,6 +57,7 @@ inline SVGAElement::SVGAElement(Document& document) |
: SVGGraphicsElement(SVGNames::aTag, document) |
, SVGURIReference(this) |
, m_svgTarget(SVGAnimatedString::create(this, SVGNames::targetAttr, SVGString::create())) |
+ , m_wasFocusedByMouse(false) |
{ |
ScriptWrappable::init(this); |
addToPropertyMap(m_svgTarget); |
@@ -160,6 +161,28 @@ bool SVGAElement::supportsFocus() const |
return isLink() || Element::supportsFocus(); |
} |
+bool SVGAElement::shouldHaveFocusAppearance() const |
+{ |
+ ASSERT(focused()); |
+ return !m_wasFocusedByMouse || Element::supportsFocus(); |
pdr.
2014/08/10 20:21:52
This should be SVGElement::supportsFocus();
robwu
2014/08/10 23:37:19
Neither of the two, it should be SVGGraphicsElemen
|
+} |
+ |
+void SVGAElement::dispatchFocusEvent(Element* oldFocusedElement, FocusType type) |
+{ |
+ if (type != FocusTypePage) |
+ m_wasFocusedByMouse = type == FocusTypeMouse; |
+ Element::dispatchFocusEvent(oldFocusedElement, type); |
+} |
+ |
+void SVGAElement::willCallDefaultEventHandler(const Event& event) |
+{ |
+ if (!event.isKeyboardEvent() || event.type() != EventTypeNames::keydown) |
+ return; |
+ if (!m_wasFocusedByMouse) |
+ return; |
+ m_wasFocusedByMouse = false; |
+} |
+ |
bool SVGAElement::isURLAttribute(const Attribute& attribute) const |
{ |
return attribute.name().localName() == hrefAttr || SVGGraphicsElement::isURLAttribute(attribute); |
@@ -167,10 +190,8 @@ bool SVGAElement::isURLAttribute(const Attribute& attribute) const |
bool SVGAElement::isMouseFocusable() const |
{ |
- // Links are focusable by default, but only allow links with tabindex or contenteditable to be mouse focusable. |
- // https://bugs.webkit.org/show_bug.cgi?id=26856 |
if (isLink()) |
- return Element::supportsFocus(); |
+ return supportsFocus(); |
return SVGElement::isMouseFocusable(); |
} |