Title: [121397] trunk/Source/WebKit/chromium
- Revision
- 121397
- Author
- commit-qu...@webkit.org
- Date
- 2012-06-27 19:06:13 -0700 (Wed, 27 Jun 2012)
Log Message
[chromium] Improve keyboardEvent() so a web page could receive a DOM3 spec compliant keyboard event.
https://bugs.webkit.org/show_bug.cgi?id=89637
Patch by Yusuke Sato <yusu...@chromium.org> on 2012-06-27
Reviewed by Tony Chang.
This is a Gtk port of http://crrev.com/142209.
Normalizes event->state to make it Windows/Mac compatible. Since the
way of setting modifier mask on X is very different than Windows/Mac
as shown in http://crbug.com/127142#c8, the normalization is necessary.
* src/gtk/WebInputEventFactory.cpp:
(WebKit):
(WebKit::normalizeEventState):
(WebKit::WebInputEventFactory::keyboardEvent):
Modified Paths
Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (121396 => 121397)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-06-28 02:03:24 UTC (rev 121396)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-06-28 02:06:13 UTC (rev 121397)
@@ -1,3 +1,21 @@
+2012-06-27 Yusuke Sato <yusu...@chromium.org>
+
+ [chromium] Improve keyboardEvent() so a web page could receive a DOM3 spec compliant keyboard event.
+ https://bugs.webkit.org/show_bug.cgi?id=89637
+
+ Reviewed by Tony Chang.
+
+ This is a Gtk port of http://crrev.com/142209.
+
+ Normalizes event->state to make it Windows/Mac compatible. Since the
+ way of setting modifier mask on X is very different than Windows/Mac
+ as shown in http://crbug.com/127142#c8, the normalization is necessary.
+
+ * src/gtk/WebInputEventFactory.cpp:
+ (WebKit):
+ (WebKit::normalizeEventState):
+ (WebKit::WebInputEventFactory::keyboardEvent):
+
2012-06-27 James Robinson <jam...@chromium.org>
[chromium] Use SkColor in compositor internals
Modified: trunk/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp (121396 => 121397)
--- trunk/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp 2012-06-28 02:03:24 UTC (rev 121396)
+++ trunk/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp 2012-06-28 02:06:13 UTC (rev 121397)
@@ -272,6 +272,39 @@
return WebCore::windowsKeyCodeForKeyEvent(event->keyval);
}
+// Normalizes event->state to make it Windows/Mac compatible. Since the way
+// of setting modifier mask on X is very different than Windows/Mac as shown
+// in http://crbug.com/127142#c8, the normalization is necessary.
+static guint normalizeEventState(const GdkEventKey* event)
+{
+ guint mask = 0;
+ switch (gdkEventToWindowsKeyCode(event)) {
+ case WebCore::VKEY_CONTROL:
+ case WebCore::VKEY_LCONTROL:
+ case WebCore::VKEY_RCONTROL:
+ mask = GDK_CONTROL_MASK;
+ break;
+ case WebCore::VKEY_SHIFT:
+ case WebCore::VKEY_LSHIFT:
+ case WebCore::VKEY_RSHIFT:
+ mask = GDK_SHIFT_MASK;
+ break;
+ case WebCore::VKEY_MENU:
+ case WebCore::VKEY_LMENU:
+ case WebCore::VKEY_RMENU:
+ mask = GDK_MOD1_MASK;
+ break;
+ case WebCore::VKEY_CAPITAL:
+ mask = GDK_LOCK_MASK;
+ break;
+ default:
+ return event->state;
+ }
+ if (event->type == GDK_KEY_PRESS)
+ return event->state | mask;
+ return event->state & ~mask;
+}
+
// Gets the corresponding control character of a specified key code. See:
// http://en.wikipedia.org/wiki/Control_characters
// We emulate Windows behavior here.
@@ -325,7 +358,7 @@
WebKeyboardEvent result;
result.timeStampSeconds = gdkEventTimeToWebEventTime(event->time);
- result.modifiers = gdkStateToWebEventModifiers(event->state);
+ result.modifiers = gdkStateToWebEventModifiers(normalizeEventState(event));
switch (event->type) {
case GDK_KEY_RELEASE:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes