| 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/base_event_utils.h" | 9 #include "ui/events/base_event_utils.h" |
| 10 #include "ui/events/keycodes/keyboard_codes.h" | 10 #include "ui/events/keycodes/keyboard_codes.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 result.phase = phase; | 54 result.phase = phase; |
| 55 return result; | 55 return result; |
| 56 } | 56 } |
| 57 | 57 |
| 58 WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build(float x, | 58 WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build(float x, |
| 59 float y, | 59 float y, |
| 60 float dx, | 60 float dx, |
| 61 float dy, | 61 float dy, |
| 62 int modifiers, | 62 int modifiers, |
| 63 bool precise) { | 63 bool precise) { |
| 64 return Build(x, y, 0, 0, dx, dy, modifiers, precise); |
| 65 } |
| 66 |
| 67 WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build(float x, |
| 68 float y, |
| 69 float global_x, |
| 70 float global_y, |
| 71 float dx, |
| 72 float dy, |
| 73 int modifiers, |
| 74 bool precise) { |
| 64 WebMouseWheelEvent result; | 75 WebMouseWheelEvent result; |
| 65 result.type = WebInputEvent::MouseWheel; | 76 result.type = WebInputEvent::MouseWheel; |
| 77 result.globalX = global_x; |
| 78 result.globalY = global_y; |
| 66 result.x = x; | 79 result.x = x; |
| 67 result.y = y; | 80 result.y = y; |
| 68 result.deltaX = dx; | 81 result.deltaX = dx; |
| 69 result.deltaY = dy; | 82 result.deltaY = dy; |
| 70 if (dx) | 83 if (dx) |
| 71 result.wheelTicksX = dx > 0.0f ? 1.0f : -1.0f; | 84 result.wheelTicksX = dx > 0.0f ? 1.0f : -1.0f; |
| 72 if (dy) | 85 if (dy) |
| 73 result.wheelTicksY = dy > 0.0f ? 1.0f : -1.0f; | 86 result.wheelTicksY = dy > 0.0f ? 1.0f : -1.0f; |
| 74 result.modifiers = modifiers; | 87 result.modifiers = modifiers; |
| 75 result.hasPreciseScrollingDeltas = precise; | 88 result.hasPreciseScrollingDeltas = precise; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 touches[index].state = WebTouchPoint::StateCancelled; | 234 touches[index].state = WebTouchPoint::StateCancelled; |
| 222 WebTouchEventTraits::ResetType( | 235 WebTouchEventTraits::ResetType( |
| 223 WebInputEvent::TouchCancel, timeStampSeconds, this); | 236 WebInputEvent::TouchCancel, timeStampSeconds, this); |
| 224 } | 237 } |
| 225 | 238 |
| 226 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { | 239 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { |
| 227 timeStampSeconds = timestamp.InSecondsF(); | 240 timeStampSeconds = timestamp.InSecondsF(); |
| 228 } | 241 } |
| 229 | 242 |
| 230 } // namespace content | 243 } // namespace content |
| OLD | NEW |