Commit 82ae4469 authored by adele@apple.com's avatar adele@apple.com

WebCore:

2009-04-25  Adele Peterson  <adele@apple.com>

        Reviewed by Oliver Hunt.

        Fix for <rdar://problem/6712771> REGRESSION(34681): Text is no longer underlined after delete
        https://bugs.webkit.org/show_bug.cgi?id=25396

        Test: editing/deleting/delete-br-013.html

        * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::moveParagraphs):
         Only preserve an empty paragraph's style when moving paragraphs around if the selection is still 
         in an empty paragraph after the move occurs.  This was causing the empty paragraph's style to overwrite
         the previous paragraph's style during a delete of an empty paragraph.

LayoutTests:

2009-04-25  Adele Peterson  <adele@apple.com>

        Reviewed by Oliver Hunt.

        Test for <rdar://problem/6712771> REGRESSION(34681): Text is no longer underlined after delete
        https://bugs.webkit.org/show_bug.cgi?id=25396

        * editing/deleting/delete-br-013.html: Added.
        * platform/mac/editing/deleting/delete-br-013-expected.checksum: Added.
        * platform/mac/editing/deleting/delete-br-013-expected.png: Added.
        * platform/mac/editing/deleting/delete-br-013-expected.txt: Added.



git-svn-id: svn://svn.chromium.org/blink/trunk@42869 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 6fd0c25e
2009-04-25 Adele Peterson <adele@apple.com>
Reviewed by Oliver Hunt.
Test for <rdar://problem/6712771> REGRESSION(34681): Text is no longer underlined after delete
https://bugs.webkit.org/show_bug.cgi?id=25396
* editing/deleting/delete-br-013.html: Added.
* platform/mac/editing/deleting/delete-br-013-expected.checksum: Added.
* platform/mac/editing/deleting/delete-br-013-expected.png: Added.
* platform/mac/editing/deleting/delete-br-013-expected.txt: Added.
2009-04-24 Pierre d'Herbemont <pdherbemont@apple.com> 2009-04-24 Pierre d'Herbemont <pdherbemont@apple.com>
Reviewed by Simon Fraser Reviewed by Simon Fraser
<html>
<head>
<script>
function test()
{
var sel = window.getSelection();
sel.setPosition(document.getElementById('dv'), 0);
document.execCommand("Delete");
}
</script>
</head>
<body onload="test()">
<div>This tests that we only preserve an empty paragraph's style when moving paragraphs around if the selection is still in an empty paragraph after the move occurs.</div>
<div>The test passes if the text below is still underlined.</div><br>
<div contenteditable><span class="Apple-style-span" style="text-decoration: underline;">This text should be underlined</span><div id="dv"><br></div></div>
</body>
</html>
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {DIV} at (0,0) size 784x36
RenderText {#text} at (0,0) size 751x36
text run at (0,0) width 751: "This tests that we only preserve an empty paragraph's style when moving paragraphs around if the selection is still in an"
text run at (0,18) width 249: "empty paragraph after the move occurs."
RenderBlock {DIV} at (0,36) size 784x18
RenderText {#text} at (0,0) size 315x18
text run at (0,0) width 315: "The test passes if the text below is still underlined."
RenderBlock (anonymous) at (0,54) size 784x18
RenderBR {BR} at (0,0) size 0x18
RenderBlock {DIV} at (0,72) size 784x18
RenderInline {SPAN} at (0,0) size 191x18
RenderText {#text} at (0,0) size 191x18
text run at (0,0) width 191: "This text should be underlined"
caret: position 30 of child 0 {#text} of child 0 {SPAN} of child 6 {DIV} of child 1 {BODY} of child 0 {HTML} of document
2009-04-25 Adele Peterson <adele@apple.com>
Reviewed by Oliver Hunt.
Fix for <rdar://problem/6712771> REGRESSION(34681): Text is no longer underlined after delete
https://bugs.webkit.org/show_bug.cgi?id=25396
Test: editing/deleting/delete-br-013.html
* editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::moveParagraphs):
Only preserve an empty paragraph's style when moving paragraphs around if the selection is still
in an empty paragraph after the move occurs. This was causing the empty paragraph's style to overwrite
the previous paragraph's style during a delete of an empty paragraph.
2009-04-25 Eric Carlson <eric.carlson@apple.com> 2009-04-25 Eric Carlson <eric.carlson@apple.com>
Reviewed by Darin Adler. Reviewed by Darin Adler.
...@@ -850,8 +850,10 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap ...@@ -850,8 +850,10 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
setEndingSelection(destination); setEndingSelection(destination);
applyCommandToComposite(ReplaceSelectionCommand::create(document(), fragment, true, false, !preserveStyle, false, true)); applyCommandToComposite(ReplaceSelectionCommand::create(document(), fragment, true, false, !preserveStyle, false, true));
// Restore styles from an empty paragraph to the new empty paragraph.
if (styleInEmptyParagraph) // If the selection is in an empty paragraph, restore styles from the old empty paragraph to the new empty paragraph.
bool selectionIsEmptyParagraph = endingSelection().isCaret() && isStartOfParagraph(endingSelection().visibleStart()) && isEndOfParagraph(endingSelection().visibleStart());
if (styleInEmptyParagraph && selectionIsEmptyParagraph)
applyStyle(styleInEmptyParagraph.get()); applyStyle(styleInEmptyParagraph.get());
if (preserveSelection && startIndex != -1) { if (preserveSelection && startIndex != -1) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment