summaryrefslogtreecommitdiff
path: root/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-09-10 19:10:20 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-09-10 19:10:20 +0200
commit284837daa07b29d6a63a748544a90b1f5842ac5c (patch)
treeecd258180bde91fe741e0cfd2638beb3c6da7e8e /Source/WebKit/chromium/src/win/WebInputEventFactory.cpp
parent2e2ba8ff45915f40ed3e014101269c175f2a89a0 (diff)
downloadqtwebkit-284837daa07b29d6a63a748544a90b1f5842ac5c.tar.gz
Imported WebKit commit 68645295d2e3e09af2c942f092556f06aa5f8b0d (http://svn.webkit.org/repository/webkit/trunk@128073)
New snapshot
Diffstat (limited to 'Source/WebKit/chromium/src/win/WebInputEventFactory.cpp')
-rw-r--r--Source/WebKit/chromium/src/win/WebInputEventFactory.cpp54
1 files changed, 44 insertions, 10 deletions
diff --git a/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp b/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp
index 9da4b4a27..a177ea244 100644
--- a/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp
+++ b/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp
@@ -42,12 +42,18 @@ static const unsigned long defaultScrollCharsPerWheelDelta = 1;
// WebKeyboardEvent -----------------------------------------------------------
-static bool isKeyPad(WPARAM wparam, LPARAM lparam)
+static bool isKeyDown(WPARAM wparam)
{
- bool keypad = false;
+ return GetKeyState(wparam) & 0x8000;
+}
+
+static int getLocationModifier(WPARAM wparam, LPARAM lparam)
+{
+ int modifier = 0;
switch (wparam) {
case VK_RETURN:
- keypad = (lparam >> 16) & KF_EXTENDED;
+ if ((lparam >> 16) & KF_EXTENDED)
+ modifier = WebInputEvent::IsKeyPad;
break;
case VK_INSERT:
case VK_DELETE:
@@ -59,7 +65,8 @@ static bool isKeyPad(WPARAM wparam, LPARAM lparam)
case VK_DOWN:
case VK_LEFT:
case VK_RIGHT:
- keypad = !((lparam >> 16) & KF_EXTENDED);
+ if (!((lparam >> 16) & KF_EXTENDED))
+ modifier = WebInputEvent::IsKeyPad;
break;
case VK_NUMLOCK:
case VK_NUMPAD0:
@@ -78,12 +85,39 @@ static bool isKeyPad(WPARAM wparam, LPARAM lparam)
case VK_ADD:
case VK_DECIMAL:
case VK_CLEAR:
- keypad = true;
+ modifier = WebInputEvent::IsKeyPad;
+ break;
+ case VK_SHIFT:
+ if (isKeyDown(VK_LSHIFT))
+ modifier = WebInputEvent::IsLeft;
+ else if (isKeyDown(VK_RSHIFT))
+ modifier = WebInputEvent::IsRight;
+ break;
+ case VK_CONTROL:
+ if (isKeyDown(VK_LCONTROL))
+ modifier = WebInputEvent::IsLeft;
+ else if (isKeyDown(VK_RCONTROL))
+ modifier = WebInputEvent::IsRight;
+ break;
+ case VK_MENU:
+ if (isKeyDown(VK_LMENU))
+ modifier = WebInputEvent::IsLeft;
+ else if (isKeyDown(VK_RMENU))
+ modifier = WebInputEvent::IsRight;
+ break;
+ case VK_LWIN:
+ modifier = WebInputEvent::IsLeft;
+ break;
+ case VK_RWIN:
+ modifier = WebInputEvent::IsRight;
break;
- default:
- keypad = false;
}
- return keypad;
+
+ ASSERT(!modifier
+ || modifier == WebInputEvent::IsKeyPad
+ || modifier == WebInputEvent::IsLeft
+ || modifier == WebInputEvent::IsRight);
+ return modifier;
}
// Loads the state for toggle keys into the event.
@@ -153,8 +187,8 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(HWND hwnd, UINT message,
if (LOWORD(lparam) > 1)
result.modifiers |= WebInputEvent::IsAutoRepeat;
- if (isKeyPad(wparam, lparam))
- result.modifiers |= WebInputEvent::IsKeyPad;
+
+ result.modifiers |= getLocationModifier(wparam, lparam);
SetToggleKeyState(&result);
return result;