Reviewed by Darin.
authorharrison <harrison@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2007 22:06:52 +0000 (22:06 +0000)
committerharrison <harrison@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2007 22:06:52 +0000 (22:06 +0000)
commitc47c153bd17f9024f4fb93948ebc7f01429b6519
tree3b3fc7a6b98c7b2b306a52edd316dddac5ad003a
parente4688838a9be11793952285b3a13840bad98117b
    Reviewed by Darin.

        <rdar://problem/5415006> Command Left in a To Do causes caret to disappear

        The selection was ending up inside non-editable content at the To Do Options
        arrow image, rather then at the editable position just to the left of that image.
        The problem was that startPositionForLine looked only at line boxes, and there
        is no linebox for the editable position at the far left of a To Do, which is
        a table. Addressed by having startPositionForLine use table offset 0 instead
        of the first VisiblePosition inside the table.

        Found and fixed the similar case with option-left (move by word position).

        Test cases:
        * editing/selection/mixed-editability-8.html: Added.
        * editing/selection/mixed-editability-9.html: Added.

        Source changes:
        * editing/SelectionController.cpp:
        (WebCore::SelectionController::modifyMovingLeftBackward):

        * editing/VisiblePosition.cpp:
        (WebCore::VisiblePosition::next):
        (WebCore::VisiblePosition::previous):
        (WebCore::VisiblePosition::stayInEditableContentLeft):
        (WebCore::VisiblePosition::stayInEditableContentRight):
        Factored stayInEditableContentLeft() and stayInEditableContentRight()
        out of previous() and next().

        * editing/VisiblePosition.h:
        Declare stayInEditableContentLeft() and stayInEditableContentRight().

        * editing/visible_units.cpp:
        (WebCore::previousWordPosition):
        (WebCore::nextWordPosition):
        (WebCore::startOfLine):
        (WebCore::endOfLine):
        (WebCore::previousSentencePosition):
        (WebCore::nextSentencePosition):
        Call stayInEditableContentLeft() or stayInEditableContentRight(), as
        appropriate, so prevent crossing from editable content into
        uneditable content.

        (WebCore::startPositionForLine):
        Use table offset 0 instead of the first VisiblePosition in the table.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25280 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebCore/ChangeLog
WebCore/editing/SelectionController.cpp
WebCore/editing/VisiblePosition.cpp
WebCore/editing/VisiblePosition.h
WebCore/editing/visible_units.cpp