WebCore:
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Sep 2007 01:39:59 +0000 (01:39 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Sep 2007 01:39:59 +0000 (01:39 +0000)
commit1e66a7eb29436307d810f344a6950f382d43ad5a
tree9d2f28bb0c7650a7efeb361228baf96ce767a892
parent672883b8f40fe11009c00585713661a9da58e48b
WebCore:

        Reviewed by Darin.

        <rdar://problem/5478250> REGRESSION: After pasting text copied from Mail subject and typing return, the cursor disappears because of negative left margin

        When pasting text from the Mail subject line, the RTF pasteboard contains text that has a first line negative indent along with a
        paragraph indent that has a counteracting positive indent. This results in the first line being flush left justified, and the remaining
        wrapped lines being indented. When this is converted to a DOM fragment, AppKit makes a block element with a margin-left and a negative
        text-indent that matches the RTF. So far this is all correct behavior.

        When this content is pasted on the line of an existing paragraph that has content, ReplaceSelectionCommand will decided to merge the paragraphs.
        This will convert the block element to a style span that has all inherited style properties. These inherited properties will still contain block
        properties that have no affect on inline elements. These block properties will hang around on the style span and will get cloned to new block
        elements if the user hit return on that line. The new block elements would then have the text-indent but not the margin-left, so the text would be
        hidden off the left edge of the page.

        In the end, we should never hang on to block-only properties in our style spans. This cuts out meaningless properties and prevents properties
        from magically affecting blocks later if the style is cloned for a new block element during a future editing operation.

        * editing/ReplaceSelectionCommand.cpp:
        (WebCore::ReplaceSelectionCommand::removeRedundantStyles): Remove any inherited block properties that are now in the span's style.
        * editing/markup.cpp:
        (WebCore::createMarkup): Ditto.

LayoutTests:

        Reviewed by Darin.

        Test for <rdar://problem/5478250> REGRESSION: After pasting text copied from Mail subject and typing return, the cursor disappears because of negative left margin

        * editing/pasteboard/5478250.html: Added.
        * platform/mac/editing/pasteboard/5478250-expected.txt: Added.

        Updated results that are affected by the style span being removed or added with different style properties.

        * editing/execCommand/5144139-1-expected.txt:
        * editing/execCommand/create-list-with-hr-expected.txt:
        * editing/pasteboard/merge-end-blockquote-expected.txt:
        * editing/pasteboard/styled-element-markup-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25634 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/editing/execCommand/5144139-1-expected.txt
LayoutTests/editing/execCommand/create-list-with-hr-expected.txt
LayoutTests/editing/pasteboard/5478250.html [new file with mode: 0644]
LayoutTests/editing/pasteboard/merge-end-blockquote-expected.txt
LayoutTests/editing/pasteboard/styled-element-markup-expected.txt
LayoutTests/platform/mac/editing/pasteboard/5478250-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/editing/ReplaceSelectionCommand.cpp
WebCore/editing/markup.cpp