OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
7 | 7 |
8 #include "ui/events/blink/blink_event_util.h" | 8 #include "ui/events/blink/blink_event_util.h" |
9 | 9 |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 "inconsistent maximum number of active touch points"); | 135 "inconsistent maximum number of active touch points"); |
136 | 136 |
137 blink::WebTouchEvent result; | 137 blink::WebTouchEvent result; |
138 | 138 |
139 result.type = ToWebInputEventType(event.GetAction()); | 139 result.type = ToWebInputEventType(event.GetAction()); |
140 result.cancelable = (result.type != WebInputEvent::TouchCancel); | 140 result.cancelable = (result.type != WebInputEvent::TouchCancel); |
141 result.timeStampSeconds = | 141 result.timeStampSeconds = |
142 (event.GetEventTime() - base::TimeTicks()).InSecondsF(), | 142 (event.GetEventTime() - base::TimeTicks()).InSecondsF(), |
143 result.causesScrollingIfUncanceled = may_cause_scrolling; | 143 result.causesScrollingIfUncanceled = may_cause_scrolling; |
144 result.modifiers = EventFlagsToWebEventModifiers(event.GetFlags()); | 144 result.modifiers = EventFlagsToWebEventModifiers(event.GetFlags()); |
| 145 DCHECK_NE(event.GetUniqueEventId(), 0U); |
| 146 result.uniqueTouchEventId = event.GetUniqueEventId(); |
145 result.touchesLength = | 147 result.touchesLength = |
146 std::min(static_cast<unsigned>(event.GetPointerCount()), | 148 std::min(static_cast<unsigned>(event.GetPointerCount()), |
147 static_cast<unsigned>(WebTouchEvent::touchesLengthCap)); | 149 static_cast<unsigned>(WebTouchEvent::touchesLengthCap)); |
148 DCHECK_GT(result.touchesLength, 0U); | 150 DCHECK_GT(result.touchesLength, 0U); |
149 | 151 |
150 for (size_t i = 0; i < result.touchesLength; ++i) | 152 for (size_t i = 0; i < result.touchesLength; ++i) |
151 result.touches[i] = CreateWebTouchPoint(event, i); | 153 result.touches[i] = CreateWebTouchPoint(event, i); |
152 | 154 |
153 return result; | 155 return result; |
154 } | 156 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } | 296 } |
295 | 297 |
296 WebGestureEvent CreateWebGestureEventFromGestureEventData( | 298 WebGestureEvent CreateWebGestureEventFromGestureEventData( |
297 const GestureEventData& data) { | 299 const GestureEventData& data) { |
298 return CreateWebGestureEvent(data.details, data.time - base::TimeTicks(), | 300 return CreateWebGestureEvent(data.details, data.time - base::TimeTicks(), |
299 gfx::PointF(data.x, data.y), | 301 gfx::PointF(data.x, data.y), |
300 gfx::PointF(data.raw_x, data.raw_y), data.flags); | 302 gfx::PointF(data.raw_x, data.raw_y), data.flags); |
301 } | 303 } |
302 | 304 |
303 } // namespace ui | 305 } // namespace ui |
OLD | NEW |