summaryrefslogtreecommitdiff
path: root/Source/WebKit2/Shared/WebKeyboardEvent.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebKit2/Shared/WebKeyboardEvent.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebKit2/Shared/WebKeyboardEvent.cpp')
-rw-r--r--Source/WebKit2/Shared/WebKeyboardEvent.cpp110
1 files changed, 108 insertions, 2 deletions
diff --git a/Source/WebKit2/Shared/WebKeyboardEvent.cpp b/Source/WebKit2/Shared/WebKeyboardEvent.cpp
index 8aef309e3..eb4771fda 100644
--- a/Source/WebKit2/Shared/WebKeyboardEvent.cpp
+++ b/Source/WebKit2/Shared/WebKeyboardEvent.cpp
@@ -27,9 +27,85 @@
#include "WebEvent.h"
#include "WebCoreArgumentCoders.h"
+#include <WebCore/KeypressCommand.h>
namespace WebKit {
+WebKeyboardEvent::WebKeyboardEvent()
+{
+}
+
+#if USE(APPKIT)
+
+WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, double timestamp)
+ : WebEvent(type, modifiers, timestamp)
+ , m_text(text)
+ , m_unmodifiedText(unmodifiedText)
+#if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
+ , m_key(key)
+#endif
+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+ , m_code(code)
+#endif
+ , m_keyIdentifier(keyIdentifier)
+ , m_windowsVirtualKeyCode(windowsVirtualKeyCode)
+ , m_nativeVirtualKeyCode(nativeVirtualKeyCode)
+ , m_macCharCode(macCharCode)
+ , m_handledByInputMethod(handledByInputMethod)
+ , m_commands(commands)
+ , m_isAutoRepeat(isAutoRepeat)
+ , m_isKeypad(isKeypad)
+ , m_isSystemKey(isSystemKey)
+{
+ ASSERT(isKeyboardEventType(type));
+}
+
+#elif PLATFORM(GTK)
+
+WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool handledByInputMethod, Vector<String>&& commands, bool isKeypad, Modifiers modifiers, double timestamp)
+ : WebEvent(type, modifiers, timestamp)
+ , m_text(text)
+ , m_unmodifiedText(text)
+ , m_key(key)
+ , m_code(code)
+ , m_keyIdentifier(keyIdentifier)
+ , m_windowsVirtualKeyCode(windowsVirtualKeyCode)
+ , m_nativeVirtualKeyCode(nativeVirtualKeyCode)
+ , m_macCharCode(0)
+ , m_handledByInputMethod(handledByInputMethod)
+ , m_commands(WTFMove(commands))
+ , m_isAutoRepeat(false)
+ , m_isKeypad(isKeypad)
+ , m_isSystemKey(false)
+{
+ ASSERT(isKeyboardEventType(type));
+}
+
+#elif PLATFORM(IOS)
+
+WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, double timestamp)
+ : WebEvent(type, modifiers, timestamp)
+ , m_text(text)
+ , m_unmodifiedText(unmodifiedText)
+#if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
+ , m_key(key)
+#endif
+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+ , m_code(code)
+#endif
+ , m_keyIdentifier(keyIdentifier)
+ , m_windowsVirtualKeyCode(windowsVirtualKeyCode)
+ , m_nativeVirtualKeyCode(nativeVirtualKeyCode)
+ , m_macCharCode(macCharCode)
+ , m_isAutoRepeat(isAutoRepeat)
+ , m_isKeypad(isKeypad)
+ , m_isSystemKey(isSystemKey)
+{
+ ASSERT(isKeyboardEventType(type));
+}
+
+#else
+
WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, double timestamp)
: WebEvent(type, modifiers, timestamp)
, m_text(text)
@@ -45,22 +121,38 @@ WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String&
ASSERT(isKeyboardEventType(type));
}
-void WebKeyboardEvent::encode(IPC::ArgumentEncoder& encoder) const
+#endif
+
+WebKeyboardEvent::~WebKeyboardEvent()
+{
+}
+
+void WebKeyboardEvent::encode(IPC::Encoder& encoder) const
{
WebEvent::encode(encoder);
encoder << m_text;
encoder << m_unmodifiedText;
+#if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
+ encoder << m_key;
+#endif
+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+ encoder << m_code;
+#endif
encoder << m_keyIdentifier;
encoder << m_windowsVirtualKeyCode;
encoder << m_nativeVirtualKeyCode;
encoder << m_macCharCode;
+#if USE(APPKIT) || PLATFORM(GTK)
+ encoder << m_handledByInputMethod;
+ encoder << m_commands;
+#endif
encoder << m_isAutoRepeat;
encoder << m_isKeypad;
encoder << m_isSystemKey;
}
-bool WebKeyboardEvent::decode(IPC::ArgumentDecoder& decoder, WebKeyboardEvent& result)
+bool WebKeyboardEvent::decode(IPC::Decoder& decoder, WebKeyboardEvent& result)
{
if (!WebEvent::decode(decoder, result))
return false;
@@ -69,6 +161,14 @@ bool WebKeyboardEvent::decode(IPC::ArgumentDecoder& decoder, WebKeyboardEvent& r
return false;
if (!decoder.decode(result.m_unmodifiedText))
return false;
+#if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
+ if (!decoder.decode(result.m_key))
+ return false;
+#endif
+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+ if (!decoder.decode(result.m_code))
+ return false;
+#endif
if (!decoder.decode(result.m_keyIdentifier))
return false;
if (!decoder.decode(result.m_windowsVirtualKeyCode))
@@ -77,6 +177,12 @@ bool WebKeyboardEvent::decode(IPC::ArgumentDecoder& decoder, WebKeyboardEvent& r
return false;
if (!decoder.decode(result.m_macCharCode))
return false;
+#if USE(APPKIT) || PLATFORM(GTK)
+ if (!decoder.decode(result.m_handledByInputMethod))
+ return false;
+ if (!decoder.decode(result.m_commands))
+ return false;
+#endif
if (!decoder.decode(result.m_isAutoRepeat))
return false;
if (!decoder.decode(result.m_isKeypad))