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

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: De-duplicate using FocusController; update TestExpectations 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
Index: Source/core/html/HTMLAnchorElement.cpp
diff --git a/Source/core/html/HTMLAnchorElement.cpp b/Source/core/html/HTMLAnchorElement.cpp
index 8aa7f7eac91f6f2094d75822d3579fb6c6128a9e..b1696b2b0e88eff47c06350936111c0381641f38 100644
--- a/Source/core/html/HTMLAnchorElement.cpp
+++ b/Source/core/html/HTMLAnchorElement.cpp
@@ -43,6 +43,8 @@
#include "core/loader/PingLoader.h"
#include "core/page/Chrome.h"
#include "core/page/ChromeClient.h"
+#include "core/page/FocusController.h"
+#include "core/page/Page.h"
#include "core/rendering/RenderImage.h"
#include "platform/PlatformMouseEvent.h"
#include "platform/network/DNS.h"
@@ -84,12 +86,16 @@ bool HTMLAnchorElement::supportsFocus() const
return isLink() || HTMLElement::supportsFocus();
}
+bool HTMLAnchorElement::shouldHaveFocusAppearance() const
+{
+ ASSERT(focused());
+ return !document().page()->focusController().wasFocusedByMouse() || HTMLElement::supportsFocus();
Xianzhu 2014/08/12 03:58:01 The above code will have side-effect. For example:
Xianzhu 2014/08/12 04:01:11 s/agile/fragile/ ..
robwu 2014/08/12 14:27:49 What is "outline-style:auto" supposed to do when a
Xianzhu 2014/08/12 16:03:07 I think 'outline-style:auto' was first introduced
Xianzhu 2014/08/14 19:12:49 I no longer insist the pseudo-class method. The cu
robwu 2014/08/15 22:51:33 Great. Anything else besides that?
+}
+
bool HTMLAnchorElement::isMouseFocusable() const
{
- // Links are focusable by default, but only allow links with tabindex or contenteditable to be mouse focusable.
pdr. 2014/08/12 02:02:22 Both here and in SVGAElement we're removing this c
robwu 2014/08/12 14:27:49 LayoutTests/fast/events/click-focus-anchor.html al
- // https://bugs.webkit.org/show_bug.cgi?id=26856
if (isLink())
- return HTMLElement::supportsFocus();
+ return supportsFocus();
return HTMLElement::isMouseFocusable();
}

Powered by Google App Engine
This is Rietveld 408576698