Changeset 51818 in webkit


Ignore:
Timestamp:
Dec 7, 2009 5:22:23 PM (14 years ago)
Author:
eric@webkit.org
Message:

2009-12-07 Finnur Thorarinsson <finnur.webkit@gmail.com>

Reviewed by Darin Fisher.

A patch for Chromium to restrict the scope of the Gmail focus fix,
where we set the Selection to 0,0 for content-editable fields and
also make sure we set the selection end-state for find to select the
text found (when not focusing a link we found).
WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=32248

  • src/WebFrameImpl.cpp: (WebKit::WebFrameImpl::setFindEndstateFocusAndSelection):
  • src/WebViewImpl.cpp: (WebKit::WebViewImpl::setFocus):
Location:
trunk/WebKit/chromium
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/chromium/ChangeLog

    r51813 r51818  
     12009-12-07  Finnur Thorarinsson  <finnur.webkit@gmail.com>
     2
     3        Reviewed by Darin Fisher.
     4
     5        A patch for Chromium to restrict the scope of the Gmail focus fix,
     6        where we set the Selection to 0,0 for content-editable fields and
     7        also make sure we set the selection end-state for find to select the
     8        text found (when not focusing a link we found).
     9        WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=32248
     10
     11        * src/WebFrameImpl.cpp:
     12        (WebKit::WebFrameImpl::setFindEndstateFocusAndSelection):
     13        * src/WebViewImpl.cpp:
     14        (WebKit::WebViewImpl::setFocus):
     15
    1162009-12-07  Dmitry Titov  <dimich@chromium.org>
    217
  • trunk/WebKit/chromium/src/WebFrameImpl.cpp

    r51394 r51818  
    16701670            // Found a focusable parent node. Set focus to it.
    16711671            frame()->document()->setFocusedNode(node);
    1672         } else {
    1673             // Iterate over all the nodes in the range until we find a focusable node.
    1674             // This, for example, sets focus to the first link if you search for
    1675             // text and text that is within one or more links.
    1676             node = m_activeMatch->firstNode();
    1677             while (node && node != m_activeMatch->pastLastNode()) {
    1678                 if (node->isFocusable()) {
    1679                     frame()->document()->setFocusedNode(node);
    1680                     break;
    1681                 }
    1682                 node = node->traverseNextNode();
     1672            return;
     1673        }
     1674
     1675        // Iterate over all the nodes in the range until we find a focusable node.
     1676        // This, for example, sets focus to the first link if you search for
     1677        // text and text that is within one or more links.
     1678        node = m_activeMatch->firstNode();
     1679        while (node && node != m_activeMatch->pastLastNode()) {
     1680            if (node->isFocusable()) {
     1681                frame()->document()->setFocusedNode(node);
     1682                return;
    16831683            }
     1684            node = node->traverseNextNode();
    16841685        }
     1686
     1687        // No node related to the active match was focusable, so set the
     1688        // active match as the selection (so that when you end the Find session,
     1689        // you'll have the last thing you found highlighted) and make sure that
     1690        // we have nothing focused (otherwise you might have text selected but
     1691        // a link focused, which is weird).
     1692        frame()->selection()->setSelection(m_activeMatch.get());
     1693        frame()->document()->setFocusedNode(0);
    16851694    }
    16861695}
  • trunk/WebKit/chromium/src/WebViewImpl.cpp

    r51719 r51818  
    926926                if (element->isTextFormControl())
    927927                    element->updateFocusAppearance(true);
    928                 else {
     928                else if (focusedNode->isContentEditable()) {
    929929                    // updateFocusAppearance() selects all the text of
    930930                    // contentseditable DIVs. So we set the selection explicitly
    931931                    // instead. Note that this has the side effect of moving the
    932                     // caret back to the begining of the text.
     932                    // caret back to the beginning of the text.
    933933                    Position position(focusedNode, 0,
    934934                                      Position::PositionIsOffsetInAnchor);
Note: See TracChangeset for help on using the changeset viewer.