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

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

Issue 455223002: Make anchors mouse-focusable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move m_wasFocusedByMouse into subclasses. Created 6 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
« no previous file with comments | « Source/core/html/HTMLAnchorElement.h ('k') | Source/core/html/HTMLFormControlElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLAnchorElement.cpp
diff --git a/Source/core/html/HTMLAnchorElement.cpp b/Source/core/html/HTMLAnchorElement.cpp
index 8aa7f7eac91f6f2094d75822d3579fb6c6128a9e..fcd81d8c01a7dea5f2b9818188e643d2a231607d 100644
--- a/Source/core/html/HTMLAnchorElement.cpp
+++ b/Source/core/html/HTMLAnchorElement.cpp
@@ -63,6 +63,7 @@ HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tagName, Document& doc
: HTMLElement(tagName, document)
, m_linkRelations(0)
, m_cachedVisitedLinkHash(0)
+ , m_wasFocusedByMouse(false)
{
ScriptWrappable::init(this);
}
@@ -84,12 +85,25 @@ bool HTMLAnchorElement::supportsFocus() const
return isLink() || HTMLElement::supportsFocus();
}
+bool HTMLAnchorElement::shouldHaveFocusAppearance() const
+{
+ return !m_wasFocusedByMouse || HTMLElement::supportsFocus();
+}
+
+bool HTMLAnchorElement::wasFocusedByMouse() const
+{
+ return m_wasFocusedByMouse;
+}
+
+void HTMLAnchorElement::setWasFocusedByMouse(bool wasFocusedByMouse)
+{
+ m_wasFocusedByMouse = wasFocusedByMouse;
+}
+
bool HTMLAnchorElement::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 HTMLElement::supportsFocus();
+ return supportsFocus();
return HTMLElement::isMouseFocusable();
}
« no previous file with comments | « Source/core/html/HTMLAnchorElement.h ('k') | Source/core/html/HTMLFormControlElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698