2010-12-05 Ryosuke Niwa <rniwa@webkit.org>
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Dec 2010 00:31:34 +0000 (00:31 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Dec 2010 00:31:34 +0000 (00:31 +0000)
commit804eb6ab763ced1fc5b5c753443d5aacac87df47
treeb0be1df9092e9191cf6c0fee96d5c175f56e7d8b
parent4bbc48985f2d428b788302711a71d2d42c587f28
2010-12-05  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Tony Chang.

        Executing FormatBlock on multiple paragraphs inside pre does not remove the outer pre
        https://bugs.webkit.org/show_bug.cgi?id=47300

        The bug was caused by FormatBlockCommand::formatRange's not removing refNode when the refNode
        contains more than one paragraphs even when the refNode is fully selected.

        Fixed the bug by modifying FormatBlockCommand::formatRange to correctly remove the node in
        such a situation.

        Also fixed a bug in ApplyBlockElementCommand::formatSelection that the end of selection
        is not properly updated when the end of selection resides in the node split by
        rangeForParagraphSplittingTextNodesIfNeeded or endOfNextParagrahSplittingTextNodesIfNeeded.

        Test: editing/execCommand/format-block-multiple-paragraphs-in-pre.html

        * editing/ApplyBlockElementCommand.cpp:
        (WebCore::ApplyBlockElementCommand::formatSelection): Calls formatRange with m_endOfLastParagraph.
        (WebCore::ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded): Updates
        m_endOfLastParagraph when the position points to the node split by this function.
        (WebCore::ApplyBlockElementCommand::endOfNextParagrahSplittingTextNodesIfNeeded): Ditto.
        * editing/ApplyBlockElementCommand.h: Added m_endOfLastParagraph as a member variable.
        * editing/FormatBlockCommand.cpp:
        (WebCore::FormatBlockCommand::formatRange): See above.
        * editing/FormatBlockCommand.h:
        * editing/IndentOutdentCommand.cpp:
        (WebCore::IndentOutdentCommand::formatRange): Ignores the end of selection.
        * editing/IndentOutdentCommand.h:
2010-12-05  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Tony Chang.

        Executing FormatBlock on multiple paragraphs inside pre does not remove the outer pre
        https://bugs.webkit.org/show_bug.cgi?id=47300

        Added a test to ensure execCommand('FormatBlock') correctly removes pre when formatting paragraphs within.
        Also rebaselined several tests because WebKit no longer erroneously format the paragraphs immediately
        after the selection.

        * editing/execCommand/format-block-multiple-paragraphs-in-pre-expected.txt: Added.
        * editing/execCommand/format-block-multiple-paragraphs-in-pre.html: Added.
        * editing/execCommand/format-block-multiple-paragraphs-expected.txt: No longer erroneously format
        the last paragraph in a pre by a blockquote when formatting all but the last paragraph in the pre.
        * editing/execCommand/indent-pre-expected.txt: No longer erroneously format the last paragraph in
        the pre-list by a blockquote.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@73411 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/execCommand/format-block-multiple-paragraphs-expected.txt
LayoutTests/editing/execCommand/format-block-multiple-paragraphs-in-pre-expected.txt [new file with mode: 0644]
LayoutTests/editing/execCommand/format-block-multiple-paragraphs-in-pre.html [new file with mode: 0644]
LayoutTests/editing/execCommand/indent-pre-expected.txt
WebCore/ChangeLog
WebCore/editing/ApplyBlockElementCommand.cpp
WebCore/editing/ApplyBlockElementCommand.h
WebCore/editing/FormatBlockCommand.cpp
WebCore/editing/FormatBlockCommand.h
WebCore/editing/IndentOutdentCommand.cpp
WebCore/editing/IndentOutdentCommand.h