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

Unified Diff: Source/core/svg/SVGAElement.cpp

Issue 166163005: [SVG2] Add tabindex handling in svg. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: make SVGElement::supportsFocus return false Created 6 years, 8 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
« no previous file with comments | « Source/core/svg/SVGAElement.h ('k') | Source/core/svg/SVGCircleElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGAElement.cpp
diff --git a/Source/core/svg/SVGAElement.cpp b/Source/core/svg/SVGAElement.cpp
index e6a8c9140fec01ee8cd2ba6d78cb5e940960b1d3..c8facc77c3d3c03304473c1cf1bf75188ce0faad 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() || Element::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();
fs 2014/04/29 12:30:16 Nit: Element::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()
« no previous file with comments | « Source/core/svg/SVGAElement.h ('k') | Source/core/svg/SVGCircleElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698