+2007-12-12 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ - fix a crash when pressing a key that is not associated with a command
+
+ * WebView.cpp:
+ (WebView::handleEditingKeyboardEvent): Check if the result of
+ interpretKeyEvent() is empty.
+
2007-12-11 Sam Weinig <sam@webkit.org>
Reviewed by Darin Adler.
if (!keyEvent || keyEvent->isSystemKey()) // do not treat this as text input if it's a system key event
return false;
- Editor::Command command = frame->editor()->command(interpretKeyEvent(evt));
-
- if (keyEvent->type() == PlatformKeyboardEvent::RawKeyDown) {
- // WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated,
- // so we leave it upon WebCore to either handle them immediately (e.g. Tab that changes focus) or let a keypress event be generated
- // (e.g. Tab that inserts a Tab character, or Enter).
- return !command.isTextInsertion() && command.execute(evt);
- }
+ String commandName = interpretKeyEvent(evt);
+ if (!commandName.isEmpty()) {
+ Editor::Command command = frame->editor()->command(commandName);
+
+ if (keyEvent->type() == PlatformKeyboardEvent::RawKeyDown) {
+ // WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated,
+ // so we leave it upon WebCore to either handle them immediately (e.g. Tab that changes focus) or let a keypress event be generated
+ // (e.g. Tab that inserts a Tab character, or Enter).
+ return !command.isTextInsertion() && command.execute(evt);
+ }
- if (command.execute(evt))
- return true;
+ if (command.execute(evt))
+ return true;
+ } else if (keyEvent->type() == PlatformKeyboardEvent::RawKeyDown)
+ return false;
// Don't insert null or control characters as they can result in unexpected behaviour
if (evt->charCode() < ' ')