Title: [107992] trunk/Source/WebKit/blackberry
Revision
107992
Author
[email protected]
Date
2012-02-16 16:04:35 -0800 (Thu, 16 Feb 2012)

Log Message

2012-02-16  Antonio Gomes  <[email protected]>

       [BlackBerry] Implemented a way to defer client navigation change client notifications
       https://bugs.webkit.org/show_bug.cgi?id=78848

       Reviewed by Rob Buis.

       Currently we postpone touch_down till touch_up if user touches
       the screen and an input field has the WebKit focus. This is done
       so we can scroll the page without hidding the vkb needlessly.

       However, it breaks the conversion of touch to mouse events
       if an input field has the focus in the following scenario:
       an <input type=text> is focused and an user grab and-drag
       a <input type=range> knob/slide. It does not work until the
       user unfocuses the currently focused edit field.

       Patch introduces a way to unfocus a currently focused input field,
       without requesting the client to show or hide the virtual keyboard
       right way. Instead it gets a delayed notification of the vkb mode requested
       at either touch_released/mouse_up or touch_cancel time.

       For now, due to content side issues with major web sites,
       only delay navigation mode notification changes if we are not dealing with
       input modes.

       * WebKitSupport/InputHandler.cpp:
       (BlackBerry::WebKit::InputHandler::InputHandler):
       (BlackBerry::WebKit::InputHandler::nodeFocused):
       (BlackBerry::WebKit::InputHandler::setElementFocused):
       (BlackBerry::WebKit::InputHandler::setNavigationMode):
       (WebKit):
       (BlackBerry::WebKit::InputHandler::setDelayClientNotificationOfNavigationModeChange):
       (BlackBerry::WebKit::InputHandler::processPendingClientNavigationModeChangeNotification):
       (BlackBerry::WebKit::InputHandler::notifyClientOfNavigationModeChange):
       (BlackBerry::WebKit::InputHandler::willOpenPopupForNode):
       (BlackBerry::WebKit::InputHandler::setPopupListIndexes):
       (BlackBerry::WebKit::InputHandler::spannableTextInRange):
       (BlackBerry::WebKit::InputHandler::removeComposedText):
       (BlackBerry::WebKit::InputHandler::firstSpanInString):
       (BlackBerry::WebKit::InputHandler::setText):
       (BlackBerry::WebKit::InputHandler::setRelativeCursorPosition):
       * WebKitSupport/InputHandler.h:
       (InputHandler):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (107991 => 107992)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-02-17 00:04:23 UTC (rev 107991)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-02-17 00:04:35 UTC (rev 107992)
@@ -1,5 +1,50 @@
 2012-02-16  Antonio Gomes  <[email protected]>
 
+        [BlackBerry] Implemented a way to defer client navigation change client notifications
+        https://bugs.webkit.org/show_bug.cgi?id=78848
+
+        Reviewed by Rob Buis.
+
+        Currently we postpone touch_down till touch_up if user touches
+        the screen and an input field has the WebKit focus. This is done
+        so we can scroll the page without hidding the vkb needlessly.
+
+        However, it breaks the conversion of touch to mouse events
+        if an input field has the focus in the following scenario:
+        an <input type=text> is focused and an user grab and-drag
+        a <input type=range> knob/slide. It does not work until the
+        user unfocuses the currently focused edit field.
+
+        Patch introduces a way to unfocus a currently focused input field,
+        without requesting the client to show or hide the virtual keyboard
+        right way. Instead it gets a delayed notification of the vkb mode requested
+        at either touch_released/mouse_up or touch_cancel time.
+
+        For now, due to content side issues with major web sites,
+        only delay navigation mode notification changes if we are not dealing with
+        input modes.
+
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::InputHandler):
+        (BlackBerry::WebKit::InputHandler::nodeFocused):
+        (BlackBerry::WebKit::InputHandler::setElementFocused):
+        (BlackBerry::WebKit::InputHandler::setNavigationMode):
+        (WebKit):
+        (BlackBerry::WebKit::InputHandler::setDelayClientNotificationOfNavigationModeChange):
+        (BlackBerry::WebKit::InputHandler::processPendingClientNavigationModeChangeNotification):
+        (BlackBerry::WebKit::InputHandler::notifyClientOfNavigationModeChange):
+        (BlackBerry::WebKit::InputHandler::willOpenPopupForNode):
+        (BlackBerry::WebKit::InputHandler::setPopupListIndexes):
+        (BlackBerry::WebKit::InputHandler::spannableTextInRange):
+        (BlackBerry::WebKit::InputHandler::removeComposedText):
+        (BlackBerry::WebKit::InputHandler::firstSpanInString):
+        (BlackBerry::WebKit::InputHandler::setText):
+        (BlackBerry::WebKit::InputHandler::setRelativeCursorPosition):
+        * WebKitSupport/InputHandler.h:
+        (InputHandler):
+
+2012-02-16  Antonio Gomes  <[email protected]>
+
         Crash @WebPagePrivate::enqueueRenderingOfClippedContentOfScrollableNodeAfterInRegionScrolling MKS_2986818
         https://bugs.webkit.org/show_bug.cgi?id=78845
 

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (107991 => 107992)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2012-02-17 00:04:23 UTC (rev 107991)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2012-02-17 00:04:35 UTC (rev 107992)
@@ -116,6 +116,8 @@
     , m_currentFocusElementTextEditMask(DEFAULT_STYLE)
     , m_composingTextStart(0)
     , m_composingTextEnd(0)
+    , m_pendingKeyboardStateChange(NoChange)
+    , m_delayClientNotificationOfNavigationModeChange(false)
 {
 }
 
@@ -474,7 +476,9 @@
 
     FocusLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::setElementFocused, Type=%d, Style=%d", type, m_currentFocusElementTextEditMask);
 
-    m_webPage->m_client->inputFocusGained(type, m_currentFocusElementTextEditMask);
+    m_webPage->m_client->inputFocusGained(type,
+                                          m_currentFocusElementTextEditMask,
+                                          m_delayClientNotificationOfNavigationModeChange /* wait an explicit keyboard show call */);
     m_navigationMode = true;
 
     handleInputLocaleChanged(m_webPage->m_webSettings->isWritingDirectionRTL());
@@ -748,7 +752,39 @@
     InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::setNavigationMode %s, %s", active ? "true" : "false", sendMessage ? "message sent" : "message not sent");
 
     if (sendMessage)
+        notifyClientOfNavigationModeChange(active);
+}
+
+void InputHandler::setDelayClientNotificationOfNavigationModeChange(bool value)
+{
+    m_delayClientNotificationOfNavigationModeChange = value;
+    m_pendingKeyboardStateChange = NoChange;
+}
+
+void InputHandler::processPendingClientNavigationModeChangeNotification()
+{
+    if (!m_delayClientNotificationOfNavigationModeChange) {
+        ASSERT(m_pendingKeyboardStateChange == NoChange);
+        return;
+    }
+
+    m_delayClientNotificationOfNavigationModeChange = false;
+
+    if (m_pendingKeyboardStateChange == NoChange)
+        return;
+
+    notifyClientOfNavigationModeChange(m_pendingKeyboardStateChange == Visible);
+    m_pendingKeyboardStateChange = NoChange;
+}
+
+void InputHandler::notifyClientOfNavigationModeChange(bool active)
+{
+    if (!m_delayClientNotificationOfNavigationModeChange) {
         m_webPage->m_client->inputSetNavigationMode(active);
+        return;
+    }
+
+    m_pendingKeyboardStateChange = active ? Visible : NotVisible;
 }
 
 bool InputHandler::selectionAtStartOfElement()

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h (107991 => 107992)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h	2012-02-17 00:04:23 UTC (rev 107991)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h	2012-02-17 00:04:35 UTC (rev 107992)
@@ -77,6 +77,11 @@
 
     void setInputValue(const WTF::String&);
 
+    void setDelayClientNotificationOfNavigationModeChange(bool value);
+    void processPendingClientNavigationModeChangeNotification();
+
+    void notifyClientOfNavigationModeChange(bool active);
+
     bool isInputMode() const { return isActiveTextEdit(); }
     bool isMultilineInputMode() const { return isActiveTextEdit() && elementType(m_currentFocusElement.get()) == BlackBerry::Platform::InputTypeTextArea; }
 
@@ -117,6 +122,8 @@
     bool shouldAcceptInputFocus();
 
 private:
+    enum PendingKeyboardStateChange { NoChange, Visible, NotVisible };
+
     void setElementFocused(WebCore::Element*);
     void setPluginFocused(WebCore::Element*);
     void setElementUnfocused(bool refocusOccuring = false);
@@ -183,6 +190,9 @@
 
     int m_composingTextStart;
     int m_composingTextEnd;
+
+    PendingKeyboardStateChange m_pendingKeyboardStateChange;
+    bool m_delayClientNotificationOfNavigationModeChange;
 };
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to