LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Mar 2007 20:42:15 +0000 (20:42 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Mar 2007 20:42:15 +0000 (20:42 +0000)
commitb26a92f4cf2dd1d07390d7d5fe5c8c5a55680650
tree0864a35226f6429c435585bf11af43e04b0203e5
parentbfe79a28a07644d5d1993854199bab6c7e5cf7bb
LayoutTests:

        Reviewed by darin

        Fixed (was missing a newline):
        * editing/execCommand/4917055-expected.txt:
        Tests setting a caet before the image and changing its alignment:
        * editing/execCommand/5080333-1-expected.checksum: Added.
        * editing/execCommand/5080333-1-expected.png: Added.
        * editing/execCommand/5080333-1-expected.txt: Added.
        * editing/execCommand/5080333-1.html: Added.
        Tests selecting the image and changing its alignment:
        * editing/execCommand/5080333-2-expected.checksum: Added.
        * editing/execCommand/5080333-2-expected.png: Added.
        * editing/execCommand/5080333-2-expected.txt: Added.
        * editing/execCommand/5080333-2.html: Added.

WebCore:

        Reviewed by darin

        <rdar://problem/5080333>
        REGRESSION: Selection changes when changing the alignment of an image

        Regression occurred when we started using moveParagraphs
        to move content in applyBlockStyle.  moveParagraphs
        moves by copying, deleting and reinserting content, and
        so must be accompanied by selection preservation code.
        That code uses rangeFromLocationAndLength and rangeLength,
        which use TextIterators, which don't emit anything for images
        and other replaced elements, causing this bug.

        * editing/ApplyStyleCommand.cpp:
        (WebCore::ApplyStyleCommand::applyBlockStyle): Ask rangeLength
        and rangeFromLocationAndLength to request that their
        TextIterators emit spaces for replaced elements.
        Use rangeCompliantEquivalent()s when creating a Range from
        VisiblePositions, since some VisiblePositions have illegal
        deepEquivalent()s.
        * editing/CompositeEditCommand.cpp:
        (WebCore::CompositeEditCommand::moveParagraphs): Ditto.
        * editing/TextIterator.cpp:
        (WebCore::TextIterator::TextIterator):
        (WebCore::TextIterator::handleReplacedElement): Emit
        a space if requested.
        (WebCore::TextIterator::representNodeOffsetZero): Emit
        ranges before m_node, not around m_lastTextNode.  These
        ranges should represent the part of the document associated
        with the emitted character.
        (WebCore::TextIterator::rangeLength): Take in the new bool.
        (WebCore::TextIterator::rangeFromLocationAndLength): Ditto.
        Also, don't loop an extra time after finding the end of the
        range when we're looking for zero length ranges.  This appeared
        to be a workaround for the bugs fixed in representNodeOffsetZero
        in this patch.
        * editing/TextIterator.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@20449 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/execCommand/4917055-expected.txt
LayoutTests/editing/execCommand/5080333-1-expected.checksum [new file with mode: 0644]
LayoutTests/editing/execCommand/5080333-1-expected.png [new file with mode: 0644]
LayoutTests/editing/execCommand/5080333-1-expected.txt [new file with mode: 0644]
LayoutTests/editing/execCommand/5080333-1.html [new file with mode: 0644]
LayoutTests/editing/execCommand/5080333-2-expected.checksum [new file with mode: 0644]
LayoutTests/editing/execCommand/5080333-2-expected.png [new file with mode: 0644]
LayoutTests/editing/execCommand/5080333-2-expected.txt [new file with mode: 0644]
LayoutTests/editing/execCommand/5080333-2.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/editing/ApplyStyleCommand.cpp
WebCore/editing/CompositeEditCommand.cpp
WebCore/editing/TextIterator.cpp
WebCore/editing/TextIterator.h