Title: [157944] trunk
Revision
157944
Author
[email protected]
Date
2013-10-24 12:18:30 -0700 (Thu, 24 Oct 2013)

Log Message

[contenteditable] Content after non-editable element disappears when merging lines using backspace
https://bugs.webkit.org/show_bug.cgi?id=122748

Patch by Santosh Mahto <[email protected]> on 2013-10-24
Reviewed by Ryosuke Niwa.

Source/WebCore:

In case of paragraph merging after deletion if second paragraph
contains non-editable element, then content after the non-editable
element(including non-editable element) will be removed while the
content before the element will be merged with the first paragraph.
This happens becasue endOfParagraphToMove calculation in merging function
stop at editing boundary so endOfParagraphToMove becomes position just
before non-editable content.
With this patch now endOfParagraphToMove is calculated by skipping
over the non-editable element.

Test: editing/deleting/merge-paragraph-contatining-noneditable.html

* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::mergeParagraphs): use CanSkipOverEditingBoundary
condition while calculating endOfParagraphToMove.

LayoutTests:

Adding test to verify that on merging the paragraph containing
non-editable element does not cause loss of non-editable content after
merging.

* editing/deleting/merge-paragraph-contatining-noneditable-expected.txt: Added.
* editing/deleting/merge-paragraph-contatining-noneditable.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (157943 => 157944)


--- trunk/LayoutTests/ChangeLog	2013-10-24 19:12:11 UTC (rev 157943)
+++ trunk/LayoutTests/ChangeLog	2013-10-24 19:18:30 UTC (rev 157944)
@@ -1,3 +1,17 @@
+2013-10-24  Santosh Mahto  <[email protected]>
+
+        [contenteditable] Content after non-editable element disappears when merging lines using backspace
+        https://bugs.webkit.org/show_bug.cgi?id=122748
+
+        Reviewed by Ryosuke Niwa.
+
+        Adding test to verify that on merging the paragraph containing
+        non-editable element does not cause loss of non-editable content after
+        merging.
+
+        * editing/deleting/merge-paragraph-contatining-noneditable-expected.txt: Added.
+        * editing/deleting/merge-paragraph-contatining-noneditable.html: Added.
+
 2013-10-24  Alexey Proskuryakov  <[email protected]>
 
         Layout Test compositing/regions/propagate-region-box-shadow-border-padding-for-video.html is flaky

Added: trunk/LayoutTests/editing/deleting/merge-paragraph-contatining-noneditable-expected.txt (0 => 157944)


--- trunk/LayoutTests/editing/deleting/merge-paragraph-contatining-noneditable-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/deleting/merge-paragraph-contatining-noneditable-expected.txt	2013-10-24 19:18:30 UTC (rev 157944)
@@ -0,0 +1,32 @@
+This test verifies merging of second paragraph containing non-editable element with first paragraph does not cause loss of element in second paragraph.
+Expected behavior is on hitting backspace all three word (First, Second and Third) should be visible and merged at the end of first line.
+
+Before:
+| "
+        "
+| <p>
+|   "First Paragraph."
+| "
+        "
+| <p>
+|   id="paragraph"
+|   "<#selection-caret>First"
+|   <span>
+|     class="noteditable"
+|     contenteditable="false"
+|     "Second"
+|   "Third"
+| "
+    "
+
+After:
+| "
+        "
+| <p>
+|   "First Paragraph.<#selection-caret>First"
+|   <span>
+|     class="noteditable"
+|     "Second"
+|   "Third"
+| "
+    "

Added: trunk/LayoutTests/editing/deleting/merge-paragraph-contatining-noneditable.html (0 => 157944)


--- trunk/LayoutTests/editing/deleting/merge-paragraph-contatining-noneditable.html	                        (rev 0)
+++ trunk/LayoutTests/editing/deleting/merge-paragraph-contatining-noneditable.html	2013-10-24 19:18:30 UTC (rev 157944)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<body>
+    <div id="container" contenteditable="true">
+        <p>First Paragraph.</p>
+        <p id="paragraph">First<span class="noteditable" contenteditable="false">Second</span>Third</p>
+    </div>
+    <script src=""
+    <script>
+        Markup.description('This test verifies merging of second paragraph containing non-editable element with first paragraph does not cause loss of element in second paragraph.\nExpected behavior is on hitting backspace all three word (First, Second and Third) should be visible and merged at the end of first line.');
+
+        getSelection().collapse(document.getElementById("paragraph"), 0);
+        Markup.dump('container', 'Before');
+
+        document.execCommand("Delete");
+        Markup.dump('container', 'After');
+    </script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (157943 => 157944)


--- trunk/Source/WebCore/ChangeLog	2013-10-24 19:12:11 UTC (rev 157943)
+++ trunk/Source/WebCore/ChangeLog	2013-10-24 19:18:30 UTC (rev 157944)
@@ -1,3 +1,26 @@
+2013-10-24  Santosh Mahto  <[email protected]>
+
+        [contenteditable] Content after non-editable element disappears when merging lines using backspace
+        https://bugs.webkit.org/show_bug.cgi?id=122748
+
+        Reviewed by Ryosuke Niwa.
+
+        In case of paragraph merging after deletion if second paragraph
+        contains non-editable element, then content after the non-editable
+        element(including non-editable element) will be removed while the
+        content before the element will be merged with the first paragraph.
+        This happens becasue endOfParagraphToMove calculation in merging function
+        stop at editing boundary so endOfParagraphToMove becomes position just
+        before non-editable content.
+        With this patch now endOfParagraphToMove is calculated by skipping
+        over the non-editable element.
+
+        Test: editing/deleting/merge-paragraph-contatining-noneditable.html
+
+        * editing/DeleteSelectionCommand.cpp:
+        (WebCore::DeleteSelectionCommand::mergeParagraphs): use CanSkipOverEditingBoundary
+        condition while calculating endOfParagraphToMove.
+
 2013-10-24  Antoine Quint  <[email protected]>
 
         Web Inspector: Inspector doesn't show webkitTransitionEnd events in the timeline

Modified: trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp (157943 => 157944)


--- trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp	2013-10-24 19:12:11 UTC (rev 157943)
+++ trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp	2013-10-24 19:18:30 UTC (rev 157944)
@@ -637,7 +637,7 @@
     if (mergeDestination == startOfParagraphToMove)
         return;
         
-    VisiblePosition endOfParagraphToMove = endOfParagraph(startOfParagraphToMove);
+    VisiblePosition endOfParagraphToMove = endOfParagraph(startOfParagraphToMove, CanSkipOverEditingBoundary);
     
     if (mergeDestination == endOfParagraphToMove)
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to