summaryrefslogtreecommitdiffstats
path: root/WebCore/html/BaseCheckableInputType.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/html/BaseCheckableInputType.cpp')
-rw-r--r--WebCore/html/BaseCheckableInputType.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/WebCore/html/BaseCheckableInputType.cpp b/WebCore/html/BaseCheckableInputType.cpp
index 009e8e4..940acf4 100644
--- a/WebCore/html/BaseCheckableInputType.cpp
+++ b/WebCore/html/BaseCheckableInputType.cpp
@@ -34,6 +34,7 @@
#include "FormDataList.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
+#include "KeyboardEvent.h"
#include "RegularExpression.h"
namespace WebCore {
@@ -57,4 +58,25 @@ bool BaseCheckableInputType::appendFormData(FormDataList& encoding, bool) const
return true;
}
+bool BaseCheckableInputType::handleKeydownEvent(KeyboardEvent* event)
+{
+ const String& key = event->keyIdentifier();
+ if (key == "U+0020") {
+ element()->setActive(true, true);
+ // No setDefaultHandled(), because IE dispatches a keypress in this case
+ // and the caller will only dispatch a keypress if we don't call setDefaultHandled().
+ }
+ return false;
+}
+
+bool BaseCheckableInputType::handleKeypressEvent(KeyboardEvent* event)
+{
+ if (event->charCode() == ' ') {
+ // Prevent scrolling down the page.
+ event->setDefaultHandled();
+ return true;
+ }
+ return false;
+}
+
} // namespace WebCore