Commit 0ac602ec authored by tdresser@chromium.org's avatar tdresser@chromium.org

Remove unclamped delta and velocity values from GestureEventDetails.

Turns out the "ordinal" values in GestureEventDetails are never used.
This patch replaces https://codereview.chromium.org/256593003/.

BUG=332418

Review URL: https://codereview.chromium.org/258803002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266517 0039d316-1c4b-4281-b951-d872f2087c98
parent 243c2111
...@@ -93,12 +93,6 @@ class GestureEventConsumeDelegate : public TestWindowDelegate { ...@@ -93,12 +93,6 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
scroll_velocity_y_(0), scroll_velocity_y_(0),
velocity_x_(0), velocity_x_(0),
velocity_y_(0), velocity_y_(0),
scroll_x_ordinal_(0),
scroll_y_ordinal_(0),
scroll_velocity_x_ordinal_(0),
scroll_velocity_y_ordinal_(0),
velocity_x_ordinal_(0),
velocity_y_ordinal_(0),
scroll_x_hint_(0), scroll_x_hint_(0),
scroll_y_hint_(0), scroll_y_hint_(0),
tap_count_(0), tap_count_(0),
...@@ -139,12 +133,6 @@ class GestureEventConsumeDelegate : public TestWindowDelegate { ...@@ -139,12 +133,6 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
scroll_velocity_y_ = 0; scroll_velocity_y_ = 0;
velocity_x_ = 0; velocity_x_ = 0;
velocity_y_ = 0; velocity_y_ = 0;
scroll_x_ordinal_ = 0;
scroll_y_ordinal_ = 0;
scroll_velocity_x_ordinal_ = 0;
scroll_velocity_y_ordinal_ = 0;
velocity_x_ordinal_ = 0;
velocity_y_ordinal_ = 0;
scroll_x_hint_ = 0; scroll_x_hint_ = 0;
scroll_y_hint_ = 0; scroll_y_hint_ = 0;
tap_count_ = 0; tap_count_ = 0;
...@@ -192,12 +180,6 @@ class GestureEventConsumeDelegate : public TestWindowDelegate { ...@@ -192,12 +180,6 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
float scroll_velocity_y() const { return scroll_velocity_y_; } float scroll_velocity_y() const { return scroll_velocity_y_; }
float velocity_x() const { return velocity_x_; } float velocity_x() const { return velocity_x_; }
float velocity_y() const { return velocity_y_; } float velocity_y() const { return velocity_y_; }
float scroll_x_ordinal() const { return scroll_x_ordinal_; }
float scroll_y_ordinal() const { return scroll_y_ordinal_; }
float scroll_velocity_x_ordinal() const { return scroll_velocity_x_ordinal_; }
float scroll_velocity_y_ordinal() const { return scroll_velocity_y_ordinal_; }
float velocity_x_ordinal() const { return velocity_x_ordinal_; }
float velocity_y_ordinal() const { return velocity_y_ordinal_; }
float scroll_x_hint() const { return scroll_x_hint_; } float scroll_x_hint() const { return scroll_x_hint_; }
float scroll_y_hint() const { return scroll_y_hint_; } float scroll_y_hint() const { return scroll_y_hint_; }
float scale() const { return scale_; } float scale() const { return scale_; }
...@@ -242,8 +224,6 @@ class GestureEventConsumeDelegate : public TestWindowDelegate { ...@@ -242,8 +224,6 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
scroll_update_ = true; scroll_update_ = true;
scroll_x_ += gesture->details().scroll_x(); scroll_x_ += gesture->details().scroll_x();
scroll_y_ += gesture->details().scroll_y(); scroll_y_ += gesture->details().scroll_y();
scroll_x_ordinal_ += gesture->details().scroll_x_ordinal();
scroll_y_ordinal_ += gesture->details().scroll_y_ordinal();
break; break;
case ui::ET_GESTURE_SCROLL_END: case ui::ET_GESTURE_SCROLL_END:
EXPECT_TRUE(velocity_x_ == 0 && velocity_y_ == 0); EXPECT_TRUE(velocity_x_ == 0 && velocity_y_ == 0);
...@@ -272,8 +252,6 @@ class GestureEventConsumeDelegate : public TestWindowDelegate { ...@@ -272,8 +252,6 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
fling_ = true; fling_ = true;
velocity_x_ = gesture->details().velocity_x(); velocity_x_ = gesture->details().velocity_x();
velocity_y_ = gesture->details().velocity_y(); velocity_y_ = gesture->details().velocity_y();
velocity_x_ordinal_ = gesture->details().velocity_x_ordinal();
velocity_y_ordinal_ = gesture->details().velocity_y_ordinal();
break; break;
case ui::ET_GESTURE_TWO_FINGER_TAP: case ui::ET_GESTURE_TWO_FINGER_TAP:
two_finger_tap_ = true; two_finger_tap_ = true;
...@@ -332,12 +310,6 @@ class GestureEventConsumeDelegate : public TestWindowDelegate { ...@@ -332,12 +310,6 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
float scroll_velocity_y_; float scroll_velocity_y_;
float velocity_x_; float velocity_x_;
float velocity_y_; float velocity_y_;
float scroll_x_ordinal_;
float scroll_y_ordinal_;
float scroll_velocity_x_ordinal_;
float scroll_velocity_y_ordinal_;
float velocity_x_ordinal_;
float velocity_y_ordinal_;
float scroll_x_hint_; float scroll_x_hint_;
float scroll_y_hint_; float scroll_y_hint_;
float scale_; float scale_;
...@@ -1225,9 +1197,7 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) { ...@@ -1225,9 +1197,7 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) {
// horizontal scroll. // horizontal scroll.
tes.SendScrollEvent(event_processor(), 25, 1, kTouchId, delegate.get()); tes.SendScrollEvent(event_processor(), 25, 1, kTouchId, delegate.get());
EXPECT_EQ(0, delegate->scroll_y()); EXPECT_EQ(0, delegate->scroll_y());
EXPECT_EQ(1, delegate->scroll_y_ordinal());
EXPECT_EQ(20, delegate->scroll_x()); EXPECT_EQ(20, delegate->scroll_x());
EXPECT_EQ(20, delegate->scroll_x_ordinal());
// Get a high x velocity, while still staying on the rail // Get a high x velocity, while still staying on the rail
tes.SendScrollEvents(event_processor(), 1, 1, tes.SendScrollEvents(event_processor(), 1, 1,
...@@ -1271,9 +1241,7 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailFling) { ...@@ -1271,9 +1241,7 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailFling) {
// vertical scroll. // vertical scroll.
tes.SendScrollEvent(event_processor(), 1, 25, kTouchId, delegate.get()); tes.SendScrollEvent(event_processor(), 1, 25, kTouchId, delegate.get());
EXPECT_EQ(20, delegate->scroll_y()); EXPECT_EQ(20, delegate->scroll_y());
EXPECT_EQ(20, delegate->scroll_y_ordinal());
EXPECT_EQ(0, delegate->scroll_x()); EXPECT_EQ(0, delegate->scroll_x());
EXPECT_EQ(1, delegate->scroll_x_ordinal());
EXPECT_EQ(0, delegate->scroll_velocity_x()); EXPECT_EQ(0, delegate->scroll_velocity_x());
// Get a high y velocity, while still staying on the rail // Get a high y velocity, while still staying on the rail
......
...@@ -22,15 +22,11 @@ GestureEventDetails::GestureEventDetails(ui::EventType type, ...@@ -22,15 +22,11 @@ GestureEventDetails::GestureEventDetails(ui::EventType type,
case ui::ET_GESTURE_SCROLL_UPDATE: case ui::ET_GESTURE_SCROLL_UPDATE:
data.scroll_update.x = delta_x; data.scroll_update.x = delta_x;
data.scroll_update.y = delta_y; data.scroll_update.y = delta_y;
data.scroll_update.x_ordinal = delta_x;
data.scroll_update.y_ordinal = delta_y;
break; break;
case ui::ET_SCROLL_FLING_START: case ui::ET_SCROLL_FLING_START:
data.fling_velocity.x = delta_x; data.fling_velocity.x = delta_x;
data.fling_velocity.y = delta_y; data.fling_velocity.y = delta_y;
data.fling_velocity.x_ordinal = delta_x;
data.fling_velocity.y_ordinal = delta_y;
break; break;
case ui::ET_GESTURE_TWO_FINGER_TAP: case ui::ET_GESTURE_TWO_FINGER_TAP:
...@@ -66,35 +62,6 @@ GestureEventDetails::GestureEventDetails(ui::EventType type, ...@@ -66,35 +62,6 @@ GestureEventDetails::GestureEventDetails(ui::EventType type,
} }
} }
GestureEventDetails::GestureEventDetails(ui::EventType type,
float delta_x,
float delta_y,
float delta_x_ordinal,
float delta_y_ordinal)
: type_(type),
touch_points_(1) {
CHECK(type == ui::ET_GESTURE_SCROLL_UPDATE ||
type == ui::ET_SCROLL_FLING_START);
switch (type_) {
case ui::ET_GESTURE_SCROLL_UPDATE:
data.scroll_update.x = delta_x;
data.scroll_update.y = delta_y;
data.scroll_update.x_ordinal = delta_x_ordinal;
data.scroll_update.y_ordinal = delta_y_ordinal;
break;
case ui::ET_SCROLL_FLING_START:
data.fling_velocity.x = delta_x;
data.fling_velocity.y = delta_y;
data.fling_velocity.x_ordinal = delta_x_ordinal;
data.fling_velocity.y_ordinal = delta_y_ordinal;
break;
default:
break;
}
}
GestureEventDetails::Details::Details() { GestureEventDetails::Details::Details() {
memset(this, 0, sizeof(Details)); memset(this, 0, sizeof(Details));
} }
......
...@@ -17,9 +17,6 @@ struct EVENTS_BASE_EXPORT GestureEventDetails { ...@@ -17,9 +17,6 @@ struct EVENTS_BASE_EXPORT GestureEventDetails {
public: public:
GestureEventDetails(); GestureEventDetails();
GestureEventDetails(EventType type, float delta_x, float delta_y); GestureEventDetails(EventType type, float delta_x, float delta_y);
GestureEventDetails(EventType type,
float delta_x, float delta_y,
float delta_x_ordinal, float delta_y_ordinal);
EventType type() const { return type_; } EventType type() const { return type_; }
...@@ -67,27 +64,6 @@ struct EVENTS_BASE_EXPORT GestureEventDetails { ...@@ -67,27 +64,6 @@ struct EVENTS_BASE_EXPORT GestureEventDetails {
return data.fling_velocity.y; return data.fling_velocity.y;
} }
// *_ordinal values are unmodified by rail based clamping.
float scroll_x_ordinal() const {
DCHECK_EQ(ui::ET_GESTURE_SCROLL_UPDATE, type_);
return data.scroll_update.x_ordinal;
}
float scroll_y_ordinal() const {
DCHECK_EQ(ui::ET_GESTURE_SCROLL_UPDATE, type_);
return data.scroll_update.y_ordinal;
}
float velocity_x_ordinal() const {
DCHECK(type_ == ui::ET_SCROLL_FLING_START);
return data.fling_velocity.x_ordinal;
}
float velocity_y_ordinal() const {
DCHECK(type_ == ui::ET_SCROLL_FLING_START);
return data.fling_velocity.y_ordinal;
}
float first_finger_width() const { float first_finger_width() const {
DCHECK_EQ(ui::ET_GESTURE_TWO_FINGER_TAP, type_); DCHECK_EQ(ui::ET_GESTURE_TWO_FINGER_TAP, type_);
return data.first_finger_enclosing_rectangle.width; return data.first_finger_enclosing_rectangle.width;
...@@ -144,8 +120,6 @@ struct EVENTS_BASE_EXPORT GestureEventDetails { ...@@ -144,8 +120,6 @@ struct EVENTS_BASE_EXPORT GestureEventDetails {
struct { // SCROLL delta. struct { // SCROLL delta.
float x; float x;
float y; float y;
float x_ordinal;
float y_ordinal;
} scroll_update; } scroll_update;
float scale; // PINCH scale. float scale; // PINCH scale.
...@@ -153,8 +127,6 @@ struct EVENTS_BASE_EXPORT GestureEventDetails { ...@@ -153,8 +127,6 @@ struct EVENTS_BASE_EXPORT GestureEventDetails {
struct { // FLING velocity. struct { // FLING velocity.
float x; float x;
float y; float y;
float x_ordinal;
float y_ordinal;
} fling_velocity; } fling_velocity;
// Dimensions of the first finger's enclosing rectangle for // Dimensions of the first finger's enclosing rectangle for
......
...@@ -989,9 +989,7 @@ void GestureSequence::AppendScrollGestureEnd(const GesturePoint& point, ...@@ -989,9 +989,7 @@ void GestureSequence::AppendScrollGestureEnd(const GesturePoint& point,
gestures->push_back(CreateGestureEvent( gestures->push_back(CreateGestureEvent(
GestureEventDetails(ui::ET_SCROLL_FLING_START, GestureEventDetails(ui::ET_SCROLL_FLING_START,
CalibrateFlingVelocity(railed_x_velocity), CalibrateFlingVelocity(railed_x_velocity),
CalibrateFlingVelocity(railed_y_velocity), CalibrateFlingVelocity(railed_y_velocity)),
CalibrateFlingVelocity(x_velocity),
CalibrateFlingVelocity(y_velocity)),
location, location,
flags_, flags_,
base::Time::FromDoubleT(point.last_touch_time()), base::Time::FromDoubleT(point.last_touch_time()),
...@@ -1044,8 +1042,6 @@ void GestureSequence::AppendScrollGestureUpdate(GesturePoint& point, ...@@ -1044,8 +1042,6 @@ void GestureSequence::AppendScrollGestureUpdate(GesturePoint& point,
d.set_y(d.y() * ratio); d.set_y(d.y() * ratio);
} }
gfx::Vector2dF o = d;
if (scroll_type_ == ST_HORIZONTAL) if (scroll_type_ == ST_HORIZONTAL)
d.set_y(0); d.set_y(0);
else if (scroll_type_ == ST_VERTICAL) else if (scroll_type_ == ST_VERTICAL)
...@@ -1053,8 +1049,7 @@ void GestureSequence::AppendScrollGestureUpdate(GesturePoint& point, ...@@ -1053,8 +1049,7 @@ void GestureSequence::AppendScrollGestureUpdate(GesturePoint& point,
if (d.IsZero()) if (d.IsZero())
return; return;
GestureEventDetails details(ui::ET_GESTURE_SCROLL_UPDATE, GestureEventDetails details(ui::ET_GESTURE_SCROLL_UPDATE, d.x(), d.y());
d.x(), d.y(), o.x(), o.y());
gestures->push_back(CreateGestureEvent( gestures->push_back(CreateGestureEvent(
details, details,
location, location,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment