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 "ui/events/blink/input_handler_proxy.h" | 5 #include "ui/events/blink/input_handler_proxy.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 } | 671 } |
672 | 672 |
673 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel( | 673 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel( |
674 const WebMouseWheelEvent& wheel_event) { | 674 const WebMouseWheelEvent& wheel_event) { |
675 // Only call |CancelCurrentFling()| if a fling was active, as it will | 675 // Only call |CancelCurrentFling()| if a fling was active, as it will |
676 // otherwise disrupt an in-progress touch scroll. | 676 // otherwise disrupt an in-progress touch scroll. |
677 if (!wheel_event.has_precise_scrolling_deltas && fling_curve_) | 677 if (!wheel_event.has_precise_scrolling_deltas && fling_curve_) |
678 CancelCurrentFling(); | 678 CancelCurrentFling(); |
679 | 679 |
680 InputHandlerProxy::EventDisposition result = DROP_EVENT; | 680 InputHandlerProxy::EventDisposition result = DROP_EVENT; |
| 681 |
| 682 if (wheel_event.dispatch_type == WebInputEvent::kEventNonBlocking) { |
| 683 // The first wheel event in the sequence should be cancellable. |
| 684 DCHECK(wheel_event.phase != WebMouseWheelEvent::kPhaseBegan); |
| 685 |
| 686 DCHECK(mouse_wheel_result_ != kEventDispositionUndefined); |
| 687 result = static_cast<EventDisposition>(mouse_wheel_result_); |
| 688 |
| 689 if (wheel_event.phase == WebMouseWheelEvent::kPhaseEnded || |
| 690 wheel_event.phase == WebMouseWheelEvent::kPhaseCancelled || |
| 691 wheel_event.momentum_phase == WebMouseWheelEvent::kPhaseEnded || |
| 692 wheel_event.momentum_phase == WebMouseWheelEvent::kPhaseCancelled) { |
| 693 mouse_wheel_result_ = kEventDispositionUndefined; |
| 694 } |
| 695 if (mouse_wheel_result_ != kEventDispositionUndefined) |
| 696 return result; |
| 697 } |
| 698 |
681 cc::EventListenerProperties properties = | 699 cc::EventListenerProperties properties = |
682 input_handler_->GetEventListenerProperties( | 700 input_handler_->GetEventListenerProperties( |
683 cc::EventListenerClass::kMouseWheel); | 701 cc::EventListenerClass::kMouseWheel); |
684 switch (properties) { | 702 switch (properties) { |
685 case cc::EventListenerProperties::kPassive: | 703 case cc::EventListenerProperties::kPassive: |
686 result = DID_HANDLE_NON_BLOCKING; | 704 result = DID_HANDLE_NON_BLOCKING; |
687 break; | 705 break; |
688 case cc::EventListenerProperties::kBlockingAndPassive: | 706 case cc::EventListenerProperties::kBlockingAndPassive: |
689 case cc::EventListenerProperties::kBlocking: | 707 case cc::EventListenerProperties::kBlocking: |
690 result = DID_NOT_HANDLE; | 708 result = DID_NOT_HANDLE; |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, | 1704 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, |
1687 scroll_result)); | 1705 scroll_result)); |
1688 } | 1706 } |
1689 | 1707 |
1690 void InputHandlerProxy::SetTickClockForTesting( | 1708 void InputHandlerProxy::SetTickClockForTesting( |
1691 std::unique_ptr<base::TickClock> tick_clock) { | 1709 std::unique_ptr<base::TickClock> tick_clock) { |
1692 tick_clock_ = std::move(tick_clock); | 1710 tick_clock_ = std::move(tick_clock); |
1693 } | 1711 } |
1694 | 1712 |
1695 } // namespace ui | 1713 } // namespace ui |
OLD | NEW |