Modified: trunk/Source/WebKit/blackberry/ChangeLog (134293 => 134294)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-11-12 21:16:39 UTC (rev 134293)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-11-12 21:26:22 UTC (rev 134294)
@@ -1,3 +1,26 @@
+2012-11-12 Nima Ghanavatian <[email protected]>
+
+ [BlackBerry] Use keyevents instead of editor commands for backspace
+ https://bugs.webkit.org/show_bug.cgi?id=101663
+
+ Reviewed by Rob Buis.
+
+ PR229395
+ Sending keyEvents for backspace and switching from KeyChar
+ to KeyDown since we are still receiving an unadultered KeyUp
+ from the input service. This was causing us to get two keyUps
+ for regular keys and no key downs for backspace since it was
+ triggering an editor command and bypassing JS listeners.
+
+ Reviewed internally by Mike Fenton.
+
+ * WebKitSupport/InputHandler.cpp:
+ (BlackBerry::WebKit::InputHandler::handleKeyboardInput):
+ (BlackBerry::WebKit::relativeRightOffset):
+ (WebKit):
+ (BlackBerry::WebKit::InputHandler::deleteTextRelativeToCursor):
+ (BlackBerry::WebKit::InputHandler::setText):
+
2012-11-12 Rob Buis <[email protected]>
[BlackBerry] Crash in InRegionScrollerPrivate.
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (134293 => 134294)
--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp 2012-11-12 21:16:39 UTC (rev 134293)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp 2012-11-12 21:26:22 UTC (rev 134294)
@@ -1528,7 +1528,7 @@
return false;
ASSERT(frame->editor());
- return frame->editor()->command("DeleteBackward").execute();
+ return handleKeyboardInput(Platform::KeyboardEvent(KEYCODE_BACKSPACE, Platform::KeyboardEvent::KeyDown, 0), false /* changeIsPartOfComposition */);
}
void InputHandler::insertText(const WTF::String& string)
@@ -1843,7 +1843,12 @@
int caretOffset = caretPosition();
int start = relativeLeftOffset(caretOffset, leftOffset);
int end = relativeRightOffset(caretOffset, elementText().length(), rightOffset);
- if (!deleteText(start, end))
+
+ // If we have backspace in a single character, send this to webkit as a KeyboardEvent. Otherwise, call deleteText.
+ if (leftOffset == 1 && !rightOffset) {
+ if (!handleKeyboardInput(Platform::KeyboardEvent(KEYCODE_BACKSPACE, Platform::KeyboardEvent::KeyDown, 0), true /* changeIsPartOfComposition */))
+ return false;
+ } else if (!deleteText(start, end))
return false;
// Scroll the field if necessary. The automatic update is suppressed
@@ -1860,6 +1865,9 @@
ProcessingChangeGuard guard(this);
+ if (end - start == 1)
+ return handleKeyboardInput(Platform::KeyboardEvent(KEYCODE_BACKSPACE, Platform::KeyboardEvent::KeyDown, 0), true /* changeIsPartOfComposition */);
+
if (!setSelection(start, end, true /*changeIsPartOfComposition*/))
return false;
@@ -2132,7 +2140,7 @@
if (composingTextLength - textLength == 1) {
InputLog(LogLevelInfo, "InputHandler::setText No spans have changed. New text is one character shorter than the old. Treating as 'delete'.");
- return editor->command("DeleteBackward").execute();
+ return handleKeyboardInput(Platform::KeyboardEvent(KEYCODE_BACKSPACE, Platform::KeyboardEvent::KeyDown, 0), true /* changeIsPartOfComposition */);
}
}
@@ -2142,7 +2150,7 @@
// If there is no text to add just delete.
if (!textLength) {
if (selectionActive())
- return editor->command("DeleteBackward").execute();
+ return handleKeyboardInput(Platform::KeyboardEvent(KEYCODE_BACKSPACE, Platform::KeyboardEvent::KeyChar, 0), true /* changeIsPartOfComposition */);
// Nothing to do.
return true;