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

Unified Diff: ui/views/controls/link.cc

Issue 2609943004: MacViews: Don't click views::Link on pressing Return key. (Closed)
Patch Set: Rebase. Created 3 years, 12 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/link.cc
diff --git a/ui/views/controls/link.cc b/ui/views/controls/link.cc
index e61140f007658c6345e95910d1ed2e576b1b6495..ab4d007655518d9322de1a8a2d2dac58cd056902 100644
--- a/ui/views/controls/link.cc
+++ b/ui/views/controls/link.cc
@@ -20,6 +20,7 @@
#include "ui/native_theme/native_theme.h"
#include "ui/views/controls/link_listener.h"
#include "ui/views/native_cursor.h"
+#include "ui/views/style/platform_style.h"
namespace views {
@@ -90,7 +91,8 @@ void Link::OnMouseCaptureLost() {
bool Link::OnKeyPressed(const ui::KeyEvent& event) {
bool activate = (((event.key_code() == ui::VKEY_SPACE) &&
(event.flags() & ui::EF_ALT_DOWN) == 0) ||
- (event.key_code() == ui::VKEY_RETURN));
+ (event.key_code() == ui::VKEY_RETURN &&
+ PlatformStyle::kReturnClicksFocusedControl));
if (!activate)
return false;
@@ -123,9 +125,11 @@ void Link::OnGestureEvent(ui::GestureEvent* event) {
}
bool Link::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) {
- // Make sure we don't process space or enter as accelerators.
+ // Don't process Space and Return (depending on the platform) as an
+ // accelerator.
return (event.key_code() == ui::VKEY_SPACE) ||
tapted 2017/01/05 02:26:54 nit: the parens around this `==` look odd
karandeepb 2017/01/05 11:15:40 Done.
- (event.key_code() == ui::VKEY_RETURN);
+ (event.key_code() == ui::VKEY_RETURN &&
+ PlatformStyle::kReturnClicksFocusedControl);
}
void Link::GetAccessibleNodeData(ui::AXNodeData* node_data) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698