2011-03-15 Ryosuke Niwa <rniwa@webkit.org>
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2011 22:37:47 +0000 (22:37 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2011 22:37:47 +0000 (22:37 +0000)
commitedc80a7417be2268e9849d97df660101222c1ad0
treebdb62b08daaca62c01809b9c22a14a0f6b3c3ff6
parent0e4f669b2185270404fc9a3f6edecbf177584891
2011-03-15  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Tony Chang.

        Crash in ReplaceSelectionCommand::doApply when inserting a node under a document node
        https://bugs.webkit.org/show_bug.cgi?id=56372

        The bug was caused by insertNodeAfter's calling parentElement on document's child.
        Fixed this by changing the node that AppendNodeCommand takes.

        There was also a bug that document node always returned false for isContentEditable
        and isContentRichlyEditable because they never overrode Node's default implementation.
        Fixed this by overriding them in Document.

        Test: editing/execCommand/append-node-under-document.html

        * dom/Document.cpp:
        (WebCore::Document::isContentEditable): Added.
        (WebCore::Document::isContentRichlyEditable): Added.
        * dom/Document.h:
        * editing/AppendNodeCommand.cpp:
        (WebCore::AppendNodeCommand::AppendNodeCommand): Takes ContainerNode instead of Element.
        * editing/AppendNodeCommand.h:
        (WebCore::AppendNodeCommand::create): Ditto.
        * editing/CompositeEditCommand.cpp:
        (WebCore::CompositeEditCommand::appendNode): Ditto.
        (WebCore::CompositeEditCommand::insertNodeAfter): Calls parentNode instead of parentElement.
        * editing/CompositeEditCommand.h:
2011-03-15  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Tony Chang.

        Crash in ReplaceSelectionCommand::doApply when inserting a node under a document node
        https://bugs.webkit.org/show_bug.cgi?id=56372

        Added a test to ensure WebKit does not crash when appending a node to a document
        that has only two nested iframes.

        * editing/execCommand/append-node-under-document-expected.txt: Added.
        * editing/execCommand/append-node-under-document.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@81185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/editing/execCommand/append-node-under-document-expected.txt [new file with mode: 0644]
LayoutTests/editing/execCommand/append-node-under-document.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/editing/AppendNodeCommand.cpp
Source/WebCore/editing/AppendNodeCommand.h
Source/WebCore/editing/CompositeEditCommand.cpp
Source/WebCore/editing/CompositeEditCommand.h