Reviewed by Maciej.
authorap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Dec 2007 09:07:58 +0000 (09:07 +0000)
committerap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Dec 2007 09:07:58 +0000 (09:07 +0000)
        http://bugs.webkit.org/show_bug.cgi?id=16436
        Alt+Space works incorrectly

        Test: platform/win/fast/events/alt-space-scroll.html

        * WebView.cpp:
        (WebView::keyDown):
        (WebView::keyPress):
        We do not handle WM_SYSCHAR events.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28746 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/win/fast/events/alt-space-scroll-expected.txt [new file with mode: 0644]
LayoutTests/platform/win/fast/events/alt-space-scroll.html [new file with mode: 0644]
WebKit/win/ChangeLog
WebKit/win/WebView.cpp

index cd2e5ce79d04fe5402032c10786bf5102fecc91c..574338c410939708d1dabe5b05fe2895fb987bb6 100644 (file)
@@ -1,3 +1,13 @@
+2007-12-15  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Maciej.
+
+        http://bugs.webkit.org/show_bug.cgi?id=16436
+        Alt+Space works incorrectly
+
+        * platform/win/fast/events/alt-space-scroll-expected.txt: Added.
+        * platform/win/fast/events/alt-space-scroll.html: Added.
+
 2007-12-14  Dan Bernstein  <mitz@apple.com>
 
         - share the results of this test between Tiger and Leopard
diff --git a/LayoutTests/platform/win/fast/events/alt-space-scroll-expected.txt b/LayoutTests/platform/win/fast/events/alt-space-scroll-expected.txt
new file mode 100644 (file)
index 0000000..88e4630
--- /dev/null
@@ -0,0 +1,11 @@
+Test that Alt+Space works correctly.
+
+To test manually, press Alt+Space - a menu for resizing the window should appear; the window should not be scrolled.
+
+Also, press other Alt-key combinations, and verify that keypress event is not dispatched.
+
+target - type - ctrlKey,altKey,shiftKey,metaKey - keyIdentifier - keyCode - charCode
+BODY - keydown - false,false,false,false - Alt - 18 - 0
+BODY - keydown - false,false,false,false - U+0020 - 32 - 0
+BODY - keydown - false,false,false,false - U+0058 - 88 - 0
+
diff --git a/LayoutTests/platform/win/fast/events/alt-space-scroll.html b/LayoutTests/platform/win/fast/events/alt-space-scroll.html
new file mode 100644 (file)
index 0000000..0a17397
--- /dev/null
@@ -0,0 +1,48 @@
+<body onkeypress="log(eventInfo(event))" onkeydown="log(eventInfo(event));">
+<p>Test that Alt+Space works correctly.</p>
+<p>To test manually, press Alt+Space - a menu for resizing the window should appear;
+the window should not be scrolled.</p>
+<p>Also, press other Alt-key combinations, and verify that keypress event is not dispatched.</p>
+<div id="log"></div>
+<div style="width:1;height:1000"></div>
+<script>
+function log(msg) {
+   document.getElementById("log").innerHTML+= msg + "<br />";
+}
+
+
+function eventInfo(event, where) {
+  try {
+  if (!event)
+    event = window.event;
+    target = event.srcElement ? event.srcElement : event.target;
+    if (event.type == "keydown" || event.type == "keypress" || event.type == "keyup") 
+        return (where ? "(" + where + ") " : "") + target.tagName
+            + (target.tagName == "INPUT" ? " " + target.type : "")
+            + " - " + event.type
+            + ' - ' + [event.ctrlKey, event.altKey, event.shiftKey, event.metaKey]
+            + ' - ' + event.keyIdentifier
+            + ' - ' + event.keyCode
+            + ' - ' + event.charCode;
+    } catch (ex) {
+        alert(ex);
+    }
+}
+log("target - type - " + ["ctrlKey", "altKey", "shiftKey", "metaKey"]
+        + ' - ' + "keyIdentifier"
+        + ' - ' + "keyCode"
+        + ' - ' + "charCode");
+
+if (window.layoutTestController) {
+
+    layoutTestController.dumpAsText();
+    eventSender.dispatchMessage(eventSender.WM_SYSKEYDOWN, 0x12 /* Alt */, 0x20380001);
+    eventSender.dispatchMessage(eventSender.WM_SYSKEYDOWN, 0x20 /* Space */, 0x20390001);
+    eventSender.dispatchMessage(eventSender.WM_SYSCHAR, 0x20 /* Space */, 0x20390001);
+    eventSender.dispatchMessage(eventSender.WM_SYSKEYDOWN, 0x58 /* X */, 0x202d0001);
+    eventSender.dispatchMessage(eventSender.WM_SYSCHAR, 0x78 /* x */, 0x202d0001);
+}
+
+</script>
+
+</body>
index f4fe2c053d870bbecfa778ea7343029e5505a563..1696f23f3c1c33c267958fbaf63cf5cb566d4c59 100644 (file)
@@ -1,3 +1,17 @@
+2007-12-15  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Maciej.
+
+        http://bugs.webkit.org/show_bug.cgi?id=16436
+        Alt+Space works incorrectly
+
+        Test: platform/win/fast/events/alt-space-scroll.html
+
+        * WebView.cpp:
+        (WebView::keyDown):
+        (WebView::keyPress):
+        We do not handle WM_SYSCHAR events.
+
 2007-12-14  Dan Bernstein  <mitz@apple.com>
 
         - yet another build fix
index 812982132dfe77c1eefed727490d17324073a62a..b79c2601cbd4268aef34773d44a0eb00051da6b1 100644 (file)
@@ -1416,10 +1416,10 @@ bool WebView::keyDown(WPARAM virtualKeyCode, LPARAM keyData, bool systemKeyDown)
     PlatformKeyboardEvent keyEvent(m_viewWindow, virtualKeyCode, keyData, PlatformKeyboardEvent::RawKeyDown, systemKeyDown);
     bool handled = frame->eventHandler()->keyEvent(keyEvent);
 
-    // These events cannot be canceled.
+    // These events cannot be canceled, and we have no default handling for them.
     // FIXME: match IE list more closely, see <http://msdn2.microsoft.com/en-us/library/ms536938.aspx>.
     if (systemKeyDown)
-        handled = false;
+        return false;
 
     if (handled) {
         // FIXME: remove WM_UNICHAR, too
@@ -1483,6 +1483,10 @@ bool WebView::keyDown(WPARAM virtualKeyCode, LPARAM keyData, bool systemKeyDown)
 
 bool WebView::keyPress(WPARAM charCode, LPARAM keyData, bool systemKeyDown)
 {
+    // IE does not dispatch keypress event for WM_SYSCHAR.
+    if (systemKeyDown)
+        return false;
+
     Frame* frame = m_page->focusController()->focusedOrMainFrame();
 
     PlatformKeyboardEvent keyEvent(m_viewWindow, charCode, keyData, PlatformKeyboardEvent::Char, systemKeyDown);