summaryrefslogtreecommitdiff
path: root/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-07 11:22:47 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-07 11:22:47 +0100
commitcfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch)
tree24d68c6f61c464ecba1e05670b80390ea3b0e50c /Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp
parent69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff)
downloadqtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp')
-rw-r--r--Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp
index 0c23f4acc..e39df6e23 100644
--- a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp
+++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp
@@ -140,6 +140,7 @@ InputHandler::InputHandler(WebPagePrivate* page)
, m_request(0)
, m_processingTransactionId(-1)
, m_focusZoomScale(0.0)
+ , m_receivedBackspaceKeyDown(false)
{
}
@@ -961,7 +962,7 @@ PassRefPtr<Range> InputHandler::getRangeForSpellCheckWithFineGranularity(Visible
bool InputHandler::openDatePopup(HTMLInputElement* element, BlackBerryInputType type)
{
- if (!element || element->disabled() || !DOMSupport::isDateTimeInputField(element))
+ if (!element || element->disabled() || element->readOnly() || !DOMSupport::isDateTimeInputField(element))
return false;
if (isActiveTextEdit())
@@ -990,7 +991,7 @@ bool InputHandler::openDatePopup(HTMLInputElement* element, BlackBerryInputType
bool InputHandler::openColorPopup(HTMLInputElement* element)
{
- if (!element || element->disabled() || !DOMSupport::isColorInputField(element))
+ if (!element || element->disabled() || element->readOnly() || !DOMSupport::isColorInputField(element))
return false;
if (isActiveTextEdit())
@@ -1018,10 +1019,7 @@ void InputHandler::setInputValue(const WTF::String& value)
void InputHandler::nodeTextChanged(const Node* node)
{
- if (processingChange() || !node)
- return;
-
- if (node != m_currentFocusElement)
+ if (processingChange() || !node || node != m_currentFocusElement || m_receivedBackspaceKeyDown)
return;
InputLog(LogLevelInfo, "InputHandler::nodeTextChanged");
@@ -1041,6 +1039,11 @@ WebCore::IntRect InputHandler::boundingBoxForInputField()
if (!m_currentFocusElement->renderer())
return WebCore::IntRect();
+ // type="search" can have a 'X', so take the inner block bounding box to not include it.
+ if (HTMLInputElement* element = m_currentFocusElement->toInputElement())
+ if (element->isSearchField())
+ return element->innerBlockElement()->renderer()->absoluteBoundingBoxRect();
+
return m_currentFocusElement->renderer()->absoluteBoundingBoxRect();
}
@@ -1382,6 +1385,9 @@ void InputHandler::selectionChanged()
ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame());
+ if (m_receivedBackspaceKeyDown)
+ return;
+
int newSelectionStart = selectionStart();
int newSelectionEnd = selectionEnd();
@@ -1450,6 +1456,9 @@ bool InputHandler::handleKeyboardInput(const Platform::KeyboardEvent& keyboardEv
{
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();
@@ -1475,9 +1484,15 @@ bool InputHandler::handleKeyboardInput(const Platform::KeyboardEvent& keyboardEv
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);