Fix <rdar://5483519> Pressing Enter on selected buttons should fire onclick
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Nov 2007 20:04:41 +0000 (20:04 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Nov 2007 20:04:41 +0000 (20:04 +0000)
commit3a60d4ad465b0df1ab0e99cb056b11fa0d9c818c
treeaeb4c9dc06f1c4bcc14bc8f8c5113243443441f6
parentedd369d29cd3b7abd70ab68319f7b837938fa809
 Fix <rdar://5483519> Pressing Enter on selected buttons should fire onclick

 LayoutTests:

         Add a test for <rdar://5483519> Pressing Enter on selected buttons should fire onclick

         Reviewed by Adele.

         * fast/forms/enter-clicks-buttons-expected.txt: Added.
         * fast/forms/enter-clicks-buttons.html: Added.

 WebCore:

         Fix <rdar://5483519> Pressing Enter on selected buttons should fire onclick

         We now match the behavior of Firefox and IE, which is to always just
         send a click event to the focused button when the Enter key is pressed
         (previously we were submitting forms directly in some cases).

         Reviewed by Adele.

         Test: fast/forms/enter-clicks-buttons.html

         * html/HTMLButtonElement.cpp:
         (WebCore::HTMLButtonElement::defaultEventHandler): Don't do anything
         fancy when Enter is pressed on a <button type=button> -- just send a
         click event like we do for other button types.
         * html/HTMLInputElement.cpp:
         (WebCore::HTMLInputElement::defaultEventHandler): Treat type=button
         the same way we treat type=submit and type=reset: just send a click
         event when Enter is pressed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27652 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/forms/enter-clicks-buttons-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/enter-clicks-buttons.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLButtonElement.cpp
WebCore/html/HTMLInputElement.cpp