Bug 9933 - DOM3 keyboard events are not working like real ones
Summary: DOM3 keyboard events are not working like real ones
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 420+
Hardware: Macintosh OS X 10.4
: P2 Normal
Assignee: Nobody
URL: http://www.w3.org/TR/DOM-Level-3-Even...
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-15 09:53 PDT by David Carson
Modified: 2013-04-05 17:10 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Carson 2006-07-15 09:53:05 PDT
DOM3 KeyboardEvents created with Javascript do not construct a PlatformKeyboardEvent, see http://bugzilla.opendarwin.org/show_bug.cgi?id=9743#c6
What should happen is KeyboardEvent is used through out the code. Presently PlatformKeyboardEvent is being used. PlatformKeyboardEvent should only be used to parse the platform event and setup the KeyboardEvent properly.
Comment 1 Geoffrey Garen 2006-07-15 09:55:26 PDT
One benefit of fixing this bug is that editing will start to work with key events dispatched by JavaScript. See this comment in FrameMac.mm:

    // FIXME: We might eventually need to make sure key bindings for editing work even with
    // events created with the DOM API. Those don't have a PlatformKeyboardEvent.
Comment 2 Darin Adler 2006-07-17 10:45:56 PDT
(In reply to comment #1)
> One benefit of fixing this bug is that editing will start to work with key
> events dispatched by JavaScript. See this comment in FrameMac.mm:
> 
>     // FIXME: We might eventually need to make sure key bindings for editing
> work even with
>     // events created with the DOM API. Those don't have a
> PlatformKeyboardEvent.

There are really two separate issues.

One is that within WebCore itself we'd like to use the DOM keyboard event objects. That may turn out to be straightforward, but it also may turn out that there's information in the platform events that the DOM events don't contain. So we might need to extend the DOM.

The key bindings issue is a separate one. That mechanism, part of OS X, is based on NSEvent objects. So a PlatformKeyboardEvent is not good enough -- we actually need an NSEvent. To fix that we'll need to create NSEvent objects for events created by the DOM.

While similar, there are different types of fixes needed for each of these two issues.
Comment 3 David Carson 2006-08-07 16:49:54 PDT
When this defect is corrected, hasFeature("keyboardevent", "3.0") should return true

Comment 4 David Carson 2006-08-07 16:51:23 PDT
(In reply to comment #3)
> When this defect is corrected, hasFeature("keyboardevent", "3.0") should return
> true
> 

Also see http://bugzilla.opendarwin.org/show_bug.cgi?id=10297 
hasFeature() is implemented in DOMImplementation.cpp
Comment 5 David Carson 2006-08-08 17:28:48 PDT
Current IDL represents the DOM3 KeyboardEvent IDL as of 31st march 2003. The IDL for keyboardevent was updated on 11th Nov 2003 to what it is today. What changed was the boolean for each of the modifier keys to a DOMString whitespace separated string list.
Comment 6 Alexey Proskuryakov 2008-01-12 14:04:46 PST
See also: http://bugs.webkit.org/show_bug.cgi?id=16735
Comment 7 Alexey Proskuryakov 2011-01-27 14:33:58 PST
The most tricky part here is probably to assess security implications. What exactly should DOM be allowed to do by dispatching synthetic events? Should it be able to dispatch Cmd+Q to quit the application, for example?
Comment 8 Darin Adler 2011-01-27 14:35:32 PST
(In reply to comment #7)
> The most tricky part here is probably to assess security implications.

OK.

> What exactly should DOM be allowed to do by dispatching synthetic events?

Generally speaking, commands that have effects within the webpage.

> Should it be able to dispatch Cmd+Q to quit the application, for example?

No.