Skip to content
Permalink
Browse files
2012-02-16 Antonio Gomes <agomes@rim.com>
       [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):

Canonical link: https://commits.webkit.org/95826@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107992 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Antonio Gomes committed Feb 17, 2012
1 parent fb13042 commit 02796a5d195b1e30f278185faf073086caf52bed
Showing with 92 additions and 1 deletion.
  1. +45 −0 Source/WebKit/blackberry/ChangeLog
  2. +37 −1 Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp
  3. +10 −0 Source/WebKit/blackberry/WebKitSupport/InputHandler.h
@@ -1,3 +1,48 @@
2012-02-16 Antonio Gomes <agomes@rim.com>

[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 <agomes@rim.com>

Crash @WebPagePrivate::enqueueRenderingOfClippedContentOfScrollableNodeAfterInRegionScrolling MKS_2986818
@@ -116,6 +116,8 @@ InputHandler::InputHandler(WebPagePrivate* page)
, m_currentFocusElementTextEditMask(DEFAULT_STYLE)
, m_composingTextStart(0)
, m_composingTextEnd(0)
, m_pendingKeyboardStateChange(NoChange)
, m_delayClientNotificationOfNavigationModeChange(false)
{
}

@@ -474,7 +476,9 @@ void InputHandler::setElementFocused(Element* element)

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 @@ void InputHandler::setNavigationMode(bool active, bool sendMessage)
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()
@@ -77,6 +77,11 @@ class InputHandler {

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 @@ class InputHandler {
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 @@ class InputHandler {

int m_composingTextStart;
int m_composingTextEnd;

PendingKeyboardStateChange m_pendingKeyboardStateChange;
bool m_delayClientNotificationOfNavigationModeChange;
};

}

0 comments on commit 02796a5

Please sign in to comment.