summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'webkit')
-rw-r--r--webkit/data/layout_test_results/common/LayoutTests/fast/events/mouse-click-events-expected.txt35
-rw-r--r--webkit/tools/layout_tests/test_lists/tests_fixable.txt6
-rw-r--r--webkit/tools/test_shell/event_sending_controller.cc52
-rw-r--r--webkit/tools/test_shell/event_sending_controller.h14
4 files changed, 84 insertions, 23 deletions
diff --git a/webkit/data/layout_test_results/common/LayoutTests/fast/events/mouse-click-events-expected.txt b/webkit/data/layout_test_results/common/LayoutTests/fast/events/mouse-click-events-expected.txt
new file mode 100644
index 0000000..591e822
--- /dev/null
+++ b/webkit/data/layout_test_results/common/LayoutTests/fast/events/mouse-click-events-expected.txt
@@ -0,0 +1,35 @@
+This tests what mouse events we send.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Left Mouse Button
+mousedown(0)
+mouseup(0)
+click(0)
+mousedown(0)
+mouseup(0)
+click(0)
+dblclick(0)
+Middle Mouse Button
+mousedown(1)
+mouseup(1)
+click(1)
+mousedown(1)
+mouseup(1)
+click(1)
+dblclick(1)
+Right Mouse Button
+mousedown(2)
+mouseup(2)
+mousedown(2)
+mouseup(2)
+4th Mouse Button
+mousedown(1)
+mouseup(1)
+click(1)
+mouseup(1)
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/webkit/tools/layout_tests/test_lists/tests_fixable.txt b/webkit/tools/layout_tests/test_lists/tests_fixable.txt
index cdd8bec..2d15739 100644
--- a/webkit/tools/layout_tests/test_lists/tests_fixable.txt
+++ b/webkit/tools/layout_tests/test_lists/tests_fixable.txt
@@ -884,12 +884,6 @@ V8 | KJS # LayoutTests/fast/forms/autofocus-opera-008.html = FAIL
# http://code.google.com/p/chromium/issues/detail?id=3005
V8 | KJS # LayoutTests/fast/events/tabindex-focus-blur-all.html = TIMEOUT
-# These tests have different mouse click messages that expected. This could
-# be a bug or an expected platform difference.
-# http://code.google.com/p/chromium/issues/detail?id=3007
-V8 | KJS # LayoutTests/fast/events/mouse-click-events.html = FAIL
-V8 | KJS # LayoutTests/fast/events/mouseup-from-button2.html = FAIL
-
# Regression from the webkit merge submitting forms to reference fragments.
# http://code.google.com/p/chromium/issues/detail?id=3008
V8 | KJS # LayoutTests/fast/forms/submit-to-url-fragment.html = FAIL
diff --git a/webkit/tools/test_shell/event_sending_controller.cc b/webkit/tools/test_shell/event_sending_controller.cc
index 9314f8d..53bde83 100644
--- a/webkit/tools/test_shell/event_sending_controller.cc
+++ b/webkit/tools/test_shell/event_sending_controller.cc
@@ -35,6 +35,8 @@ gfx::Point EventSendingController::last_mouse_pos_;
WebMouseEvent::Button EventSendingController::pressed_button_ =
WebMouseEvent::BUTTON_NONE;
+int EventSendingController::last_button_number_ = -1;
+
namespace {
#if defined(OS_WIN)
@@ -149,6 +151,7 @@ void EventSendingController::Reset() {
dragMode.Set(true);
last_click_time_sec = 0;
click_count = 0;
+ last_button_number_ = -1;
}
/* static */ WebView* EventSendingController::webview() {
@@ -170,19 +173,27 @@ void EventSendingController::Reset() {
}
#endif
+WebMouseEvent::Button EventSendingController::GetButtonTypeFromButtonNumber(
+ int button_code) {
+ if (button_code == 0)
+ return WebMouseEvent::BUTTON_LEFT;
+ else if (button_code == 2)
+ return WebMouseEvent::BUTTON_RIGHT;
+
+ return WebMouseEvent::BUTTON_MIDDLE;
+}
+
// static
-WebMouseEvent::Button EventSendingController::GetButtonTypeFromSingleArg(
+int EventSendingController::GetButtonNumberFromSingleArg(
const CppArgumentList& args) {
+ int button_code = 0;
+
if (args.size() > 0 && args[0].isNumber()) {
- int button_code = args[0].ToInt32();
- if (button_code == 1)
- return WebMouseEvent::BUTTON_MIDDLE;
- else if (button_code == 2)
- return WebMouseEvent::BUTTON_RIGHT;
+ button_code = args[0].ToInt32();
}
- return WebMouseEvent::BUTTON_LEFT;
-}
+ return button_code;
+}
//
// Implemented javascript methods.
//
@@ -193,15 +204,22 @@ WebMouseEvent::Button EventSendingController::GetButtonTypeFromSingleArg(
webview()->Layout();
- WebMouseEvent::Button button_type = GetButtonTypeFromSingleArg(args);
+ int button_number = GetButtonNumberFromSingleArg(args);
+ DCHECK(button_number != -1);
- if ((GetCurrentEventTimeSec() - last_click_time_sec >= kMultiClickTimeSec) ||
- outside_multiclick_radius(last_mouse_pos_, last_click_pos)) {
- click_count = 1;
- } else {
+ WebMouseEvent::Button button_type = GetButtonTypeFromButtonNumber(
+ button_number);
+
+ if ((GetCurrentEventTimeSec() - last_click_time_sec < kMultiClickTimeSec) &&
+ (!outside_multiclick_radius(last_mouse_pos_, last_click_pos)) &&
+ (button_number == last_button_number_)) {
++click_count;
+ } else {
+ click_count = 1;
}
+ last_button_number_ = button_number;
+
WebMouseEvent event;
pressed_button_ = button_type;
InitMouseEvent(WebInputEvent::MOUSE_DOWN, button_type,
@@ -215,7 +233,13 @@ WebMouseEvent::Button EventSendingController::GetButtonTypeFromSingleArg(
webview()->Layout();
- WebMouseEvent::Button button_type = GetButtonTypeFromSingleArg(args);
+ int button_number = GetButtonNumberFromSingleArg(args);
+ DCHECK(button_number != -1);
+
+ WebMouseEvent::Button button_type = GetButtonTypeFromButtonNumber(
+ button_number);
+
+ last_button_number_ = button_number;
WebMouseEvent event;
InitMouseEvent(WebInputEvent::MOUSE_UP, button_type,
diff --git a/webkit/tools/test_shell/event_sending_controller.h b/webkit/tools/test_shell/event_sending_controller.h
index d910bd7..e544732 100644
--- a/webkit/tools/test_shell/event_sending_controller.h
+++ b/webkit/tools/test_shell/event_sending_controller.h
@@ -71,9 +71,12 @@ class EventSendingController : public CppBoundClass {
static void DoMouseUp(const WebMouseEvent& e);
static void ReplaySavedEvents();
- // Helper to extract the optional arg from mouseDown() and mouseUp()
- static WebMouseEvent::Button GetButtonTypeFromSingleArg(
- const CppArgumentList& args);
+ // Helper to return the button type given a button code
+ static WebMouseEvent::Button GetButtonTypeFromButtonNumber(int button_code);
+
+ // Helper to extract the button number from the optional argument in
+ // mouseDown and mouseUp
+ static int GetButtonNumberFromSingleArg(const CppArgumentList& args);
// Returns true if the key_code passed in needs a shift key modifier to
// be passed into the generated event.
@@ -87,6 +90,11 @@ class EventSendingController : public CppBoundClass {
// Currently pressed mouse button (Left/Right/Middle or None)
static WebMouseEvent::Button pressed_button_;
+
+ // The last button number passed to mouseDown and mouseUp.
+ // Used to determine whether the click count continues to
+ // increment or not.
+ static int last_button_number_;
};
#endif // WEBKIT_TOOLS_TEST_SHELL_EVENT_SENDING_CONTROLLER_H_