https://bugs.webkit.org/show_bug.cgi?id=80594
Patch by Mike Fenton <mifenton@rim.com> on 2012-03-08
Reviewed by Antonio Gomes.
Update InputHandler focused node handling to strictly use
the currently focused node. This prevents a handling loop
when JS is modifying the focus and we get a late notification
of a past change from ChromeClientBlackBerry with the previously
unfocused node.
* WebCoreSupport/ChromeClientBlackBerry.cpp:
(WebCore::ChromeClientBlackBerry::focusedNodeChanged):
* WebCoreSupport/EditorClientBlackBerry.cpp:
(WebCore::EditorClientBlackBerry::shouldChangeSelectedRange):
(WebCore::EditorClientBlackBerry::setInputMethodState):
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::focusedNodeChanged):
* WebKitSupport/InputHandler.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110175
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-03-08 Mike Fenton <mifenton@rim.com>
+
+ [BlackBerry] Always use the current focused node when processing focus changes
+ https://bugs.webkit.org/show_bug.cgi?id=80594
+
+ Reviewed by Antonio Gomes.
+
+ Update InputHandler focused node handling to strictly use
+ the currently focused node. This prevents a handling loop
+ when JS is modifying the focus and we get a late notification
+ of a past change from ChromeClientBlackBerry with the previously
+ unfocused node.
+
+ * WebCoreSupport/ChromeClientBlackBerry.cpp:
+ (WebCore::ChromeClientBlackBerry::focusedNodeChanged):
+ * WebCoreSupport/EditorClientBlackBerry.cpp:
+ (WebCore::EditorClientBlackBerry::shouldChangeSelectedRange):
+ (WebCore::EditorClientBlackBerry::setInputMethodState):
+ * WebKitSupport/InputHandler.cpp:
+ (BlackBerry::WebKit::InputHandler::focusedNodeChanged):
+ * WebKitSupport/InputHandler.h:
+
2012-03-07 Jacky Jiang <zhajiang@rim.com>
[BlackBerry] WebKit rendering problem when show/hide VKB
notImplemented();
}
-void ChromeClientBlackBerry::focusedNodeChanged(Node* node)
+void ChromeClientBlackBerry::focusedNodeChanged(Node*)
{
- m_webPagePrivate->m_inputHandler->nodeFocused(node);
+ m_webPagePrivate->m_inputHandler->focusedNodeChanged();
}
void ChromeClientBlackBerry::focusedFrameChanged(Frame*)
if (frame->document()->focusedNode() && frame->document()->focusedNode()->hasTagName(HTMLNames::selectTag))
return false;
- // Update the focus state to re-show the keyboard if needed.
- // FIXME, this should be removed and strictly be a show keyboard call if
- // focus is active.
- if (m_webPagePrivate->m_inputHandler->isInputMode())
- m_webPagePrivate->m_inputHandler->nodeFocused(frame->document()->focusedNode());
+ // Check if this change does not represent a focus change and input is active and if so ensure the keyboard is visible.
+ if (m_webPagePrivate->m_inputHandler->isInputMode() && (fromRange->startContainer() == toRange->startContainer()))
+ m_webPagePrivate->m_inputHandler->notifyClientOfKeyboardVisibilityChange(true);
}
return true;
notImplemented();
}
-void EditorClientBlackBerry::setInputMethodState(bool active)
+void EditorClientBlackBerry::setInputMethodState(bool)
{
- Frame* frame = m_webPagePrivate->focusedOrMainFrame();
- // Determines whether or not to provide input assistance. Password fields
- // do not have this flag active, so it needs to be overridden.
- if (frame && frame->document()) {
- if (Node* focusNode = frame->document()->focusedNode()) {
- if (!active && focusNode->hasTagName(HTMLNames::inputTag)
- && static_cast<HTMLInputElement*>(focusNode)->isPasswordField())
- active = true;
-
- if (active) {
- m_webPagePrivate->m_inputHandler->nodeFocused(focusNode);
- return;
- }
- }
- }
- // No frame or document or a node that doesn't support IME.
- m_webPagePrivate->m_inputHandler->nodeFocused(0);
+ m_webPagePrivate->m_inputHandler->focusedNodeChanged();
}
} // namespace WebCore
return InputTypeTextArea;
}
-void InputHandler::nodeFocused(Node* node)
+void InputHandler::focusedNodeChanged()
{
+ ASSERT(m_webPage->m_page->focusController());
+ Frame* frame = m_webPage->m_page->focusController()->focusedOrMainFrame();
+ if (!frame || !frame->document())
+ return;
+
+ Node* node = frame->document()->focusedNode();
+
if (isActiveTextEdit() && m_currentFocusElement == node) {
notifyClientOfKeyboardVisibilityChange(true);
return;
enum FocusElementType { TextEdit, TextPopup /* Date/Time & Color */, SelectPopup, Plugin };
enum CaretScrollType { CenterAlways, CenterIfNeeded, EdgeIfNeeded };
- void nodeFocused(WebCore::Node*);
+ void focusedNodeChanged();
void nodeTextChanged(const WebCore::Node*);
void selectionChanged();
void frameUnloaded(const WebCore::Frame*);