2011-03-10 Ryosuke Niwa <rniwa@webkit.org>
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Mar 2011 00:52:53 +0000 (00:52 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Mar 2011 00:52:53 +0000 (00:52 +0000)
commit6e505e5869f54636200c67393a3cfddb9effe30f
tree376b2e5cc7f95c37a37de8ff1ea05462436151ea
parentf1ee09f6b6be24392903b861483dc11804a777e3
2011-03-10  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Tony Chang.

        startOfBlock and endOfBlock may return a position inside hr
        https://bugs.webkit.org/show_bug.cgi?id=56025

        Replaced calls to enclosingBlockFlowElement in startOfBlock and endOfBlock by
        calls to enclosingBlock. Added EditingBoundaryCrossingRule to the argument lists
        of startOfBlock, endOfBlock, and enclosingBlock. Also replaced the last boolean
        argument variable of enclosingNodeOfType by EditingBoundaryCrossingRule.

        Also replaced calls to enclosingBlockFlowElement in inSameBlock by calls to
        enclosingBlock to be consitent with startOfBlock and endOfBlock.

        This patch also replaced calls to deprecatedNode in startOfBlock, endOfBlock,
        and inSameBlock by calls to containerNode because the enclosing block of a position
        should never be before or after the position.

        No tests are added because this change only affects WebCore internally.

        * editing/DeleteSelectionCommand.cpp:
        (WebCore::DeleteSelectionCommand::initializePositionData): Calls enclosingNodeOfType.
        Pass CanCrossEditingBoundary instead of false.
        * editing/htmlediting.cpp:
        (WebCore::unsplittableElementForPosition): Ditto.
        (WebCore::enclosingBlock): Takes EditingBoundaryCrossingRule and passes it to
        enclosingNodeOfType.
        (WebCore::enclosingNodeOfType): Takes EditingBoundaryCrossingRule instead of boolean.
        Fixed a bug that it stops walking the tree when it reached the root editable node
        even when the editing boundary crossing rule is CanCrossEditingBoundary.
        * editing/htmlediting.h: Prototype changes.
        * editing/visible_units.cpp:
        (WebCore::startOfBlock): Calls enclosingBlock instead of enclosingBlockFlowElement.
        Also added an early exit when there's no enclosing block.
        (WebCore::endOfBlock): Ditto. The early exist in this case prevents crash in
        lastPositionInNode.
        (WebCore::inSameBlock): Calls enclosingBlock instead of enclosingBlockFlowElement.
        (WebCore::isStartOfBlock): Calls startOfBlock with CanCrossEditingBoundary because
        we don't care where the start of block is when we're comparing against the given position.
        (WebCore::isEndOfBlock): Ditto.
        * editing/visible_units.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@80793 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/editing/DeleteSelectionCommand.cpp
Source/WebCore/editing/htmlediting.cpp
Source/WebCore/editing/htmlediting.h
Source/WebCore/editing/visible_units.cpp
Source/WebCore/editing/visible_units.h