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

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

Issue 453493002: Improve detection of touch events when hiding media controls. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@autoHideControls
Patch Set: Fix build breakage Created 6 years, 3 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 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 19 matching lines...) Expand all
30 #include "platform/geometry/IntPoint.h" 30 #include "platform/geometry/IntPoint.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 // These button numbers match the ones used in the DOM API, 0 through 2, except for NoButton which isn't specified. 34 // These button numbers match the ones used in the DOM API, 0 through 2, except for NoButton which isn't specified.
35 enum MouseButton { NoButton = -1, LeftButton, MiddleButton, RightButton }; 35 enum MouseButton { NoButton = -1, LeftButton, MiddleButton, RightButton };
36 36
37 class PlatformMouseEvent : public PlatformEvent { 37 class PlatformMouseEvent : public PlatformEvent {
38 public: 38 public:
39 enum SyntheticEventType { 39 enum SyntheticEventType {
40 NotFromTouch, 40 // Real mouse input events or synthetic events that behave just like rea l events
41 RealOrIndistinguishable,
42 // Mouse events derived from touch input
41 FromTouch, 43 FromTouch,
42 }; 44 };
43 45
44 PlatformMouseEvent() 46 PlatformMouseEvent()
45 : PlatformEvent(PlatformEvent::MouseMoved) 47 : PlatformEvent(PlatformEvent::MouseMoved)
46 , m_button(NoButton) 48 , m_button(NoButton)
47 , m_clickCount(0) 49 , m_clickCount(0)
48 , m_synthesized(NotFromTouch) 50 , m_synthesized(RealOrIndistinguishable)
49 , m_modifierFlags(0) 51 , m_modifierFlags(0)
50 { 52 {
51 } 53 }
52 54
53 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifie rs, double timestamp) 55 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifie rs, double timestamp)
54 : PlatformEvent(type, modifiers, timestamp) 56 : PlatformEvent(type, modifiers, timestamp)
55 , m_position(position) 57 , m_position(position)
56 , m_globalPosition(globalPosition) 58 , m_globalPosition(globalPosition)
57 , m_button(button) 59 , m_button(button)
58 , m_clickCount(clickCount) 60 , m_clickCount(clickCount)
59 , m_synthesized(NotFromTouch) 61 , m_synthesized(RealOrIndistinguishable)
60 , m_modifierFlags(0) 62 , m_modifierFlags(0)
61 { 63 {
62 } 64 }
63 65
64 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifie rs, SyntheticEventType synthesized, double timestamp) 66 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifie rs, SyntheticEventType synthesized, double timestamp)
65 : PlatformEvent(type, modifiers, timestamp) 67 : PlatformEvent(type, modifiers, timestamp)
66 , m_position(position) 68 , m_position(position)
67 , m_globalPosition(globalPosition) 69 , m_globalPosition(globalPosition)
68 , m_button(button) 70 , m_button(button)
69 , m_clickCount(clickCount) 71 , m_clickCount(clickCount)
70 , m_synthesized(synthesized) 72 , m_synthesized(synthesized)
71 , m_modifierFlags(0) 73 , m_modifierFlags(0)
72 { 74 {
73 } 75 }
74 76
75 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, bool shiftKey, bo ol ctrlKey, bool altKey, bool metaKey, double timestamp) 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)
76 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp) 78 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp)
77 , m_position(position) 79 , m_position(position)
78 , m_globalPosition(globalPosition) 80 , m_globalPosition(globalPosition)
79 , m_button(button) 81 , m_button(button)
80 , m_clickCount(clickCount) 82 , m_clickCount(clickCount)
81 , m_synthesized(NotFromTouch) 83 , m_synthesized(synthesized)
82 , m_modifierFlags(0) 84 , m_modifierFlags(0)
83 { 85 {
84 } 86 }
85 87
86 const IntPoint& position() const { return m_position; } 88 const IntPoint& position() const { return m_position; }
87 const IntPoint& globalPosition() const { return m_globalPosition; } 89 const IntPoint& globalPosition() const { return m_globalPosition; }
88 const IntPoint& movementDelta() const { return m_movementDelta; } 90 const IntPoint& movementDelta() const { return m_movementDelta; }
89 91
90 MouseButton button() const { return m_button; } 92 MouseButton button() const { return m_button; }
91 int clickCount() const { return m_clickCount; } 93 int clickCount() const { return m_clickCount; }
92 unsigned modifierFlags() const { return m_modifierFlags; } 94 unsigned modifierFlags() const { return m_modifierFlags; }
93 bool fromTouch() const { return m_synthesized == FromTouch; } 95 bool fromTouch() const { return m_synthesized == FromTouch; }
96 SyntheticEventType syntheticEventType() const { return m_synthesized; }
94 97
95 protected: 98 protected:
96 IntPoint m_position; 99 IntPoint m_position;
97 IntPoint m_globalPosition; 100 IntPoint m_globalPosition;
98 IntPoint m_movementDelta; 101 IntPoint m_movementDelta;
99 MouseButton m_button; 102 MouseButton m_button;
100 int m_clickCount; 103 int m_clickCount;
101 SyntheticEventType m_synthesized; 104 SyntheticEventType m_synthesized;
102 unsigned m_modifierFlags; 105 unsigned m_modifierFlags;
103 }; 106 };
104 107
105 } // namespace blink 108 } // namespace blink
106 109
107 #endif // PlatformMouseEvent_h 110 #endif // PlatformMouseEvent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698