Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: ui/events/blink/input_handler_proxy.cc

Issue 2569273002: Add constructors to WebInputEvents and setters so we can work at cleaning up these public structs. (Closed)
Patch Set: Rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 return false; 121 return false;
122 122
123 if (new_fling_velocity.LengthSquared() < kMinBoostFlingSpeedSquare) 123 if (new_fling_velocity.LengthSquared() < kMinBoostFlingSpeedSquare)
124 return false; 124 return false;
125 125
126 return true; 126 return true;
127 } 127 }
128 128
129 WebGestureEvent ObtainGestureScrollBegin(const WebGestureEvent& event) { 129 WebGestureEvent ObtainGestureScrollBegin(const WebGestureEvent& event) {
130 WebGestureEvent scroll_begin_event = event; 130 WebGestureEvent scroll_begin_event = event;
131 scroll_begin_event.type = WebInputEvent::GestureScrollBegin; 131 scroll_begin_event.setType(WebInputEvent::GestureScrollBegin);
132 scroll_begin_event.data.scrollBegin.deltaXHint = 0; 132 scroll_begin_event.data.scrollBegin.deltaXHint = 0;
133 scroll_begin_event.data.scrollBegin.deltaYHint = 0; 133 scroll_begin_event.data.scrollBegin.deltaYHint = 0;
134 return scroll_begin_event; 134 return scroll_begin_event;
135 } 135 }
136 136
137 cc::ScrollState CreateScrollStateForGesture(const WebGestureEvent& event) { 137 cc::ScrollState CreateScrollStateForGesture(const WebGestureEvent& event) {
138 cc::ScrollStateData scroll_state_data; 138 cc::ScrollStateData scroll_state_data;
139 switch (event.type) { 139 switch (event.type) {
140 case WebInputEvent::GestureScrollBegin: 140 case WebInputEvent::GestureScrollBegin:
141 scroll_state_data.position_x = event.x; 141 scroll_state_data.position_x = event.x;
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 InputHandlerProxy::EventDisposition disposition; 1398 InputHandlerProxy::EventDisposition disposition;
1399 cc::EventListenerProperties properties = 1399 cc::EventListenerProperties properties =
1400 input_handler_->GetEventListenerProperties( 1400 input_handler_->GetEventListenerProperties(
1401 cc::EventListenerClass::kMouseWheel); 1401 cc::EventListenerClass::kMouseWheel);
1402 switch (properties) { 1402 switch (properties) {
1403 case cc::EventListenerProperties::kBlocking: 1403 case cc::EventListenerProperties::kBlocking:
1404 disposition = DID_NOT_HANDLE; 1404 disposition = DID_NOT_HANDLE;
1405 break; 1405 break;
1406 case cc::EventListenerProperties::kPassive: 1406 case cc::EventListenerProperties::kPassive:
1407 case cc::EventListenerProperties::kNone: { 1407 case cc::EventListenerProperties::kNone: {
1408 WebMouseWheelEvent synthetic_wheel; 1408 WebMouseWheelEvent synthetic_wheel(WebInputEvent::MouseWheel,
1409 synthetic_wheel.type = WebInputEvent::MouseWheel; 1409 fling_parameters_.modifiers,
1410 synthetic_wheel.timeStampSeconds = InSecondsF(base::TimeTicks::Now()); 1410 InSecondsF(base::TimeTicks::Now()));
1411 synthetic_wheel.deltaX = increment.width; 1411 synthetic_wheel.deltaX = increment.width;
1412 synthetic_wheel.deltaY = increment.height; 1412 synthetic_wheel.deltaY = increment.height;
1413 synthetic_wheel.hasPreciseScrollingDeltas = true; 1413 synthetic_wheel.hasPreciseScrollingDeltas = true;
1414 synthetic_wheel.x = fling_parameters_.point.x; 1414 synthetic_wheel.x = fling_parameters_.point.x;
1415 synthetic_wheel.y = fling_parameters_.point.y; 1415 synthetic_wheel.y = fling_parameters_.point.y;
1416 synthetic_wheel.globalX = fling_parameters_.globalPoint.x; 1416 synthetic_wheel.globalX = fling_parameters_.globalPoint.x;
1417 synthetic_wheel.globalY = fling_parameters_.globalPoint.y; 1417 synthetic_wheel.globalY = fling_parameters_.globalPoint.y;
1418 synthetic_wheel.modifiers = fling_parameters_.modifiers;
1419 1418
1420 disposition = ScrollByMouseWheel(synthetic_wheel, properties); 1419 disposition = ScrollByMouseWheel(synthetic_wheel, properties);
1421 1420
1422 // Send the event over to the main thread. 1421 // Send the event over to the main thread.
1423 if (disposition == DID_HANDLE_NON_BLOCKING) { 1422 if (disposition == DID_HANDLE_NON_BLOCKING) {
1424 client_->DispatchNonBlockingEventToMainThread( 1423 client_->DispatchNonBlockingEventToMainThread(
1425 ui::WebInputEventTraits::Clone(synthetic_wheel), ui::LatencyInfo()); 1424 ui::WebInputEventTraits::Clone(synthetic_wheel), ui::LatencyInfo());
1426 } 1425 }
1427 break; 1426 break;
1428 } 1427 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, 1539 scroll_elasticity_controller_->GetWeakPtr(), gesture_event,
1541 scroll_result)); 1540 scroll_result));
1542 } 1541 }
1543 1542
1544 void InputHandlerProxy::SetTickClockForTesting( 1543 void InputHandlerProxy::SetTickClockForTesting(
1545 std::unique_ptr<base::TickClock> tick_clock) { 1544 std::unique_ptr<base::TickClock> tick_clock) {
1546 tick_clock_ = std::move(tick_clock); 1545 tick_clock_ = std::move(tick_clock);
1547 } 1546 }
1548 1547
1549 } // namespace ui 1548 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698