Title: [133343] trunk/Source/WebKit/blackberry
- Revision
- 133343
- Author
- [email protected]
- Date
- 2012-11-02 14:11:44 -0700 (Fri, 02 Nov 2012)
Log Message
[BlackBerry] Optimize backspace key handling
https://bugs.webkit.org/show_bug.cgi?id=101083
PR233591
Optimize backspace key handling. Some of these calls are not
required by IMF since the input_service already processes the backspace key
and updates the state before passing us the key.
Internally reviewed by Mike Fenton.
Patch by Nima Ghanavatian <[email protected]> on 2012-11-02
Reviewed by Yong Li.
Blocking calls with a flag that we clear immediately after
processing a backspace keydown.
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::nodeTextChanged):
(BlackBerry::WebKit::InputHandler::selectionChanged):
(BlackBerry::WebKit::InputHandler::handleKeyboardInput):
* WebKitSupport/InputHandler.h:
(InputHandler):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/ChangeLog (133342 => 133343)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-11-02 21:09:27 UTC (rev 133342)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-11-02 21:11:44 UTC (rev 133343)
@@ -1,3 +1,27 @@
+2012-11-02 Nima Ghanavatian <[email protected]>
+
+ [BlackBerry] Optimize backspace key handling
+ https://bugs.webkit.org/show_bug.cgi?id=101083
+
+ PR233591
+ Optimize backspace key handling. Some of these calls are not
+ required by IMF since the input_service already processes the backspace key
+ and updates the state before passing us the key.
+
+ Internally reviewed by Mike Fenton.
+
+ Reviewed by Yong Li.
+
+ Blocking calls with a flag that we clear immediately after
+ processing a backspace keydown.
+
+ * WebKitSupport/InputHandler.cpp:
+ (BlackBerry::WebKit::InputHandler::nodeTextChanged):
+ (BlackBerry::WebKit::InputHandler::selectionChanged):
+ (BlackBerry::WebKit::InputHandler::handleKeyboardInput):
+ * WebKitSupport/InputHandler.h:
+ (InputHandler):
+
2012-11-02 Otto Derek Cheung <[email protected]>
[BlackBerry] Adding window.external to our port
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (133342 => 133343)
--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp 2012-11-02 21:09:27 UTC (rev 133342)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp 2012-11-02 21:11:44 UTC (rev 133343)
@@ -140,6 +140,7 @@
, m_request(0)
, m_processingTransactionId(-1)
, m_focusZoomScale(0.0)
+ , m_receivedBackspaceKeyDown(false)
{
}
@@ -1018,12 +1019,9 @@
void InputHandler::nodeTextChanged(const Node* node)
{
- if (processingChange() || !node)
+ if (processingChange() || !node || node != m_currentFocusElement || m_receivedBackspaceKeyDown)
return;
- if (node != m_currentFocusElement)
- return;
-
InputLog(LogLevelInfo, "InputHandler::nodeTextChanged");
m_webPage->m_client->inputTextChanged();
@@ -1387,6 +1385,9 @@
ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame());
+ if (m_receivedBackspaceKeyDown)
+ return;
+
int newSelectionStart = selectionStart();
int newSelectionEnd = selectionEnd();
@@ -1455,6 +1456,9 @@
{
InputLog(LogLevelInfo, "InputHandler::handleKeyboardInput received character=%lc, type=%d", keyboardEvent.character(), keyboardEvent.type());
+ // Clearing the m_receivedBackspaceKeyDown state on any KeyboardEvent.
+ m_receivedBackspaceKeyDown = false;
+
// Enable input mode if we are processing a key event.
setInputModeEnabled();
@@ -1480,9 +1484,15 @@
if (isKeyChar)
type = Platform::KeyboardEvent::KeyDown;
+ // If we receive the KeyDown of a Backspace, set this flag to prevent sending unnecessary selection and caret changes to IMF.
+ if (keyboardEvent.character() == KEYCODE_BACKSPACE && type == Platform::KeyboardEvent::KeyDown)
+ m_receivedBackspaceKeyDown = true;
+
Platform::KeyboardEvent adjustedKeyboardEvent(keyboardEvent.character(), type, adjustedModifiers);
keyboardEventHandled = focusedFrame->eventHandler()->keyEvent(PlatformKeyboardEvent(adjustedKeyboardEvent));
+ m_receivedBackspaceKeyDown = false;
+
if (isKeyChar) {
type = Platform::KeyboardEvent::KeyUp;
adjustedKeyboardEvent = Platform::KeyboardEvent(keyboardEvent.character(), type, adjustedModifiers);
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h (133342 => 133343)
--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h 2012-11-02 21:09:27 UTC (rev 133342)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h 2012-11-02 21:11:44 UTC (rev 133343)
@@ -225,6 +225,8 @@
double m_focusZoomScale;
WebCore::FloatPoint m_focusZoomLocation;
+
+ bool m_receivedBackspaceKeyDown;
};
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes