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 // This file contains the definition for EventSender. | 5 // This file contains the definition for EventSender. |
6 // | 6 // |
7 // Some notes about drag and drop handling: | 7 // Some notes about drag and drop handling: |
8 // Windows drag and drop goes through a system call to doDragDrop. At that | 8 // Windows drag and drop goes through a system call to doDragDrop. At that |
9 // point, program control is given to Windows which then periodically makes | 9 // point, program control is given to Windows which then periodically makes |
10 // callbacks into the webview. This won't work for layout tests, so instead, | 10 // callbacks into the webview. This won't work for layout tests, so instead, |
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 // Force a layout here just to make sure every position has been | 1156 // Force a layout here just to make sure every position has been |
1157 // determined before we send events (as well as all the other methods | 1157 // determined before we send events (as well as all the other methods |
1158 // that send an event do). | 1158 // that send an event do). |
1159 if (shouldForceLayoutOnEvents()) | 1159 if (shouldForceLayoutOnEvents()) |
1160 webview()->layout(); | 1160 webview()->layout(); |
1161 | 1161 |
1162 int horizontal = arguments[0].toInt32(); | 1162 int horizontal = arguments[0].toInt32(); |
1163 int vertical = arguments[1].toInt32(); | 1163 int vertical = arguments[1].toInt32(); |
1164 int paged = false; | 1164 int paged = false; |
1165 int hasPreciseScrollingDeltas = false; | 1165 int hasPreciseScrollingDeltas = false; |
| 1166 int modifiers = 0; |
1166 | 1167 |
1167 if (arguments.size() > 2 && arguments[2].isBool()) | 1168 if (arguments.size() > 2 && arguments[2].isBool()) |
1168 paged = arguments[2].toBoolean(); | 1169 paged = arguments[2].toBoolean(); |
1169 | 1170 |
1170 if (arguments.size() > 3 && arguments[3].isBool()) | 1171 if (arguments.size() > 3 && arguments[3].isBool()) |
1171 hasPreciseScrollingDeltas = arguments[3].toBoolean(); | 1172 hasPreciseScrollingDeltas = arguments[3].toBoolean(); |
1172 | 1173 |
1173 initMouseEvent(WebInputEvent::MouseWheel, pressedButton, lastMousePos, event
, getCurrentEventTimeSec(m_delegate), 0); | 1174 if (arguments.size() > 4 && (arguments[4].isObject() || arguments[4].isStrin
g())) |
| 1175 modifiers = getKeyModifiers(&(arguments[4])); |
| 1176 |
| 1177 initMouseEvent(WebInputEvent::MouseWheel, pressedButton, lastMousePos, event
, getCurrentEventTimeSec(m_delegate), modifiers); |
1174 event->wheelTicksX = static_cast<float>(horizontal); | 1178 event->wheelTicksX = static_cast<float>(horizontal); |
1175 event->wheelTicksY = static_cast<float>(vertical); | 1179 event->wheelTicksY = static_cast<float>(vertical); |
1176 event->deltaX = event->wheelTicksX; | 1180 event->deltaX = event->wheelTicksX; |
1177 event->deltaY = event->wheelTicksY; | 1181 event->deltaY = event->wheelTicksY; |
1178 event->scrollByPage = paged; | 1182 event->scrollByPage = paged; |
1179 event->hasPreciseScrollingDeltas = hasPreciseScrollingDeltas; | 1183 event->hasPreciseScrollingDeltas = hasPreciseScrollingDeltas; |
1180 | 1184 |
1181 if (continuous) { | 1185 if (continuous) { |
1182 event->wheelTicksX /= scrollbarPixelsPerTick; | 1186 event->wheelTicksX /= scrollbarPixelsPerTick; |
1183 event->wheelTicksY /= scrollbarPixelsPerTick; | 1187 event->wheelTicksY /= scrollbarPixelsPerTick; |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1454 { | 1458 { |
1455 result->setNull(); | 1459 result->setNull(); |
1456 } | 1460 } |
1457 | 1461 |
1458 void EventSender::clearKillRing(const CppArgumentList&, CppVariant* result) | 1462 void EventSender::clearKillRing(const CppArgumentList&, CppVariant* result) |
1459 { | 1463 { |
1460 result->setNull(); | 1464 result->setNull(); |
1461 } | 1465 } |
1462 | 1466 |
1463 } | 1467 } |
OLD | NEW |