Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ | 5 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ |
| 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "ui/events/event_constants.h" | 9 #include "ui/events/event_constants.h" |
| 10 #include "ui/events/events_base_export.h" | 10 #include "ui/events/events_base_export.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 type_ == ET_GESTURE_DOUBLE_TAP); | 123 type_ == ET_GESTURE_DOUBLE_TAP); |
| 124 data.tap_count = tap_count; | 124 data.tap_count = tap_count; |
| 125 } | 125 } |
| 126 | 126 |
| 127 void set_scale(float scale) { | 127 void set_scale(float scale) { |
| 128 DCHECK_GE(scale, 0.0f); | 128 DCHECK_GE(scale, 0.0f); |
| 129 DCHECK_EQ(type_, ET_GESTURE_PINCH_UPDATE); | 129 DCHECK_EQ(type_, ET_GESTURE_PINCH_UPDATE); |
| 130 data.scale = scale; | 130 data.scale = scale; |
| 131 } | 131 } |
| 132 | 132 |
| 133 void mark_previous_scroll_update_in_sequence_prevented() const { | |
| 134 DCHECK_EQ(ET_GESTURE_SCROLL_UPDATE, type_); | |
| 135 data.scroll_update.previous_update_in_sequence_prevented = true; | |
| 136 } | |
| 137 | |
| 138 bool previous_scroll_update_in_sequence_prevented() const { | |
| 139 DCHECK_EQ(ET_GESTURE_SCROLL_UPDATE, type_); | |
| 140 return data.scroll_update.previous_update_in_sequence_prevented; | |
| 141 } | |
| 142 | |
| 133 private: | 143 private: |
| 134 EventType type_; | 144 EventType type_; |
| 135 union Details { | 145 union Details { |
| 136 Details(); | 146 Details(); |
| 137 struct { // SCROLL start details. | 147 struct { // SCROLL start details. |
| 138 // Distance that caused the scroll to start. Generally redundant with | 148 // Distance that caused the scroll to start. Generally redundant with |
| 139 // the x/y values from the first scroll_update. | 149 // the x/y values from the first scroll_update. |
| 140 float x_hint; | 150 float x_hint; |
| 141 float y_hint; | 151 float y_hint; |
| 142 } scroll_begin; | 152 } scroll_begin; |
| 143 | 153 |
| 144 struct { // SCROLL delta. | 154 struct { // SCROLL delta. |
| 145 float x; | 155 float x; |
| 146 float y; | 156 float y; |
| 157 // Whether any previous scroll update in the current scroll sequence was | |
| 158 // suppressed because the underlying touch was consumed. This is marked | |
| 159 // mutable as its value may be set downstream from event creation. | |
| 160 mutable bool previous_update_in_sequence_prevented; | |
|
tdresser
2014/11/10 21:51:01
I'm not sure this is superior to making all the ev
Rick Byers
2014/11/10 22:03:08
We hit a similar issue with touch-action, and ther
jdduke (slow)
2014/11/10 22:23:43
This is a very different case.
This extra bit I c
jdduke (slow)
2014/11/10 22:31:32
Anyhow, if you guys prefer we not make this mutabl
| |
| 147 } scroll_update; | 161 } scroll_update; |
| 148 | 162 |
| 149 float scale; // PINCH scale. | 163 float scale; // PINCH scale. |
| 150 | 164 |
| 151 struct { // FLING velocity. | 165 struct { // FLING velocity. |
| 152 float x; | 166 float x; |
| 153 float y; | 167 float y; |
| 154 } fling_velocity; | 168 } fling_velocity; |
| 155 | 169 |
| 156 // Dimensions of the first finger's enclosing rectangle for | 170 // Dimensions of the first finger's enclosing rectangle for |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 178 // enclosing rectangles of the touch-points in the gesture. | 192 // enclosing rectangles of the touch-points in the gesture. |
| 179 gfx::RectF bounding_box_; | 193 gfx::RectF bounding_box_; |
| 180 | 194 |
| 181 // The touch id of the oldest touch contributing to the gesture. | 195 // The touch id of the oldest touch contributing to the gesture. |
| 182 int oldest_touch_id_; | 196 int oldest_touch_id_; |
| 183 }; | 197 }; |
| 184 | 198 |
| 185 } // namespace ui | 199 } // namespace ui |
| 186 | 200 |
| 187 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ | 201 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ |
| OLD | NEW |