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/input_router_impl.h" | 5 #include "content/browser/renderer_host/input/input_router_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
450 // - magnitude roughly matches wheels: f(2) > 25 && f(2) < 100 | 450 // - magnitude roughly matches wheels: f(2) > 25 && f(2) < 100 |
451 // - a formula that's relatively easy to use from JavaScript | 451 // - a formula that's relatively easy to use from JavaScript |
452 // Note that 'wheel' event deltaY values have their sign inverted. So to | 452 // Note that 'wheel' event deltaY values have their sign inverted. So to |
453 // convert a wheel deltaY back to a scale use Math.exp(-deltaY/100). | 453 // convert a wheel deltaY back to a scale use Math.exp(-deltaY/100). |
454 DCHECK_GT(pinch_event.event.data.pinchUpdate.scale, 0); | 454 DCHECK_GT(pinch_event.event.data.pinchUpdate.scale, 0); |
455 wheelEvent.deltaY = 100.0f * log(pinch_event.event.data.pinchUpdate.scale); | 455 wheelEvent.deltaY = 100.0f * log(pinch_event.event.data.pinchUpdate.scale); |
456 wheelEvent.hasPreciseScrollingDeltas = true; | 456 wheelEvent.hasPreciseScrollingDeltas = true; |
457 wheelEvent.wheelTicksX = 0; | 457 wheelEvent.wheelTicksX = 0; |
458 wheelEvent.wheelTicksY = | 458 wheelEvent.wheelTicksY = |
459 pinch_event.event.data.pinchUpdate.scale > 1 ? 1 : -1; | 459 pinch_event.event.data.pinchUpdate.scale > 1 ? 1 : -1; |
460 | 460 // Avoid touchpad pinch on Mac OS to scroll. |
tdresser
2014/12/02 15:37:37
Is this Mac OS specific?
Reword to:
Prevent track
lanwei
2014/12/02 22:28:06
Done.
Yes, this is only for Mac OS.
| |
461 wheelEvent.canScroll = false; | |
461 SendWheelEvent(QueuedWheelEvent( | 462 SendWheelEvent(QueuedWheelEvent( |
462 MouseWheelEventWithLatencyInfo(wheelEvent, pinch_event.latency), true)); | 463 MouseWheelEventWithLatencyInfo(wheelEvent, pinch_event.latency), true)); |
463 } | 464 } |
464 | 465 |
465 void InputRouterImpl::OnInputEventAck( | 466 void InputRouterImpl::OnInputEventAck( |
466 const InputHostMsg_HandleInputEvent_ACK_Params& ack) { | 467 const InputHostMsg_HandleInputEvent_ACK_Params& ack) { |
467 client_->DecrementInFlightEventCount(); | 468 client_->DecrementInFlightEventCount(); |
468 | 469 |
469 // Log the time delta for processing an input event. | 470 // Log the time delta for processing an input event. |
470 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; | 471 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
711 InputRouterImpl::QueuedWheelEvent::QueuedWheelEvent( | 712 InputRouterImpl::QueuedWheelEvent::QueuedWheelEvent( |
712 const MouseWheelEventWithLatencyInfo& event, | 713 const MouseWheelEventWithLatencyInfo& event, |
713 bool synthesized_from_pinch) | 714 bool synthesized_from_pinch) |
714 : event(event), synthesized_from_pinch(synthesized_from_pinch) { | 715 : event(event), synthesized_from_pinch(synthesized_from_pinch) { |
715 } | 716 } |
716 | 717 |
717 InputRouterImpl::QueuedWheelEvent::~QueuedWheelEvent() { | 718 InputRouterImpl::QueuedWheelEvent::~QueuedWheelEvent() { |
718 } | 719 } |
719 | 720 |
720 } // namespace content | 721 } // namespace content |
OLD | NEW |