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

Unified Diff: ui/events/event.h

Issue 1017473002: [Merge] Make mouse buttons 8 - 11 navigate forward and back in history (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2311
Patch Set: Created 5 years, 9 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 | « ui/aura/window_event_dispatcher.cc ('k') | ui/events/event_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/event.h
diff --git a/ui/events/event.h b/ui/events/event.h
index c698decace6a241fb990199a7b2d567cde931e4e..b65c27516ab48f1f6d4e4f1b00a2270524cd2a9a 100644
--- a/ui/events/event.h
+++ b/ui/events/event.h
@@ -361,8 +361,7 @@ class EVENTS_EXPORT MouseEvent : public LocatedEvent {
// Conveniences to quickly test what button is down
bool IsOnlyLeftMouseButton() const {
- return (flags() & EF_LEFT_MOUSE_BUTTON) &&
- !(flags() & (EF_MIDDLE_MOUSE_BUTTON | EF_RIGHT_MOUSE_BUTTON));
+ return button_flags() == EF_LEFT_MOUSE_BUTTON;
}
bool IsLeftMouseButton() const {
@@ -370,8 +369,7 @@ class EVENTS_EXPORT MouseEvent : public LocatedEvent {
}
bool IsOnlyMiddleMouseButton() const {
- return (flags() & EF_MIDDLE_MOUSE_BUTTON) &&
- !(flags() & (EF_LEFT_MOUSE_BUTTON | EF_RIGHT_MOUSE_BUTTON));
+ return button_flags() == EF_MIDDLE_MOUSE_BUTTON;
}
bool IsMiddleMouseButton() const {
@@ -379,8 +377,7 @@ class EVENTS_EXPORT MouseEvent : public LocatedEvent {
}
bool IsOnlyRightMouseButton() const {
- return (flags() & EF_RIGHT_MOUSE_BUTTON) &&
- !(flags() & (EF_LEFT_MOUSE_BUTTON | EF_MIDDLE_MOUSE_BUTTON));
+ return button_flags() == EF_RIGHT_MOUSE_BUTTON;
}
bool IsRightMouseButton() const {
@@ -388,8 +385,7 @@ class EVENTS_EXPORT MouseEvent : public LocatedEvent {
}
bool IsAnyButton() const {
- return (flags() & (EF_LEFT_MOUSE_BUTTON | EF_MIDDLE_MOUSE_BUTTON |
- EF_RIGHT_MOUSE_BUTTON)) != 0;
+ return button_flags() != 0;
}
// Compares two mouse down events and returns true if the second one should
@@ -418,6 +414,13 @@ class EVENTS_EXPORT MouseEvent : public LocatedEvent {
FRIEND_TEST_ALL_PREFIXES(EventTest, DoubleClickRequiresRelease);
FRIEND_TEST_ALL_PREFIXES(EventTest, SingleClickRightLeft);
+ // Returns the flags for the mouse buttons.
+ int button_flags() const {
+ return flags() & (EF_LEFT_MOUSE_BUTTON | EF_MIDDLE_MOUSE_BUTTON |
+ EF_RIGHT_MOUSE_BUTTON | EF_BACK_MOUSE_BUTTON |
+ EF_FORWARD_MOUSE_BUTTON);
+ }
+
// Returns the repeat count based on the previous mouse click, if it is
// recent enough and within a small enough distance.
static int GetRepeatCount(const MouseEvent& click_event);
« no previous file with comments | « ui/aura/window_event_dispatcher.cc ('k') | ui/events/event_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698