OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 bindMethod("gestureTap", &EventSender::gestureTap); | 297 bindMethod("gestureTap", &EventSender::gestureTap); |
298 bindMethod("gestureTapDown", &EventSender::gestureTapDown); | 298 bindMethod("gestureTapDown", &EventSender::gestureTapDown); |
299 bindMethod("gestureTapCancel", &EventSender::gestureTapCancel); | 299 bindMethod("gestureTapCancel", &EventSender::gestureTapCancel); |
300 bindMethod("gestureLongPress", &EventSender::gestureLongPress); | 300 bindMethod("gestureLongPress", &EventSender::gestureLongPress); |
301 bindMethod("gestureLongTap", &EventSender::gestureLongTap); | 301 bindMethod("gestureLongTap", &EventSender::gestureLongTap); |
302 bindMethod("gestureTwoFingerTap", &EventSender::gestureTwoFingerTap); | 302 bindMethod("gestureTwoFingerTap", &EventSender::gestureTwoFingerTap); |
303 bindMethod("zoomPageIn", &EventSender::zoomPageIn); | 303 bindMethod("zoomPageIn", &EventSender::zoomPageIn); |
304 bindMethod("zoomPageOut", &EventSender::zoomPageOut); | 304 bindMethod("zoomPageOut", &EventSender::zoomPageOut); |
305 bindMethod("scalePageBy", &EventSender::scalePageBy); | 305 bindMethod("scalePageBy", &EventSender::scalePageBy); |
306 | 306 |
| 307 bindProperty("forceLayoutOnEvents", &forceLayoutOnEvents); |
| 308 |
307 // When set to true (the default value), we batch mouse move and mouse up | 309 // When set to true (the default value), we batch mouse move and mouse up |
308 // events so we can simulate drag & drop. | 310 // events so we can simulate drag & drop. |
309 bindProperty("dragMode", &dragMode); | 311 bindProperty("dragMode", &dragMode); |
310 #ifdef WIN32 | 312 #ifdef WIN32 |
311 bindProperty("WM_KEYDOWN", &wmKeyDown); | 313 bindProperty("WM_KEYDOWN", &wmKeyDown); |
312 bindProperty("WM_KEYUP", &wmKeyUp); | 314 bindProperty("WM_KEYUP", &wmKeyUp); |
313 bindProperty("WM_CHAR", &wmChar); | 315 bindProperty("WM_CHAR", &wmChar); |
314 bindProperty("WM_DEADCHAR", &wmDeadChar); | 316 bindProperty("WM_DEADCHAR", &wmDeadChar); |
315 bindProperty("WM_SYSKEYDOWN", &wmSysKeyDown); | 317 bindProperty("WM_SYSKEYDOWN", &wmSysKeyDown); |
316 bindProperty("WM_SYSKEYUP", &wmSysKeyUp); | 318 bindProperty("WM_SYSKEYUP", &wmSysKeyUp); |
(...skipping 13 matching lines...) Expand all Loading... |
330 | 332 |
331 void EventSender::reset() | 333 void EventSender::reset() |
332 { | 334 { |
333 // The test should have finished a drag and the mouse button state. | 335 // The test should have finished a drag and the mouse button state. |
334 WEBKIT_ASSERT(currentDragData.isNull()); | 336 WEBKIT_ASSERT(currentDragData.isNull()); |
335 currentDragData.reset(); | 337 currentDragData.reset(); |
336 currentDragEffect = WebKit::WebDragOperationNone; | 338 currentDragEffect = WebKit::WebDragOperationNone; |
337 currentDragEffectsAllowed = WebKit::WebDragOperationNone; | 339 currentDragEffectsAllowed = WebKit::WebDragOperationNone; |
338 pressedButton = WebMouseEvent::ButtonNone; | 340 pressedButton = WebMouseEvent::ButtonNone; |
339 dragMode.set(true); | 341 dragMode.set(true); |
| 342 forceLayoutOnEvents.set(true); |
340 #ifdef WIN32 | 343 #ifdef WIN32 |
341 wmKeyDown.set(WM_KEYDOWN); | 344 wmKeyDown.set(WM_KEYDOWN); |
342 wmKeyUp.set(WM_KEYUP); | 345 wmKeyUp.set(WM_KEYUP); |
343 wmChar.set(WM_CHAR); | 346 wmChar.set(WM_CHAR); |
344 wmDeadChar.set(WM_DEADCHAR); | 347 wmDeadChar.set(WM_DEADCHAR); |
345 wmSysKeyDown.set(WM_SYSKEYDOWN); | 348 wmSysKeyDown.set(WM_SYSKEYDOWN); |
346 wmSysKeyUp.set(WM_SYSKEYUP); | 349 wmSysKeyUp.set(WM_SYSKEYUP); |
347 wmSysChar.set(WM_SYSCHAR); | 350 wmSysChar.set(WM_SYSCHAR); |
348 wmSysDeadChar.set(WM_SYSDEADCHAR); | 351 wmSysDeadChar.set(WM_SYSDEADCHAR); |
349 #endif | 352 #endif |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 420 |
418 // | 421 // |
419 // Implemented javascript methods. | 422 // Implemented javascript methods. |
420 // | 423 // |
421 | 424 |
422 void EventSender::mouseDown(const CppArgumentList& arguments, CppVariant* result
) | 425 void EventSender::mouseDown(const CppArgumentList& arguments, CppVariant* result
) |
423 { | 426 { |
424 if (result) // Could be 0 if invoked asynchronously. | 427 if (result) // Could be 0 if invoked asynchronously. |
425 result->setNull(); | 428 result->setNull(); |
426 | 429 |
| 430 if (shouldForceLayoutOnEvents()) |
| 431 webview()->layout(); |
| 432 |
427 int buttonNumber = getButtonNumberFromSingleArg(arguments); | 433 int buttonNumber = getButtonNumberFromSingleArg(arguments); |
428 WEBKIT_ASSERT(buttonNumber != -1); | 434 WEBKIT_ASSERT(buttonNumber != -1); |
429 | 435 |
430 WebMouseEvent::Button buttonType = getButtonTypeFromButtonNumber(buttonNumbe
r); | 436 WebMouseEvent::Button buttonType = getButtonTypeFromButtonNumber(buttonNumbe
r); |
431 | 437 |
432 updateClickCountForButton(buttonType); | 438 updateClickCountForButton(buttonType); |
433 | 439 |
434 WebMouseEvent event; | 440 WebMouseEvent event; |
435 pressedButton = buttonType; | 441 pressedButton = buttonType; |
436 initMouseEvent(WebInputEvent::MouseDown, buttonType, lastMousePos, &event, g
etCurrentEventTimeSec(m_delegate)); | 442 initMouseEvent(WebInputEvent::MouseDown, buttonType, lastMousePos, &event, g
etCurrentEventTimeSec(m_delegate)); |
437 if (arguments.size() >= 2 && (arguments[1].isObject() || arguments[1].isStri
ng())) | 443 if (arguments.size() >= 2 && (arguments[1].isObject() || arguments[1].isStri
ng())) |
438 applyKeyModifiers(&(arguments[1]), &event); | 444 applyKeyModifiers(&(arguments[1]), &event); |
439 webview()->handleInputEvent(event); | 445 webview()->handleInputEvent(event); |
440 } | 446 } |
441 | 447 |
442 void EventSender::mouseUp(const CppArgumentList& arguments, CppVariant* result) | 448 void EventSender::mouseUp(const CppArgumentList& arguments, CppVariant* result) |
443 { | 449 { |
444 if (result) // Could be 0 if invoked asynchronously. | 450 if (result) // Could be 0 if invoked asynchronously. |
445 result->setNull(); | 451 result->setNull(); |
446 | 452 |
| 453 if (shouldForceLayoutOnEvents()) |
| 454 webview()->layout(); |
| 455 |
447 int buttonNumber = getButtonNumberFromSingleArg(arguments); | 456 int buttonNumber = getButtonNumberFromSingleArg(arguments); |
448 WEBKIT_ASSERT(buttonNumber != -1); | 457 WEBKIT_ASSERT(buttonNumber != -1); |
449 | 458 |
450 WebMouseEvent::Button buttonType = getButtonTypeFromButtonNumber(buttonNumbe
r); | 459 WebMouseEvent::Button buttonType = getButtonTypeFromButtonNumber(buttonNumbe
r); |
451 | 460 |
452 if (isDragMode() && !replayingSavedEvents) { | 461 if (isDragMode() && !replayingSavedEvents) { |
453 SavedEvent savedEvent; | 462 SavedEvent savedEvent; |
454 savedEvent.type = SavedEvent::MouseUp; | 463 savedEvent.type = SavedEvent::MouseUp; |
455 savedEvent.buttonType = buttonType; | 464 savedEvent.buttonType = buttonType; |
456 mouseEventQueue.push_back(savedEvent); | 465 mouseEventQueue.push_back(savedEvent); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 | 504 |
496 currentDragData.reset(); | 505 currentDragData.reset(); |
497 } | 506 } |
498 | 507 |
499 void EventSender::mouseMoveTo(const CppArgumentList& arguments, CppVariant* resu
lt) | 508 void EventSender::mouseMoveTo(const CppArgumentList& arguments, CppVariant* resu
lt) |
500 { | 509 { |
501 result->setNull(); | 510 result->setNull(); |
502 | 511 |
503 if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumb
er()) | 512 if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumb
er()) |
504 return; | 513 return; |
| 514 if (shouldForceLayoutOnEvents()) |
| 515 webview()->layout(); |
505 | 516 |
506 WebPoint mousePos(arguments[0].toInt32(), arguments[1].toInt32()); | 517 WebPoint mousePos(arguments[0].toInt32(), arguments[1].toInt32()); |
507 | 518 |
508 if (isDragMode() && pressedButton == WebMouseEvent::ButtonLeft && !replaying
SavedEvents) { | 519 if (isDragMode() && pressedButton == WebMouseEvent::ButtonLeft && !replaying
SavedEvents) { |
509 SavedEvent savedEvent; | 520 SavedEvent savedEvent; |
510 savedEvent.type = SavedEvent::MouseMove; | 521 savedEvent.type = SavedEvent::MouseMove; |
511 savedEvent.pos = mousePos; | 522 savedEvent.pos = mousePos; |
512 mouseEventQueue.push_back(savedEvent); | 523 mouseEventQueue.push_back(savedEvent); |
513 } else { | 524 } else { |
514 WebMouseEvent event; | 525 WebMouseEvent event; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 if (arguments.size() >= 3 && arguments[2].isNumber()) { | 658 if (arguments.size() >= 3 && arguments[2].isNumber()) { |
648 int location = arguments[2].toInt32(); | 659 int location = arguments[2].toInt32(); |
649 if (location == DOMKeyLocationNumpad) | 660 if (location == DOMKeyLocationNumpad) |
650 eventDown.modifiers |= WebInputEvent::IsKeyPad; | 661 eventDown.modifiers |= WebInputEvent::IsKeyPad; |
651 } | 662 } |
652 | 663 |
653 eventChar = eventUp = eventDown; | 664 eventChar = eventUp = eventDown; |
654 eventUp.type = WebInputEvent::KeyUp; | 665 eventUp.type = WebInputEvent::KeyUp; |
655 // EventSender.m forces a layout here, with at least one | 666 // EventSender.m forces a layout here, with at least one |
656 // test (fast/forms/focus-control-to-page.html) relying on this. | 667 // test (fast/forms/focus-control-to-page.html) relying on this. |
657 webview()->layout(); | 668 if (shouldForceLayoutOnEvents()) |
| 669 webview()->layout(); |
658 | 670 |
659 // In the browser, if a keyboard event corresponds to an editor command, | 671 // In the browser, if a keyboard event corresponds to an editor command, |
660 // the command will be dispatched to the renderer just before dispatching | 672 // the command will be dispatched to the renderer just before dispatching |
661 // the keyboard event, and then it will be executed in the | 673 // the keyboard event, and then it will be executed in the |
662 // RenderView::handleCurrentKeyboardEvent() method, which is called from | 674 // RenderView::handleCurrentKeyboardEvent() method, which is called from |
663 // third_party/WebKit/Source/WebKit/chromium/src/EditorClientImpl.cpp. | 675 // third_party/WebKit/Source/WebKit/chromium/src/EditorClientImpl.cpp. |
664 // We just simulate the same behavior here. | 676 // We just simulate the same behavior here. |
665 string editCommand; | 677 string editCommand; |
666 if (getEditCommand(eventDown, &editCommand)) | 678 if (getEditCommand(eventDown, &editCommand)) |
667 m_delegate->setEditCommand(editCommand, ""); | 679 m_delegate->setEditCommand(editCommand, ""); |
(...skipping 25 matching lines...) Expand all Loading... |
693 if (arguments.size() == 3) { | 705 if (arguments.size() == 3) { |
694 // Grab the message id to see if we need to dispatch it. | 706 // Grab the message id to see if we need to dispatch it. |
695 int msg = arguments[0].toInt32(); | 707 int msg = arguments[0].toInt32(); |
696 | 708 |
697 // WebKit's version of this function stuffs a MSG struct and uses | 709 // WebKit's version of this function stuffs a MSG struct and uses |
698 // TranslateMessage and DispatchMessage. We use a WebKeyboardEvent, whic
h | 710 // TranslateMessage and DispatchMessage. We use a WebKeyboardEvent, whic
h |
699 // doesn't need to receive the DeadChar and SysDeadChar messages. | 711 // doesn't need to receive the DeadChar and SysDeadChar messages. |
700 if (msg == WM_DEADCHAR || msg == WM_SYSDEADCHAR) | 712 if (msg == WM_DEADCHAR || msg == WM_SYSDEADCHAR) |
701 return; | 713 return; |
702 | 714 |
703 webview()->layout(); | 715 if (shouldForceLayoutOnEvents()) |
| 716 webview()->layout(); |
704 | 717 |
705 unsigned long lparam = static_cast<unsigned long>(arguments[2].toDouble(
)); | 718 unsigned long lparam = static_cast<unsigned long>(arguments[2].toDouble(
)); |
706 webview()->handleInputEvent(WebInputEventFactory::keyboardEvent(0, msg,
arguments[1].toInt32(), lparam)); | 719 webview()->handleInputEvent(WebInputEventFactory::keyboardEvent(0, msg,
arguments[1].toInt32(), lparam)); |
707 } else | 720 } else |
708 WEBKIT_ASSERT_NOT_REACHED(); | 721 WEBKIT_ASSERT_NOT_REACHED(); |
709 #endif | 722 #endif |
710 } | 723 } |
711 | 724 |
712 bool EventSender::needsShiftModifier(int keyCode) | 725 bool EventSender::needsShiftModifier(int keyCode) |
713 { | 726 { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 } else { | 860 } else { |
848 for (const char** item = nonEditableMenuStrings; *item; ++item) | 861 for (const char** item = nonEditableMenuStrings; *item; ++item) |
849 strings.push_back(WebString::fromUTF8(*item)); | 862 strings.push_back(WebString::fromUTF8(*item)); |
850 } | 863 } |
851 | 864 |
852 return strings; | 865 return strings; |
853 } | 866 } |
854 | 867 |
855 void EventSender::contextClick(const CppArgumentList& arguments, CppVariant* res
ult) | 868 void EventSender::contextClick(const CppArgumentList& arguments, CppVariant* res
ult) |
856 { | 869 { |
857 webview()->layout(); | 870 if (shouldForceLayoutOnEvents()) |
| 871 webview()->layout(); |
858 | 872 |
859 updateClickCountForButton(WebMouseEvent::ButtonRight); | 873 updateClickCountForButton(WebMouseEvent::ButtonRight); |
860 | 874 |
861 // Clears last context menu data because we need to know if the context menu
be requested | 875 // Clears last context menu data because we need to know if the context menu
be requested |
862 // after following mouse events. | 876 // after following mouse events. |
863 m_lastContextMenuData.reset(); | 877 m_lastContextMenuData.reset(); |
864 | 878 |
865 // Generate right mouse down and up. | 879 // Generate right mouse down and up. |
866 WebMouseEvent event; | 880 WebMouseEvent event; |
867 // This is a hack to work around only allowing a single pressed button since
we want to | 881 // This is a hack to work around only allowing a single pressed button since
we want to |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 const unsigned index = arguments[0].toInt32(); | 1042 const unsigned index = arguments[0].toInt32(); |
1029 WEBKIT_ASSERT(index < touchPoints.size()); | 1043 WEBKIT_ASSERT(index < touchPoints.size()); |
1030 | 1044 |
1031 WebTouchPoint* touchPoint = &touchPoints[index]; | 1045 WebTouchPoint* touchPoint = &touchPoints[index]; |
1032 touchPoint->state = WebTouchPoint::StateCancelled; | 1046 touchPoint->state = WebTouchPoint::StateCancelled; |
1033 } | 1047 } |
1034 | 1048 |
1035 void EventSender::sendCurrentTouchEvent(const WebInputEvent::Type type) | 1049 void EventSender::sendCurrentTouchEvent(const WebInputEvent::Type type) |
1036 { | 1050 { |
1037 WEBKIT_ASSERT(static_cast<unsigned>(WebTouchEvent::touchesLengthCap) > touch
Points.size()); | 1051 WEBKIT_ASSERT(static_cast<unsigned>(WebTouchEvent::touchesLengthCap) > touch
Points.size()); |
1038 webview()->layout(); | 1052 if (shouldForceLayoutOnEvents()) |
| 1053 webview()->layout(); |
1039 | 1054 |
1040 WebTouchEvent touchEvent; | 1055 WebTouchEvent touchEvent; |
1041 touchEvent.type = type; | 1056 touchEvent.type = type; |
1042 touchEvent.modifiers = touchModifiers; | 1057 touchEvent.modifiers = touchModifiers; |
1043 touchEvent.timeStampSeconds = getCurrentEventTimeSec(m_delegate); | 1058 touchEvent.timeStampSeconds = getCurrentEventTimeSec(m_delegate); |
1044 touchEvent.touchesLength = touchPoints.size(); | 1059 touchEvent.touchesLength = touchPoints.size(); |
1045 for (unsigned i = 0; i < touchPoints.size(); ++i) | 1060 for (unsigned i = 0; i < touchPoints.size(); ++i) |
1046 touchEvent.touches[i] = touchPoints[i]; | 1061 touchEvent.touches[i] = touchPoints[i]; |
1047 webview()->handleInputEvent(touchEvent); | 1062 webview()->handleInputEvent(touchEvent); |
1048 | 1063 |
(...skipping 16 matching lines...) Expand all Loading... |
1065 webview()->handleInputEvent(event); | 1080 webview()->handleInputEvent(event); |
1066 } | 1081 } |
1067 | 1082 |
1068 void EventSender::handleMouseWheel(const CppArgumentList& arguments, CppVariant*
result, bool continuous) | 1083 void EventSender::handleMouseWheel(const CppArgumentList& arguments, CppVariant*
result, bool continuous) |
1069 { | 1084 { |
1070 result->setNull(); | 1085 result->setNull(); |
1071 | 1086 |
1072 if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumb
er()) | 1087 if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumb
er()) |
1073 return; | 1088 return; |
1074 | 1089 |
| 1090 // Force a layout here just to make sure every position has been |
| 1091 // determined before we send events (as well as all the other methods |
| 1092 // that send an event do). |
| 1093 if (shouldForceLayoutOnEvents()) |
| 1094 webview()->layout(); |
| 1095 |
1075 int horizontal = arguments[0].toInt32(); | 1096 int horizontal = arguments[0].toInt32(); |
1076 int vertical = arguments[1].toInt32(); | 1097 int vertical = arguments[1].toInt32(); |
1077 int paged = false; | 1098 int paged = false; |
1078 int hasPreciseScrollingDeltas = false; | 1099 int hasPreciseScrollingDeltas = false; |
1079 | 1100 |
1080 if (arguments.size() > 2 && arguments[2].isBool()) | 1101 if (arguments.size() > 2 && arguments[2].isBool()) |
1081 paged = arguments[2].toBoolean(); | 1102 paged = arguments[2].toBoolean(); |
1082 | 1103 |
1083 if (arguments.size() > 3 && arguments[3].isBool()) | 1104 if (arguments.size() > 3 && arguments[3].isBool()) |
1084 hasPreciseScrollingDeltas = arguments[3].toBoolean(); | 1105 hasPreciseScrollingDeltas = arguments[3].toBoolean(); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 event.data.twoFingerTap.firstFingerHeight = static_cast<float>(argum
ents[3].toDouble()); | 1299 event.data.twoFingerTap.firstFingerHeight = static_cast<float>(argum
ents[3].toDouble()); |
1279 } | 1300 } |
1280 break; | 1301 break; |
1281 default: | 1302 default: |
1282 WEBKIT_ASSERT_NOT_REACHED(); | 1303 WEBKIT_ASSERT_NOT_REACHED(); |
1283 } | 1304 } |
1284 | 1305 |
1285 event.globalX = event.x; | 1306 event.globalX = event.x; |
1286 event.globalY = event.y; | 1307 event.globalY = event.y; |
1287 event.timeStampSeconds = getCurrentEventTimeSec(m_delegate); | 1308 event.timeStampSeconds = getCurrentEventTimeSec(m_delegate); |
| 1309 |
| 1310 if (shouldForceLayoutOnEvents()) |
| 1311 webview()->layout(); |
| 1312 |
1288 webview()->handleInputEvent(event); | 1313 webview()->handleInputEvent(event); |
1289 | 1314 |
1290 // Long press might start a drag drop session. Complete it if so. | 1315 // Long press might start a drag drop session. Complete it if so. |
1291 if (type == WebInputEvent::GestureLongPress && !currentDragData.isNull()) { | 1316 if (type == WebInputEvent::GestureLongPress && !currentDragData.isNull()) { |
1292 WebMouseEvent mouseEvent; | 1317 WebMouseEvent mouseEvent; |
1293 initMouseEvent(WebInputEvent::MouseDown, pressedButton, point, &mouseEve
nt, getCurrentEventTimeSec(m_delegate)); | 1318 initMouseEvent(WebInputEvent::MouseDown, pressedButton, point, &mouseEve
nt, getCurrentEventTimeSec(m_delegate)); |
1294 finishDragAndDrop(mouseEvent, WebKit::WebDragOperationNone); | 1319 finishDragAndDrop(mouseEvent, WebKit::WebDragOperationNone); |
1295 } | 1320 } |
1296 } | 1321 } |
1297 | 1322 |
1298 void EventSender::gestureFlingCancel(const CppArgumentList&, CppVariant* result) | 1323 void EventSender::gestureFlingCancel(const CppArgumentList&, CppVariant* result) |
1299 { | 1324 { |
1300 result->setNull(); | 1325 result->setNull(); |
1301 | 1326 |
1302 WebGestureEvent event; | 1327 WebGestureEvent event; |
1303 event.type = WebInputEvent::GestureFlingCancel; | 1328 event.type = WebInputEvent::GestureFlingCancel; |
1304 event.timeStampSeconds = getCurrentEventTimeSec(m_delegate); | 1329 event.timeStampSeconds = getCurrentEventTimeSec(m_delegate); |
| 1330 |
| 1331 if (shouldForceLayoutOnEvents()) |
| 1332 webview()->layout(); |
| 1333 |
1305 webview()->handleInputEvent(event); | 1334 webview()->handleInputEvent(event); |
1306 } | 1335 } |
1307 | 1336 |
1308 void EventSender::gestureFlingStart(const CppArgumentList& arguments, CppVariant
* result) | 1337 void EventSender::gestureFlingStart(const CppArgumentList& arguments, CppVariant
* result) |
1309 { | 1338 { |
1310 result->setNull(); | 1339 result->setNull(); |
1311 if (arguments.size() < 4) | 1340 if (arguments.size() < 4) |
1312 return; | 1341 return; |
1313 | 1342 |
1314 for (int i = 0; i < 4; i++) | 1343 for (int i = 0; i < 4; i++) |
1315 if (!arguments[i].isNumber()) | 1344 if (!arguments[i].isNumber()) |
1316 return; | 1345 return; |
1317 | 1346 |
1318 WebGestureEvent event; | 1347 WebGestureEvent event; |
1319 event.type = WebInputEvent::GestureFlingStart; | 1348 event.type = WebInputEvent::GestureFlingStart; |
1320 | 1349 |
1321 event.x = static_cast<float>(arguments[0].toDouble()); | 1350 event.x = static_cast<float>(arguments[0].toDouble()); |
1322 event.y = static_cast<float>(arguments[1].toDouble()); | 1351 event.y = static_cast<float>(arguments[1].toDouble()); |
1323 event.globalX = event.x; | 1352 event.globalX = event.x; |
1324 event.globalY = event.y; | 1353 event.globalY = event.y; |
1325 | 1354 |
1326 event.data.flingStart.velocityX = static_cast<float>(arguments[2].toDouble()
); | 1355 event.data.flingStart.velocityX = static_cast<float>(arguments[2].toDouble()
); |
1327 event.data.flingStart.velocityY = static_cast<float>(arguments[3].toDouble()
); | 1356 event.data.flingStart.velocityY = static_cast<float>(arguments[3].toDouble()
); |
1328 event.timeStampSeconds = getCurrentEventTimeSec(m_delegate); | 1357 event.timeStampSeconds = getCurrentEventTimeSec(m_delegate); |
| 1358 |
| 1359 if (shouldForceLayoutOnEvents()) |
| 1360 webview()->layout(); |
| 1361 |
1329 webview()->handleInputEvent(event); | 1362 webview()->handleInputEvent(event); |
1330 } | 1363 } |
1331 | 1364 |
1332 // | 1365 // |
1333 // Unimplemented stubs | 1366 // Unimplemented stubs |
1334 // | 1367 // |
1335 | 1368 |
1336 void EventSender::enableDOMUIEventLogging(const CppArgumentList&, CppVariant* re
sult) | 1369 void EventSender::enableDOMUIEventLogging(const CppArgumentList&, CppVariant* re
sult) |
1337 { | 1370 { |
1338 result->setNull(); | 1371 result->setNull(); |
1339 } | 1372 } |
1340 | 1373 |
1341 void EventSender::fireKeyboardEventsToElement(const CppArgumentList&, CppVariant
* result) | 1374 void EventSender::fireKeyboardEventsToElement(const CppArgumentList&, CppVariant
* result) |
1342 { | 1375 { |
1343 result->setNull(); | 1376 result->setNull(); |
1344 } | 1377 } |
1345 | 1378 |
1346 void EventSender::clearKillRing(const CppArgumentList&, CppVariant* result) | 1379 void EventSender::clearKillRing(const CppArgumentList&, CppVariant* result) |
1347 { | 1380 { |
1348 result->setNull(); | 1381 result->setNull(); |
1349 } | 1382 } |
1350 | 1383 |
1351 } | 1384 } |
OLD | NEW |