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

Side by Side Diff: Source/platform/PlatformMouseEvent.h

Issue 727593003: Implement MouseEvent buttons attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 28 matching lines...) Expand all
39 enum SyntheticEventType { 39 enum SyntheticEventType {
40 // Real mouse input events or synthetic events that behave just like rea l events 40 // Real mouse input events or synthetic events that behave just like rea l events
41 RealOrIndistinguishable, 41 RealOrIndistinguishable,
42 // Mouse events derived from touch input 42 // Mouse events derived from touch input
43 FromTouch, 43 FromTouch,
44 }; 44 };
45 45
46 PlatformMouseEvent() 46 PlatformMouseEvent()
47 : PlatformEvent(PlatformEvent::MouseMoved) 47 : PlatformEvent(PlatformEvent::MouseMoved)
48 , m_button(NoButton) 48 , m_button(NoButton)
49 , m_buttons(0)
49 , m_clickCount(0) 50 , m_clickCount(0)
50 , m_synthesized(RealOrIndistinguishable) 51 , m_synthesized(RealOrIndistinguishable)
51 , m_modifierFlags(0) 52 , m_modifierFlags(0)
52 { 53 {
53 } 54 }
54 55
55 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifie rs, double timestamp) 56 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifie rs, double timestamp)
56 : PlatformEvent(type, modifiers, timestamp) 57 : PlatformEvent(type, modifiers, timestamp)
57 , m_position(position) 58 , m_position(position)
58 , m_globalPosition(globalPosition) 59 , m_globalPosition(globalPosition)
59 , m_button(button) 60 , m_button(button)
61 , m_buttons(0)
60 , m_clickCount(clickCount) 62 , m_clickCount(clickCount)
61 , m_synthesized(RealOrIndistinguishable) 63 , m_synthesized(RealOrIndistinguishable)
62 , m_modifierFlags(0) 64 , m_modifierFlags(0)
63 { 65 {
64 } 66 }
65 67
66 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifie rs, SyntheticEventType synthesized, double timestamp) 68 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifie rs, SyntheticEventType synthesized, double timestamp)
67 : PlatformEvent(type, modifiers, timestamp) 69 : PlatformEvent(type, modifiers, timestamp)
68 , m_position(position) 70 , m_position(position)
69 , m_globalPosition(globalPosition) 71 , m_globalPosition(globalPosition)
70 , m_button(button) 72 , m_button(button)
73 , m_buttons(0)
71 , m_clickCount(clickCount) 74 , m_clickCount(clickCount)
72 , m_synthesized(synthesized) 75 , m_synthesized(synthesized)
73 , m_modifierFlags(0) 76 , m_modifierFlags(0)
74 { 77 {
75 } 78 }
76 79
77 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, bool shiftKey, bo ol ctrlKey, bool altKey, bool metaKey, SyntheticEventType synthesized, double ti mestamp) 80 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, bool shiftKey, bo ol ctrlKey, bool altKey, bool metaKey, SyntheticEventType synthesized, double ti mestamp)
78 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp) 81 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp)
79 , m_position(position) 82 , m_position(position)
80 , m_globalPosition(globalPosition) 83 , m_globalPosition(globalPosition)
81 , m_button(button) 84 , m_button(button)
85 , m_buttons(0)
Rick Byers 2014/11/14 19:48:09 I think using 0 here is a bug. You probably need
zino 2014/11/18 14:19:35 Good point! Thank you. Done.
82 , m_clickCount(clickCount) 86 , m_clickCount(clickCount)
83 , m_synthesized(synthesized) 87 , m_synthesized(synthesized)
84 , m_modifierFlags(0) 88 , m_modifierFlags(0)
85 { 89 {
86 } 90 }
87 91
88 const IntPoint& position() const { return m_position; } 92 const IntPoint& position() const { return m_position; }
89 const IntPoint& globalPosition() const { return m_globalPosition; } 93 const IntPoint& globalPosition() const { return m_globalPosition; }
90 const IntPoint& movementDelta() const { return m_movementDelta; } 94 const IntPoint& movementDelta() const { return m_movementDelta; }
91 95
92 MouseButton button() const { return m_button; } 96 MouseButton button() const { return m_button; }
97 unsigned short buttons() const { return m_buttons; }
93 int clickCount() const { return m_clickCount; } 98 int clickCount() const { return m_clickCount; }
94 unsigned modifierFlags() const { return m_modifierFlags; } 99 unsigned modifierFlags() const { return m_modifierFlags; }
95 bool fromTouch() const { return m_synthesized == FromTouch; } 100 bool fromTouch() const { return m_synthesized == FromTouch; }
96 SyntheticEventType syntheticEventType() const { return m_synthesized; } 101 SyntheticEventType syntheticEventType() const { return m_synthesized; }
97 102
98 protected: 103 protected:
99 IntPoint m_position; 104 IntPoint m_position;
100 IntPoint m_globalPosition; 105 IntPoint m_globalPosition;
101 IntPoint m_movementDelta; 106 IntPoint m_movementDelta;
102 MouseButton m_button; 107 MouseButton m_button;
108 unsigned short m_buttons;
103 int m_clickCount; 109 int m_clickCount;
104 SyntheticEventType m_synthesized; 110 SyntheticEventType m_synthesized;
105 unsigned m_modifierFlags; 111 unsigned m_modifierFlags;
106 }; 112 };
107 113
108 } // namespace blink 114 } // namespace blink
109 115
110 #endif // PlatformMouseEvent_h 116 #endif // PlatformMouseEvent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698