diff options
author | pkasting <pkasting@chromium.org> | 2016-01-08 15:38:47 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-08 23:40:20 +0000 |
commit | cc7f6acc589a1be4c65a9562f77596278f62d561 (patch) | |
tree | d181dd7243767caaf1725030dfc1e9579de0e915 /ash | |
parent | 0b9b4aefc8954c096ac7f5178aa75fbf5b62ce52 (diff) | |
download | chromium_src-cc7f6acc589a1be4c65a9562f77596278f62d561.zip chromium_src-cc7f6acc589a1be4c65a9562f77596278f62d561.tar.gz chromium_src-cc7f6acc589a1be4c65a9562f77596278f62d561.tar.bz2 |
Clean up event flags a bit:
* Reorder to group related items together. Add group comments.
* Rename {NUM,CAPS,SCROLL}_LOCK_DOWN to ..._ON, in hopes of avoiding confusion
as to whether the event is about one of these keys actually being pressed down
versus just conveying the current state of the various locks.
* Rename EF_EXTENDED to EF_IS_EXTENDED_KEY in hopes of greater clarity. Move it
to the KeyEvent-specific enum since it's non-sensical for non-KeyEvents.
* Expose MouseEvent::button_flags() since a couple callers outside the class
wanted it.
* Move Event::IsRepeat() to KeyEvent (to match the enum placement) and rename it
unix_hacker()-style. (There are a ton of other functions in event.h that
should be named that way, but there's only so much drudgery I can stand.)
* Add some missing bits: missing static_asserts in the Mojo code that didn't
check all enum values were equal, a missing SCROLL_LOCK_ON check in the exo
code that would have no functional effect but looked unduly suspicious.
* Attempt to reorder code to either check/use these enum values in the same
order they're declared, or, in cases like code mapping GTK enum values to
these values, in the order of the GTK enum values (and similar).
BUG=none
TEST=none
Review URL: https://codereview.chromium.org/1559163002
Cr-Commit-Position: refs/heads/master@{#368456}
Diffstat (limited to 'ash')
-rw-r--r-- | ash/accelerators/accelerator_filter_unittest.cc | 4 | ||||
-rw-r--r-- | ash/autoclick/autoclick_controller.cc | 9 | ||||
-rw-r--r-- | ash/content/keyboard_overlay/keyboard_overlay_view_unittest.cc | 4 |
3 files changed, 7 insertions, 10 deletions
diff --git a/ash/accelerators/accelerator_filter_unittest.cc b/ash/accelerators/accelerator_filter_unittest.cc index 9eefbbd..2cabbc2 100644 --- a/ash/accelerators/accelerator_filter_unittest.cc +++ b/ash/accelerators/accelerator_filter_unittest.cc @@ -81,9 +81,9 @@ TEST_F(AcceleratorFilterTest, TestCapsLockMask) { // Check if AcceleratorFilter ignores the mask for Caps Lock. Note that there // is no ui::EF_ mask for Num Lock. - generator.PressKey(ui::VKEY_PRINT, ui::EF_CAPS_LOCK_DOWN); + generator.PressKey(ui::VKEY_PRINT, ui::EF_CAPS_LOCK_ON); EXPECT_EQ(2, delegate->handle_take_screenshot_count()); - generator.ReleaseKey(ui::VKEY_PRINT, ui::EF_CAPS_LOCK_DOWN); + generator.ReleaseKey(ui::VKEY_PRINT, ui::EF_CAPS_LOCK_ON); EXPECT_EQ(2, delegate->handle_take_screenshot_count()); } diff --git a/ash/autoclick/autoclick_controller.cc b/ash/autoclick/autoclick_controller.cc index 39d1b02..21b8e26 100644 --- a/ash/autoclick/autoclick_controller.cc +++ b/ash/autoclick/autoclick_controller.cc @@ -153,12 +153,9 @@ void AutoclickControllerImpl::OnMouseEvent(ui::MouseEvent* event) { } void AutoclickControllerImpl::OnKeyEvent(ui::KeyEvent* event) { - int modifier_mask = - ui::EF_SHIFT_DOWN | - ui::EF_CONTROL_DOWN | - ui::EF_ALT_DOWN | - ui::EF_COMMAND_DOWN | - ui::EF_EXTENDED; + int modifier_mask = ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | + ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN | + ui::EF_IS_EXTENDED_KEY; int new_modifiers = event->flags() & modifier_mask; mouse_event_flags_ = (mouse_event_flags_ & ~modifier_mask) | new_modifiers; diff --git a/ash/content/keyboard_overlay/keyboard_overlay_view_unittest.cc b/ash/content/keyboard_overlay/keyboard_overlay_view_unittest.cc index ef5159e..4e129e8 100644 --- a/ash/content/keyboard_overlay/keyboard_overlay_view_unittest.cc +++ b/ash/content/keyboard_overlay/keyboard_overlay_view_unittest.cc @@ -50,8 +50,8 @@ TEST_F(KeyboardOverlayViewTest, TestCancelingKeysWithNonModifierFlags) { ShellContentState::GetInstance()->GetActiveBrowserContext(), &delegate, new ui::test::TestWebContentsHandler); - const int kNonModifierFlags = ui::EF_IS_REPEAT | ui::EF_IME_FABRICATED_KEY | - ui::EF_NUM_LOCK_DOWN | ui::EF_IS_SYNTHESIZED; + const int kNonModifierFlags = ui::EF_IS_SYNTHESIZED | ui::EF_NUM_LOCK_ON | + ui::EF_IME_FABRICATED_KEY | ui::EF_IS_REPEAT; std::vector<KeyboardOverlayView::KeyEventData> canceling_keys; KeyboardOverlayView::GetCancelingKeysForTesting(&canceling_keys); |