2011-03-10 Levi Weintraub <leviw@chromium.org>
authorleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Mar 2011 23:50:56 +0000 (23:50 +0000)
committerleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Mar 2011 23:50:56 +0000 (23:50 +0000)
commit117e7ecf8eff1cd7fff83686d70edcbb678527dc
tree7e5234281b4f805fe614bbacbf30f3feae7cb685
parentc9e89a9a20eae4a210329a20b9dc3a18f0cbb030
2011-03-10  Levi Weintraub  <leviw@chromium.org>

        Reviewed by Ryosuke Niwa.

        InsertUnorderedList over a non-editable region and multiple lines enters an infinite loop
        https://bugs.webkit.org/show_bug.cgi?id=53409

        Avoiding crashes and infinite loops when listifying content with mixed-editability

        * editing/execCommand/insert-list-with-noneditable-content-expected.txt: Added.
        * editing/execCommand/insert-list-with-noneditable-content.html: Added.
2011-03-10  Levi Weintraub  <leviw@chromium.org>

        Reviewed by Ryosuke Niwa.

        InsertUnorderedList over a non-editable region and multiple lines enters an infinite loop
        https://bugs.webkit.org/show_bug.cgi?id=53409

        Fixing broken handling of mixed-editability content for InsertListCommand. Previously, if the selection
        spanned non-contenteditable regions, it would get stuck endlessly iterating the same region as the algorithm
        didn't skip the editable boundary.

        Test: editing/execCommand/insert-list-with-noneditable-content.html

        * editing/CompositeEditCommand.cpp:
        (WebCore::CompositeEditCommand::cleanupAfterDeletion): Changed signature to take the destination
        position for the active editing command. Without this, there are cases when the destination happens
        to be a placeholder, and we remove it.
        (WebCore::CompositeEditCommand::moveParagraphs):
        * editing/CompositeEditCommand.h:
        * editing/InsertListCommand.cpp:
        (WebCore::InsertListCommand::doApply): Added logic to the paragraph iteration loop to handle pockets of
        non-editable content in an editable context. Previously, this could cause an infinite loop.
        * editing/visible_units.cpp:
        (WebCore::startOfParagraph): Added a mode of operation where we'll jump across non-editable
        content in the same paragraph to reach the actual editable paragraph start.
        (WebCore::endOfParagraph): Ditto.
        (WebCore::startOfNextParagraph): Now uses the aforementioned non-editable content skipping mode of
        endOfParagraph.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@80780 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/editing/execCommand/insert-list-with-noneditable-content-expected.txt [new file with mode: 0644]
LayoutTests/editing/execCommand/insert-list-with-noneditable-content.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/editing/CompositeEditCommand.cpp
Source/WebCore/editing/CompositeEditCommand.h
Source/WebCore/editing/InsertListCommand.cpp
Source/WebCore/editing/visible_units.cpp
Source/WebCore/editing/visible_units.h