summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell/event_sending_controller.cc
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-16 22:47:20 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-16 22:47:20 +0000
commit4f7336749506dead4f348f37171eda7165b5abb3 (patch)
treebf77d11330cc7c9b63d718a6fad5b038cbd706be /webkit/tools/test_shell/event_sending_controller.cc
parent21e1e7dd3aaec080af56a91c7054565234f5e289 (diff)
downloadchromium_src-4f7336749506dead4f348f37171eda7165b5abb3.zip
chromium_src-4f7336749506dead4f348f37171eda7165b5abb3.tar.gz
chromium_src-4f7336749506dead4f348f37171eda7165b5abb3.tar.bz2
Revert 41769 - Fix test_shell so that eventSender works for opened windows. I've also made focus go to the webview, just like what happens in Chrome.
This is needed for https://bugs.webkit.org/show_bug.cgi?id=36147 and also fixes plugins/keyboardevents.html on Windows. Review URL: http://codereview.chromium.org/1011005 TBR=jam@chromium.org Review URL: http://codereview.chromium.org/997008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41781 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/event_sending_controller.cc')
-rw-r--r--webkit/tools/test_shell/event_sending_controller.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/webkit/tools/test_shell/event_sending_controller.cc b/webkit/tools/test_shell/event_sending_controller.cc
index 9cc100f..2ab01a0 100644
--- a/webkit/tools/test_shell/event_sending_controller.cc
+++ b/webkit/tools/test_shell/event_sending_controller.cc
@@ -60,6 +60,7 @@ using WebKit::WebTouchEvent;
using WebKit::WebTouchPoint;
using WebKit::WebView;
+TestShell* EventSendingController::shell_ = NULL;
gfx::Point EventSendingController::last_mouse_pos_;
WebMouseEvent::Button EventSendingController::pressed_button_ =
WebMouseEvent::ButtonNone;
@@ -251,8 +252,13 @@ enum KeyLocationCode {
} // anonymous namespace
EventSendingController::EventSendingController(TestShell* shell)
- : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
- shell_(shell) {
+ : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
+ // Set static shell_ variable since we can't do it in an initializer list.
+ // We also need to be careful not to assign shell_ to new windows which are
+ // temporary.
+ if (NULL == shell_)
+ shell_ = shell;
+
// Initialize the map that associates methods of this class with the names
// they will use when called by JavaScript. The actual binding of those
// names to their methods will be done by calling BindToJavaScript() (defined
@@ -332,10 +338,12 @@ void EventSendingController::Reset() {
touch_points.clear();
}
+// static
WebView* EventSendingController::webview() {
return shell_->webView();
}
+// static
void EventSendingController::DoDragDrop(const WebKit::WebPoint &event_pos,
const WebDragData& drag_data,
WebDragOperationsMask mask) {
@@ -443,6 +451,7 @@ void EventSendingController::mouseUp(
}
}
+// static
void EventSendingController::DoMouseUp(const WebMouseEvent& e) {
webview()->handleInputEvent(e);
@@ -521,6 +530,7 @@ void EventSendingController::mouseWheelTo(
}
}
+// static
void EventSendingController::DoMouseMove(const WebMouseEvent& e) {
last_mouse_pos_.SetPoint(e.x, e.y);