Summary: | keydown event is fired once for every millisecond the Esc key is held down | ||
---|---|---|---|
Product: | WebKit | Reporter: | Tyson Tate <tyson> |
Component: | UI Events | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | ap, enrica, joepeck, olivier.borowski, tyson, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | 528+ (Nightly build) | ||
Hardware: | Mac (Intel) | ||
OS: | OS X 10.7 | ||
URL: | http://jsfiddle.net/PLtjN/ |
Description
Tyson Tate
2012-02-08 23:40:19 PST
Also worth noting, the events don't fire until the escape key is released. So if you press and hold the escape key for 1 second, 1,000 keydown events will fire at the end of that second, when you release the key. Yah, this is pretty bad! A workaround would be to call event.preventDefault() in the JavaScript handler.
The duplicate events seems to be caused by the default behavior of the Esc key for a window. WebCore sends a "cancelOperation" up to WebKit and the NSResponder chain to the NSWindow which sends a _cancelKey (Esc key) back down into the page. Here is a UIProcess snippet I took of Safari. Maybe this handling of _cancelKey can be made smarter?
Breakpoint 1, WebKit::WebPageProxy::handleKeyboardEvent (this=0x7fd3f6804000, event=@0x7fff6fa56d88) Source/WebKit2/UIProcess/WebPageProxy.cpp:971
971 if (!isValid())
#0 WebKit::WebPageProxy::handleKeyboardEvent (this=0x7fd3f6804000, event=@0x7fff6fa56d88) Source/WebKit2/UIProcess/WebPageProxy.cpp:971
#1 0x0000000112d57ea8 in -[WKView performKeyEquivalent:] (self=0x7fd3f5a07900, _cmd=0x7fff8110fac4, event=0x7fd3f44716e0) Source/WebKit2/UIProcess/API/mac/WKView.mm:1229
#2 0x000000011004a7fd in -[BrowserWKView performKeyEquivalent:] (self=0x7fd3f5a07900, _cmd=0x7fff8110fac4, event=0x7fd3f44716e0)
#3 0x00007fff809f91a0 in -[NSView _performKeyEquivalent:conditionally:] ()
#4 0x00007fff809f92ce in -[NSView performKeyEquivalent:] ()
#5 0x00007fff809f91a0 in -[NSView _performKeyEquivalent:conditionally:] ()
#6 0x00007fff809f92ce in -[NSView performKeyEquivalent:] ()
#7 0x00007fff809f91a0 in -[NSView _performKeyEquivalent:conditionally:] ()
#8 0x00007fff809f92ce in -[NSView performKeyEquivalent:] ()
#9 0x00007fff809f91a0 in -[NSView _performKeyEquivalent:conditionally:] ()
#10 0x00007fff809f92ce in -[NSView performKeyEquivalent:] ()
#11 0x00007fff809f91a0 in -[NSView _performKeyEquivalent:conditionally:] ()
#12 0x00007fff809f9111 in -[NSWindow performKeyEquivalent:] ()
#13 0x0000000110554116 in -[Window performKeyEquivalent:] (self=0x7fd3f5b92c60, _cmd=0x7fff8110fac4, event=0x7fd3f44716e0)
#14 0x00000001100058d9 in -[BrowserWindow performKeyEquivalent:] (self=0x7fd3f5b92c60, _cmd=0x7fff8110fac4, event=0x7fd3f44716e0)
> #15 0x00007fff80f19699 in -[NSWindow _cancelKey:] ()
#16 0x00007fff8c6d275d in -[NSObject performSelector:withObject:] ()
#17 0x00007fff80daf659 in -[NSResponder doCommandBySelector:] ()
#18 0x00007fff80f1c826 in -[NSWindow doCommandBySelector:] ()
#19 0x00007fff80daf72b in -[NSResponder doCommandBySelector:] ()
#20 0x00007fff80daf72b in -[NSResponder doCommandBySelector:] ()
#21 0x00007fff80daf72b in -[NSResponder doCommandBySelector:] ()
#22 0x00007fff80daf72b in -[NSResponder doCommandBySelector:] ()
#23 0x0000000112d60e02 in -[WKView(Internal) _executeSavedCommandBySelector:] (self=0x7fd3f5a07900, _cmd=0x7fff84fe874a, selector=0x7fff8114ca3c) Source/WebKit2/UIProcess/API/mac/WKView.mm:2673
#24 0x0000000112b0eac0 in WebKit::PageClientImpl::executeSavedCommandBySelector (this=0x7fd3f5a0c510, selectorString=@0x7fff6fa57560) Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm:519
#25 0x0000000112cb1502 in WebKit::WebPageProxy::executeSavedCommandBySelector (this=0x7fd3f6804000, selector=@0x7fff6fa57560, handled=@0x7fff6fa57558) Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm:375
#26 0x0000000112cc086f in CoreIPC::callMemberFunction<WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(WTF::String const&, bool&), WTF::String, bool> (args=@0x7fff6fa57560, replyArgs=@0x7fff6fa57558, object=0x7fd3f6804000, function={ptr = 4610266304, ptr = 0}) at HandleMessage.h:93
#27 0x0000000112cc02fa in CoreIPC::handleMessage<Messages::WebPageProxy::ExecuteSavedCommandBySelector, WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(WTF::String const&, bool&)> (argumentDecoder=0x7fd3f7910e50, replyEncoder=0x7fd3f4154770, object=0x7fd3f6804000, function={ptr = 4610266304, ptr = 0}) at HandleMessage.h:307
...
This appears to be fixed in Safari 6.0.1 (8536.26.14). (I don't know if it was fixed earlier, though. Anyways: closing. This bug is still not fixed, please reopen it ! Tested on : - Safari 6.0.1 (8536.26.14) on 10.8.2 - Safari 5.1.7 (6534.57.2) on 10.6.8 Yes, I'm also seeing this in Safari 6.0.1 on OS X 10.8.2. This was fixed by <http://trac.webkit.org/changeset/165356>. Sorry if that broke someone's workflow :-) |