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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 return false; | 120 return false; |
121 | 121 |
122 if (new_fling_velocity.LengthSquared() < kMinBoostFlingSpeedSquare) | 122 if (new_fling_velocity.LengthSquared() < kMinBoostFlingSpeedSquare) |
123 return false; | 123 return false; |
124 | 124 |
125 return true; | 125 return true; |
126 } | 126 } |
127 | 127 |
128 WebGestureEvent ObtainGestureScrollBegin(const WebGestureEvent& event) { | 128 WebGestureEvent ObtainGestureScrollBegin(const WebGestureEvent& event) { |
129 WebGestureEvent scroll_begin_event = event; | 129 WebGestureEvent scroll_begin_event = event; |
130 scroll_begin_event.type = WebInputEvent::GestureScrollBegin; | 130 scroll_begin_event.setType(WebInputEvent::GestureScrollBegin); |
131 scroll_begin_event.data.scrollBegin.deltaXHint = 0; | 131 scroll_begin_event.data.scrollBegin.deltaXHint = 0; |
132 scroll_begin_event.data.scrollBegin.deltaYHint = 0; | 132 scroll_begin_event.data.scrollBegin.deltaYHint = 0; |
133 return scroll_begin_event; | 133 return scroll_begin_event; |
134 } | 134 } |
135 | 135 |
136 cc::ScrollState CreateScrollStateForGesture(const WebGestureEvent& event) { | 136 cc::ScrollState CreateScrollStateForGesture(const WebGestureEvent& event) { |
137 cc::ScrollStateData scroll_state_data; | 137 cc::ScrollStateData scroll_state_data; |
138 switch (event.type) { | 138 switch (event.type) { |
139 case WebInputEvent::GestureScrollBegin: | 139 case WebInputEvent::GestureScrollBegin: |
140 scroll_state_data.position_x = event.x; | 140 scroll_state_data.position_x = event.x; |
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 InputHandlerProxy::EventDisposition disposition; | 1397 InputHandlerProxy::EventDisposition disposition; |
1398 cc::EventListenerProperties properties = | 1398 cc::EventListenerProperties properties = |
1399 input_handler_->GetEventListenerProperties( | 1399 input_handler_->GetEventListenerProperties( |
1400 cc::EventListenerClass::kMouseWheel); | 1400 cc::EventListenerClass::kMouseWheel); |
1401 switch (properties) { | 1401 switch (properties) { |
1402 case cc::EventListenerProperties::kBlocking: | 1402 case cc::EventListenerProperties::kBlocking: |
1403 disposition = DID_NOT_HANDLE; | 1403 disposition = DID_NOT_HANDLE; |
1404 break; | 1404 break; |
1405 case cc::EventListenerProperties::kPassive: | 1405 case cc::EventListenerProperties::kPassive: |
1406 case cc::EventListenerProperties::kNone: { | 1406 case cc::EventListenerProperties::kNone: { |
1407 WebMouseWheelEvent synthetic_wheel; | 1407 WebMouseWheelEvent synthetic_wheel(WebInputEvent::MouseWheel, |
1408 synthetic_wheel.type = WebInputEvent::MouseWheel; | 1408 fling_parameters_.modifiers, |
1409 synthetic_wheel.timeStampSeconds = InSecondsF(base::TimeTicks::Now()); | 1409 InSecondsF(base::TimeTicks::Now())); |
1410 synthetic_wheel.deltaX = increment.width; | 1410 synthetic_wheel.deltaX = increment.width; |
1411 synthetic_wheel.deltaY = increment.height; | 1411 synthetic_wheel.deltaY = increment.height; |
1412 synthetic_wheel.hasPreciseScrollingDeltas = true; | 1412 synthetic_wheel.hasPreciseScrollingDeltas = true; |
1413 synthetic_wheel.x = fling_parameters_.point.x; | 1413 synthetic_wheel.x = fling_parameters_.point.x; |
1414 synthetic_wheel.y = fling_parameters_.point.y; | 1414 synthetic_wheel.y = fling_parameters_.point.y; |
1415 synthetic_wheel.globalX = fling_parameters_.globalPoint.x; | 1415 synthetic_wheel.globalX = fling_parameters_.globalPoint.x; |
1416 synthetic_wheel.globalY = fling_parameters_.globalPoint.y; | 1416 synthetic_wheel.globalY = fling_parameters_.globalPoint.y; |
1417 synthetic_wheel.modifiers = fling_parameters_.modifiers; | |
1418 | 1417 |
1419 disposition = ScrollByMouseWheel(synthetic_wheel, properties); | 1418 disposition = ScrollByMouseWheel(synthetic_wheel, properties); |
1420 | 1419 |
1421 // Send the event over to the main thread. | 1420 // Send the event over to the main thread. |
1422 if (disposition == DID_HANDLE_NON_BLOCKING) { | 1421 if (disposition == DID_HANDLE_NON_BLOCKING) { |
1423 client_->DispatchNonBlockingEventToMainThread( | 1422 client_->DispatchNonBlockingEventToMainThread( |
1424 ui::WebInputEventTraits::Clone(synthetic_wheel), ui::LatencyInfo()); | 1423 ui::WebInputEventTraits::Clone(synthetic_wheel), ui::LatencyInfo()); |
1425 } | 1424 } |
1426 break; | 1425 break; |
1427 } | 1426 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1539 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, | 1538 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, |
1540 scroll_result)); | 1539 scroll_result)); |
1541 } | 1540 } |
1542 | 1541 |
1543 void InputHandlerProxy::SetTickClockForTesting( | 1542 void InputHandlerProxy::SetTickClockForTesting( |
1544 std::unique_ptr<base::TickClock> tick_clock) { | 1543 std::unique_ptr<base::TickClock> tick_clock) { |
1545 tick_clock_ = std::move(tick_clock); | 1544 tick_clock_ = std::move(tick_clock); |
1546 } | 1545 } |
1547 | 1546 |
1548 } // namespace ui | 1547 } // namespace ui |
OLD | NEW |