Title: [152260] branches/safari-537-branch

Diff

Modified: branches/safari-537-branch/LayoutTests/ChangeLog (152259 => 152260)


--- branches/safari-537-branch/LayoutTests/ChangeLog	2013-07-01 21:10:46 UTC (rev 152259)
+++ branches/safari-537-branch/LayoutTests/ChangeLog	2013-07-01 21:12:21 UTC (rev 152260)
@@ -1,5 +1,21 @@
 2013-07-01  Lucas Forschler  <[email protected]>
 
+        Merge r152185
+
+    2013-06-28  Ryosuke Niwa  <[email protected]>
+
+            -webkit-line-break: after-white-space sometimes truncates DOM on copy & paste
+            https://bugs.webkit.org/show_bug.cgi?id=118164
+
+            Reviewed by Sam Weinig.
+
+            Add a regression test.
+
+            * editing/pasteboard/simplfiying-markup-should-not-strip-content-expected.txt: Added.
+            * editing/pasteboard/simplfiying-markup-should-not-strip-content.html: Added.
+
+2013-07-01  Lucas Forschler  <[email protected]>
+
         Merge r152198
 
     2013-06-28  Ryosuke Niwa  <[email protected]>

Copied: branches/safari-537-branch/LayoutTests/editing/pasteboard/simplfiying-markup-should-not-strip-content-expected.txt (from rev 152185, trunk/LayoutTests/editing/pasteboard/simplfiying-markup-should-not-strip-content-expected.txt) (0 => 152260)


--- branches/safari-537-branch/LayoutTests/editing/pasteboard/simplfiying-markup-should-not-strip-content-expected.txt	                        (rev 0)
+++ branches/safari-537-branch/LayoutTests/editing/pasteboard/simplfiying-markup-should-not-strip-content-expected.txt	2013-07-01 21:12:21 UTC (rev 152260)
@@ -0,0 +1,39 @@
+This tests copying and pasting doesn't strip content.
+To manually test, copy the content in the first box and paste it into the second box.
+
+Original content:
+| "
+"
+| <font>
+|   face="Verdana"
+|   "hello "
+| <br>
+| "
+"
+| <font>
+|   face="Verdana"
+|   <div>
+|     style="-webkit-line-break: after-white-space;"
+|     <div>
+|       <font>
+|         face="Verdana"
+|         "world"
+|     "
+"
+|     <div>
+|       style="-webkit-line-break: after-white-space; "
+|       <font>
+|         face="Verdana"
+|         "WebKit"
+|   "
+"
+
+Pasted content:
+| <font>
+|   face="Verdana"
+|   "hello "
+| <br>
+|   style="font-family: Helvetica;"
+| <font>
+|   face="Verdana"
+|   "worldWebKit<#selection-caret>"

Copied: branches/safari-537-branch/LayoutTests/editing/pasteboard/simplfiying-markup-should-not-strip-content.html (from rev 152185, trunk/LayoutTests/editing/pasteboard/simplfiying-markup-should-not-strip-content.html) (0 => 152260)


--- branches/safari-537-branch/LayoutTests/editing/pasteboard/simplfiying-markup-should-not-strip-content.html	                        (rev 0)
+++ branches/safari-537-branch/LayoutTests/editing/pasteboard/simplfiying-markup-should-not-strip-content.html	2013-07-01 21:12:21 UTC (rev 152260)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<body style="font-family: Helvetica">
+<p id="description">This tests copying and pasting doesn't strip content.
+To manually test, copy the content in the first box and paste it into the second box.</p>
+<div id="source" contenteditable style="border: solid 1px; black; margin: 5px;">
+<font face="Verdana">hello&nbsp;</font><br>
+<font face="Verdana"><div style="-webkit-line-break: after-white-space;"><div><font face="Verdana">world</font></div>
+<div style="-webkit-line-break: after-white-space; "><font face="Verdana">WebKit</font></div></div>
+</div>
+<div id="destination" contenteditable style="border: solid 1px black; margin: 5px;"><br></div>
+<script src=""
+<script>
+
+Markup.description(document.getElementById('description').textContent);
+
+document.getElementById('source').focus();
+document.execCommand('selectall', false, null);
+document.execCommand('copy', false, null);
+if (document.queryCommandEnabled('paste')) {
+    document.getElementById('destination').focus();
+    document.execCommand('paste', false, null);
+
+    Markup.dump('source', 'Original content');
+    Markup.dump('destination', 'Pasted content');
+}
+
+</script>
+</body>
+</html>

Modified: branches/safari-537-branch/Source/WebCore/ChangeLog (152259 => 152260)


--- branches/safari-537-branch/Source/WebCore/ChangeLog	2013-07-01 21:10:46 UTC (rev 152259)
+++ branches/safari-537-branch/Source/WebCore/ChangeLog	2013-07-01 21:12:21 UTC (rev 152260)
@@ -1,5 +1,28 @@
 2013-07-01  Lucas Forschler  <[email protected]>
 
+        Merge r152185
+
+    2013-06-28  Ryosuke Niwa  <[email protected]>
+
+            -webkit-line-break: after-white-space sometimes truncates DOM on copy & paste
+            https://bugs.webkit.org/show_bug.cgi?id=118164
+
+            Reviewed by Sam Weinig.
+
+            We can't assume that all subsequent ancestors contain exactly one child since they could have been
+            added in the first if statement matching: currentNode->parentNode() != rootNode && isRemovableBlock(currentNode)
+
+            Exit early when we encounter such an ancestor since removing its ancestor (that contains multiple children
+            some of which aren't in nodesToRemove) can clobber more nodes than we're allowed to remove.
+
+            Test: editing/pasteboard/simplfiying-markup-should-not-strip-content.html
+
+            * editing/SimplifyMarkupCommand.cpp:
+            (WebCore::SimplifyMarkupCommand::doApply):
+            (WebCore::SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove):
+
+2013-07-01  Lucas Forschler  <[email protected]>
+
         Merge r152234
 
     2013-06-27  Jer Noble  <[email protected]>

Modified: branches/safari-537-branch/Source/WebCore/editing/SimplifyMarkupCommand.cpp (152259 => 152260)


--- branches/safari-537-branch/Source/WebCore/editing/SimplifyMarkupCommand.cpp	2013-07-01 21:10:46 UTC (rev 152259)
+++ branches/safari-537-branch/Source/WebCore/editing/SimplifyMarkupCommand.cpp	2013-07-01 21:12:21 UTC (rev 152260)
@@ -44,6 +44,8 @@
     Node* rootNode = m_firstNode->parentNode();
     Vector<RefPtr<Node> > nodesToRemove;
     
+    document()->updateLayoutIgnorePendingStylesheets();
+
     // Walk through the inserted nodes, to see if there are elements that could be removed
     // without affecting the style. The goal is to produce leaner markup even when starting
     // from a verbose fragment.
@@ -102,7 +104,8 @@
     for (; pastLastNodeToRemove < nodesToRemove.size(); ++pastLastNodeToRemove) {
         if (nodesToRemove[pastLastNodeToRemove - 1]->parentNode() != nodesToRemove[pastLastNodeToRemove])
             break;
-        ASSERT(nodesToRemove[pastLastNodeToRemove]->firstChild() == nodesToRemove[pastLastNodeToRemove]->lastChild());
+        if (nodesToRemove[pastLastNodeToRemove]->firstChild() != nodesToRemove[pastLastNodeToRemove]->lastChild())
+            break;
     }
 
     Node* highestAncestorToRemove = nodesToRemove[pastLastNodeToRemove - 1].get();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to