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

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

Issue 619613005: The link should be activated by enter key on focusing the child element inside the anchor(relanding) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 6163eb8b78e9ea16c135f1376c4bdef04ce13e84..7736b8d1ba8b54d8ba0141d8805bba213a046f91 100644
--- a/Source/core/html/HTMLAnchorElement.cpp
+++ b/Source/core/html/HTMLAnchorElement.cpp
@@ -147,8 +147,11 @@ static void appendServerMapMousePosition(StringBuilder& url, Event* event)
void HTMLAnchorElement::defaultEventHandler(Event* event)
{
- if (isLink()) {
- if (focused() && isEnterKeyKeydownEvent(event) && isLiveLink()) {
+ if (isLiveLink()) {
+ ASSERT(event->target());
+ Node* target = event->target()->toNode();
+ ASSERT(target);
+ if ((focused() || target->focused()) && isEnterKeyKeypressEvent(event)) {
robwu 2014/10/13 09:19:48 Don't forget to update similar code in src/third_p
Miyoung Shin(g) 2014/10/13 11:05:01 Sure, I remember it. But I mentioned earlier, I ho
robwu 2014/10/13 11:29:33 There is some duplicate logic in the implementatio
event->setDefaultHandled();
dispatchSimulatedClick(event);
return;
@@ -357,6 +360,11 @@ void HTMLAnchorElement::handleClick(Event* event)
}
}
+bool isEnterKeyKeypressEvent(Event* event)
+{
+ return event->type() == EventTypeNames::keypress && event->isKeyboardEvent() && toKeyboardEvent(event)->keyIdentifier() == "Enter";
+}
+
bool isEnterKeyKeydownEvent(Event* event)
robwu 2014/10/13 09:19:48 And remove this method declaration (and its defeni
Miyoung Shin(g) 2014/10/13 11:05:01 Sure, I remember it as well. After checking SVG is
{
return event->type() == EventTypeNames::keydown && event->isKeyboardEvent() && toKeyboardEvent(event)->keyIdentifier() == "Enter";

Powered by Google App Engine
This is Rietveld 408576698