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

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: Better function/variable names. 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
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..12692778a12ee02630c84c9748c32461e2015921 100644
--- a/ui/events/gesture_event_details.h
+++ b/ui/events/gesture_event_details.h
@@ -17,9 +17,20 @@ 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.
+ PAGE // page (visible viewport) based scrolling.
+ };
+
GestureEventDetails();
explicit GestureEventDetails(EventType type);
- GestureEventDetails(EventType type, float delta_x, float delta_y);
+ GestureEventDetails(EventType type,
+ float delta_x,
+ float delta_y,
+ ScrollUnits units = ScrollUnits::PRECISE_PIXELS);
Bret 2017/02/17 21:06:03 nit: add a short comment saying this is the defaul
chengx 2017/02/17 21:57:45 Done.
// 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 +69,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 +84,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 +183,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;

Powered by Google App Engine
This is Rietveld 408576698