Title: [120923] trunk/Source/WebKit/blackberry
Revision
120923
Author
mifen...@rim.com
Date
2012-06-21 06:39:45 -0700 (Thu, 21 Jun 2012)

Log Message

[BlackBerry] Input mode should adapt automatically to settings changes
https://bugs.webkit.org/show_bug.cgi?id=89595

Reviewed by Antonio Gomes.

PR 167540.

Add helper function to check if input is enabled so that
the override settings can be applied at any time.

Reviewed Internally by Gen Mak.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::setLoadState):
(BlackBerry::WebKit::WebPagePrivate::handleMouseEvent):
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::isInputModeEnabled):
(BlackBerry::WebKit::InputHandler::setInputModeEnabled):
(BlackBerry::WebKit::InputHandler::setElementFocused):
(BlackBerry::WebKit::InputHandler::ensureFocusTextElementVisible):
(BlackBerry::WebKit::InputHandler::notifyClientOfKeyboardVisibilityChange):
(BlackBerry::WebKit::InputHandler::handleKeyboardInput):
(BlackBerry::WebKit::InputHandler::setComposingText):
* WebKitSupport/InputHandler.h:
* WebKitSupport/TouchEventHandler.cpp:
(BlackBerry::WebKit::TouchEventHandler::handleTouchPoint):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (120922 => 120923)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-06-21 13:26:42 UTC (rev 120922)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-06-21 13:39:45 UTC (rev 120923)
@@ -1021,7 +1021,7 @@
 #endif
 
             // Notify InputHandler of state change.
-            m_inputHandler->enableInputMode(false);
+            m_inputHandler->setInputModeEnabled(false);
 
             // Set the scroll to origin here and notify the client since we'll be
             // zooming below without any real contents yet thus the contents size
@@ -3967,7 +3967,7 @@
     }
 
     if (mouseEvent.type() == WebCore::PlatformEvent::MousePressed) {
-        m_inputHandler->enableInputMode();
+        m_inputHandler->setInputModeEnabled();
         if (m_inputHandler->willOpenPopupForNode(node)) {
             // Do not allow any human generated mouse or keyboard events to select <option>s in the list box
             // because we use a pop up dialog to handle the actual selections. This prevents options from

Modified: trunk/Source/WebKit/blackberry/ChangeLog (120922 => 120923)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-06-21 13:26:42 UTC (rev 120922)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-06-21 13:39:45 UTC (rev 120923)
@@ -1,3 +1,32 @@
+2012-06-21  Mike Fenton  <mifen...@rim.com>
+
+        [BlackBerry] Input mode should adapt automatically to settings changes
+        https://bugs.webkit.org/show_bug.cgi?id=89595
+
+        Reviewed by Antonio Gomes.
+
+        PR 167540.
+
+        Add helper function to check if input is enabled so that
+        the override settings can be applied at any time.
+
+        Reviewed Internally by Gen Mak.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::setLoadState):
+        (BlackBerry::WebKit::WebPagePrivate::handleMouseEvent):
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::isInputModeEnabled):
+        (BlackBerry::WebKit::InputHandler::setInputModeEnabled):
+        (BlackBerry::WebKit::InputHandler::setElementFocused):
+        (BlackBerry::WebKit::InputHandler::ensureFocusTextElementVisible):
+        (BlackBerry::WebKit::InputHandler::notifyClientOfKeyboardVisibilityChange):
+        (BlackBerry::WebKit::InputHandler::handleKeyboardInput):
+        (BlackBerry::WebKit::InputHandler::setComposingText):
+        * WebKitSupport/InputHandler.h:
+        * WebKitSupport/TouchEventHandler.cpp:
+        (BlackBerry::WebKit::TouchEventHandler::handleTouchPoint):
+
 2012-06-20  Jacky Jiang  <zhaji...@rim.com>
 
         Add a != operator to ViewportArguments

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (120922 => 120923)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2012-06-21 13:26:42 UTC (rev 120922)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2012-06-21 13:39:45 UTC (rev 120923)
@@ -432,21 +432,22 @@
     m_currentFocusElementType = TextEdit;
 }
 
-void InputHandler::enableInputMode(bool inputModeAllowed)
+bool InputHandler::isInputModeEnabled() const
 {
-    FocusLog(LogLevelInfo, "InputHandler::enableInputMode '%s', override is '%s'"
-             , inputModeAllowed ? "true" : "false"
+    // Input mode is enabled when set, or when dump render tree or always show keyboard setting is enabled.
+    return m_inputModeEnabled || m_webPage->m_dumpRenderTree || Platform::Settings::get()->alwaysShowKeyboardOnFocus();
+}
+
+void InputHandler::setInputModeEnabled(bool active)
+{
+    FocusLog(LogLevelInfo, "InputHandler::setInputModeEnabled '%s', override is '%s'"
+             , active ? "true" : "false"
              , m_webPage->m_dumpRenderTree || Platform::Settings::get()->alwaysShowKeyboardOnFocus() ? "true" : "false");
 
-    m_inputModeEnabled = inputModeAllowed;
+    m_inputModeEnabled = active;
 
-    // If DRT is running or always show keyboard setting is active, do not delay
-    // showing the keyboard.
-    if (m_webPage->m_dumpRenderTree || Platform::Settings::get()->alwaysShowKeyboardOnFocus())
-        m_inputModeEnabled = true;
-
     // If the frame selection isn't focused, focus it.
-    if (m_inputModeEnabled && isActiveTextEdit() && !m_currentFocusElement->document()->frame()->selection()->isFocused())
+    if (isInputModeEnabled() && isActiveTextEdit() && !m_currentFocusElement->document()->frame()->selection()->isFocused())
         m_currentFocusElement->document()->frame()->selection()->setFocused(true);
 }
 
@@ -455,8 +456,8 @@
     ASSERT(DOMSupport::isTextBasedContentEditableElement(element));
     ASSERT(element->document() && element->document()->frame());
 
-    if (element->document()->frame()->selection()->isFocused() != m_inputModeEnabled)
-        element->document()->frame()->selection()->setFocused(m_inputModeEnabled);
+    if (element->document()->frame()->selection()->isFocused() != isInputModeEnabled())
+        element->document()->frame()->selection()->setFocused(isInputModeEnabled());
 
     // Clear the existing focus node details.
     setElementUnfocused(true /*refocusOccuring*/);
@@ -552,7 +553,7 @@
 
 void InputHandler::ensureFocusTextElementVisible(CaretScrollType scrollType)
 {
-    if (!m_inputModeEnabled || !m_currentFocusElement || !m_currentFocusElement->document())
+    if (!isActiveTextEdit() || !isInputModeEnabled() || !m_currentFocusElement->document())
         return;
 
     if (!Platform::Settings::get()->allowCenterScrollAdjustmentForInputFields() && scrollType != EdgeIfNeeded)
@@ -770,7 +771,7 @@
 void InputHandler::notifyClientOfKeyboardVisibilityChange(bool visible)
 {
     // If we aren't ready for input, keyboard changes should be ignored.
-    if (!m_inputModeEnabled && visible)
+    if (!isInputModeEnabled() && visible)
         return;
 
     if (!m_delayKeyboardVisibilityChange) {
@@ -929,7 +930,7 @@
     InputLog(LogLevelInfo, "InputHandler::handleKeyboardInput received character=%lc, type=%d", keyboardEvent.character(), keyboardEvent.type());
 
     // Enable input mode if we are processing a key event.
-    enableInputMode();
+    setInputModeEnabled();
 
     // If we aren't specifically part of a composition, fail, IMF should never send key input
     // while composing text. If IMF has failed, we should have already finished the
@@ -1725,7 +1726,7 @@
     InputLog(LogLevelInfo, "InputHandler::setComposingText at relativeCursorPosition: %d", relativeCursorPosition);
 
     // Enable input mode if we are processing a key event.
-    enableInputMode();
+    setInputModeEnabled();
 
     return setSpannableTextAndRelativeCursor(spannableString, relativeCursorPosition, true /* markTextAsComposing */) ? 0 : -1;
 }

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h (120922 => 120923)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h	2012-06-21 13:26:42 UTC (rev 120922)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h	2012-06-21 13:39:45 UTC (rev 120923)
@@ -57,7 +57,8 @@
     enum FocusElementType { TextEdit, TextPopup /* Date/Time & Color */, SelectPopup, Plugin };
     enum CaretScrollType { CenterAlways, CenterIfNeeded, EdgeIfNeeded };
 
-    void enableInputMode(bool inputModeAllowed = true);
+    bool isInputModeEnabled() const;
+    void setInputModeEnabled(bool active = true);
 
     void focusedNodeChanged();
     void nodeTextChanged(const WebCore::Node*);

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp (120922 => 120923)


--- trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp	2012-06-21 13:26:42 UTC (rev 120922)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp	2012-06-21 13:39:45 UTC (rev 120923)
@@ -171,7 +171,7 @@
 bool TouchEventHandler::handleTouchPoint(Platform::TouchPoint& point)
 {
     // Enable input mode on any touch event.
-    m_webPage->m_inputHandler->enableInputMode();
+    m_webPage->m_inputHandler->setInputModeEnabled();
     bool pureWithMouseConversion = m_webPage->m_touchEventMode == PureTouchEventsWithMouseConversion;
 
     switch (point.m_state) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to