Index: ui/events/event.cc |
diff --git a/ui/events/event.cc b/ui/events/event.cc |
index d0966da00847a13bcfe64258596a445fa57bd0e4..a0a6c9b851e3c1d3f74dd3e6151a4bd5d499000c 100644 |
--- a/ui/events/event.cc |
+++ b/ui/events/event.cc |
@@ -526,19 +526,17 @@ TouchEvent::TouchEvent(const base::NativeEvent& native_event) |
radius_y_(GetTouchRadiusY(native_event)), |
rotation_angle_(GetTouchAngle(native_event)), |
force_(GetTouchForce(native_event)), |
- may_cause_scrolling_(false) { |
- latency()->AddLatencyNumberWithTimestamp( |
- INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, |
- 0, |
- 0, |
- base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), |
- 1); |
+ should_remove_native_touch_id_mapping_(false) { |
+ if (type() == ET_TOUCH_RELEASED || type() == ET_TOUCH_CANCELLED) |
+ should_remove_native_touch_id_mapping_ = true; |
latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
fixRotationAngle(); |
sadrul
2015/01/26 18:49:46
We should call this FixRotationAngle() (https://co
tdresser
2015/01/27 21:43:05
Done.
|
- if (type() == ET_TOUCH_PRESSED) |
- IncrementTouchIdRefCount(native_event); |
+ latency()->AddLatencyNumberWithTimestamp( |
+ INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0, |
+ base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), 1); |
+ latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
} |
TouchEvent::TouchEvent(EventType type, |
@@ -552,7 +550,7 @@ TouchEvent::TouchEvent(EventType type, |
radius_y_(0.0f), |
rotation_angle_(0.0f), |
force_(0.0f), |
- may_cause_scrolling_(false) { |
+ should_remove_native_touch_id_mapping_(false) { |
latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
} |
@@ -572,7 +570,7 @@ TouchEvent::TouchEvent(EventType type, |
radius_y_(radius_y), |
rotation_angle_(angle), |
force_(force), |
- may_cause_scrolling_(false) { |
+ should_remove_native_touch_id_mapping_(false) { |
latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
fixRotationAngle(); |
} |
@@ -581,8 +579,11 @@ TouchEvent::~TouchEvent() { |
// In ctor TouchEvent(native_event) we call GetTouchId() which in X11 |
// platform setups the tracking_id to slot mapping. So in dtor here, |
// if this touch event is a release event, we clear the mapping accordingly. |
- if (HasNativeEvent()) |
- ClearTouchIdIfReleased(native_event()); |
+ if (should_remove_native_touch_id_mapping_) { |
+ DCHECK(type() == ET_TOUCH_RELEASED || type() == ET_TOUCH_CANCELLED); |
+ if (type() == ET_TOUCH_RELEASED || type() == ET_TOUCH_CANCELLED) |
+ ClearTouchIdIfReleased(native_event()); |
+ } |
} |
void TouchEvent::UpdateForRootTransform( |