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

Side by Side Diff: webkit/tools/test_shell/event_sending_controller.cc

Issue 4703004: Update the EventSendingController to send complete touch events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comments Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 EventSendingController. 5 // This file contains the definition for EventSendingController.
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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 result->SetNull(); 833 result->SetNull();
834 } 834 }
835 835
836 void EventSendingController::addTouchPoint( 836 void EventSendingController::addTouchPoint(
837 const CppArgumentList& args, CppVariant* result) { 837 const CppArgumentList& args, CppVariant* result) {
838 result->SetNull(); 838 result->SetNull();
839 839
840 WebTouchPoint touch_point; 840 WebTouchPoint touch_point;
841 touch_point.state = WebTouchPoint::StatePressed; 841 touch_point.state = WebTouchPoint::StatePressed;
842 touch_point.position = WebPoint(args[0].ToInt32(), args[1].ToInt32()); 842 touch_point.position = WebPoint(args[0].ToInt32(), args[1].ToInt32());
843 touch_point.screenPosition = touch_point.position;
843 touch_point.id = touch_points.size(); 844 touch_point.id = touch_points.size();
844 touch_points.push_back(touch_point); 845 touch_points.push_back(touch_point);
845 } 846 }
846 847
847 void EventSendingController::clearTouchPoints( 848 void EventSendingController::clearTouchPoints(
848 const CppArgumentList& args, CppVariant* result) { 849 const CppArgumentList& args, CppVariant* result) {
849 result->SetNull(); 850 result->SetNull();
850 851
851 touch_points.clear(); 852 touch_points.clear();
852 } 853 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 const unsigned int index = args[0].ToInt32(); 895 const unsigned int index = args[0].ToInt32();
895 if (index >= touch_points.size()) { 896 if (index >= touch_points.size()) {
896 NOTREACHED() << "Invalid touch point index"; 897 NOTREACHED() << "Invalid touch point index";
897 } 898 }
898 899
899 WebPoint position(args[1].ToInt32(), args[2].ToInt32()); 900 WebPoint position(args[1].ToInt32(), args[2].ToInt32());
900 901
901 WebTouchPoint* touch_point = &touch_points[index]; 902 WebTouchPoint* touch_point = &touch_points[index];
902 touch_point->state = WebTouchPoint::StateMoved; 903 touch_point->state = WebTouchPoint::StateMoved;
903 touch_point->position = position; 904 touch_point->position = position;
905 touch_point->screenPosition = position;
904 } 906 }
905 907
906 void EventSendingController::cancelTouchPoint( 908 void EventSendingController::cancelTouchPoint(
907 const CppArgumentList& args, CppVariant* result) { 909 const CppArgumentList& args, CppVariant* result) {
908 result->SetNull(); 910 result->SetNull();
909 911
910 const unsigned int index = args[0].ToInt32(); 912 const unsigned int index = args[0].ToInt32();
911 if (index >= touch_points.size()) { 913 if (index >= touch_points.size()) {
912 NOTREACHED() << "Invalid touch point index"; 914 NOTREACHED() << "Invalid touch point index";
913 } 915 }
914 916
915 WebTouchPoint* touch_point = &touch_points[index]; 917 WebTouchPoint* touch_point = &touch_points[index];
916 touch_point->state = WebTouchPoint::StateCancelled; 918 touch_point->state = WebTouchPoint::StateCancelled;
917 } 919 }
918 920
919 void EventSendingController::SendCurrentTouchEvent( 921 void EventSendingController::SendCurrentTouchEvent(
920 const WebInputEvent::Type type) { 922 const WebInputEvent::Type type) {
923 webview()->layout();
924
921 if (static_cast<unsigned int>(WebTouchEvent::touchPointsLengthCap) <= 925 if (static_cast<unsigned int>(WebTouchEvent::touchPointsLengthCap) <=
922 touch_points.size()) { 926 touch_points.size()) {
923 NOTREACHED() << "Too many touch points for event"; 927 NOTREACHED() << "Too many touch points for event";
924 } 928 }
925 929
926 WebTouchEvent touch_event; 930 WebTouchEvent touch_event;
927 touch_event.type = type; 931 touch_event.type = type;
928 touch_event.modifiers = touch_modifiers; 932 touch_event.modifiers = touch_modifiers;
929 touch_event.timeStampSeconds = GetCurrentEventTimeSec(); 933 touch_event.timeStampSeconds = GetCurrentEventTimeSec();
930 touch_event.touchPointsLength = touch_points.size(); 934 touch_event.touchPointsLength = touch_points.size();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 1017
1014 void EventSendingController::fireKeyboardEventsToElement( 1018 void EventSendingController::fireKeyboardEventsToElement(
1015 const CppArgumentList& args, CppVariant* result) { 1019 const CppArgumentList& args, CppVariant* result) {
1016 result->SetNull(); 1020 result->SetNull();
1017 } 1021 }
1018 1022
1019 void EventSendingController::clearKillRing( 1023 void EventSendingController::clearKillRing(
1020 const CppArgumentList& args, CppVariant* result) { 1024 const CppArgumentList& args, CppVariant* result) {
1021 result->SetNull(); 1025 result->SetNull();
1022 } 1026 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698