| Index: Source/core/svg/SVGAElement.cpp
|
| diff --git a/Source/core/svg/SVGAElement.cpp b/Source/core/svg/SVGAElement.cpp
|
| index e6a8c9140fec01ee8cd2ba6d78cb5e940960b1d3..dd5a48d13677d4256f2eb18993daa05fcbb871a7 100644
|
| --- a/Source/core/svg/SVGAElement.cpp
|
| +++ b/Source/core/svg/SVGAElement.cpp
|
| @@ -31,6 +31,7 @@
|
| #include "core/dom/Document.h"
|
| #include "core/events/KeyboardEvent.h"
|
| #include "core/events/MouseEvent.h"
|
| +#include "core/frame/FrameHost.h"
|
| #include "core/frame/LocalFrame.h"
|
| #include "core/html/HTMLAnchorElement.h"
|
| #include "core/html/HTMLFormElement.h"
|
| @@ -174,11 +175,18 @@ void SVGAElement::defaultEventHandler(Event* event)
|
| SVGGraphicsElement::defaultEventHandler(event);
|
| }
|
|
|
| +short SVGAElement::tabIndex() const
|
| +{
|
| + // Skip the supportsFocus check in SVGElement.
|
| + return Element::tabIndex();
|
| +}
|
| +
|
| bool SVGAElement::supportsFocus() const
|
| {
|
| if (rendererIsEditable())
|
| return SVGGraphicsElement::supportsFocus();
|
| - return true;
|
| + // If not a link we should still be able to focus the element if it has tabIndex.
|
| + return isLink() || SVGElement::supportsFocus();
|
| }
|
|
|
| bool SVGAElement::isURLAttribute(const Attribute& attribute) const
|
| @@ -188,17 +196,29 @@ bool SVGAElement::isURLAttribute(const Attribute& attribute) const
|
|
|
| bool SVGAElement::isMouseFocusable() const
|
| {
|
| - return false;
|
| + // 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 SVGElement::supportsFocus();
|
| +
|
| + return SVGElement::isMouseFocusable();
|
| }
|
|
|
| bool SVGAElement::isKeyboardFocusable() const
|
| {
|
| - if (!isFocusable())
|
| - return false;
|
| + if (isFocusable() && Element::supportsFocus())
|
| + return SVGElement::isKeyboardFocusable();
|
|
|
| - if (Page* page = document().page())
|
| - return page->chrome().client().tabsToLinks();
|
| - return false;
|
| + if (isLink())
|
| + return document().frameHost()->chrome().client().tabsToLinks();
|
| + return SVGElement::isKeyboardFocusable();
|
| +}
|
| +
|
| +bool SVGAElement::canStartSelection() const
|
| +{
|
| + if (!isLink())
|
| + return SVGElement::canStartSelection();
|
| + return rendererIsEditable();
|
| }
|
|
|
| bool SVGAElement::willRespondToMouseClickEvents()
|
|
|