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/common/input/synthetic_web_input_event_builders.h" | 5 #include "content/common/input/synthetic_web_input_event_builders.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/common/input/web_touch_event_traits.h" | 8 #include "content/common/input/web_touch_event_traits.h" |
9 #include "ui/events/keycodes/keyboard_codes.h" | 9 #include "ui/events/keycodes/keyboard_codes.h" |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 WebMouseWheelEvent result; | 61 WebMouseWheelEvent result; |
62 result.type = WebInputEvent::MouseWheel; | 62 result.type = WebInputEvent::MouseWheel; |
63 result.deltaX = dx; | 63 result.deltaX = dx; |
64 result.deltaY = dy; | 64 result.deltaY = dy; |
65 if (dx) | 65 if (dx) |
66 result.wheelTicksX = dx > 0.0f ? 1.0f : -1.0f; | 66 result.wheelTicksX = dx > 0.0f ? 1.0f : -1.0f; |
67 if (dy) | 67 if (dy) |
68 result.wheelTicksY = dy > 0.0f ? 1.0f : -1.0f; | 68 result.wheelTicksY = dy > 0.0f ? 1.0f : -1.0f; |
69 result.modifiers = modifiers; | 69 result.modifiers = modifiers; |
70 result.hasPreciseScrollingDeltas = precise; | 70 result.hasPreciseScrollingDeltas = precise; |
71 if ((modifiers & blink::WebInputEvent::ControlKey) && !precise) { | |
Rick Byers
2014/12/12 22:20:29
Which tests fail if you just unconditionally set c
lanwei
2014/12/17 23:16:40
Done.
| |
72 result.canScroll = false; | |
73 } | |
71 return result; | 74 return result; |
72 } | 75 } |
73 | 76 |
74 WebKeyboardEvent SyntheticWebKeyboardEventBuilder::Build( | 77 WebKeyboardEvent SyntheticWebKeyboardEventBuilder::Build( |
75 WebInputEvent::Type type) { | 78 WebInputEvent::Type type) { |
76 DCHECK(WebInputEvent::isKeyboardEventType(type)); | 79 DCHECK(WebInputEvent::isKeyboardEventType(type)); |
77 WebKeyboardEvent result; | 80 WebKeyboardEvent result; |
78 result.type = type; | 81 result.type = type; |
79 result.windowsKeyCode = ui::VKEY_L; // non-null made up value. | 82 result.windowsKeyCode = ui::VKEY_L; // non-null made up value. |
80 return result; | 83 return result; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 touches[index].state = WebTouchPoint::StateCancelled; | 205 touches[index].state = WebTouchPoint::StateCancelled; |
203 WebTouchEventTraits::ResetType( | 206 WebTouchEventTraits::ResetType( |
204 WebInputEvent::TouchCancel, timeStampSeconds, this); | 207 WebInputEvent::TouchCancel, timeStampSeconds, this); |
205 } | 208 } |
206 | 209 |
207 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { | 210 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { |
208 timeStampSeconds = timestamp.InSecondsF(); | 211 timeStampSeconds = timestamp.InSecondsF(); |
209 } | 212 } |
210 | 213 |
211 } // namespace content | 214 } // namespace content |
OLD | NEW |