Changeset 138893 in webkit


Ignore:
Timestamp:
Jan 5, 2013 12:01:16 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Add function to move caret selection towards a point
https://bugs.webkit.org/show_bug.cgi?id=105189

Patch by Chris Hopman <cjhopman@google.com> on 2013-01-05
Reviewed by Eric Seidel.

This function moves the selection to the corresponding point in the
rootEditableElement of the current selection. Used on Android for
the behavior of insertion handles (i.e. dragging the caret around).

  • public/WebFrame.h:

(WebFrame):

  • src/WebFrameImpl.cpp:

(WebKit::WebFrameImpl::moveCaretSelectionTowardsWindowPoint):
(WebKit):

  • src/WebFrameImpl.h:

(WebFrameImpl):

Location:
trunk/Source/WebKit/chromium
Files:
4 edited

Legend:

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

    r138859 r138893  
     12013-01-05  Chris Hopman  <cjhopman@google.com>
     2
     3        Add function to move caret selection towards a point
     4        https://bugs.webkit.org/show_bug.cgi?id=105189
     5
     6        Reviewed by Eric Seidel.
     7
     8        This function moves the selection to the corresponding point in the
     9        rootEditableElement of the current selection. Used on Android for
     10        the behavior of insertion handles (i.e. dragging the caret around).
     11
     12        * public/WebFrame.h:
     13        (WebFrame):
     14        * src/WebFrameImpl.cpp:
     15        (WebKit::WebFrameImpl::moveCaretSelectionTowardsWindowPoint):
     16        (WebKit):
     17        * src/WebFrameImpl.h:
     18        (WebFrameImpl):
     19
    1202013-01-04  James Robinson  <jamesr@chromium.org>
    221
  • trunk/Source/WebKit/chromium/public/WebFrame.h

    r133006 r138893  
    471471    virtual void selectRange(const WebRange&) = 0;
    472472
     473    virtual void moveCaretSelectionTowardsWindowPoint(const WebPoint&) = 0;
     474
    473475    // Printing ------------------------------------------------------------
    474476
  • trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp

    r137318 r138893  
    13891389}
    13901390
     1391void WebFrameImpl::moveCaretSelectionTowardsWindowPoint(const WebPoint& point)
     1392{
     1393    Element* editable = frame()->selection()->rootEditableElement();
     1394    IntPoint contentsPoint = frame()->view()->windowToContents(IntPoint(point));
     1395    LayoutPoint localPoint(editable->convertFromPage(contentsPoint));
     1396    VisiblePosition position = editable->renderer()->positionForPoint(localPoint);
     1397    if (frame()->selection()->shouldChangeSelection(position))
     1398        frame()->selection()->moveTo(position, UserTriggered);
     1399}
     1400
    13911401VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& point)
    13921402{
  • trunk/Source/WebKit/chromium/src/WebFrameImpl.h

    r133006 r138893  
    191191    virtual void selectRange(const WebPoint& base, const WebPoint& extent);
    192192    virtual void selectRange(const WebRange&);
     193    virtual void moveCaretSelectionTowardsWindowPoint(const WebPoint&);
    193194    virtual int printBegin(const WebPrintParams&,
    194195                           const WebNode& constrainToNode,
Note: See TracChangeset for help on using the changeset viewer.