diff options
author | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-10 00:31:45 +0000 |
---|---|---|
committer | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-10 00:31:45 +0000 |
commit | 44fbb5ea6a624a60ccc5a5e566a745f91bc2b553 (patch) | |
tree | edfca64469ea88e4d44c07b3cd9b1170218fe4ef /chrome/views | |
parent | 6c5006f8960fcf368f198a83b626fd4f61859af4 (diff) | |
download | chromium_src-44fbb5ea6a624a60ccc5a5e566a745f91bc2b553.zip chromium_src-44fbb5ea6a624a60ccc5a5e566a745f91bc2b553.tar.gz chromium_src-44fbb5ea6a624a60ccc5a5e566a745f91bc2b553.tar.bz2 |
Fixing 4687: Enter in FirstRun UI starts import when Customize link is focued.
We now properly handle Enter when links are focused. I also made it so that links navigate on KeyDown (when you press Enter or Space) instead of on KeyUp. This matches WebKit and native Windows behavior.
Review URL: http://codereview.chromium.org/13321
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6670 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
-rw-r--r-- | chrome/views/link.cc | 15 | ||||
-rw-r--r-- | chrome/views/link.h | 2 |
2 files changed, 7 insertions, 10 deletions
diff --git a/chrome/views/link.cc b/chrome/views/link.cc index c824e62..357c3dd 100644 --- a/chrome/views/link.cc +++ b/chrome/views/link.cc @@ -104,15 +104,7 @@ void Link::OnMouseReleased(const MouseEvent& e, bool canceled) { } bool Link::OnKeyPressed(const KeyEvent& e) { - if ((e.GetCharacter() == L' ') || (e.GetCharacter() == L'\n')) { - SetHighlighted(true); - return true; - } - return false; -} - -bool Link::OnKeyReleased(const KeyEvent& e) { - if ((e.GetCharacter() == L' ') || (e.GetCharacter() == L'\n')) { + if ((e.GetCharacter() == VK_SPACE) || (e.GetCharacter() == VK_RETURN)) { SetHighlighted(false); // Focus the link on key pressed. @@ -126,6 +118,11 @@ bool Link::OnKeyReleased(const KeyEvent& e) { return false; } +bool Link::OverrideAccelerator(const Accelerator& accelerator) { + return (accelerator.GetKeyCode() == VK_SPACE) || + (accelerator.GetKeyCode() == VK_RETURN); +} + void Link::SetHighlighted(bool f) { if (f != highlighted_) { highlighted_ = f; diff --git a/chrome/views/link.h b/chrome/views/link.h index 8db9620..e80b1795 100644 --- a/chrome/views/link.h +++ b/chrome/views/link.h @@ -47,7 +47,7 @@ class Link : public Label { virtual void OnMouseReleased(const MouseEvent& event, bool canceled); virtual bool OnKeyPressed(const KeyEvent& e); - virtual bool OnKeyReleased(const KeyEvent& e); + virtual bool OverrideAccelerator(const Accelerator& accelerator); virtual void SetFont(const ChromeFont& font); |