LayoutTests:
authoraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Oct 2006 00:11:57 +0000 (00:11 +0000)
committeraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Oct 2006 00:11:57 +0000 (00:11 +0000)
        Reviewed by Brady.

        New test to make sure we're generating the correct keycodes for Tab
        and Shift-Tab keypresses.

        * fast/events/js-keyboard-event-creation-expected.txt: Added.
        * fast/events/js-keyboard-event-creation.html: Added.

WebCore:

        Reviewed by Brady.

        Change Shift-Tab to generate keyIdentifier U+000009 (Tab) instead of
        U+000019 (Backtab). This matches our windowsKeyCode for this key
        combination.

        * platform/mac/KeyEventMac.mm:
        (WebCore::keyIdentifierForKeyEvent):

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

LayoutTests/ChangeLog
LayoutTests/fast/events/js-keyboard-event-creation-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/js-keyboard-event-creation.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/mac/KeyEventMac.mm

index 5aa8ac8e8866717700c6b24c2d16b39ba5d74a01..e49783b6b1a98a39cc56f2df172026a2580f82c5 100644 (file)
@@ -1,3 +1,13 @@
+2006-10-18  Adam Roben  <aroben@apple.com>
+
+        Reviewed by Brady.
+
+        New test to make sure we're generating the correct keycodes for Tab
+        and Shift-Tab keypresses.
+
+        * fast/events/js-keyboard-event-creation-expected.txt: Added.
+        * fast/events/js-keyboard-event-creation.html: Added.
+
 2006-10-18  Adam Roben  <aroben@apple.com>
 
         Reviewed by Brady.
diff --git a/LayoutTests/fast/events/js-keyboard-event-creation-expected.txt b/LayoutTests/fast/events/js-keyboard-event-creation-expected.txt
new file mode 100644 (file)
index 0000000..9bb0dbe
--- /dev/null
@@ -0,0 +1,17 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+
+This tests that DOMKeyboardEvents are created correctly in the JavaScript API.
+
+keydown - key: U+000009@0 (keyCode/charCode: 9/9) modifiers: false,false,false,false
+
+keypress - key: U+000009@0 (keyCode/charCode: 9/9) modifiers: false,false,false,false
+
+keydown - key: U+000009@0 (keyCode/charCode: 9/9) modifiers: false,false,true,false
+
+keypress - key: U+000009@0 (keyCode/charCode: 9/9) modifiers: false,false,true,false
+
+
diff --git a/LayoutTests/fast/events/js-keyboard-event-creation.html b/LayoutTests/fast/events/js-keyboard-event-creation.html
new file mode 100644 (file)
index 0000000..92a956e
--- /dev/null
@@ -0,0 +1,37 @@
+<html>
+<head>
+<script>
+
+function keyevent(event) {
+    var p = document.createElement("p");
+    p.appendChild(document.createTextNode(event.type + " - key: " + event.keyIdentifier + "@" + event.keyLocation + " (keyCode/charCode: " + event.keyCode + "/" + event.charCode + ")" + " modifiers: " + event.ctrlKey + "," + event.altKey + "," + event.shiftKey + "," + event.metaKey));
+    document.getElementById("result").appendChild(p);
+}
+
+function init() {
+    var input = document.getElementById("testinput");
+    input.addEventListener("keydown", keyevent, true);
+    input.addEventListener("keypress", keyevent, true);
+    input.addEventListener("keyup", keyevent, true);
+   
+    if (layoutTestController)
+        layoutTestController.dumpAsText();
+    
+    input.focus();
+    if (eventSender) {
+        eventSender.keyDown("\t");
+        eventSender.keyDown("\t", new Array("shiftKey"));
+    }
+}
+</script>
+</head>
+<body onload="init()">
+    <form>
+        <input type="text" size="50" id="testinput" />
+    </form>
+   
+    <p>This tests that DOMKeyboardEvents are created correctly in the JavaScript API.</p>
+   
+    <div id="result"></div>
+</body>
+</html>
index 2fc053f0dc7e667fe643665be1feb6e4bcef56bd..51b669e07fbc1738a232c91a18432c4a7f9b8d58 100644 (file)
@@ -1,3 +1,14 @@
+2006-10-18  Adam Roben  <aroben@apple.com>
+
+        Reviewed by Brady.
+
+        Change Shift-Tab to generate keyIdentifier U+000009 (Tab) instead of
+        U+000019 (Backtab). This matches our windowsKeyCode for this key
+        combination.
+
+        * platform/mac/KeyEventMac.mm:
+        (WebCore::keyIdentifierForKeyEvent):
+
 2006-10-18  Steve Falkenburg  <sfalken@apple.com>
 
         Reviewed by Adam, Brady.
index 855487f37883c39d3aa3f2f061392a2fdbc4a892..70af370b53816eea444539b8bbe96076ffe6505c 100644 (file)
@@ -299,6 +299,10 @@ static String keyIdentifierForKeyEvent(NSEvent* event)
         // Standard says that DEL becomes U+00007F.
         case NSDeleteFunctionKey:
             return "U+00007F";
+            
+        // Always use 0x09 for tab instead of AppKit's backtab character.
+        case NSBackTabCharacter:
+            return "U+000009";
 
         case NSBeginFunctionKey:
         case NSBreakFunctionKey: