OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/touch_emulator.h" | 5 #include "content/browser/renderer_host/input/touch_emulator.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "content/browser/renderer_host/input/motion_event_web.h" | 8 #include "content/browser/renderer_host/input/motion_event_web.h" |
9 #include "content/common/input/web_touch_event_traits.h" | 9 #include "content/common/input/web_touch_event_traits.h" |
10 #include "content/grit/content_resources.h" | 10 #include "content/grit/content_resources.h" |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 << mouse_event.type(); | 454 << mouse_event.type(); |
455 } | 455 } |
456 touch_event_.touchesLength = 1; | 456 touch_event_.touchesLength = 1; |
457 touch_event_.setModifiers(ModifiersWithoutMouseButtons(mouse_event)); | 457 touch_event_.setModifiers(ModifiersWithoutMouseButtons(mouse_event)); |
458 WebTouchEventTraits::ResetTypeAndTouchStates( | 458 WebTouchEventTraits::ResetTypeAndTouchStates( |
459 eventType, mouse_event.timeStampSeconds(), &touch_event_); | 459 eventType, mouse_event.timeStampSeconds(), &touch_event_); |
460 WebTouchPoint& point = touch_event_.touches[0]; | 460 WebTouchPoint& point = touch_event_.touches[0]; |
461 point.id = 0; | 461 point.id = 0; |
462 point.radiusX = 0.5f * cursor_size_.width(); | 462 point.radiusX = 0.5f * cursor_size_.width(); |
463 point.radiusY = 0.5f * cursor_size_.height(); | 463 point.radiusY = 0.5f * cursor_size_.height(); |
464 point.force = 1.f; | 464 point.force = eventType == WebInputEvent::TouchEnd ? 0.f : 1.f; |
465 point.rotationAngle = 0.f; | 465 point.rotationAngle = 0.f; |
466 point.position.x = mouse_event.x; | 466 point.position.x = mouse_event.x; |
467 point.screenPosition.x = mouse_event.globalX; | 467 point.screenPosition.x = mouse_event.globalX; |
468 point.position.y = mouse_event.y; | 468 point.position.y = mouse_event.y; |
469 point.screenPosition.y = mouse_event.globalY; | 469 point.screenPosition.y = mouse_event.globalY; |
470 point.tiltX = 0; | 470 point.tiltX = 0; |
471 point.tiltY = 0; | 471 point.tiltY = 0; |
472 point.pointerType = blink::WebPointerProperties::PointerType::Touch; | 472 point.pointerType = blink::WebPointerProperties::PointerType::Touch; |
473 } | 473 } |
474 | 474 |
475 bool TouchEmulator::InPinchGestureMode() const { | 475 bool TouchEmulator::InPinchGestureMode() const { |
476 return shift_pressed_; | 476 return shift_pressed_; |
477 } | 477 } |
478 | 478 |
479 } // namespace content | 479 } // namespace content |
OLD | NEW |