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

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: Rebase Created 6 years, 1 month 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/svg/SVGAElement.cpp » ('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 6163eb8b78e9ea16c135f1376c4bdef04ce13e84..4761a5625df5d6f30a70c18a350b28444e782783 100644
--- a/Source/core/html/HTMLAnchorElement.cpp
+++ b/Source/core/html/HTMLAnchorElement.cpp
@@ -147,14 +147,17 @@ 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)) {
event->setDefaultHandled();
dispatchSimulatedClick(event);
return;
}
- if (isLinkClick(event) && isLiveLink()) {
+ if (isLinkClick(event)) {
handleClick(event);
return;
}
@@ -357,9 +360,9 @@ void HTMLAnchorElement::handleClick(Event* event)
}
}
-bool isEnterKeyKeydownEvent(Event* event)
+bool isEnterKeyKeypressEvent(Event* event)
{
- return event->type() == EventTypeNames::keydown && event->isKeyboardEvent() && toKeyboardEvent(event)->keyIdentifier() == "Enter";
+ return event->type() == EventTypeNames::keypress && event->isKeyboardEvent() && toKeyboardEvent(event)->keyIdentifier() == "Enter";
}
bool isLinkClick(Event* event)
« no previous file with comments | « Source/core/html/HTMLAnchorElement.h ('k') | Source/core/svg/SVGAElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698