[webkit-dev] Syncing javascript keycode's across platforms

Adam Treat treat at kde.org
Wed Mar 28 15:43:53 PDT 2007


Currently the keycodes returned by the various platforms under WebKit are 
nowhere near close to uniform.  This seems like something that should be 
standard across all platforms that WebKit provides.  It is unclear to me 
exactly how the keycodes are generated by the different platforms...

In platform/qt/PlatformKeyboardEventQt.cpp the following snippet of code seems 
to handle the return code for the up arrow key:

        case Qt::Key_Up:
            return VK_UP; // (26) UP ARROW key

The equivalent code for the mac would seem to be in 

        // VK_UP (26) UP ARROW key
        case NSUpArrowFunctionKey: return 0x26;

The actual behavior under Safari seems to be to return '63232'

I am not at all aware how this happens.

The current mess for javascript keycodes is nicely summarized on this page.


If we can't fix this as a standard across browsers, surely this could be fixed 
across platforms that WebKit provides, no?


PS Any clue as to where Safari turns that code into '63232' would be much 

More information about the webkit-dev mailing list