summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'webkit')
-rw-r--r--webkit/build/WebKit/SConscript5
-rw-r--r--webkit/build/WebKit/WebKit.vcproj24
-rw-r--r--webkit/build/WebKit/WebKit.vsprops2
-rw-r--r--webkit/glue/SConscript3
-rw-r--r--webkit/glue/chrome_client_impl.cc9
-rw-r--r--webkit/glue/context_menu_unittest.cc15
-rw-r--r--webkit/glue/event_conversion.cc85
-rw-r--r--webkit/glue/event_conversion.h10
-rw-r--r--webkit/glue/glue.vcproj16
-rw-r--r--webkit/glue/webinputevent.h206
-rw-r--r--webkit/glue/webinputevent_util.cc120
-rw-r--r--webkit/glue/webinputevent_util.h18
-rw-r--r--webkit/glue/webinputevent_win.cc345
-rw-r--r--webkit/glue/webview_impl.cc91
-rw-r--r--webkit/glue/webview_impl.h39
-rw-r--r--webkit/glue/webwidget.h5
-rw-r--r--webkit/glue/webwidget_impl.cc25
-rw-r--r--webkit/glue/webwidget_impl.h35
-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
-rw-r--r--webkit/webkit.gyp25
30 files changed, 373 insertions, 963 deletions
diff --git a/webkit/build/WebKit/SConscript b/webkit/build/WebKit/SConscript
index db059cc..41ef3ed 100644
--- a/webkit/build/WebKit/SConscript
+++ b/webkit/build/WebKit/SConscript
@@ -9,11 +9,12 @@ env = env.Clone()
env.Append(
CPPDEFINES = [
'WEBKIT_IMPLEMENTATION',
- 'WEBKIT_USING_SKIA'
],
CPPPATH = [
'$WEBKIT_DIR/build/WebCore',
'$THIRD_PARTY_WEBKIT_DIR/WebKit/chromium/public',
+ '$THIRD_PARTY_WEBKIT_DIR/WebKit/chromium/public/gtk',
+ '$THIRD_PARTY_WEBKIT_DIR/WebKit/chromium/src',
]
)
@@ -21,12 +22,14 @@ input_files = [
'$THIRD_PARTY_WEBKIT_DIR/WebKit/chromium/src/ChromiumBridge.cpp',
'$THIRD_PARTY_WEBKIT_DIR/WebKit/chromium/src/ChromiumCurrentTime.cpp',
'$THIRD_PARTY_WEBKIT_DIR/WebKit/chromium/src/ChromiumThreading.cpp',
+ '$THIRD_PARTY_WEBKIT_DIR/WebKit/chromium/src/KeyIdentifier.cpp',
'$THIRD_PARTY_WEBKIT_DIR/WebKit/chromium/src/WebCache.cpp',
'$THIRD_PARTY_WEBKIT_DIR/WebKit/chromium/src/WebCString.cpp',
'$THIRD_PARTY_WEBKIT_DIR/WebKit/chromium/src/WebImageSkia.cpp',
'$THIRD_PARTY_WEBKIT_DIR/WebKit/chromium/src/WebKit.cpp',
'$THIRD_PARTY_WEBKIT_DIR/WebKit/chromium/src/WebString.cpp',
'$THIRD_PARTY_WEBKIT_DIR/WebKit/chromium/src/WebURL.cpp',
+ '$THIRD_PARTY_WEBKIT_DIR/WebKit/chromium/src/gtk/WebInputEventFactory.cpp',
]
env.ChromeLibrary('WebKit', input_files)
diff --git a/webkit/build/WebKit/WebKit.vcproj b/webkit/build/WebKit/WebKit.vcproj
index b76c8f0..87aee8d 100644
--- a/webkit/build/WebKit/WebKit.vcproj
+++ b/webkit/build/WebKit/WebKit.vcproj
@@ -156,6 +156,10 @@
>
</File>
<File
+ RelativePath="..\..\..\third_party\WebKit\WebKit\chromium\public\WebInputEvent.h"
+ >
+ </File>
+ <File
RelativePath="..\..\..\third_party\WebKit\WebKit\chromium\public\WebKit.h"
>
</File>
@@ -187,6 +191,10 @@
Name="win"
>
<File
+ RelativePath="..\..\..\third_party\WebKit\WebKit\chromium\public\win\WebInputEventFactory.h"
+ >
+ </File>
+ <File
RelativePath="..\..\..\third_party\WebKit\WebKit\chromium\public\win\WebSandboxSupport.h"
>
</File>
@@ -212,6 +220,14 @@
>
</File>
<File
+ RelativePath="..\..\..\third_party\WebKit\WebKit\chromium\src\KeyIdentifier.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebKit\chromium\src\KeyIdentifier.h"
+ >
+ </File>
+ <File
RelativePath="..\..\..\third_party\WebKit\WebKit\chromium\src\WebCache.cpp"
>
</File>
@@ -239,6 +255,14 @@
RelativePath="..\..\..\third_party\WebKit\WebKit\chromium\src\WebURL.cpp"
>
</File>
+ <Filter
+ Name="win"
+ >
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebKit\chromium\src\win\WebInputEventFactory.cpp"
+ >
+ </File>
+ </Filter>
</Filter>
</Filter>
</Files>
diff --git a/webkit/build/WebKit/WebKit.vsprops b/webkit/build/WebKit/WebKit.vsprops
index 905211e..0a16a8c 100644
--- a/webkit/build/WebKit/WebKit.vsprops
+++ b/webkit/build/WebKit/WebKit.vsprops
@@ -7,7 +7,7 @@
>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="$(SolutionDir)..\third_party\WebKit\WebKit\chromium\public;$(SolutionDir)..\third_party\WebKit\WebKit\chromium\public\win"
+ AdditionalIncludeDirectories="$(SolutionDir)..\third_party\WebKit\WebKit\chromium\public;$(SolutionDir)..\third_party\WebKit\WebKit\chromium\public\win;$(SolutionDir)..\third_party\WebKit\WebKit\chromium\src"
PreprocessorDefinitions="WEBKIT_IMPLEMENTATION;_SCL_SECURE_NO_DEPRECATE;_HAS_EXCEPTIONS=1"
WarnAsError="true"
/>
diff --git a/webkit/glue/SConscript b/webkit/glue/SConscript
index 5e364ae..73aef79 100644
--- a/webkit/glue/SConscript
+++ b/webkit/glue/SConscript
@@ -135,7 +135,6 @@ if env.Bit('windows'):
'plugins/plugin_list_win.cc',
'plugins/plugin_stream_win.cc',
'webcursor_win.cc',
- 'webinputevent_win.cc',
'webkit_glue_win.cc',
])
elif env.Bit('linux'):
@@ -144,8 +143,6 @@ elif env.Bit('linux'):
'plugins/plugin_list_linux.cc',
'plugins/webplugin_delegate_impl_gtk.cc',
'webcursor_gtk.cc',
- 'webinputevent_linux.cc',
- 'webinputevent_util.cc',
'webkit_glue_gtk.cc',
])
elif env.Bit('mac'):
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc
index 6b574d5..60cfe9b 100644
--- a/webkit/glue/chrome_client_impl.cc
+++ b/webkit/glue/chrome_client_impl.cc
@@ -30,16 +30,19 @@ MSVC_POP_WARNING();
#include "base/logging.h"
#include "base/gfx/rect.h"
#include "googleurl/src/gurl.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
#include "webkit/glue/glue_util.h"
#include "webkit/glue/webframe_impl.h"
-#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/weburlrequest_impl.h"
#include "webkit/glue/webview_delegate.h"
#include "webkit/glue/webview_impl.h"
#include "webkit/glue/webwidget_impl.h"
+using WebKit::WebInputEvent;
+using WebKit::WebMouseEvent;
+
// Callback class that's given to the WebViewDelegate during a file choose
// operation.
class WebFileChooserCallbackImpl : public WebFileChooserCallback {
@@ -191,11 +194,11 @@ static inline bool CurrentEventShouldCauseBackgroundTab(
if (!input_event)
return false;
- if (input_event->type != WebInputEvent::MOUSE_UP)
+ if (input_event->type != WebInputEvent::MouseUp)
return false;
const WebMouseEvent* mouse_event = static_cast<const WebMouseEvent*>(input_event);
- return (mouse_event->button == WebMouseEvent::BUTTON_MIDDLE);
+ return (mouse_event->button == WebMouseEvent::ButtonMiddle);
}
void ChromeClientImpl::show() {
diff --git a/webkit/glue/context_menu_unittest.cc b/webkit/glue/context_menu_unittest.cc
index d54d1f3..b7ff8ed 100644
--- a/webkit/glue/context_menu_unittest.cc
+++ b/webkit/glue/context_menu_unittest.cc
@@ -14,6 +14,8 @@
#include "webkit/glue/webview.h"
#include "webkit/tools/test_shell/test_shell_test.h"
+using WebKit::WebInputEvent;
+using WebKit::WebMouseEvent;
// Right clicking inside on an iframe should produce a context menu
class ContextMenuCapturing : public TestShellTest {
@@ -45,21 +47,18 @@ TEST_F(ContextMenuCapturing, ContextMenuCapturing) {
// Create a right click in the center of the iframe. (I'm hoping this will
// make this a bit more robust in case of some other formatting or other bug.)
WebMouseEvent mouse_event;
- mouse_event.type = WebInputEvent::MOUSE_DOWN;
- mouse_event.modifiers = 0;
- mouse_event.button = WebMouseEvent::BUTTON_RIGHT;
+ mouse_event.type = WebInputEvent::MouseDown;
+ mouse_event.button = WebMouseEvent::ButtonRight;
mouse_event.x = 250;
mouse_event.y = 250;
- mouse_event.global_x = 250;
- mouse_event.global_y = 250;
- mouse_event.timestamp_sec = 0;
- mouse_event.layout_test_click_count = 0;
+ mouse_event.globalX = 250;
+ mouse_event.globalY = 250;
WebView* webview = test_shell_->webView();
webview->HandleInputEvent(&mouse_event);
// Now simulate the corresponding up event which should display the menu
- mouse_event.type = WebInputEvent::MOUSE_UP;
+ mouse_event.type = WebInputEvent::MouseUp;
webview->HandleInputEvent(&mouse_event);
EXPECT_EQ(1U, test_delegate->captured_context_menu_events().size());
diff --git a/webkit/glue/event_conversion.cc b/webkit/glue/event_conversion.cc
index 826c02f..ae2ed73 100644
--- a/webkit/glue/event_conversion.cc
+++ b/webkit/glue/event_conversion.cc
@@ -15,13 +15,18 @@
#undef LOG
#include "base/gfx/point.h"
#include "base/logging.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
#include "webkit/glue/glue_util.h"
-#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webkit_glue.h"
using namespace WebCore;
+using WebKit::WebInputEvent;
+using WebKit::WebKeyboardEvent;
+using WebKit::WebMouseEvent;
+using WebKit::WebMouseWheelEvent;
+
// MakePlatformMouseEvent -----------------------------------------------------
int MakePlatformMouseEvent::last_click_count_ = 0;
@@ -32,14 +37,14 @@ MakePlatformMouseEvent::MakePlatformMouseEvent(Widget* widget,
// TODO(mpcomplete): widget is always toplevel, unless it's a popup. We
// may be able to get rid of this once we abstract popups into a WebKit API.
m_position = widget->convertFromContainingWindow(IntPoint(e.x, e.y));
- m_globalPosition = IntPoint(e.global_x, e.global_y);
+ m_globalPosition = IntPoint(e.globalX, e.globalY);
m_button = static_cast<MouseButton>(e.button);
- m_shiftKey = (e.modifiers & WebInputEvent::SHIFT_KEY) != 0;
- m_ctrlKey = (e.modifiers & WebInputEvent::CTRL_KEY) != 0;
- m_altKey = (e.modifiers & WebInputEvent::ALT_KEY) != 0;
- m_metaKey = (e.modifiers & WebInputEvent::META_KEY) != 0;
+ m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey) != 0;
+ m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey) != 0;
+ m_altKey = (e.modifiers & WebInputEvent::AltKey) != 0;
+ m_metaKey = (e.modifiers & WebInputEvent::MetaKey) != 0;
m_modifierFlags = e.modifiers;
- m_timestamp = e.timestamp_sec;
+ m_timestamp = e.timeStampSeconds;
// This differs slightly from the WebKit code in WebKit/win/WebView.cpp where
// their original code looks buggy.
@@ -59,8 +64,8 @@ MakePlatformMouseEvent::MakePlatformMouseEvent(Widget* widget,
#endif
switch (e.type) {
- case WebInputEvent::MOUSE_MOVE:
- case WebInputEvent::MOUSE_LEAVE: // synthesize a move event
+ case WebInputEvent::MouseMove:
+ case WebInputEvent::MouseLeave: // synthesize a move event
if (cancel_previous_click) {
last_click_count_ = 0;
last_click_position = IntPoint();
@@ -72,18 +77,18 @@ MakePlatformMouseEvent::MakePlatformMouseEvent(Widget* widget,
// TODO(port): make these platform agnostic when we restructure this code.
#if defined(OS_LINUX) || defined(OS_MACOSX)
- case WebInputEvent::MOUSE_DOUBLE_CLICK:
+ case WebInputEvent::MouseDoubleClick:
++m_clickCount;
// fall through
- case WebInputEvent::MOUSE_DOWN:
+ case WebInputEvent::MouseDown:
++m_clickCount;
last_click_time_ = current_time;
last_click_button = m_button;
m_eventType = MouseEventPressed;
break;
#else
- case WebInputEvent::MOUSE_DOWN:
- case WebInputEvent::MOUSE_DOUBLE_CLICK:
+ case WebInputEvent::MouseDown:
+ case WebInputEvent::MouseDoubleClick:
if (!cancel_previous_click && (m_button == last_click_button)) {
++last_click_count_;
} else {
@@ -97,7 +102,7 @@ MakePlatformMouseEvent::MakePlatformMouseEvent(Widget* widget,
break;
#endif
- case WebInputEvent::MOUSE_UP:
+ case WebInputEvent::MouseUp:
m_clickCount = last_click_count_;
m_eventType = MouseEventReleased;
break;
@@ -107,7 +112,7 @@ MakePlatformMouseEvent::MakePlatformMouseEvent(Widget* widget,
}
if (WebKit::layoutTestMode()) {
- m_clickCount = e.layout_test_click_count;
+ m_clickCount = e.layoutTestClickCount;
}
}
@@ -116,18 +121,18 @@ MakePlatformMouseEvent::MakePlatformMouseEvent(Widget* widget,
MakePlatformWheelEvent::MakePlatformWheelEvent(Widget* widget,
const WebMouseWheelEvent& e) {
m_position = widget->convertFromContainingWindow(IntPoint(e.x, e.y));
- m_globalPosition = IntPoint(e.global_x, e.global_y);
- m_deltaX = e.delta_x;
- m_deltaY = e.delta_y;
- m_wheelTicksX = e.wheel_ticks_x;
- m_wheelTicksY = e.wheel_ticks_y;
+ m_globalPosition = IntPoint(e.globalX, e.globalY);
+ m_deltaX = e.deltaX;
+ m_deltaY = e.deltaY;
+ m_wheelTicksX = e.wheelTicksX;
+ m_wheelTicksY = e.wheelTicksY;
m_isAccepted = false;
- m_granularity = e.scroll_by_page ?
+ m_granularity = e.scrollByPage ?
ScrollByPageWheelEvent : ScrollByPixelWheelEvent;
- m_shiftKey = (e.modifiers & WebInputEvent::SHIFT_KEY) != 0;
- m_ctrlKey = (e.modifiers & WebInputEvent::CTRL_KEY) != 0;
- m_altKey = (e.modifiers & WebInputEvent::ALT_KEY) != 0;
- m_metaKey = (e.modifiers & WebInputEvent::META_KEY) != 0;
+ m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey) != 0;
+ m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey) != 0;
+ m_altKey = (e.modifiers & WebInputEvent::AltKey) != 0;
+ m_metaKey = (e.modifiers & WebInputEvent::MetaKey) != 0;
}
// MakePlatformKeyboardEvent --------------------------------------------------
@@ -135,13 +140,13 @@ MakePlatformWheelEvent::MakePlatformWheelEvent(Widget* widget,
static inline const PlatformKeyboardEvent::Type ToPlatformKeyboardEventType(
WebInputEvent::Type type) {
switch (type) {
- case WebInputEvent::KEY_UP:
+ case WebInputEvent::KeyUp:
return PlatformKeyboardEvent::KeyUp;
- case WebInputEvent::KEY_DOWN:
+ case WebInputEvent::KeyDown:
return PlatformKeyboardEvent::KeyDown;
- case WebInputEvent::RAW_KEY_DOWN:
+ case WebInputEvent::RawKeyDown:
return PlatformKeyboardEvent::RawKeyDown;
- case WebInputEvent::CHAR:
+ case WebInputEvent::Char:
return PlatformKeyboardEvent::Char;
default:
ASSERT_NOT_REACHED();
@@ -153,17 +158,17 @@ MakePlatformKeyboardEvent::MakePlatformKeyboardEvent(
const WebKeyboardEvent& e) {
m_type = ToPlatformKeyboardEventType(e.type);
m_text = WebCore::String(e.text);
- m_unmodifiedText = WebCore::String(e.unmodified_text);
- m_keyIdentifier = WebCore::String(e.key_identifier);
- m_autoRepeat = (e.modifiers & WebInputEvent::IS_AUTO_REPEAT) != 0;
- m_windowsVirtualKeyCode = e.windows_key_code;
- m_nativeVirtualKeyCode = e.native_key_code;
- m_isKeypad = (e.modifiers & WebInputEvent::IS_KEYPAD) != 0;
- m_shiftKey = (e.modifiers & WebInputEvent::SHIFT_KEY) != 0;
- m_ctrlKey = (e.modifiers & WebInputEvent::CTRL_KEY) != 0;
- m_altKey = (e.modifiers & WebInputEvent::ALT_KEY) != 0;
- m_metaKey = (e.modifiers & WebInputEvent::META_KEY) != 0;
- m_isSystemKey = e.system_key;
+ m_unmodifiedText = WebCore::String(e.unmodifiedText);
+ m_keyIdentifier = WebCore::String(e.keyIdentifier);
+ m_autoRepeat = (e.modifiers & WebInputEvent::IsAutoRepeat) != 0;
+ m_windowsVirtualKeyCode = e.windowsKeyCode;
+ m_nativeVirtualKeyCode = e.nativeKeyCode;
+ m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad) != 0;
+ m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey) != 0;
+ m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey) != 0;
+ m_altKey = (e.modifiers & WebInputEvent::AltKey) != 0;
+ m_metaKey = (e.modifiers & WebInputEvent::MetaKey) != 0;
+ m_isSystemKey = e.isSystemKey;
}
void MakePlatformKeyboardEvent::SetKeyType(Type type) {
diff --git a/webkit/glue/event_conversion.h b/webkit/glue/event_conversion.h
index 05cb4cd..3f49938 100644
--- a/webkit/glue/event_conversion.h
+++ b/webkit/glue/event_conversion.h
@@ -18,16 +18,19 @@ namespace WebCore {
class Widget;
}
+namespace WebKit {
class WebMouseEvent;
class WebMouseWheelEvent;
class WebKeyboardEvent;
+}
// These classes are used to convert from WebInputEvent subclasses to
// corresponding WebCore events.
class MakePlatformMouseEvent : public WebCore::PlatformMouseEvent {
public:
- MakePlatformMouseEvent(WebCore::Widget* widget, const WebMouseEvent& e);
+ MakePlatformMouseEvent(
+ WebCore::Widget* widget, const WebKit::WebMouseEvent& e);
static void ResetLastClick() {
last_click_time_ = last_click_count_ = 0;
@@ -40,12 +43,13 @@ class MakePlatformMouseEvent : public WebCore::PlatformMouseEvent {
class MakePlatformWheelEvent : public WebCore::PlatformWheelEvent {
public:
- MakePlatformWheelEvent(WebCore::Widget* widget, const WebMouseWheelEvent& e);
+ MakePlatformWheelEvent(
+ WebCore::Widget* widget, const WebKit::WebMouseWheelEvent& e);
};
class MakePlatformKeyboardEvent : public WebCore::PlatformKeyboardEvent {
public:
- MakePlatformKeyboardEvent(const WebKeyboardEvent& e);
+ MakePlatformKeyboardEvent(const WebKit::WebKeyboardEvent& e);
void SetKeyType(Type type);
bool IsCharacterKey() const;
};
diff --git a/webkit/glue/glue.vcproj b/webkit/glue/glue.vcproj
index 8e166c4..5583de0 100644
--- a/webkit/glue/glue.vcproj
+++ b/webkit/glue/glue.vcproj
@@ -219,14 +219,6 @@
>
</File>
<File
- RelativePath=".\webinputevent.h"
- >
- </File>
- <File
- RelativePath=".\webinputevent_win.cc"
- >
- </File>
- <File
RelativePath=".\webmediaplayer.h"
>
</File>
@@ -667,14 +659,6 @@
>
</File>
<File
- RelativePath=".\webinputevent_util.cc"
- >
- </File>
- <File
- RelativePath=".\webinputevent_util.h"
- >
- </File>
- <File
RelativePath=".\webkit_glue.cc"
>
</File>
diff --git a/webkit/glue/webinputevent.h b/webkit/glue/webinputevent.h
deleted file mode 100644
index 351da4b..0000000
--- a/webkit/glue/webinputevent.h
+++ /dev/null
@@ -1,206 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEBKIT_GLUE_WEBINPUTEVENT_H_
-#define WEBKIT_GLUE_WEBINPUTEVENT_H_
-
-#include "base/basictypes.h"
-#include "base/string16.h"
-
-#if defined(OS_WIN)
-#include <windows.h>
-#elif defined(OS_MACOSX)
-#ifdef __OBJC__
-@class NSEvent;
-@class NSView;
-#else
-class NSEvent;
-class NSView;
-#endif // __OBJC__
-#elif defined(OS_LINUX)
-#include <glib.h>
-typedef struct _GdkEventButton GdkEventButton;
-typedef struct _GdkEventMotion GdkEventMotion;
-typedef struct _GdkEventScroll GdkEventScroll;
-typedef struct _GdkEventKey GdkEventKey;
-#endif
-
-// The classes defined in this file are intended to be used with WebView's
-// HandleInputEvent method. These event types are cross-platform; however,
-// there are platform-specific constructors that accept native UI events.
-//
-// The fields of these event classes roughly correspond to the fields required
-// by WebCore's platform event classes.
-//
-// WARNING! These classes must remain PODs (plain old data). They will be
-// "serialized" by shipping their raw bytes across the wire, so they must not
-// contain any non-bit-copyable member variables!
-
-// WebInputEvent --------------------------------------------------------------
-
-class WebInputEvent {
- public:
- WebInputEvent() : modifiers(0) { }
-
- // There are two schemes used for keyboard input. On Windows (and,
- // interestingly enough, on Mac Carbon) there are two events for a keypress.
- // One is a raw keydown, which provides the keycode only. If the app doesn't
- // handle that, then the system runs key translation to create an event
- // containing the generated character and pumps that event. In such a scheme,
- // those two events are translated to RAW_KEY_DOWN and CHAR events
- // respectively. In Cocoa and Gtk, key events contain both the keycode and any
- // translation into actual text. In such a case, WebCore will eventually need
- // to split the events (see disambiguateKeyDownEvent and its callers) but we
- // don't worry about that here. We just use a different type (KEY_DOWN) to
- // indicate this.
- enum Type {
- // WebMouseEvent
- MOUSE_DOWN,
- MOUSE_UP,
- MOUSE_MOVE,
- MOUSE_LEAVE,
- MOUSE_DOUBLE_CLICK,
-
- // WebMouseWheelEvent
- MOUSE_WHEEL,
-
- // WebKeyboardEvent
- RAW_KEY_DOWN,
- KEY_DOWN,
- KEY_UP,
- CHAR
- };
-
- enum Modifiers {
- // modifiers for all events:
- SHIFT_KEY = 1 << 0,
- CTRL_KEY = 1 << 1,
- ALT_KEY = 1 << 2,
- META_KEY = 1 << 3,
-
- // modifiers for keyboard events:
- IS_KEYPAD = 1 << 4,
- IS_AUTO_REPEAT = 1 << 5
- };
-
- Type type;
- int modifiers;
-
- // Returns true if the WebInputEvent |type| is a keyboard event.
- static bool IsKeyboardEventType(int type) {
- return type == RAW_KEY_DOWN ||
- type == KEY_DOWN ||
- type == KEY_UP ||
- type == CHAR;
- }
-};
-
-// WebMouseEvent --------------------------------------------------------------
-
-class WebMouseEvent : public WebInputEvent {
- public:
- // These values defined for WebCore::MouseButton
- enum Button {
- BUTTON_NONE = -1,
- BUTTON_LEFT,
- BUTTON_MIDDLE,
- BUTTON_RIGHT
- };
-
- Button button;
- int x;
- int y;
- int global_x;
- int global_y;
- double timestamp_sec; // Seconds since epoch.
- int layout_test_click_count; // Only used during layout tests.
-
- WebMouseEvent() {}
-#if defined(OS_WIN)
- WebMouseEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
-#elif defined(OS_MACOSX)
- WebMouseEvent(NSEvent *event, NSView* view);
-#elif defined(OS_LINUX)
- explicit WebMouseEvent(const GdkEventButton* event);
- explicit WebMouseEvent(const GdkEventMotion* event);
-#endif
-};
-
-// WebMouseWheelEvent ---------------------------------------------------------
-
-class WebMouseWheelEvent : public WebMouseEvent {
- public:
- float delta_x;
- float delta_y;
- float wheel_ticks_x;
- float wheel_ticks_y;
- bool scroll_by_page;
-
- WebMouseWheelEvent() {}
-#if defined(OS_WIN)
- WebMouseWheelEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
-#elif defined(OS_MACOSX)
- WebMouseWheelEvent(NSEvent *event, NSView* view);
-#elif defined(OS_LINUX)
- explicit WebMouseWheelEvent(const GdkEventScroll* event);
-#endif
-};
-
-// WebKeyboardEvent -----------------------------------------------------------
-
-// Caps on string lengths so we can make them static arrays and keep them PODs.
-const size_t kTextLengthCap = 4;
-// http://www.w3.org/TR/DOM-Level-3-Events/keyset.html lists the identifiers.
-// The longest is 18 characters, so we'll round up to the next multiple of 4.
-const size_t kIdentifierLengthCap = 20;
-
-class WebKeyboardEvent : public WebInputEvent {
- public:
- // |windows_key_code| is the Windows key code associated with this key event.
- // Sometimes it's direct from the event (i.e. on Windows), sometimes it's via
- // a mapping function. If you want a list, see
- // webkit/port/platform/chromium/KeyboardCodes* .
- int windows_key_code;
-
- // The actual key code genenerated by the platform. The DOM spec runs on
- // Windows-equivalent codes (thus |windows_key_code| above) but it doesn't
- // hurt to have this one around.
- int native_key_code;
-
- // |text| is the text generated by this keystroke. |unmodified_text| is
- // |text|, but unmodified by an concurrently-held modifiers (except shift).
- // This is useful for working out shortcut keys. Linux and Windows guarantee
- // one character per event. The Mac does not, but in reality that's all it
- // ever gives. We're generous, and cap it a bit longer.
- char16 text[kTextLengthCap];
- char16 unmodified_text[kTextLengthCap];
-
- // This is a string identifying the key pressed.
- char key_identifier[kIdentifierLengthCap];
-
- // This identifies whether this event was tagged by the system as being a
- // "system key" event (see
- // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for details).
- // Other platforms don't have this concept, but it's just easier to leave it
- // always false than ifdef.
- bool system_key;
-
- WebKeyboardEvent() : windows_key_code(0),
- native_key_code(0),
- system_key(false) {
- memset(&text, 0, sizeof(text));
- memset(&unmodified_text, 0, sizeof(unmodified_text));
- memset(&key_identifier, 0, sizeof(key_identifier));
- }
-
-#if defined(OS_WIN)
- WebKeyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
-#elif defined(OS_MACOSX)
- explicit WebKeyboardEvent(NSEvent *event);
-#elif defined(OS_LINUX)
- explicit WebKeyboardEvent(const GdkEventKey* event);
-#endif
-};
-
-#endif // WEBKIT_GLUE_WEBINPUTEVENT_H_
diff --git a/webkit/glue/webinputevent_util.cc b/webkit/glue/webinputevent_util.cc
deleted file mode 100644
index 9f47429..0000000
--- a/webkit/glue/webinputevent_util.cc
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-
-#include "webkit/glue/webinputevent_util.h"
-
-#include "KeyboardCodes.h"
-
-#include "base/string_util.h"
-
-using namespace WebCore;
-
-namespace webkit_glue {
-
-std::string GetKeyIdentifierForWindowsKeyCode(unsigned short key_code) {
- switch (key_code) {
- case VKEY_MENU:
- return "Alt";
- case VKEY_CONTROL:
- return "Control";
- case VKEY_SHIFT:
- return "Shift";
- case VKEY_CAPITAL:
- return "CapsLock";
- case VKEY_LWIN:
- case VKEY_RWIN:
- return "Win";
- case VKEY_CLEAR:
- return "Clear";
- case VKEY_DOWN:
- return "Down";
- // "End"
- case VKEY_END:
- return "End";
- // "Enter"
- case VKEY_RETURN:
- return "Enter";
- case VKEY_EXECUTE:
- return "Execute";
- case VKEY_F1:
- return "F1";
- case VKEY_F2:
- return "F2";
- case VKEY_F3:
- return "F3";
- case VKEY_F4:
- return "F4";
- case VKEY_F5:
- return "F5";
- case VKEY_F6:
- return "F6";
- case VKEY_F7:
- return "F7";
- case VKEY_F8:
- return "F8";
- case VKEY_F9:
- return "F9";
- case VKEY_F10:
- return "F11";
- case VKEY_F12:
- return "F12";
- case VKEY_F13:
- return "F13";
- case VKEY_F14:
- return "F14";
- case VKEY_F15:
- return "F15";
- case VKEY_F16:
- return "F16";
- case VKEY_F17:
- return "F17";
- case VKEY_F18:
- return "F18";
- case VKEY_F19:
- return "F19";
- case VKEY_F20:
- return "F20";
- case VKEY_F21:
- return "F21";
- case VKEY_F22:
- return "F22";
- case VKEY_F23:
- return "F23";
- case VKEY_F24:
- return "F24";
- case VKEY_HELP:
- return "Help";
- case VKEY_HOME:
- return "Home";
- case VKEY_INSERT:
- return "Insert";
- case VKEY_LEFT:
- return "Left";
- case VKEY_NEXT:
- return "PageDown";
- case VKEY_PRIOR:
- return "PageUp";
- case VKEY_PAUSE:
- return "Pause";
- case VKEY_SNAPSHOT:
- return "PrintScreen";
- case VKEY_RIGHT:
- return "Right";
- case VKEY_SCROLL:
- return "Scroll";
- case VKEY_SELECT:
- return "Select";
- case VKEY_UP:
- return "Up";
- // Standard says that DEL becomes U+007F.
- case VKEY_DELETE:
- return "U+007F";
- default:
- return StringPrintf("U+%04X", toupper(key_code));
- }
-}
-
-} // namespace webkit_glue
diff --git a/webkit/glue/webinputevent_util.h b/webkit/glue/webinputevent_util.h
deleted file mode 100644
index 6452c77..0000000
--- a/webkit/glue/webinputevent_util.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEBKIT_GLUE_WEBINPUTEVENT_UTIL_H_
-#define WEBKIT_GLUE_WEBINPUTEVENT_UTIL_H_
-
-#include <string>
-
-// The shared Linux and Windows keyboard event code lives here.
-
-namespace webkit_glue {
-
-std::string GetKeyIdentifierForWindowsKeyCode(unsigned short key_code);
-
-} // namespace webkit_glue
-
-#endif // WEBKIT_GLUE_WEBINPUTEVENT_UTIL_H_
diff --git a/webkit/glue/webinputevent_win.cc b/webkit/glue/webinputevent_win.cc
deleted file mode 100644
index 9dd4d85..0000000
--- a/webkit/glue/webinputevent_win.cc
+++ /dev/null
@@ -1,345 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-
-#include "webkit/glue/webinputevent.h"
-
-#include "base/logging.h"
-#include "base/string_util.h"
-#include "webkit/glue/webinputevent_util.h"
-
-static const unsigned long kDefaultScrollLinesPerWheelDelta = 3;
-static const unsigned long kDefaultScrollCharsPerWheelDelta = 1;
-
-// WebMouseEvent --------------------------------------------------------------
-
-static LPARAM GetRelativeCursorPos(HWND hwnd) {
- POINT pos = {-1, -1};
- GetCursorPos(&pos);
- ScreenToClient(hwnd, &pos);
- return MAKELPARAM(pos.x, pos.y);
-}
-
-WebMouseEvent::WebMouseEvent(HWND hwnd, UINT message, WPARAM wparam,
- LPARAM lparam) {
- switch (message) {
- case WM_MOUSEMOVE:
- type = MOUSE_MOVE;
- if (wparam & MK_LBUTTON)
- button = BUTTON_LEFT;
- else if (wparam & MK_MBUTTON)
- button = BUTTON_MIDDLE;
- else if (wparam & MK_RBUTTON)
- button = BUTTON_MIDDLE;
- else
- button = BUTTON_NONE;
- break;
- case WM_MOUSELEAVE:
- type = MOUSE_LEAVE;
- button = BUTTON_NONE;
- // set the current mouse position (relative to the client area of the
- // current window) since none is specified for this event
- lparam = GetRelativeCursorPos(hwnd);
- break;
- case WM_LBUTTONDOWN:
- type = MOUSE_DOWN;
- button = BUTTON_LEFT;
- break;
- case WM_MBUTTONDOWN:
- type = MOUSE_DOWN;
- button = BUTTON_MIDDLE;
- break;
- case WM_RBUTTONDOWN:
- type = MOUSE_DOWN;
- button = BUTTON_RIGHT;
- break;
- case WM_LBUTTONUP:
- type = MOUSE_UP;
- button = BUTTON_LEFT;
- break;
- case WM_MBUTTONUP:
- type = MOUSE_UP;
- button = BUTTON_MIDDLE;
- break;
- case WM_RBUTTONUP:
- type = MOUSE_UP;
- button = BUTTON_RIGHT;
- break;
- case WM_LBUTTONDBLCLK:
- type = MOUSE_DOUBLE_CLICK;
- button = BUTTON_LEFT;
- break;
- case WM_MBUTTONDBLCLK:
- type = MOUSE_DOUBLE_CLICK;
- button = BUTTON_MIDDLE;
- break;
- case WM_RBUTTONDBLCLK:
- type = MOUSE_DOUBLE_CLICK;
- button = BUTTON_RIGHT;
- break;
- default:
- NOTREACHED() << "unexpected native message";
- }
-
- // set position fields:
-
- x = static_cast<short>(LOWORD(lparam));
- y = static_cast<short>(HIWORD(lparam));
-
- POINT global_point = { x, y };
- ClientToScreen(hwnd, &global_point);
-
- global_x = global_point.x;
- global_y = global_point.y;
-
- // set modifiers:
-
- if (wparam & MK_CONTROL)
- modifiers |= CTRL_KEY;
- if (wparam & MK_SHIFT)
- modifiers |= SHIFT_KEY;
- if (GetKeyState(VK_MENU) & 0x8000)
- modifiers |= (ALT_KEY | META_KEY); // TODO(darin): set META properly
-
- // TODO(pkasting): http://b/1117926 Instead of using GetTickCount() here, we
- // should use GetMessageTime() on the original Windows message in the browser
- // process, and pass that in the WebMouseEvent.
- timestamp_sec = GetTickCount() / 1000.0;
-
- layout_test_click_count = 0;
-}
-
-// WebMouseWheelEvent ---------------------------------------------------------
-
-WebMouseWheelEvent::WebMouseWheelEvent(HWND hwnd,
- UINT message,
- WPARAM wparam,
- LPARAM lparam)
- : scroll_by_page(false) {
- type = MOUSE_WHEEL;
- button = BUTTON_NONE;
-
- // Get key state, coordinates, and wheel delta from event.
- typedef SHORT (WINAPI *GetKeyStateFunction)(int key);
- GetKeyStateFunction get_key_state;
- UINT key_state;
- float wheel_delta;
- bool horizontal_scroll = false;
- if ((message == WM_VSCROLL) || (message == WM_HSCROLL)) {
- // Synthesize mousewheel event from a scroll event. This is needed to
- // simulate middle mouse scrolling in some laptops. Use GetAsyncKeyState
- // for key state since we are synthesizing the input event.
- get_key_state = GetAsyncKeyState;
- key_state = 0;
- if (get_key_state(VK_SHIFT))
- key_state |= MK_SHIFT;
- if (get_key_state(VK_CONTROL))
- key_state |= MK_CONTROL;
-
- POINT cursor_position = {0};
- GetCursorPos(&cursor_position);
- global_x = cursor_position.x;
- global_y = cursor_position.y;
-
- switch (LOWORD(wparam)) {
- case SB_LINEUP: // == SB_LINELEFT
- wheel_delta = WHEEL_DELTA;
- break;
- case SB_LINEDOWN: // == SB_LINERIGHT
- wheel_delta = -WHEEL_DELTA;
- break;
- case SB_PAGEUP:
- wheel_delta = 1;
- scroll_by_page = true;
- break;
- case SB_PAGEDOWN:
- wheel_delta = -1;
- scroll_by_page = true;
- break;
- default: // We don't supoprt SB_THUMBPOSITION or SB_THUMBTRACK here.
- wheel_delta = 0;
- break;
- }
-
- if (message == WM_HSCROLL)
- horizontal_scroll = true;
- } else {
- // Non-synthesized event; we can just read data off the event.
- get_key_state = GetKeyState;
- key_state = GET_KEYSTATE_WPARAM(wparam);
-
- global_x = static_cast<short>(LOWORD(lparam));
- global_y = static_cast<short>(HIWORD(lparam));
-
- wheel_delta = static_cast<float>(GET_WHEEL_DELTA_WPARAM(wparam));
- if (message == WM_MOUSEHWHEEL) {
- horizontal_scroll = true;
- wheel_delta = -wheel_delta; // Windows is <- -/+ ->, WebKit <- +/- ->.
- }
- }
- if (key_state & MK_SHIFT)
- horizontal_scroll = true;
-
- // Set modifiers based on key state.
- if (key_state & MK_SHIFT)
- modifiers |= SHIFT_KEY;
- if (key_state & MK_CONTROL)
- modifiers |= CTRL_KEY;
- if (get_key_state(VK_MENU) & 0x8000)
- modifiers |= (ALT_KEY | META_KEY);
-
- // Set coordinates by translating event coordinates from screen to client.
- POINT client_point = { global_x, global_y };
- MapWindowPoints(NULL, hwnd, &client_point, 1);
- x = client_point.x;
- y = client_point.y;
-
- // Convert wheel delta amount to a number of pixels to scroll.
- //
- // How many pixels should we scroll per line? Gecko uses the height of the
- // current line, which means scroll distance changes as you go through the
- // page or go to different pages. IE 7 is ~50 px/line, although the value
- // seems to vary slightly by page and zoom level. Since IE 7 has a smoothing
- // algorithm on scrolling, it can get away with slightly larger scroll values
- // without feeling jerky. Here we use 100 px per three lines (the default
- // scroll amount is three lines per wheel tick).
- static const float kScrollbarPixelsPerLine = 100.0f / 3.0f;
- wheel_delta /= WHEEL_DELTA;
- float scroll_delta = wheel_delta;
- if (horizontal_scroll) {
- unsigned long scroll_chars = kDefaultScrollCharsPerWheelDelta;
- SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &scroll_chars, 0);
- // TODO(pkasting): Should probably have a different multiplier
- // kScrollbarPixelsPerChar here.
- scroll_delta *= static_cast<float>(scroll_chars) * kScrollbarPixelsPerLine;
- } else {
- unsigned long scroll_lines = kDefaultScrollLinesPerWheelDelta;
- SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scroll_lines, 0);
- if (scroll_lines == WHEEL_PAGESCROLL)
- scroll_by_page = true;
- if (!scroll_by_page) {
- scroll_delta *=
- static_cast<float>(scroll_lines) * kScrollbarPixelsPerLine;
- }
- }
-
- // Set scroll amount based on above calculations. WebKit expects positive
- // delta_y to mean "scroll up" and positive delta_x to mean "scroll left".
- if (horizontal_scroll) {
- delta_x = scroll_delta;
- delta_y = 0;
- wheel_ticks_x = wheel_delta;
- wheel_ticks_y = 0;
- } else {
- delta_x = 0;
- delta_y = scroll_delta;
- wheel_ticks_x = 0;
- wheel_ticks_y = wheel_delta;
- }
-}
-
-// WebKeyboardEvent -----------------------------------------------------------
-
-bool IsKeyPad(WPARAM wparam, LPARAM lparam) {
- bool keypad = false;
- switch (wparam) {
- case VK_RETURN:
- keypad = (lparam >> 16) & KF_EXTENDED;
- break;
- case VK_INSERT:
- case VK_DELETE:
- case VK_HOME:
- case VK_END:
- case VK_PRIOR:
- case VK_NEXT:
- case VK_UP:
- case VK_DOWN:
- case VK_LEFT:
- case VK_RIGHT:
- keypad = !((lparam >> 16) & KF_EXTENDED);
- break;
- case VK_NUMLOCK:
- case VK_NUMPAD0:
- case VK_NUMPAD1:
- case VK_NUMPAD2:
- case VK_NUMPAD3:
- case VK_NUMPAD4:
- case VK_NUMPAD5:
- case VK_NUMPAD6:
- case VK_NUMPAD7:
- case VK_NUMPAD8:
- case VK_NUMPAD9:
- case VK_DIVIDE:
- case VK_MULTIPLY:
- case VK_SUBTRACT:
- case VK_ADD:
- case VK_DECIMAL:
- case VK_CLEAR:
- keypad = true;
- break;
- default:
- keypad = false;
- }
-
- return keypad;
-}
-
-WebKeyboardEvent::WebKeyboardEvent(HWND hwnd, UINT message, WPARAM wparam,
- LPARAM lparam) {
- system_key = false;
-
- windows_key_code = native_key_code = static_cast<int>(wparam);
-
- switch (message) {
- case WM_SYSKEYDOWN:
- system_key = true;
- case WM_KEYDOWN:
- type = RAW_KEY_DOWN;
- break;
- case WM_SYSKEYUP:
- system_key = true;
- case WM_KEYUP:
- type = KEY_UP;
- break;
- case WM_IME_CHAR:
- type = CHAR;
- break;
- case WM_SYSCHAR:
- system_key = true;
- type = CHAR;
- case WM_CHAR:
- type = CHAR;
- break;
- default:
- NOTREACHED() << "unexpected native message: " << message;
- }
-
- memset(&text, 0, sizeof(text));
- memset(&unmodified_text, 0, sizeof(unmodified_text));
- memset(&key_identifier, 0, sizeof(key_identifier));
-
- if (type == CHAR || type == RAW_KEY_DOWN) {
- text[0] = windows_key_code;
- unmodified_text[0] = windows_key_code;
- }
- if (type != CHAR) {
- std::string key_identifier_str =
- webkit_glue::GetKeyIdentifierForWindowsKeyCode(windows_key_code);
- base::strlcpy(key_identifier, key_identifier_str.c_str(),
- kIdentifierLengthCap);
- }
-
- if (GetKeyState(VK_SHIFT) & 0x8000)
- modifiers |= SHIFT_KEY;
- if (GetKeyState(VK_CONTROL) & 0x8000)
- modifiers |= CTRL_KEY;
- if (GetKeyState(VK_MENU) & 0x8000)
- modifiers |= (ALT_KEY | META_KEY);
-
- if (LOWORD(lparam) > 1)
- modifiers |= IS_AUTO_REPEAT;
- if (IsKeyPad(wparam, lparam))
- modifiers |= IS_KEYPAD;
-}
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index c09a174..4d6b8a09 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -84,6 +84,7 @@ MSVC_POP_WARNING();
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/string_util.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
#include "webkit/glue/chrome_client_impl.h"
#include "webkit/glue/clipboard_conversion.h"
#include "webkit/glue/context_menu_client_impl.h"
@@ -99,7 +100,6 @@ MSVC_POP_WARNING();
#include "webkit/glue/webdevtoolsagent_impl.h"
#include "webkit/glue/webdropdata.h"
#include "webkit/glue/webhistoryitem_impl.h"
-#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webpreferences.h"
#include "webkit/glue/webdevtoolsagent.h"
@@ -114,6 +114,11 @@ MSVC_POP_WARNING();
using namespace WebCore;
+using WebKit::WebInputEvent;
+using WebKit::WebKeyboardEvent;
+using WebKit::WebMouseEvent;
+using WebKit::WebMouseWheelEvent;
+
// Change the text zoom level by kTextSizeMultiplierRatio each time the user
// zooms text in or out (ie., change by 20%). The min and max values limit
// text zoom to half and 3x the original text size. These three values match
@@ -429,7 +434,7 @@ void WebViewImpl::MouseDown(const WebMouseEvent& event) {
// If a text field that has focus is clicked again, we should display the
// autocomplete popup.
RefPtr<Node> clicked_node;
- if (event.button == WebMouseEvent::BUTTON_LEFT) {
+ if (event.button == WebMouseEvent::ButtonLeft) {
RefPtr<Node> focused_node = GetFocusedNode();
if (focused_node.get() &&
webkit_glue::NodeToHTMLInputElement(focused_node.get())) {
@@ -501,7 +506,7 @@ void WebViewImpl::MouseUp(const WebMouseEvent& event) {
#if defined(OS_WIN) || defined(OS_LINUX)
// Dispatch the contextmenu event regardless of if the click was swallowed.
- if (event.button == WebMouseEvent::BUTTON_RIGHT)
+ if (event.button == WebMouseEvent::ButtonRight)
MouseContextMenu(event);
#endif
}
@@ -512,9 +517,9 @@ void WebViewImpl::MouseWheel(const WebMouseWheelEvent& event) {
}
bool WebViewImpl::KeyEvent(const WebKeyboardEvent& event) {
- DCHECK((event.type == WebInputEvent::RAW_KEY_DOWN) ||
- (event.type == WebInputEvent::KEY_DOWN) ||
- (event.type == WebInputEvent::KEY_UP));
+ DCHECK((event.type == WebInputEvent::RawKeyDown) ||
+ (event.type == WebInputEvent::KeyDown) ||
+ (event.type == WebInputEvent::KeyUp));
// Please refer to the comments explaining the suppress_next_keypress_event_
// member.
@@ -538,9 +543,9 @@ bool WebViewImpl::KeyEvent(const WebKeyboardEvent& event) {
#if defined(OS_WIN)
// TODO(pinkerton): figure out these keycodes on non-windows
- if (((event.modifiers == 0) && (event.windows_key_code == VK_APPS)) ||
- ((event.modifiers == WebInputEvent::SHIFT_KEY) &&
- (event.windows_key_code == VK_F10))) {
+ if (((event.modifiers == 0) && (event.windowsKeyCode == VK_APPS)) ||
+ ((event.modifiers == WebInputEvent::ShiftKey) &&
+ (event.windowsKeyCode == VK_F10))) {
SendContextMenuEvent(event);
return true;
}
@@ -548,7 +553,7 @@ bool WebViewImpl::KeyEvent(const WebKeyboardEvent& event) {
MakePlatformKeyboardEvent evt(event);
- if (WebInputEvent::RAW_KEY_DOWN == event.type) {
+ if (WebInputEvent::RawKeyDown == event.type) {
if (handler->keyEvent(evt) && !evt.isSystemKey()) {
suppress_next_keypress_event_ = true;
return true;
@@ -565,14 +570,14 @@ bool WebViewImpl::KeyEvent(const WebKeyboardEvent& event) {
bool WebViewImpl::AutocompleteHandleKeyEvent(const WebKeyboardEvent& event) {
if (!autocomplete_popup_showing_ ||
// Home and End should be left to the text field to process.
- event.windows_key_code == base::VKEY_HOME ||
- event.windows_key_code == base::VKEY_END) {
+ event.windowsKeyCode == base::VKEY_HOME ||
+ event.windowsKeyCode == base::VKEY_END) {
return false;
}
// Pressing delete triggers the removal of the selected suggestion from the
// DB.
- if (event.windows_key_code == base::VKEY_DELETE &&
+ if (event.windowsKeyCode == base::VKEY_DELETE &&
autocomplete_popup_->selectedIndex() != -1) {
Node* node = GetFocusedNode();
if (!node || (node->nodeType() != WebCore::Node::ELEMENT_NODE)) {
@@ -599,14 +604,14 @@ bool WebViewImpl::AutocompleteHandleKeyEvent(const WebKeyboardEvent& event) {
return false;
}
- if (!autocomplete_popup_->isInterestedInEventForKey(event.windows_key_code))
+ if (!autocomplete_popup_->isInterestedInEventForKey(event.windowsKeyCode))
return false;
if (autocomplete_popup_->handleKeyEvent(MakePlatformKeyboardEvent(event))) {
#if defined(OS_WIN)
- // We need to ignore the next CHAR event after this otherwise pressing
+ // We need to ignore the next Char event after this otherwise pressing
// enter when selecting an item in the menu will go to the page.
- if (WebInputEvent::RAW_KEY_DOWN == event.type)
+ if (WebInputEvent::RawKeyDown == event.type)
suppress_next_keypress_event_ = true;
#endif
return true;
@@ -616,7 +621,7 @@ bool WebViewImpl::AutocompleteHandleKeyEvent(const WebKeyboardEvent& event) {
}
bool WebViewImpl::CharEvent(const WebKeyboardEvent& event) {
- DCHECK(event.type == WebInputEvent::CHAR);
+ DCHECK(event.type == WebInputEvent::Char);
// Please refer to the comments explaining the suppress_next_keypress_event_
// member.
@@ -716,10 +721,10 @@ bool WebViewImpl::SendContextMenuEvent(const WebKeyboardEvent& event) {
Frame* focused_frame = page()->focusController()->focusedOrMainFrame();
focused_frame->view()->setCursor(pointerCursor());
WebMouseEvent mouse_event;
- mouse_event.button = WebMouseEvent::BUTTON_RIGHT;
+ mouse_event.button = WebMouseEvent::ButtonRight;
mouse_event.x = coords.x();
mouse_event.y = coords.y();
- mouse_event.type = WebInputEvent::MOUSE_UP;
+ mouse_event.type = WebInputEvent::MouseUp;
MakePlatformMouseEvent platform_event(view, mouse_event);
@@ -737,9 +742,9 @@ bool WebViewImpl::KeyEventDefault(const WebKeyboardEvent& event) {
return false;
switch (event.type) {
- case WebInputEvent::CHAR: {
- if (event.windows_key_code == VKEY_SPACE) {
- int key_code = ((event.modifiers & WebInputEvent::SHIFT_KEY) ?
+ case WebInputEvent::Char: {
+ if (event.windowsKeyCode == VKEY_SPACE) {
+ int key_code = ((event.modifiers & WebInputEvent::ShiftKey) ?
VKEY_PRIOR : VKEY_NEXT);
return ScrollViewWithKeyboard(key_code);
}
@@ -747,12 +752,12 @@ bool WebViewImpl::KeyEventDefault(const WebKeyboardEvent& event) {
}
#if defined(OS_WIN)
- case WebInputEvent::RAW_KEY_DOWN: {
+ case WebInputEvent::RawKeyDown: {
#else
- case WebInputEvent::KEY_DOWN: {
+ case WebInputEvent::KeyDown: {
#endif
- if (event.modifiers == WebInputEvent::CTRL_KEY) {
- switch (event.windows_key_code) {
+ if (event.modifiers == WebInputEvent::ControlKey) {
+ switch (event.windowsKeyCode) {
case 'A':
GetFocusedFrame()->SelectAll();
return true;
@@ -771,8 +776,8 @@ bool WebViewImpl::KeyEventDefault(const WebKeyboardEvent& event) {
return false;
}
}
- if (!event.system_key) {
- return ScrollViewWithKeyboard(event.windows_key_code);
+ if (!event.isSystemKey) {
+ return ScrollViewWithKeyboard(event.windowsKeyCode);
}
break;
}
@@ -991,34 +996,34 @@ bool WebViewImpl::HandleInputEvent(const WebInputEvent* input_event) {
// processing methods. For now we'll assume it has processed them (as we are
// only interested in whether keyboard events are processed).
switch (input_event->type) {
- case WebInputEvent::MOUSE_MOVE:
+ case WebInputEvent::MouseMove:
MouseMove(*static_cast<const WebMouseEvent*>(input_event));
break;
- case WebInputEvent::MOUSE_LEAVE:
+ case WebInputEvent::MouseLeave:
MouseLeave(*static_cast<const WebMouseEvent*>(input_event));
break;
- case WebInputEvent::MOUSE_WHEEL:
+ case WebInputEvent::MouseWheel:
MouseWheel(*static_cast<const WebMouseWheelEvent*>(input_event));
break;
- case WebInputEvent::MOUSE_DOWN:
- case WebInputEvent::MOUSE_DOUBLE_CLICK:
+ case WebInputEvent::MouseDown:
+ case WebInputEvent::MouseDoubleClick:
MouseDown(*static_cast<const WebMouseEvent*>(input_event));
break;
- case WebInputEvent::MOUSE_UP:
+ case WebInputEvent::MouseUp:
MouseUp(*static_cast<const WebMouseEvent*>(input_event));
break;
- case WebInputEvent::RAW_KEY_DOWN:
- case WebInputEvent::KEY_DOWN:
- case WebInputEvent::KEY_UP:
+ case WebInputEvent::RawKeyDown:
+ case WebInputEvent::KeyDown:
+ case WebInputEvent::KeyUp:
handled = KeyEvent(*static_cast<const WebKeyboardEvent*>(input_event));
break;
- case WebInputEvent::CHAR:
+ case WebInputEvent::Char:
handled = CharEvent(*static_cast<const WebKeyboardEvent*>(input_event));
break;
default:
@@ -1302,14 +1307,14 @@ void WebViewImpl::SetInitialFocus(bool reverse) {
// Since we don't have a keyboard event, we'll create one.
WebKeyboardEvent keyboard_event;
- keyboard_event.type = WebInputEvent::RAW_KEY_DOWN;
+ keyboard_event.type = WebInputEvent::RawKeyDown;
if (reverse)
- keyboard_event.modifiers = WebInputEvent::SHIFT_KEY;
+ keyboard_event.modifiers = WebInputEvent::ShiftKey;
// VK_TAB which is only defined on Windows.
- keyboard_event.windows_key_code = 0x09;
+ keyboard_event.windowsKeyCode = 0x09;
MakePlatformKeyboardEvent platform_event(keyboard_event);
- RefPtr<KeyboardEvent> webkit_event = KeyboardEvent::create(platform_event,
- NULL);
+ RefPtr<KeyboardEvent> webkit_event =
+ KeyboardEvent::create(platform_event, NULL);
page()->focusController()->setInitialFocus(
reverse ? WebCore::FocusDirectionBackward :
WebCore::FocusDirectionForward,
diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h
index 4ac01fb..539e125 100644
--- a/webkit/glue/webview_impl.h
+++ b/webkit/glue/webview_impl.h
@@ -35,14 +35,17 @@ class Range;
class Widget;
}
+namespace WebKit {
+class WebKeyboardEvent;
+class WebMouseEvent;
+class WebMouseWheelEvent;
+}
+
class AutocompletePopupMenuClient;
class ImageResourceFetcher;
class SearchableFormData;
struct WebDropData;
class WebHistoryItemImpl;
-class WebKeyboardEvent;
-class WebMouseEvent;
-class WebMouseWheelEvent;
class WebDevToolsAgent;
class WebDevToolsAgentImpl;
class WebViewDelegate;
@@ -65,7 +68,7 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> {
virtual gfx::Size GetSize() { return size(); }
virtual void Layout();
virtual void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect);
- virtual bool HandleInputEvent(const WebInputEvent* input_event);
+ virtual bool HandleInputEvent(const WebKit::WebInputEvent* input_event);
virtual void MouseCaptureLost();
virtual void SetFocus(bool enable);
virtual void StoreFocusForFrame(WebFrame* frame);
@@ -148,15 +151,15 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> {
void ObserveNewNavigation();
// Event related methods:
- void MouseMove(const WebMouseEvent& mouse_event);
- void MouseLeave(const WebMouseEvent& mouse_event);
- void MouseDown(const WebMouseEvent& mouse_event);
- void MouseUp(const WebMouseEvent& mouse_event);
- void MouseContextMenu(const WebMouseEvent& mouse_event);
- void MouseDoubleClick(const WebMouseEvent& mouse_event);
- void MouseWheel(const WebMouseWheelEvent& wheel_event);
- bool KeyEvent(const WebKeyboardEvent& key_event);
- bool CharEvent(const WebKeyboardEvent& key_event);
+ void MouseMove(const WebKit::WebMouseEvent& mouse_event);
+ void MouseLeave(const WebKit::WebMouseEvent& mouse_event);
+ void MouseDown(const WebKit::WebMouseEvent& mouse_event);
+ void MouseUp(const WebKit::WebMouseEvent& mouse_event);
+ void MouseContextMenu(const WebKit::WebMouseEvent& mouse_event);
+ void MouseDoubleClick(const WebKit::WebMouseEvent& mouse_event);
+ void MouseWheel(const WebKit::WebMouseWheelEvent& wheel_event);
+ bool KeyEvent(const WebKit::WebKeyboardEvent& key_event);
+ bool CharEvent(const WebKit::WebKeyboardEvent& key_event);
// Handles context menu events orignated via the the keyboard. These
// include the VK_APPS virtual key and the Shift+F10 combine.
@@ -165,7 +168,7 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> {
// webkit\webkit\win\WebView.cpp. The only significant change in this
// function is the code to convert from a Keyboard event to the Right
// Mouse button down event.
- bool SendContextMenuEvent(const WebKeyboardEvent& event);
+ bool SendContextMenuEvent(const WebKit::WebKeyboardEvent& event);
// Releases references used to restore focus.
void ReleaseFocusReferences();
@@ -257,10 +260,10 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> {
private:
// Returns true if the event was actually processed.
- bool KeyEventDefault(const WebKeyboardEvent& event);
+ bool KeyEventDefault(const WebKit::WebKeyboardEvent& event);
// Returns true if the autocomple has consumed the event.
- bool AutocompleteHandleKeyEvent(const WebKeyboardEvent& event);
+ bool AutocompleteHandleKeyEvent(const WebKit::WebKeyboardEvent& event);
// Repaints the autofill popup. Should be called when the suggestions have
// changed. Note that this should only be called when the autofill popup is
@@ -338,11 +341,11 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> {
// WebKit to pass enough information up into ChromeClient::show() so we can
// decide if the window.open event was caused by a middle-mouse click
public:
- static const WebInputEvent* current_input_event() {
+ static const WebKit::WebInputEvent* current_input_event() {
return g_current_input_event;
}
private:
- static const WebInputEvent* g_current_input_event;
+ static const WebKit::WebInputEvent* g_current_input_event;
DISALLOW_COPY_AND_ASSIGN(WebViewImpl);
};
diff --git a/webkit/glue/webwidget.h b/webkit/glue/webwidget.h
index b1b011d..ed38375 100644
--- a/webkit/glue/webwidget.h
+++ b/webkit/glue/webwidget.h
@@ -13,7 +13,10 @@ class Rect;
class Size;
}
+namespace WebKit {
class WebInputEvent;
+}
+
class WebWidgetDelegate;
class WebWidget {
@@ -48,7 +51,7 @@ class WebWidget {
// Called to inform the WebWidget of an input event.
// Returns true if the event has been processed, false otherwise.
- virtual bool HandleInputEvent(const WebInputEvent* input_event) = 0;
+ virtual bool HandleInputEvent(const WebKit::WebInputEvent* input_event) = 0;
// Called to inform the WebWidget that mouse capture was lost.
virtual void MouseCaptureLost() = 0;
diff --git a/webkit/glue/webwidget_impl.cc b/webkit/glue/webwidget_impl.cc
index 52e5ed0..1ea7c1c 100644
--- a/webkit/glue/webwidget_impl.cc
+++ b/webkit/glue/webwidget_impl.cc
@@ -22,14 +22,19 @@ MSVC_POP_WARNING();
#include "base/gfx/rect.h"
#include "base/logging.h"
#include "skia/ext/platform_canvas.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
#include "webkit/glue/event_conversion.h"
#include "webkit/glue/glue_util.h"
-#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webwidget_delegate.h"
#include "webkit/glue/webwidget_impl.h"
using namespace WebCore;
+using WebKit::WebInputEvent;
+using WebKit::WebKeyboardEvent;
+using WebKit::WebMouseEvent;
+using WebKit::WebMouseWheelEvent;
+
// WebWidget ----------------------------------------------------------------
/*static*/
@@ -165,30 +170,30 @@ bool WebWidgetImpl::HandleInputEvent(const WebInputEvent* input_event) {
// methods. For now we'll assume it has processed them (as we are only
// interested in whether keyboard events are processed).
switch (input_event->type) {
- case WebInputEvent::MOUSE_MOVE:
+ case WebInputEvent::MouseMove:
MouseMove(*static_cast<const WebMouseEvent*>(input_event));
return true;
- case WebInputEvent::MOUSE_LEAVE:
+ case WebInputEvent::MouseLeave:
MouseLeave(*static_cast<const WebMouseEvent*>(input_event));
return true;
- case WebInputEvent::MOUSE_WHEEL:
+ case WebInputEvent::MouseWheel:
MouseWheel(*static_cast<const WebMouseWheelEvent*>(input_event));
return true;
- case WebInputEvent::MOUSE_DOWN:
- case WebInputEvent::MOUSE_DOUBLE_CLICK:
+ case WebInputEvent::MouseDown:
+ case WebInputEvent::MouseDoubleClick:
MouseDown(*static_cast<const WebMouseEvent*>(input_event));
return true;
- case WebInputEvent::MOUSE_UP:
+ case WebInputEvent::MouseUp:
MouseUp(*static_cast<const WebMouseEvent*>(input_event));
return true;
- case WebInputEvent::RAW_KEY_DOWN:
- case WebInputEvent::KEY_DOWN:
- case WebInputEvent::KEY_UP:
+ case WebInputEvent::RawKeyDown:
+ case WebInputEvent::KeyDown:
+ case WebInputEvent::KeyUp:
return KeyEvent(*static_cast<const WebKeyboardEvent*>(input_event));
default:
diff --git a/webkit/glue/webwidget_impl.h b/webkit/glue/webwidget_impl.h
index 83fc23b..5cf6cfe 100644
--- a/webkit/glue/webwidget_impl.h
+++ b/webkit/glue/webwidget_impl.h
@@ -16,19 +16,22 @@
#include "FramelessScrollViewClient.h"
namespace WebCore {
- class Frame;
- class FramelessScrollView;
- class KeyboardEvent;
- class Page;
- class PlatformKeyboardEvent;
- class Range;
- class Widget;
+class Frame;
+class FramelessScrollView;
+class KeyboardEvent;
+class Page;
+class PlatformKeyboardEvent;
+class Range;
+class Widget;
}
-struct MenuItem;
+namespace WebKit {
class WebKeyboardEvent;
class WebMouseEvent;
class WebMouseWheelEvent;
+}
+
+struct MenuItem;
class WebWidgetDelegate;
class WebWidgetImpl : public WebWidget,
@@ -41,7 +44,7 @@ class WebWidgetImpl : public WebWidget,
virtual gfx::Size GetSize() { return size(); }
virtual void Layout();
virtual void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect);
- virtual bool HandleInputEvent(const WebInputEvent* input_event);
+ virtual bool HandleInputEvent(const WebKit::WebInputEvent* input_event);
virtual void MouseCaptureLost();
virtual void SetFocus(bool enable);
virtual bool ImeSetComposition(int string_type,
@@ -67,13 +70,13 @@ class WebWidgetImpl : public WebWidget,
return delegate_;
}
- void MouseMove(const WebMouseEvent& mouse_event);
- void MouseLeave(const WebMouseEvent& mouse_event);
- void MouseDown(const WebMouseEvent& mouse_event);
- void MouseUp(const WebMouseEvent& mouse_event);
- void MouseDoubleClick(const WebMouseEvent& mouse_event);
- void MouseWheel(const WebMouseWheelEvent& wheel_event);
- bool KeyEvent(const WebKeyboardEvent& key_event);
+ void MouseMove(const WebKit::WebMouseEvent& mouse_event);
+ void MouseLeave(const WebKit::WebMouseEvent& mouse_event);
+ void MouseDown(const WebKit::WebMouseEvent& mouse_event);
+ void MouseUp(const WebKit::WebMouseEvent& mouse_event);
+ void MouseDoubleClick(const WebKit::WebMouseEvent& mouse_event);
+ void MouseWheel(const WebKit::WebMouseWheelEvent& wheel_event);
+ bool KeyEvent(const WebKit::WebKeyboardEvent& key_event);
protected:
friend class WebWidget; // So WebWidget::Create can call our constructor
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);
}
diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp
index 22d9647..ce5be61 100644
--- a/webkit/webkit.gyp
+++ b/webkit/webkit.gyp
@@ -4091,6 +4091,7 @@
],
'include_dirs': [
'../third_party/WebKit/WebKit/chromium/public',
+ '../third_party/WebKit/WebKit/chromium/src',
],
'defines': [
'WEBKIT_IMPLEMENTATION',
@@ -4113,6 +4114,8 @@
'../third_party/WebKit/WebKit/chromium/src/ChromiumBridge.cpp',
'../third_party/WebKit/WebKit/chromium/src/ChromiumCurrentTime.cpp',
'../third_party/WebKit/WebKit/chromium/src/ChromiumThreading.cpp',
+ '../third_party/WebKit/WebKit/chromium/src/KeyIdentifier.cpp',
+ '../third_party/WebKit/WebKit/chromium/src/KeyIdentifier.h',
'../third_party/WebKit/WebKit/chromium/src/WebCache.cpp',
'../third_party/WebKit/WebKit/chromium/src/WebCString.cpp',
'../third_party/WebKit/WebKit/chromium/src/WebImageSkia.cpp',
@@ -4125,16 +4128,32 @@
'dependencies': [
'../build/linux/system.gyp:gtk',
],
+ 'include_dirs': [
+ '../third_party/WebKit/WebKit/chromium/public/gdk',
+ ],
+ 'sources': [
+ '../third_party/WebKit/WebKit/chromium/src/gdk/WebInputEventFactory.cpp',
+ ],
}],
['OS=="mac"', {
+ 'include_dirs': [
+ '../third_party/WebKit/WebKit/chromium/public/mac',
+ ],
+ 'sources': [
+ '../third_party/WebKit/WebKit/chromium/src/mac/WebInputEventFactory.mm',
+ ],
'sources!': [
'../third_party/WebKit/WebKit/chromium/src/WebImageSkia.cpp',
],
}],
['OS=="win"', {
+ 'include_dirs': [
+ '../third_party/WebKit/WebKit/chromium/public/win',
+ ],
'sources': [
'../third_party/WebKit/WebKit/chromium/public/win/WebSandboxSupport.h',
'../third_party/WebKit/WebKit/chromium/public/win/WebThemeEngine.h',
+ '../third_party/WebKit/WebKit/chromium/src/win/WebInputEventFactory.cpp',
],
}],
],
@@ -4362,12 +4381,6 @@
'glue/webhistoryitem.h',
'glue/webhistoryitem_impl.cc',
'glue/webhistoryitem_impl.h',
- 'glue/webinputevent.h',
- 'glue/webinputevent_linux.cc',
- 'glue/webinputevent_mac.mm',
- 'glue/webinputevent_util.cc',
- 'glue/webinputevent_util.h',
- 'glue/webinputevent_win.cc',
'glue/webkit_glue.cc',
'glue/webkit_glue.h',
'glue/webkit_glue_gtk.cc',