LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 May 2006 01:43:26 +0000 (01:43 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 May 2006 01:43:26 +0000 (01:43 +0000)
commit1905fbb8db4a38eab876d3007d3dd4bc5304eb66
tree06536d91029969d51d6a2105c6abf226d6be2ded
parent92d0071e837ed74355916d08e48f98054d86dbd2
LayoutTests:

        Reviewed by harrison

        Pasted content would end up inside the block that contained the end of
        the selection that was pasted into and not the block that contained
        the start of the selection that was pasted into:
        * editing/pasteboard/merge-end-5-expected.checksum: Added.
        * editing/pasteboard/merge-end-5-expected.png: Added.
        * editing/pasteboard/merge-end-5-expected.txt: Added.
        * editing/pasteboard/merge-end-5.html: Added.

        Inserting a paragraph separator was splitting and cloning the body element
        if the html element was editable:
        * editing/inserting/editable-html-element-expected.checksum: Added.
        * editing/inserting/editable-html-element-expected.png: Added.
        * editing/inserting/editable-html-element-expected.txt: Added.
        * editing/inserting/editable-html-element.html: Added.

        Since we now sometimes merge backward (from content already in the
        document to just inserted content) during the end merge, the node that
        contains the old caret is removed more often during paste.  The editing
        delegate notifications in these tests reflect this:
        * editing/pasteboard/paste-line-endings-007-expected.txt:
        * editing/pasteboard/paste-line-endings-008-expected.txt:
        * editing/pasteboard/paste-line-endings-009-expected.txt:

        Now demonstrates a bug where the html element is focused, but its contents
        aren't selected:
        * editing/selection/focus_editable_html-expected.checksum:
        * editing/selection/focus_editable_html-expected.png:
        * editing/selection/focus_editable_html-expected.txt:
        * editing/selection/focus_editable_html.html:

WebCore:

        Reviewed by harrison

        * dom/Node.cpp:
        (WebCore::Node::rootEditableElement):
        Restored code to stop at the body tag.  Editing shouldn't be allowed to
        happen outside the body, so it needs to be the editable root even if the
        html element is contentEditable.
        * editing/ReplaceSelectionCommand.cpp:
        (WebCore::ReplaceSelectionCommand::shouldMergeEnd):
        Now takes in more information so it can be "the decider".
        (WebCore::ReplaceSelectionCommand::doApply):
        Merging two paragraphs will destroy the moved one's block styles. Perform
        the end merge backward (from content already in the document to just inserted
        content) if moving forward would move the paragraph that contained the start of
        the selection being pasted into, since we always want to preserve that paragraph's
        block style.
        Moving backward in this case is also helpful because otherwise it would be
        difficult to remember the position where inserted content began (since merging
        would remove m_firstNodeInserted).  That position is needed in order to select
        the replacement and to add smart replace whitespace.
        (WebCore::ReplaceSelectionCommand::removeEndBRIfNeeded):
        If [br, 0] is at the end of a block, the br is not necessarily collapsed
        in quirks mode.  [br, 0] needs to also not be at the start of a block.

        * editing/ReplaceSelectionCommand.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14195 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/inserting/editable-html-element-expected.checksum [new file with mode: 0644]
LayoutTests/editing/inserting/editable-html-element-expected.png [new file with mode: 0644]
LayoutTests/editing/inserting/editable-html-element-expected.txt [new file with mode: 0644]
LayoutTests/editing/inserting/editable-html-element.html [new file with mode: 0644]
LayoutTests/editing/pasteboard/merge-end-5-expected.checksum [new file with mode: 0644]
LayoutTests/editing/pasteboard/merge-end-5-expected.png [new file with mode: 0644]
LayoutTests/editing/pasteboard/merge-end-5-expected.txt [new file with mode: 0644]
LayoutTests/editing/pasteboard/merge-end-5.html [new file with mode: 0644]
LayoutTests/editing/pasteboard/paste-line-endings-007-expected.txt
LayoutTests/editing/pasteboard/paste-line-endings-008-expected.txt
LayoutTests/editing/pasteboard/paste-line-endings-009-expected.txt
LayoutTests/editing/selection/focus_editable_html-expected.checksum
LayoutTests/editing/selection/focus_editable_html-expected.png
LayoutTests/editing/selection/focus_editable_html-expected.txt
LayoutTests/editing/selection/focus_editable_html.html
WebCore/ChangeLog
WebCore/dom/Node.cpp
WebCore/editing/ReplaceSelectionCommand.cpp
WebCore/editing/ReplaceSelectionCommand.h