OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/browser/renderer_host/input/web_input_event_util.h" | 5 #include "content/browser/renderer_host/input/web_input_event_util.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "content/common/input/web_touch_event_traits.h" | 8 #include "content/common/input/web_touch_event_traits.h" |
9 #include "ui/events/gesture_detection/gesture_event_data.h" | 9 #include "ui/events/gesture_detection/gesture_event_data.h" |
10 #include "ui/events/gesture_detection/motion_event.h" | 10 #include "ui/events/gesture_detection/motion_event.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 break; | 249 break; |
250 case ui::ET_GESTURE_DOUBLE_TAP: | 250 case ui::ET_GESTURE_DOUBLE_TAP: |
251 gesture.type = WebInputEvent::GestureDoubleTap; | 251 gesture.type = WebInputEvent::GestureDoubleTap; |
252 DCHECK_EQ(1, data.details.tap_count()); | 252 DCHECK_EQ(1, data.details.tap_count()); |
253 gesture.data.tap.tapCount = data.details.tap_count(); | 253 gesture.data.tap.tapCount = data.details.tap_count(); |
254 gesture.data.tap.width = data.details.bounding_box_f().width(); | 254 gesture.data.tap.width = data.details.bounding_box_f().width(); |
255 gesture.data.tap.height = data.details.bounding_box_f().height(); | 255 gesture.data.tap.height = data.details.bounding_box_f().height(); |
256 break; | 256 break; |
257 case ui::ET_GESTURE_TAP: | 257 case ui::ET_GESTURE_TAP: |
258 gesture.type = WebInputEvent::GestureTap; | 258 gesture.type = WebInputEvent::GestureTap; |
259 DCHECK_EQ(1, data.details.tap_count()); | 259 DCHECK_GT(data.details.tap_count(), 0); |
260 gesture.data.tap.tapCount = data.details.tap_count(); | 260 gesture.data.tap.tapCount = data.details.tap_count(); |
261 gesture.data.tap.width = data.details.bounding_box_f().width(); | 261 gesture.data.tap.width = data.details.bounding_box_f().width(); |
262 gesture.data.tap.height = data.details.bounding_box_f().height(); | 262 gesture.data.tap.height = data.details.bounding_box_f().height(); |
263 break; | 263 break; |
264 case ui::ET_GESTURE_TAP_UNCONFIRMED: | 264 case ui::ET_GESTURE_TAP_UNCONFIRMED: |
265 gesture.type = WebInputEvent::GestureTapUnconfirmed; | 265 gesture.type = WebInputEvent::GestureTapUnconfirmed; |
266 DCHECK_EQ(1, data.details.tap_count()); | 266 DCHECK_GT(data.details.tap_count(), 0); |
267 gesture.data.tap.tapCount = data.details.tap_count(); | 267 gesture.data.tap.tapCount = data.details.tap_count(); |
268 gesture.data.tap.width = data.details.bounding_box_f().width(); | 268 gesture.data.tap.width = data.details.bounding_box_f().width(); |
269 gesture.data.tap.height = data.details.bounding_box_f().height(); | 269 gesture.data.tap.height = data.details.bounding_box_f().height(); |
270 break; | 270 break; |
271 case ui::ET_GESTURE_LONG_PRESS: | 271 case ui::ET_GESTURE_LONG_PRESS: |
272 gesture.type = WebInputEvent::GestureLongPress; | 272 gesture.type = WebInputEvent::GestureLongPress; |
273 gesture.data.longPress.width = data.details.bounding_box_f().width(); | 273 gesture.data.longPress.width = data.details.bounding_box_f().width(); |
274 gesture.data.longPress.height = data.details.bounding_box_f().height(); | 274 gesture.data.longPress.height = data.details.bounding_box_f().height(); |
275 break; | 275 break; |
276 case ui::ET_GESTURE_LONG_TAP: | 276 case ui::ET_GESTURE_LONG_TAP: |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 break; | 324 break; |
325 default: | 325 default: |
326 NOTREACHED() << "ui::EventType provided wasn't a valid gesture event."; | 326 NOTREACHED() << "ui::EventType provided wasn't a valid gesture event."; |
327 break; | 327 break; |
328 } | 328 } |
329 | 329 |
330 return gesture; | 330 return gesture; |
331 } | 331 } |
332 | 332 |
333 } // namespace content | 333 } // namespace content |
OLD | NEW |