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

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

Issue 850443002: Scroll Customization Prototype (Not for review, WIP) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase / cleanup / minor bug fixes 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 unified diff | Download patch
« no previous file with comments | « Source/core/testing/Internals.idl ('k') | Source/web/WebInputEventConversion.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 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 25 matching lines...) Expand all
36 namespace blink { 36 namespace blink {
37 37
38 class PlatformGestureEvent : public PlatformEvent { 38 class PlatformGestureEvent : public PlatformEvent {
39 public: 39 public:
40 PlatformGestureEvent() 40 PlatformGestureEvent()
41 : PlatformEvent(PlatformEvent::GestureScrollBegin) 41 : PlatformEvent(PlatformEvent::GestureScrollBegin)
42 { 42 {
43 memset(&m_data, 0, sizeof(m_data)); 43 memset(&m_data, 0, sizeof(m_data));
44 } 44 }
45 45
46 PlatformGestureEvent(Type type, const IntPoint& position, const IntPoint& gl obalPosition, const IntSize& area, double timestamp, bool shiftKey, bool ctrlKey , bool altKey, bool metaKey, float deltaX, float deltaY, float velocityX, float velocityY, bool preventPropagation) 46 PlatformGestureEvent(Type type, const IntPoint& position, const IntPoint& gl obalPosition, const IntSize& area, double timestamp, bool shiftKey, bool ctrlKey , bool altKey, bool metaKey, float deltaX, float deltaY, float velocityX, float velocityY, bool inertial, bool preventPropagation)
47 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp) 47 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp)
48 , m_position(position) 48 , m_position(position)
49 , m_globalPosition(globalPosition) 49 , m_globalPosition(globalPosition)
50 , m_area(area) 50 , m_area(area)
51 { 51 {
52 memset(&m_data, 0, sizeof(m_data)); 52 memset(&m_data, 0, sizeof(m_data));
53 if (type == PlatformEvent::GestureScrollBegin 53 if (type == PlatformEvent::GestureScrollBegin
54 || type == PlatformEvent::GestureScrollEnd 54 || type == PlatformEvent::GestureScrollEnd
55 || type == PlatformEvent::GestureScrollUpdate) { 55 || type == PlatformEvent::GestureScrollUpdate) {
56 m_data.m_scrollUpdate.m_deltaX = deltaX; 56 m_data.m_scroll.m_deltaX = deltaX;
57 m_data.m_scrollUpdate.m_deltaY = deltaY; 57 m_data.m_scroll.m_deltaY = deltaY;
58 m_data.m_scrollUpdate.m_velocityX = velocityX; 58 m_data.m_scroll.m_velocityX = velocityX;
59 m_data.m_scrollUpdate.m_velocityY = velocityY; 59 m_data.m_scroll.m_velocityY = velocityY;
60 m_data.m_scrollUpdate.m_preventPropagation = preventPropagation; 60 m_data.m_scroll.m_inertial = inertial;
61 m_data.m_scroll.m_preventPropagation = preventPropagation;
61 } 62 }
62 } 63 }
63 64
64 const IntPoint& position() const { return m_position; } // PlatformWindow co ordinates. 65 const IntPoint& position() const { return m_position; } // PlatformWindow co ordinates.
65 const IntPoint& globalPosition() const { return m_globalPosition; } // Scree n coordinates. 66 const IntPoint& globalPosition() const { return m_globalPosition; } // Scree n coordinates.
66 67
67 const IntSize& area() const { return m_area; } 68 const IntSize& area() const { return m_area; }
68 69
69 float deltaX() const 70 float deltaX() const
70 { 71 {
71 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); 72 ASSERT(m_type == PlatformEvent::GestureScrollUpdate
72 return m_data.m_scrollUpdate.m_deltaX; 73 || m_type == PlatformEvent::GestureScrollEnd);
74 return m_data.m_scroll.m_deltaX;
73 } 75 }
74 76
75 float deltaY() const 77 float deltaY() const
76 { 78 {
77 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); 79 ASSERT(m_type == PlatformEvent::GestureScrollUpdate
78 return m_data.m_scrollUpdate.m_deltaY; 80 || m_type == PlatformEvent::GestureScrollEnd);
81 return m_data.m_scroll.m_deltaY;
79 } 82 }
80 83
81 int tapCount() const 84 int tapCount() const
82 { 85 {
83 ASSERT(m_type == PlatformEvent::GestureTap); 86 ASSERT(m_type == PlatformEvent::GestureTap);
84 return m_data.m_tap.m_tapCount; 87 return m_data.m_tap.m_tapCount;
85 } 88 }
86 89
87 float velocityX() const 90 float velocityX() const
88 { 91 {
89 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); 92 ASSERT(m_type == PlatformEvent::GestureScrollUpdate
90 return m_data.m_scrollUpdate.m_velocityX; 93 || m_type == PlatformEvent::GestureScrollEnd);
94 return m_data.m_scroll.m_velocityX;
91 } 95 }
92 96
93 float velocityY() const 97 float velocityY() const
94 { 98 {
95 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); 99 ASSERT(m_type == PlatformEvent::GestureScrollUpdate
96 return m_data.m_scrollUpdate.m_velocityY; 100 || m_type == PlatformEvent::GestureScrollEnd);
101 return m_data.m_scroll.m_velocityY;
102 }
103
104 bool inertial() const
105 {
106 ASSERT(m_type == PlatformEvent::GestureScrollUpdate
107 || m_type == PlatformEvent::GestureScrollEnd);
108 return m_data.m_scroll.m_inertial;
97 } 109 }
98 110
99 bool preventPropagation() const 111 bool preventPropagation() const
100 { 112 {
101 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); 113 ASSERT(m_type == PlatformEvent::GestureScrollUpdate);
102 return m_data.m_scrollUpdate.m_preventPropagation; 114 return m_data.m_scroll.m_preventPropagation;
103 } 115 }
104 116
105 float scale() const 117 float scale() const
106 { 118 {
107 ASSERT(m_type == PlatformEvent::GesturePinchUpdate); 119 ASSERT(m_type == PlatformEvent::GesturePinchUpdate);
108 return m_data.m_pinchUpdate.m_scale; 120 return m_data.m_pinchUpdate.m_scale;
109 } 121 }
110 122
111 void applyTouchAdjustment(const IntPoint& adjustedPosition) 123 void applyTouchAdjustment(const IntPoint& adjustedPosition)
112 { 124 {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 struct { 165 struct {
154 int m_tapCount; 166 int m_tapCount;
155 } m_tap; 167 } m_tap;
156 168
157 struct { 169 struct {
158 float m_deltaX; 170 float m_deltaX;
159 float m_deltaY; 171 float m_deltaY;
160 float m_velocityX; 172 float m_velocityX;
161 float m_velocityY; 173 float m_velocityY;
162 int m_preventPropagation; 174 int m_preventPropagation;
163 } m_scrollUpdate; 175 bool m_inertial;
176 } m_scroll;
164 177
165 struct { 178 struct {
166 float m_scale; 179 float m_scale;
167 } m_pinchUpdate; 180 } m_pinchUpdate;
168 } m_data; 181 } m_data;
169 }; 182 };
170 183
171 } // namespace blink 184 } // namespace blink
172 185
173 #endif // PlatformGestureEvent_h 186 #endif // PlatformGestureEvent_h
OLDNEW
« no previous file with comments | « Source/core/testing/Internals.idl ('k') | Source/web/WebInputEventConversion.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698