summaryrefslogtreecommitdiffstats
path: root/webkit/tools
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 23:30:22 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 23:30:22 +0000
commit62cb33cae4bad68a085b50832c8a7f1e1c2e917c (patch)
tree4eddbf29c7ae1c41fd1300ae4ce95b817404bbaf /webkit/tools
parent57346c5659ada3c2a06095afac6e53bedf41ab94 (diff)
downloadchromium_src-62cb33cae4bad68a085b50832c8a7f1e1c2e917c.zip
chromium_src-62cb33cae4bad68a085b50832c8a7f1e1c2e917c.tar.gz
chromium_src-62cb33cae4bad68a085b50832c8a7f1e1c2e917c.tar.bz2
Use Webkit::WebInputEvent and remove webkit/glue/webinputevent.
This change adds a temporary dependency on src/KeyIdentifier.{h,cpp} which I am going to remove after this CL. I didn't want to grow this CL any larger. R=dglazkov Review URL: http://codereview.chromium.org/53099 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12728 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r--webkit/tools/test_shell/event_sending_controller.cc110
-rw-r--r--webkit/tools/test_shell/event_sending_controller.h17
-rw-r--r--webkit/tools/test_shell/keyboard_unittest.cc37
-rw-r--r--webkit/tools/test_shell/mac/webview_host.mm1
-rw-r--r--webkit/tools/test_shell/mac/webwidget_host.mm22
-rw-r--r--webkit/tools/test_shell/test_shell.gyp10
-rw-r--r--webkit/tools/test_shell/webview_host_gtk.cc1
-rw-r--r--webkit/tools/test_shell/webview_host_win.cc1
-rw-r--r--webkit/tools/test_shell/webwidget_host.h8
-rw-r--r--webkit/tools/test_shell/webwidget_host_gtk.cc17
-rw-r--r--webkit/tools/test_shell/webwidget_host_win.cc34
11 files changed, 153 insertions, 105 deletions
diff --git a/webkit/tools/test_shell/event_sending_controller.cc b/webkit/tools/test_shell/event_sending_controller.cc
index 6fadaa3..cded2e6 100644
--- a/webkit/tools/test_shell/event_sending_controller.cc
+++ b/webkit/tools/test_shell/event_sending_controller.cc
@@ -28,20 +28,34 @@
#include "base/message_loop.h"
#include "base/string_util.h"
#include "base/time.h"
-#include "webkit/glue/webinputevent_util.h"
+#include "webkit/glue/webdropdata.h"
#include "webkit/glue/webview.h"
#include "webkit/tools/test_shell/test_shell.h"
+// TODO(darin): This is a temporary hack. The better solution is to defer
+// generation of the keyIdentifier to the point where a PlatformKeyboardEvent
+// is created from our WebKeyboardEvent.
+#include "third_party/WebKit/WebKit/chromium/src/KeyIdentifier.h"
+
+#if defined(OS_WIN)
+#include "third_party/WebKit/WebKit/chromium/public/win/WebInputEventFactory.h"
+using WebKit::WebInputEventFactory;
+#endif
+
// TODO(mpcomplete): layout before each event?
// TODO(mpcomplete): do we need modifiers for mouse events?
using base::Time;
using base::TimeTicks;
+using WebKit::WebInputEvent;
+using WebKit::WebKeyboardEvent;
+using WebKit::WebMouseEvent;
+
TestShell* EventSendingController::shell_ = NULL;
gfx::Point EventSendingController::last_mouse_pos_;
WebMouseEvent::Button EventSendingController::pressed_button_ =
- WebMouseEvent::BUTTON_NONE;
+ WebMouseEvent::ButtonNone;
int EventSendingController::last_button_number_ = -1;
@@ -88,25 +102,25 @@ void InitMouseEvent(WebInputEvent::Type t, WebMouseEvent::Button b,
e->modifiers = 0;
e->x = pos.x();
e->y = pos.y();
- e->global_x = pos.x();
- e->global_y = pos.y();
- e->timestamp_sec = GetCurrentEventTimeSec();
- e->layout_test_click_count = click_count;
+ e->globalX = pos.x();
+ e->globalY = pos.y();
+ e->timeStampSeconds = GetCurrentEventTimeSec();
+ e->layoutTestClickCount = click_count;
}
void ApplyKeyModifier(const std::wstring& arg, WebKeyboardEvent* event) {
const wchar_t* arg_string = arg.c_str();
if (!wcscmp(arg_string, L"ctrlKey")) {
- event->modifiers |= WebInputEvent::CTRL_KEY;
+ event->modifiers |= WebInputEvent::ControlKey;
} else if (!wcscmp(arg_string, L"shiftKey")) {
- event->modifiers |= WebInputEvent::SHIFT_KEY;
+ event->modifiers |= WebInputEvent::ShiftKey;
} else if (!wcscmp(arg_string, L"altKey")) {
- event->modifiers |= WebInputEvent::ALT_KEY;
+ event->modifiers |= WebInputEvent::AltKey;
#if defined(OS_WIN)
- event->system_key = true;
+ event->isSystemKey = true;
#endif
} else if (!wcscmp(arg_string, L"metaKey")) {
- event->modifiers |= WebInputEvent::META_KEY;
+ event->modifiers |= WebInputEvent::MetaKey;
}
}
@@ -172,7 +186,7 @@ void EventSendingController::Reset() {
// The test should have finished a drag and the mouse button state.
DCHECK(!drag_data_object.get());
drag_data_object.reset();
- pressed_button_ = WebMouseEvent::BUTTON_NONE;
+ pressed_button_ = WebMouseEvent::ButtonNone;
dragMode.Set(true);
#if defined(OS_WIN)
wmKeyDown.Set(WM_KEYDOWN);
@@ -207,11 +221,11 @@ void EventSendingController::Reset() {
WebMouseEvent::Button EventSendingController::GetButtonTypeFromButtonNumber(
int button_code) {
if (button_code == 0)
- return WebMouseEvent::BUTTON_LEFT;
+ return WebMouseEvent::ButtonLeft;
else if (button_code == 2)
- return WebMouseEvent::BUTTON_RIGHT;
+ return WebMouseEvent::ButtonRight;
- return WebMouseEvent::BUTTON_MIDDLE;
+ return WebMouseEvent::ButtonMiddle;
}
// static
@@ -254,7 +268,7 @@ void EventSendingController::mouseDown(
WebMouseEvent event;
pressed_button_ = button_type;
- InitMouseEvent(WebInputEvent::MOUSE_DOWN, button_type,
+ InitMouseEvent(WebInputEvent::MouseDown, button_type,
last_mouse_pos_, &event);
webview()->HandleInputEvent(&event);
}
@@ -275,7 +289,7 @@ void EventSendingController::mouseUp(
last_button_number_ = button_number;
WebMouseEvent event;
- InitMouseEvent(WebInputEvent::MOUSE_UP, button_type,
+ InitMouseEvent(WebInputEvent::MouseUp, button_type,
last_mouse_pos_, &event);
if (drag_mode() && !replaying_saved_events) {
mouse_event_queue.push(event);
@@ -284,23 +298,23 @@ void EventSendingController::mouseUp(
DoMouseUp(event);
}
- last_click_time_sec = event.timestamp_sec;
+ last_click_time_sec = event.timeStampSeconds;
last_click_pos = gfx::Point(event.x, event.y);
}
/* static */ void EventSendingController::DoMouseUp(const WebMouseEvent& e) {
webview()->HandleInputEvent(&e);
- pressed_button_ = WebMouseEvent::BUTTON_NONE;
+ pressed_button_ = WebMouseEvent::ButtonNone;
// If we're in a drag operation, complete it.
if (drag_data_object.get()) {
- bool valid = webview()->DragTargetDragOver(e.x, e.y, e.global_x,
- e.global_y);
+ bool valid = webview()->DragTargetDragOver(e.x, e.y, e.globalX,
+ e.globalY);
if (valid) {
- webview()->DragSourceEndedAt(e.x, e.y, e.global_x, e.global_y);
- webview()->DragTargetDrop(e.x, e.y, e.global_x, e.global_y);
+ webview()->DragSourceEndedAt(e.x, e.y, e.globalX, e.globalY);
+ webview()->DragTargetDrop(e.x, e.y, e.globalX, e.globalY);
} else {
- webview()->DragSourceEndedAt(e.x, e.y, e.global_x, e.global_y);
+ webview()->DragSourceEndedAt(e.x, e.y, e.globalX, e.globalY);
webview()->DragTargetDragLeave();
}
drag_data_object.reset();
@@ -316,10 +330,10 @@ void EventSendingController::mouseMoveTo(
WebMouseEvent event;
last_mouse_pos_.SetPoint(args[0].ToInt32(), args[1].ToInt32());
- InitMouseEvent(WebInputEvent::MOUSE_MOVE, pressed_button_,
+ InitMouseEvent(WebInputEvent::MouseMove, pressed_button_,
last_mouse_pos_, &event);
- if (drag_mode() && pressed_button_ != WebMouseEvent::BUTTON_NONE &&
+ if (drag_mode() && pressed_button_ != WebMouseEvent::ButtonNone &&
!replaying_saved_events) {
mouse_event_queue.push(event);
} else {
@@ -331,9 +345,9 @@ void EventSendingController::mouseMoveTo(
/* static */ void EventSendingController::DoMouseMove(const WebMouseEvent& e) {
webview()->HandleInputEvent(&e);
- if (pressed_button_ != WebMouseEvent::BUTTON_NONE && drag_data_object.get()) {
- webview()->DragSourceMovedTo(e.x, e.y, e.global_x, e.global_y);
- webview()->DragTargetDragOver(e.x, e.y, e.global_x, e.global_y);
+ if (pressed_button_ != WebMouseEvent::ButtonNone && drag_data_object.get()) {
+ webview()->DragSourceMovedTo(e.x, e.y, e.globalX, e.globalY);
+ webview()->DragTargetDragOver(e.x, e.y, e.globalX, e.globalY);
}
}
@@ -384,30 +398,29 @@ void EventSendingController::keyDown(
// the event flow that that platform provides.
WebKeyboardEvent event_down, event_up;
#if defined(OS_WIN)
- event_down.type = WebInputEvent::RAW_KEY_DOWN;
+ event_down.type = WebInputEvent::RawKeyDown;
#else
- event_down.type = WebInputEvent::KEY_DOWN;
+ event_down.type = WebInputEvent::KeyDown;
#endif
event_down.modifiers = 0;
- event_down.windows_key_code = code;
+ event_down.windowsKeyCode = code;
if (generate_char) {
event_down.text[0] = code;
- event_down.unmodified_text[0] = code;
+ event_down.unmodifiedText[0] = code;
}
- std::string key_identifier_str =
- webkit_glue::GetKeyIdentifierForWindowsKeyCode(code);
- base::strlcpy(event_down.key_identifier, key_identifier_str.c_str(),
- kIdentifierLengthCap);
+ // TODO(darin): remove this temporary hack.
+ WebKit::keyIdentifierForWindowsKeyCode(
+ code, event_down.keyIdentifier, sizeof(event_down.keyIdentifier));
if (args.size() >= 2 && (args[1].isObject() || args[1].isString()))
ApplyKeyModifiers(&(args[1]), &event_down);
if (needs_shift_key_modifier)
- event_down.modifiers |= WebInputEvent::SHIFT_KEY;
+ event_down.modifiers |= WebInputEvent::ShiftKey;
event_up = event_down;
- event_up.type = WebInputEvent::KEY_UP;
+ event_up.type = WebInputEvent::KeyUp;
// EventSendingController.m forces a layout here, with at least one
// test (fast\forms\focus-control-to-page.html) relying on this.
webview()->Layout();
@@ -417,8 +430,8 @@ void EventSendingController::keyDown(
#if defined(OS_WIN)
if (generate_char) {
WebKeyboardEvent event_char = event_down;
- event_char.type = WebInputEvent::CHAR;
- event_char.key_identifier[0] = '\0';
+ event_char.type = WebInputEvent::Char;
+ event_char.keyIdentifier[0] = '\0';
webview()->HandleInputEvent(&event_char);
}
#endif
@@ -445,7 +458,8 @@ void EventSendingController::dispatchMessage(
webview()->Layout();
unsigned long lparam = static_cast<unsigned long>(args[2].ToDouble());
- WebKeyboardEvent key_event(0, msg, args[1].ToInt32(), lparam);
+ const WebKeyboardEvent& key_event = WebInputEventFactory::keyboardEvent(
+ NULL, msg, args[1].ToInt32(), lparam);
webview()->HandleInputEvent(&key_event);
} else {
NOTREACHED() << L"Wrong number of arguments";
@@ -494,10 +508,10 @@ void EventSendingController::ReplaySavedEvents() {
mouse_event_queue.pop();
switch (event.type) {
- case WebInputEvent::MOUSE_UP:
+ case WebInputEvent::MouseUp:
DoMouseUp(event);
break;
- case WebInputEvent::MOUSE_MOVE:
+ case WebInputEvent::MouseMove:
DoMouseMove(event);
break;
default:
@@ -523,16 +537,16 @@ void EventSendingController::contextClick(
// Generate right mouse down and up.
WebMouseEvent event;
- pressed_button_ = WebMouseEvent::BUTTON_RIGHT;
- InitMouseEvent(WebInputEvent::MOUSE_DOWN, WebMouseEvent::BUTTON_RIGHT,
+ pressed_button_ = WebMouseEvent::ButtonRight;
+ InitMouseEvent(WebInputEvent::MouseDown, WebMouseEvent::ButtonRight,
last_mouse_pos_, &event);
webview()->HandleInputEvent(&event);
- InitMouseEvent(WebInputEvent::MOUSE_UP, WebMouseEvent::BUTTON_RIGHT,
+ InitMouseEvent(WebInputEvent::MouseUp, WebMouseEvent::ButtonRight,
last_mouse_pos_, &event);
webview()->HandleInputEvent(&event);
- pressed_button_ = WebMouseEvent::BUTTON_NONE;
+ pressed_button_ = WebMouseEvent::ButtonNone;
}
void EventSendingController::scheduleAsynchronousClick(
diff --git a/webkit/tools/test_shell/event_sending_controller.h b/webkit/tools/test_shell/event_sending_controller.h
index 906ccef..d6d62d5 100644
--- a/webkit/tools/test_shell/event_sending_controller.h
+++ b/webkit/tools/test_shell/event_sending_controller.h
@@ -19,12 +19,16 @@
#include "build/build_config.h"
#include "base/gfx/point.h"
#include "base/task.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
#include "webkit/glue/cpp_bound_class.h"
-#include "webkit/glue/webdropdata.h"
-#include "webkit/glue/webinputevent.h"
class TestShell;
class WebView;
+struct WebDropData;
+
+namespace WebKit {
+class WebMouseEvent;
+}
class EventSendingController : public CppBoundClass {
public:
@@ -78,12 +82,13 @@ class EventSendingController : public CppBoundClass {
// Sometimes we queue up mouse move and mouse up events for drag drop
// handling purposes. These methods dispatch the event.
- static void DoMouseMove(const WebMouseEvent& e);
- static void DoMouseUp(const WebMouseEvent& e);
+ static void DoMouseMove(const WebKit::WebMouseEvent& e);
+ static void DoMouseUp(const WebKit::WebMouseEvent& e);
static void ReplaySavedEvents();
// Helper to return the button type given a button code
- static WebMouseEvent::Button GetButtonTypeFromButtonNumber(int button_code);
+ static WebKit::WebMouseEvent::Button GetButtonTypeFromButtonNumber(
+ int button_code);
// Helper to extract the button number from the optional argument in
// mouseDown and mouseUp
@@ -102,7 +107,7 @@ class EventSendingController : public CppBoundClass {
static gfx::Point last_mouse_pos_;
// Currently pressed mouse button (Left/Right/Middle or None)
- static WebMouseEvent::Button pressed_button_;
+ static WebKit::WebMouseEvent::Button pressed_button_;
// The last button number passed to mouseDown and mouseUp.
// Used to determine whether the click count continues to
diff --git a/webkit/tools/test_shell/keyboard_unittest.cc b/webkit/tools/test_shell/keyboard_unittest.cc
index 03f1b15..5786612 100644
--- a/webkit/tools/test_shell/keyboard_unittest.cc
+++ b/webkit/tools/test_shell/keyboard_unittest.cc
@@ -17,13 +17,16 @@ MSVC_POP_WARNING();
#include "base/string_util.h"
#include "webkit/glue/editor_client_impl.h"
#include "webkit/glue/event_conversion.h"
-#include "webkit/glue/webinputevent.h"
-#include "webkit/glue/webinputevent_util.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
+#include "third_party/WebKit/WebKit/chromium/src/KeyIdentifier.h" // TODO(darin): TEMPORARY HACK
using WebCore::PlatformKeyboardEvent;
using WebCore::KeyboardEvent;
+using WebKit::WebInputEvent;
+using WebKit::WebKeyboardEvent;
+
class KeyboardTest : public testing::Test {
public:
void SetUp() {
@@ -48,14 +51,16 @@ class KeyboardTest : public testing::Test {
void SetupKeyDownEvent(WebKeyboardEvent* keyboard_event,
char key_code,
int modifiers) {
- keyboard_event->windows_key_code = key_code;
+ keyboard_event->windowsKeyCode = key_code;
keyboard_event->modifiers = modifiers;
- keyboard_event->type = WebInputEvent::KEY_DOWN;
+ keyboard_event->type = WebInputEvent::KeyDown;
keyboard_event->text[0] = key_code;
- std::string key_identifier_str =
- webkit_glue::GetKeyIdentifierForWindowsKeyCode(key_code);
- base::strlcpy(keyboard_event->key_identifier, key_identifier_str.c_str(),
- kIdentifierLengthCap);
+
+ // TODO(darin): remove this temporary hack.
+ WebKit::keyIdentifierForWindowsKeyCode(
+ key_code,
+ keyboard_event->keyIdentifier,
+ sizeof(keyboard_event->keyIdentifier));
}
// Like InterpretKeyEvent, but with pressing down OSModifier+|key_code|.
@@ -64,9 +69,9 @@ class KeyboardTest : public testing::Test {
const char* InterpretOSModifierKeyPress(char key_code) {
WebKeyboardEvent keyboard_event;
#if defined(OS_WIN) || defined(OS_LINUX)
- WebInputEvent::Modifiers os_modifier = WebInputEvent::CTRL_KEY;
+ WebInputEvent::Modifiers os_modifier = WebInputEvent::ControlKey;
#elif defined(OS_MACOSX)
- WebInputEvent::Modifiers os_modifier = WebInputEvent::META_KEY;
+ WebInputEvent::Modifiers os_modifier = WebInputEvent::MetaKey;
#endif
SetupKeyDownEvent(&keyboard_event, key_code, os_modifier);
return InterpretKeyEvent(keyboard_event, PlatformKeyboardEvent::RawKeyDown);
@@ -75,7 +80,7 @@ class KeyboardTest : public testing::Test {
// Like InterpretKeyEvent, but with pressing down ctrl+|key_code|.
const char* InterpretCtrlKeyPress(char key_code) {
WebKeyboardEvent keyboard_event;
- SetupKeyDownEvent(&keyboard_event, key_code, WebInputEvent::CTRL_KEY);
+ SetupKeyDownEvent(&keyboard_event, key_code, WebInputEvent::ControlKey);
return InterpretKeyEvent(keyboard_event, PlatformKeyboardEvent::RawKeyDown);
}
@@ -139,7 +144,7 @@ TEST_F(KeyboardTest, TestInsertTab) {
}
TEST_F(KeyboardTest, TestInsertBackTab) {
- EXPECT_STREQ("InsertBacktab", InterpretTab(WebInputEvent::SHIFT_KEY));
+ EXPECT_STREQ("InsertBacktab", InterpretTab(WebInputEvent::ShiftKey));
}
TEST_F(KeyboardTest, TestInsertNewline) {
@@ -147,19 +152,19 @@ TEST_F(KeyboardTest, TestInsertNewline) {
}
TEST_F(KeyboardTest, TestInsertNewline2) {
- EXPECT_STREQ("InsertNewline", InterpretNewLine(WebInputEvent::CTRL_KEY));
+ EXPECT_STREQ("InsertNewline", InterpretNewLine(WebInputEvent::ControlKey));
}
TEST_F(KeyboardTest, TestInsertLineBreak) {
- EXPECT_STREQ("InsertLineBreak", InterpretNewLine(WebInputEvent::SHIFT_KEY));
+ EXPECT_STREQ("InsertLineBreak", InterpretNewLine(WebInputEvent::ShiftKey));
}
TEST_F(KeyboardTest, TestInsertNewline3) {
- EXPECT_STREQ("InsertNewline", InterpretNewLine(WebInputEvent::ALT_KEY));
+ EXPECT_STREQ("InsertNewline", InterpretNewLine(WebInputEvent::AltKey));
}
TEST_F(KeyboardTest, TestInsertNewline4) {
- int modifiers = WebInputEvent::ALT_KEY | WebInputEvent::SHIFT_KEY;
+ int modifiers = WebInputEvent::AltKey | WebInputEvent::ShiftKey;
const char* result = InterpretNewLine(modifiers);
EXPECT_STREQ("InsertNewline", result);
}
diff --git a/webkit/tools/test_shell/mac/webview_host.mm b/webkit/tools/test_shell/mac/webview_host.mm
index bb9c0d3..7c6c949 100644
--- a/webkit/tools/test_shell/mac/webview_host.mm
+++ b/webkit/tools/test_shell/mac/webview_host.mm
@@ -10,7 +10,6 @@
#include "base/gfx/platform_canvas.h"
#include "base/gfx/rect.h"
#include "base/gfx/size.h"
-#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webview.h"
/*static*/
diff --git a/webkit/tools/test_shell/mac/webwidget_host.mm b/webkit/tools/test_shell/mac/webwidget_host.mm
index fd95535..41b47b5 100644
--- a/webkit/tools/test_shell/mac/webwidget_host.mm
+++ b/webkit/tools/test_shell/mac/webwidget_host.mm
@@ -10,9 +10,16 @@
#include "base/gfx/rect.h"
#include "base/gfx/size.h"
#include "base/logging.h"
-#include "webkit/glue/webinputevent.h"
+#include "third_party/WebKit/WebKit/chromium/public/mac/WebInputEventFactory.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
#include "webkit/glue/webwidget.h"
+using WebKit::WebInputEvent;
+using WebKit::WebInputEventFactory;
+using WebKit::WebKeyboardEvent;
+using WebKit::WebMouseEvent;
+using WebKit::WebMouseWheelEvent;
+
/*static*/
WebWidgetHost* WebWidgetHost::Create(NSView* parent_view,
WebWidgetDelegate* delegate) {
@@ -213,12 +220,13 @@ void WebWidgetHost::Resize(const gfx::Rect& rect) {
}
void WebWidgetHost::MouseEvent(NSEvent *event) {
- WebMouseEvent web_event(event, view_);
+ const WebMouseEvent& web_event = WebInputEventFactory::mouseEvent(
+ event, view_);
switch (web_event.type) {
- case WebInputEvent::MOUSE_MOVE:
+ case WebInputEvent::MouseMove:
TrackMouseLeave(true);
break;
- case WebInputEvent::MOUSE_LEAVE:
+ case WebInputEvent::MouseLeave:
TrackMouseLeave(false);
break;
default:
@@ -228,12 +236,14 @@ void WebWidgetHost::MouseEvent(NSEvent *event) {
}
void WebWidgetHost::WheelEvent(NSEvent *event) {
- WebMouseWheelEvent web_event(event, view_);
+ const WebMouseWheelEvent& web_event = WebInputEventFactory::mouseWheelEvent(
+ event, view_);
webwidget_->HandleInputEvent(&web_event);
}
void WebWidgetHost::KeyEvent(NSEvent *event) {
- WebKeyboardEvent web_event(event);
+ const WebKeyboardEvent& web_event = WebInputEventFactory::keyboardEvent(
+ event);
webwidget_->HandleInputEvent(&web_event);
}
diff --git a/webkit/tools/test_shell/test_shell.gyp b/webkit/tools/test_shell/test_shell.gyp
index db95ec0..5c3094f 100644
--- a/webkit/tools/test_shell/test_shell.gyp
+++ b/webkit/tools/test_shell/test_shell.gyp
@@ -93,15 +93,7 @@
['exclude', '_gtk\\.cc$']
],
}],
- ['OS=="mac"', {
- 'sources': [
- # Windows/Linux use this code normally when constructing events, so
- # in test_shell they get it from glue. The Mac has its own code for
- # accomplishing it, so in test_shell, where events are constructed
- # from scratch, we need to pull this in.
- '../../glue/webinputevent_util.cc',
- ]
- }, { # else: OS!=mac
+ ['OS!="mac"', {
'sources/': [
['exclude', 'mac/[^/]*\\.(cc|mm?)$'],
['exclude', '_mac\\.(cc|mm?)$'],
diff --git a/webkit/tools/test_shell/webview_host_gtk.cc b/webkit/tools/test_shell/webview_host_gtk.cc
index a116c4a..54e3ec8 100644
--- a/webkit/tools/test_shell/webview_host_gtk.cc
+++ b/webkit/tools/test_shell/webview_host_gtk.cc
@@ -9,7 +9,6 @@
#include "base/gfx/rect.h"
#include "base/gfx/size.h"
#include "skia/ext/platform_canvas.h"
-#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webview.h"
// static
diff --git a/webkit/tools/test_shell/webview_host_win.cc b/webkit/tools/test_shell/webview_host_win.cc
index 5689f40..d5c18ef 100644
--- a/webkit/tools/test_shell/webview_host_win.cc
+++ b/webkit/tools/test_shell/webview_host_win.cc
@@ -8,7 +8,6 @@
#include "base/gfx/size.h"
#include "base/win_util.h"
#include "skia/ext/platform_canvas.h"
-#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webview.h"
static const wchar_t kWindowClassName[] = L"WebViewHost";
diff --git a/webkit/tools/test_shell/webwidget_host.h b/webkit/tools/test_shell/webwidget_host.h
index 216c0b1..c35661b 100644
--- a/webkit/tools/test_shell/webwidget_host.h
+++ b/webkit/tools/test_shell/webwidget_host.h
@@ -18,6 +18,14 @@ namespace gfx {
class Size;
}
+#if defined(OS_MACOSX)
+#ifdef __OBJC__
+@class NSEvent;
+#else
+class NSEvent;
+#endif
+#endif
+
// This class is a simple NativeView-based host for a WebWidget
class WebWidgetHost {
public:
diff --git a/webkit/tools/test_shell/webwidget_host_gtk.cc b/webkit/tools/test_shell/webwidget_host_gtk.cc
index 57d88d8..90194c5 100644
--- a/webkit/tools/test_shell/webwidget_host_gtk.cc
+++ b/webkit/tools/test_shell/webwidget_host_gtk.cc
@@ -12,9 +12,15 @@
#include "skia/ext/bitmap_platform_device_linux.h"
#include "skia/ext/platform_canvas_linux.h"
#include "skia/ext/platform_device_linux.h"
-#include "webkit/glue/webinputevent.h"
+#include "third_party/WebKit/WebKit/chromium/public/gtk/WebInputEventFactory.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
#include "webkit/glue/webwidget.h"
+using WebKit::WebInputEventFactory;
+using WebKit::WebKeyboardEvent;
+using WebKit::WebMouseEvent;
+using WebKit::WebMouseWheelEvent;
+
namespace {
// In response to an invalidation, we call into WebKit to do layout. On
@@ -145,7 +151,7 @@ class WebWidgetHostGtkWidget {
static gboolean HandleKeyPress(GtkWidget* widget,
GdkEventKey* event,
WebWidgetHost* host) {
- WebKeyboardEvent wke(event);
+ const WebKeyboardEvent& wke = WebInputEventFactory::keyboardEvent(event);
host->webwidget()->HandleInputEvent(&wke);
return FALSE;
@@ -188,7 +194,7 @@ class WebWidgetHostGtkWidget {
static gboolean HandleButtonPress(GtkWidget* widget,
GdkEventButton* event,
WebWidgetHost* host) {
- WebMouseEvent wme(event);
+ const WebMouseEvent& wme = WebInputEventFactory::mouseEvent(event);
host->webwidget()->HandleInputEvent(&wme);
return FALSE;
}
@@ -204,7 +210,7 @@ class WebWidgetHostGtkWidget {
static gboolean HandleMotionNotify(GtkWidget* widget,
GdkEventMotion* event,
WebWidgetHost* host) {
- WebMouseEvent wme(event);
+ const WebMouseEvent& wme = WebInputEventFactory::mouseEvent(event);
host->webwidget()->HandleInputEvent(&wme);
return FALSE;
}
@@ -213,7 +219,8 @@ class WebWidgetHostGtkWidget {
static gboolean HandleScroll(GtkWidget* widget,
GdkEventScroll* event,
WebWidgetHost* host) {
- WebMouseWheelEvent wmwe(event);
+ const WebMouseWheelEvent& wmwe =
+ WebInputEventFactory::mouseWheelEvent(event);
host->webwidget()->HandleInputEvent(&wmwe);
return FALSE;
}
diff --git a/webkit/tools/test_shell/webwidget_host_win.cc b/webkit/tools/test_shell/webwidget_host_win.cc
index fc4be75..76a5973 100644
--- a/webkit/tools/test_shell/webwidget_host_win.cc
+++ b/webkit/tools/test_shell/webwidget_host_win.cc
@@ -9,9 +9,16 @@
#include "base/win_util.h"
#include "skia/ext/platform_canvas.h"
#include "skia/ext/platform_canvas_win.h"
-#include "webkit/glue/webinputevent.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
+#include "third_party/WebKit/WebKit/chromium/public/win/WebInputEventFactory.h"
#include "webkit/glue/webwidget.h"
+using WebKit::WebInputEvent;
+using WebKit::WebInputEventFactory;
+using WebKit::WebKeyboardEvent;
+using WebKit::WebMouseEvent;
+using WebKit::WebMouseWheelEvent;
+
static const wchar_t kWindowClassName[] = L"WebWidgetHost";
/*static*/
@@ -273,23 +280,24 @@ void WebWidgetHost::Resize(LPARAM lparam) {
}
void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) {
- WebMouseEvent event(view_, message, wparam, lparam);
+ const WebMouseEvent& event = WebInputEventFactory::mouseEvent(
+ view_, message, wparam, lparam);
switch (event.type) {
- case WebInputEvent::MOUSE_MOVE:
+ case WebInputEvent::MouseMove:
TrackMouseLeave(true);
break;
- case WebInputEvent::MOUSE_LEAVE:
+ case WebInputEvent::MouseLeave:
TrackMouseLeave(false);
break;
- case WebInputEvent::MOUSE_DOWN:
+ case WebInputEvent::MouseDown:
SetCapture(view_);
- // This mimics a temporary workaround in RenderWidgetHostViewWin
- // for bug 765011 to get focus when the mouse is clicked. This
- // happens after the mouse down event is sent to the renderer
- // because normally Windows does a WM_SETFOCUS after WM_LBUTTONDOWN.
+ // This mimics a temporary workaround in RenderWidgetHostViewWin for bug
+ // 765011 to get focus when the mouse is clicked. This happens after the
+ // mouse down event is sent to the renderer because normally Windows does
+ // a WM_SETFOCUS after WM_LBUTTONDOWN.
::SetFocus(view_);
break;
- case WebInputEvent::MOUSE_UP:
+ case WebInputEvent::MouseUp:
if (GetCapture() == view_)
ReleaseCapture();
break;
@@ -298,12 +306,14 @@ void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) {
}
void WebWidgetHost::WheelEvent(WPARAM wparam, LPARAM lparam) {
- WebMouseWheelEvent event(view_, WM_MOUSEWHEEL, wparam, lparam);
+ const WebMouseWheelEvent& event = WebInputEventFactory::mouseWheelEvent(
+ view_, WM_MOUSEWHEEL, wparam, lparam);
webwidget_->HandleInputEvent(&event);
}
void WebWidgetHost::KeyEvent(UINT message, WPARAM wparam, LPARAM lparam) {
- WebKeyboardEvent event(view_, message, wparam, lparam);
+ const WebKeyboardEvent& event = WebInputEventFactory::keyboardEvent(
+ view_, message, wparam, lparam);
webwidget_->HandleInputEvent(&event);
}