Title: [87937] trunk
Revision
87937
Author
rn...@webkit.org
Date
2011-06-02 12:07:56 -0700 (Thu, 02 Jun 2011)

Log Message

2011-06-02  Ryosuke Niwa  <rn...@webkit.org>

        Reviewed by Eric Seidel.

        REGRESSION: inline style is lost when deleting line break between paragraphs with same style
        https://bugs.webkit.org/show_bug.cgi?id=61899

        Added a regression test to ensure WebKit preserves font family for a paragraph being merged
        to the previous paragraph when deleting a line break between two paragraphs with the same style.

        * editing/deleting/delete-line-break-between-paragraphs-with-same-style-expected.txt: Added.
        * editing/deleting/delete-line-break-between-paragraphs-with-same-style.html: Added.
2011-06-02  Ryosuke Niwa  <rn...@webkit.org>

        Reviewed by Eric Seidel.

        REGRESSION: inline style is lost when deleting line break between paragraphs with same style
        https://bugs.webkit.org/show_bug.cgi?id=61899

        The bug was caused by ReplaceSelectionCommand::doApply's calling handleStyleSpansBeforeInsertion
        before insertionPos is adjusted by positionAvoidingPrecedingNodes and positionOutsideTabSpan.

        Fixed the bug by calling handleStyleSpansBeforeInsertion after the calls to these two functions.

        Test: editing/deleting/delete-line-break-between-paragraphs-with-same-style.html

        * editing/ReplaceSelectionCommand.cpp:
        (WebCore::ReplaceSelectionCommand::doApply):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (87936 => 87937)


--- trunk/LayoutTests/ChangeLog	2011-06-02 19:05:52 UTC (rev 87936)
+++ trunk/LayoutTests/ChangeLog	2011-06-02 19:07:56 UTC (rev 87937)
@@ -1,3 +1,16 @@
+2011-06-02  Ryosuke Niwa  <rn...@webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        REGRESSION: inline style is lost when deleting line break between paragraphs with same style
+        https://bugs.webkit.org/show_bug.cgi?id=61899
+
+        Added a regression test to ensure WebKit preserves font family for a paragraph being merged
+        to the previous paragraph when deleting a line break between two paragraphs with the same style.
+
+        * editing/deleting/delete-line-break-between-paragraphs-with-same-style-expected.txt: Added.
+        * editing/deleting/delete-line-break-between-paragraphs-with-same-style.html: Added.
+
 2011-06-01  Ryosuke Niwa  <rn...@webkit.org>
 
         Reviewed by Simon Fraser.

Added: trunk/LayoutTests/editing/deleting/delete-line-break-between-paragraphs-with-same-style-expected.txt (0 => 87937)


--- trunk/LayoutTests/editing/deleting/delete-line-break-between-paragraphs-with-same-style-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/deleting/delete-line-break-between-paragraphs-with-same-style-expected.txt	2011-06-02 19:07:56 UTC (rev 87937)
@@ -0,0 +1,14 @@
+This tests deleting a line break between paragraphs with the same inline style. Inline style should be preserved after the merge.
+| "
+"
+| <div>
+|   <font>
+|     class="Apple-style-span"
+|     face="monospace"
+|     "hello world<#selection-caret>"
+|   <span>
+|     class="Apple-style-span"
+|     style="font-family: monospace; "
+|     "WebKit"
+| "
+"

Added: trunk/LayoutTests/editing/deleting/delete-line-break-between-paragraphs-with-same-style.html (0 => 87937)


--- trunk/LayoutTests/editing/deleting/delete-line-break-between-paragraphs-with-same-style.html	                        (rev 0)
+++ trunk/LayoutTests/editing/deleting/delete-line-break-between-paragraphs-with-same-style.html	2011-06-02 19:07:56 UTC (rev 87937)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div id="test" contenteditable>
+<div><font class="Apple-style-span" face="monospace">hello world</font></div><div><font class="Apple-style-span" face="monospace">WebKit</font></div>
+</div>
+<script src=""
+<script>
+
+Markup.description('This tests deleting a line break between paragraphs with the same inline style.'
++ ' Inline style should be preserved after the merge.');
+
+document.getElementById('test').focus();
+window.getSelection().modify('move', 'forward', 'line');
+document.execCommand('Delete');
+
+Markup.dump('test');
+
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (87936 => 87937)


--- trunk/Source/WebCore/ChangeLog	2011-06-02 19:05:52 UTC (rev 87936)
+++ trunk/Source/WebCore/ChangeLog	2011-06-02 19:07:56 UTC (rev 87937)
@@ -1,3 +1,20 @@
+2011-06-02  Ryosuke Niwa  <rn...@webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        REGRESSION: inline style is lost when deleting line break between paragraphs with same style
+        https://bugs.webkit.org/show_bug.cgi?id=61899
+
+        The bug was caused by ReplaceSelectionCommand::doApply's calling handleStyleSpansBeforeInsertion
+        before insertionPos is adjusted by positionAvoidingPrecedingNodes and positionOutsideTabSpan.
+
+        Fixed the bug by calling handleStyleSpansBeforeInsertion after the calls to these two functions.
+
+        Test: editing/deleting/delete-line-break-between-paragraphs-with-same-style.html
+
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplaceSelectionCommand::doApply):
+
 2011-06-01  Ryosuke Niwa  <rn...@webkit.org>
 
         Reviewed by Simon Fraser.

Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (87936 => 87937)


--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp	2011-06-02 19:05:52 UTC (rev 87936)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp	2011-06-02 19:07:56 UTC (rev 87937)
@@ -921,8 +921,6 @@
 
     removeHeadContents(fragment);
 
-    bool handledStyleSpans = handleStyleSpansBeforeInsertion(fragment, insertionPos);
-
     // We don't want the destination to end up inside nodes that weren't selected.  To avoid that, we move the
     // position forward without changing the visible position so we're still at the same visible location, but
     // outside of preceding tags.
@@ -931,6 +929,8 @@
     // Paste into run of tabs splits the tab span.
     insertionPos = positionOutsideTabSpan(insertionPos);
 
+    bool handledStyleSpans = handleStyleSpansBeforeInsertion(fragment, insertionPos);
+
     // If we are not trying to match the destination style we prefer a position
     // that is outside inline elements that provide style.
     // This way we can produce a less verbose markup.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to