WebKitTools:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Oct 2007 17:29:25 +0000 (17:29 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Oct 2007 17:29:25 +0000 (17:29 +0000)
        Reviewed by Tim Hatcher.

        - http://bugs.webkit.org/show_bug.cgi?id=15544
          <rdar://problem/5076426> fast/events/arrow-navigation.html needs to
          not rely on Apple-specific key codes

        * DumpRenderTree/mac/EventSendingController.mm:
        (-[EventSendingController keyDown:withModifiers:]):
        Added named key "rightArrow". Later we could have a whole table of these.
        Also tweaked modifiers code a little.

        * DumpRenderTree/win/EventSender.cpp: (keyDownCallback): Ditto.

LayoutTests:

        Reviewed by Tim Hatcher.

        - http://bugs.webkit.org/show_bug.cgi?id=15544
          <rdar://problem/5076426> fast/events/arrow-navigation.html needs to
          not rely on Apple-specific key codes

        * fast/events/arrow-navigation.html: Use "rightArrow" instead.

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

LayoutTests/ChangeLog
LayoutTests/fast/events/arrow-navigation.html
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/mac/EventSendingController.mm
WebKitTools/DumpRenderTree/win/EventSender.cpp

index 409ec4baa5d647aad89d28e6465d7142c3bae53b..702ba5d26c614fdc59564b62208604a8a099f364 100644 (file)
@@ -1,3 +1,13 @@
+2007-10-20  Darin Adler  <darin@apple.com>
+
+        Reviewed by Tim Hatcher.
+
+        - http://bugs.webkit.org/show_bug.cgi?id=15544
+          <rdar://problem/5076426> fast/events/arrow-navigation.html needs to
+          not rely on Apple-specific key codes
+
+        * fast/events/arrow-navigation.html: Use "rightArrow" instead.
+
 2007-10-20  Nikolas Zimmermann  <zimmermann@kde.org>
 
         Reviewed by Eric.
index 53d8690bd1dc47d99c706e6f7e1a649b3480978a..ee3c297e61e1f03aac1d5aa54ce15f91fb682564 100644 (file)
@@ -8,7 +8,7 @@
                 tf.setSelectionRange(0, 0);
                 if (window.layoutTestController) {
                     layoutTestController.dumpAsText();
-                    eventSender.keyDown(String.fromCharCode(0xf703));
+                    eventSender.keyDown("rightArrow");
                 }
                 if (tf.selectionStart == 1)
                     log("Test Passed");
index 1eeda3849f1bbb665e65ff470213a61e2df16f33..4fd600f7b6c7385d181b29313b289bc121539310 100644 (file)
@@ -1,3 +1,18 @@
+2007-10-20  Darin Adler  <darin@apple.com>
+
+        Reviewed by Tim Hatcher.
+
+        - http://bugs.webkit.org/show_bug.cgi?id=15544
+          <rdar://problem/5076426> fast/events/arrow-navigation.html needs to
+          not rely on Apple-specific key codes
+
+        * DumpRenderTree/mac/EventSendingController.mm:
+        (-[EventSendingController keyDown:withModifiers:]):
+        Added named key "rightArrow". Later we could have a whole table of these.
+        Also tweaked modifiers code a little.
+
+        * DumpRenderTree/win/EventSender.cpp: (keyDownCallback): Ditto.
+
 2007-10-19  Darin Adler  <darin@apple.com>
 
         Reviewed by Eric.
index 015fa32254fc78e8f27f73b2b5f5fc22144bdffb..5ba2cd5f3549552d412bcec60e430c4ebf92b813 100644 (file)
@@ -349,12 +349,16 @@ BOOL replayingSavedEvents;
 
 - (void)keyDown:(NSString *)character withModifiers:(WebScriptObject *)modifiers
 {
-    NSString *modifier = nil;
+    NSString *eventCharacter = character;
+    if ([character isEqualToString:@"rightArrow"]) {
+        const unichar rightArrowCharacter = NSRightArrowFunctionKey;
+        eventCharacter = [NSString stringWithCharacters:&rightArrowCharacter length:1];
+    }
+
     int mask = 0;
-    
     if ([modifiers isKindOfClass:[WebScriptObject class]])
         for (unsigned i = 0; [[modifiers webScriptValueAtIndex:i] isKindOfClass:[NSString class]]; i++) {
-            modifier = (NSString *)[modifiers webScriptValueAtIndex:i];
+            NSString *modifier = (NSString *)[modifiers webScriptValueAtIndex:i];
             if ([modifier isEqual:@"ctrlKey"])
                 mask |= NSControlKeyMask;
             else if ([modifier isEqual:@"shiftKey"])
@@ -363,26 +367,22 @@ BOOL replayingSavedEvents;
                 mask |= NSAlternateKeyMask;
             else if ([modifier isEqual:@"metaKey"])
                 mask |= NSCommandKeyMask;
-            else
-                break;
         }
 
     [[[mainFrame frameView] documentView] layout];
-    
+
     NSEvent *event = [NSEvent keyEventWithType:NSKeyDown
                         location:NSMakePoint(5, 5)
                         modifierFlags:mask
                         timestamp:[self currentEventTime]
                         windowNumber:[[[mainFrame webView] window] windowNumber]
                         context:[NSGraphicsContext currentContext]
-                        characters:character
-                        charactersIgnoringModifiers:character
+                        characters:eventCharacter
+                        charactersIgnoringModifiers:eventCharacter
                         isARepeat:NO
                         keyCode:0];
-    
 
-    NSResponder *firstResponder = [[[mainFrame webView] window] firstResponder];
-    [firstResponder keyDown:event];
+    [[[[mainFrame webView] window] firstResponder] keyDown:event];
 }
 
 - (void)enableDOMUIEventLogging:(WebScriptObject *)node
index 22d0d593ab00c04ef78d5447569f56d107297da4..224e9a90d59766e496943d42bb2b6057da098516 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -242,16 +242,21 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS
     if (argumentCount < 1)
         return JSValueMakeUndefined(context);
 
-    static JSStringRef lengthProperty = JSStringCreateWithUTF8CString("length");
+    static const JSStringRef lengthProperty = JSStringCreateWithUTF8CString("length");
 
     COMPtr<IWebFramePrivate> framePrivate;
     if (SUCCEEDED(frame->QueryInterface(&framePrivate)))
         framePrivate->layout();
     
     JSStringRef character = JSValueToStringCopy(context, arguments[0], exception);
-    ASSERT(!exception || !*exception);
-    int charCode = JSStringGetCharactersPtr(character)[0];
-    int virtualKeyCode = toupper(LOBYTE(VkKeyScan(charCode)));
+    ASSERT(!*exception);
+    int virtualKeyCode;
+    if (JSStringIsEqualToUTF8CString(string, "rightArrow")) {
+        virtualKeyCode = VK_RIGHT;
+    } else {
+        int charCode = JSStringGetCharactersPtr(character)[0];
+        virtualKeyCode = toupper(LOBYTE(VkKeyScan(charCode)));
+    }
     JSStringRelease(character);
 
     BYTE keyState[256];
@@ -336,7 +341,8 @@ static JSStaticValue staticValues[] = {
     { 0, 0, 0, 0 }
 };
 
-static JSClassRef getClass(JSContextRef context) {
+static JSClassRef getClass(JSContextRef context)
+{
     static JSClassRef eventSenderClass = 0;
 
     if (!eventSenderClass) {