Changeset 128183 in webkit


Ignore:
Timestamp:
Sep 11, 2012 7:30:18 AM (12 years ago)
Author:
anilsson@rim.com
Message:

[BlackBerry] SelectionHandler drops caret change notifications
https://bugs.webkit.org/show_bug.cgi?id=96378

Reviewed by Antonio Gomes.

The selection handler deliberately drops caret change notifications
while the input handler is processing changes, to avoid displaying
intermediate state during a complex change.

However, this meant that the client was never informed of the final
caret position.

Fixed by notifying client about caret change after processing ends, if
one or more caret change notifications were dropped during processing.

PR #205073

Reviewed internally by Mike Fenton.

  • WebKitSupport/InputHandler.cpp:

(BlackBerry::WebKit::InputHandler::setProcessingChange):
(WebKit):

  • WebKitSupport/InputHandler.h:

(InputHandler):

  • WebKitSupport/SelectionHandler.cpp:

(BlackBerry::WebKit::SelectionHandler::SelectionHandler):
(BlackBerry::WebKit::SelectionHandler::inputHandlerDidFinishProcessingChange):
(WebKit):
(BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):
(BlackBerry::WebKit::SelectionHandler::notifyCaretPositionChangedIfNeeded):

  • WebKitSupport/SelectionHandler.h:

(SelectionHandler):

Location:
trunk/Source/WebKit/blackberry
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/blackberry/ChangeLog

    r128142 r128183  
     12012-09-11  Arvid Nilsson  <anilsson@rim.com>
     2
     3        [BlackBerry] SelectionHandler drops caret change notifications
     4        https://bugs.webkit.org/show_bug.cgi?id=96378
     5
     6        Reviewed by Antonio Gomes.
     7
     8        The selection handler deliberately drops caret change notifications
     9        while the input handler is processing changes, to avoid displaying
     10        intermediate state during a complex change.
     11
     12        However, this meant that the client was never informed of the final
     13        caret position.
     14
     15        Fixed by notifying client about caret change after processing ends, if
     16        one or more caret change notifications were dropped during processing.
     17
     18        PR #205073
     19
     20        Reviewed internally by Mike Fenton.
     21
     22        * WebKitSupport/InputHandler.cpp:
     23        (BlackBerry::WebKit::InputHandler::setProcessingChange):
     24        (WebKit):
     25        * WebKitSupport/InputHandler.h:
     26        (InputHandler):
     27        * WebKitSupport/SelectionHandler.cpp:
     28        (BlackBerry::WebKit::SelectionHandler::SelectionHandler):
     29        (BlackBerry::WebKit::SelectionHandler::inputHandlerDidFinishProcessingChange):
     30        (WebKit):
     31        (BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):
     32        (BlackBerry::WebKit::SelectionHandler::notifyCaretPositionChangedIfNeeded):
     33        * WebKitSupport/SelectionHandler.h:
     34        (SelectionHandler):
     35
    1362012-09-10  Antonio Gomes  <agomes@rim.com>
    237
  • trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp

    r127817 r128183  
    339339}
    340340
     341void InputHandler::setProcessingChange(bool processingChange)
     342{
     343    if (processingChange == m_processingChange)
     344        return;
     345
     346    m_processingChange = processingChange;
     347
     348    if (!m_processingChange)
     349        m_webPage->m_selectionHandler->inputHandlerDidFinishProcessingChange();
     350}
     351
    341352WTF::String InputHandler::elementText()
    342353{
  • trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h

    r126925 r128183  
    111111
    112112    bool processingChange() const { return m_processingChange; }
    113     void setProcessingChange(bool processingChange) { m_processingChange = processingChange; }
     113    void setProcessingChange(bool);
    114114
    115115    WTF::String elementText();
  • trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp

    r127894 r128183  
    7171    , m_caretActive(false)
    7272    , m_lastUpdatedEndPointIsValid(false)
     73    , m_didSuppressCaretPositionChangedNotification(false)
    7374{
    7475}
     
    269270
    270271    SelectionLog(LogLevelInfo, "SelectionHandler::setCaretPosition point valid, cursor updated");
     272}
     273
     274void SelectionHandler::inputHandlerDidFinishProcessingChange()
     275{
     276    if (m_didSuppressCaretPositionChangedNotification)
     277        notifyCaretPositionChangedIfNeeded();
    271278}
    272279
     
    854861    if (m_webPage->m_inputHandler->isInputMode() && m_webPage->m_inputHandler->processingChange()) {
    855862        m_webPage->m_client->cancelSelectionVisuals();
    856         return;
    857     }
    858 
    859     if (m_caretActive || (m_webPage->m_inputHandler->isInputMode() && m_webPage->focusedOrMainFrame()->selection()->isCaret())) {
    860         // This may update the caret to no longer be active.
    861         caretPositionChanged();
    862     }
     863
     864        // Since we're not calling notifyCaretPositionChangedIfNeeded now, we have to do so at the end of processing
     865        // to avoid dropping a notification.
     866        m_didSuppressCaretPositionChangedNotification = true;
     867        return;
     868    }
     869
     870    notifyCaretPositionChangedIfNeeded();
    863871
    864872    // Enter selection mode if selection type is RangeSelection, and disable selection if
     
    949957}
    950958
     959
     960void SelectionHandler::notifyCaretPositionChangedIfNeeded()
     961{
     962    m_didSuppressCaretPositionChangedNotification = false;
     963
     964    if (m_caretActive || (m_webPage->m_inputHandler->isInputMode() && m_webPage->focusedOrMainFrame()->selection()->isCaret())) {
     965        // This may update the caret to no longer be active.
     966        caretPositionChanged();
     967    }
     968}
     969
    951970// NOTE: This function is not in WebKit coordinates.
    952971void SelectionHandler::caretPositionChanged()
  • trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h

    r124050 r128183  
    7272    bool lastUpdatedEndPointIsValid() const { return m_lastUpdatedEndPointIsValid; }
    7373
     74    void inputHandlerDidFinishProcessingChange();
     75
    7476private:
     77    void notifyCaretPositionChangedIfNeeded();
    7578    void caretPositionChanged();
    7679    void regionForTextQuads(WTF::Vector<WebCore::FloatQuad>&, BlackBerry::Platform::IntRectRegion&, bool shouldClipToVisibleContent = true) const;
     
    9093    bool m_caretActive;
    9194    bool m_lastUpdatedEndPointIsValid;
     95    bool m_didSuppressCaretPositionChangedNotification;
    9296    BlackBerry::Platform::IntRectRegion m_lastSelectionRegion;
    9397
Note: See TracChangeset for help on using the changeset viewer.