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

Unified Diff: ui/events/gesture_event_details.h

Issue 2605193002: Fix mouse wheel over-scrolls when display is scaled and scroll is paginated (Closed)
Patch Set: More unittests. Created 3 years, 10 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/events/blink/blink_event_util_unittest.cc ('k') | ui/events/gesture_event_details.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/gesture_event_details.h
diff --git a/ui/events/gesture_event_details.h b/ui/events/gesture_event_details.h
index 377c4232c991e3c0d580002421667ce311b69bfa..2b066d56188c5a7ae999492165d8e74b81b8734f 100644
--- a/ui/events/gesture_event_details.h
+++ b/ui/events/gesture_event_details.h
@@ -17,9 +17,22 @@ namespace ui {
struct EVENTS_BASE_EXPORT GestureEventDetails {
public:
+ // The definition of ScrollUnits below is consistent with that in
+ // //src/third_party/WebKit/public/platform/WebGestureEvent.h
+ enum class ScrollUnits {
+ PRECISE_PIXELS = 0, // generated by high precision devices.
+ PIXELS, // large pixel jump duration; should animate to delta.
sky 2017/02/17 22:52:31 Are you sure this isn't DIPs and what you are call
chengx 2017/02/17 23:19:18 I agree the names here, which originate from WebGe
+ PAGE // page (visible viewport) based scrolling.
+ };
+
GestureEventDetails();
explicit GestureEventDetails(EventType type);
- GestureEventDetails(EventType type, float delta_x, float delta_y);
+
+ // ScrollUnits::PRECISE_PIXELS is the default in WebGestureEvent.h too.
+ GestureEventDetails(EventType type,
+ float delta_x,
+ float delta_y,
+ ScrollUnits units = ScrollUnits::PRECISE_PIXELS);
// The caller is responsible for ensuring that the gesture data from |other|
// is compatible and sufficient for that expected by gestures of |type|.
@@ -58,6 +71,11 @@ struct EVENTS_BASE_EXPORT GestureEventDetails {
return data_.scroll_begin.y_hint;
}
+ ScrollUnits scroll_begin_units() const {
+ DCHECK_EQ(ET_GESTURE_SCROLL_BEGIN, type_);
+ return data_.scroll_begin.delta_hint_units;
+ }
+
float scroll_x() const {
DCHECK_EQ(ET_GESTURE_SCROLL_UPDATE, type_);
return data_.scroll_update.x;
@@ -68,6 +86,11 @@ struct EVENTS_BASE_EXPORT GestureEventDetails {
return data_.scroll_update.y;
}
+ ScrollUnits scroll_update_units() const {
+ DCHECK_EQ(ET_GESTURE_SCROLL_UPDATE, type_);
+ return data_.scroll_update.delta_units;
+ }
+
float velocity_x() const {
DCHECK_EQ(ET_SCROLL_FLING_START, type_);
return data_.fling_velocity.x;
@@ -162,11 +185,13 @@ struct EVENTS_BASE_EXPORT GestureEventDetails {
// the x/y values from the first scroll_update.
float x_hint;
float y_hint;
+ ScrollUnits delta_hint_units;
} scroll_begin;
struct { // SCROLL delta.
float x;
float y;
+ ScrollUnits delta_units;
// Whether any previous scroll update in the current scroll sequence was
// suppressed because the underlying touch was consumed.
bool previous_update_in_sequence_prevented;
« no previous file with comments | « ui/events/blink/blink_event_util_unittest.cc ('k') | ui/events/gesture_event_details.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698