<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[20707] trunk</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/20707">20707</a></dd>
<dt>Author</dt> <dd>justing</dd>
<dt>Date</dt> <dd>2007-04-04 13:49:52 -0700 (Wed, 04 Apr 2007)</dd>
</dl>
<h3>Log Message</h3>
<pre>LayoutTests:
Reviewed by darin
<rdar://problem/5026848> Can cut/delete To Do subunits
This tests to make sure that non-editable content
that is in both the start and end editable roots
is removed:
* editing/deleting/5026848-1-expected.checksum: Added.
* editing/deleting/5026848-1-expected.png: Added.
* editing/deleting/5026848-1-expected.txt: Added.
* editing/deleting/5026848-1.html: Added.
This tests to make sure that non-editable content
that is not in both the start and end editable roots
is not removed:
* editing/deleting/5026848-2-expected.checksum: Added.
* editing/deleting/5026848-2-expected.png: Added.
* editing/deleting/5026848-2-expected.txt: Added.
* editing/deleting/5026848-2.html: Added.
This tests to make sure that editable regions
that are not in both the start and end editable roots
are cleared (not removed, unless they are in another
editable region):
* editing/deleting/5026848-3-expected.checksum: Added.
* editing/deleting/5026848-3-expected.png: Added.
* editing/deleting/5026848-3-expected.txt: Added.
* editing/deleting/5026848-3.html: Added.
WebCore:
Reviewed by darin
<rdar://problem/5026848> Can cut/delete ToDo subunits
We were removing non-editable content during a delete.
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::initializePositionData):
Set m_startRoot and m_endRoot.
(WebCore::DeleteSelectionCommand::removeNode): If a node
is not inside both the start and end roots, remove it only
if it is in editable content.
* editing/DeleteSelectionCommand.h: Added m_startRoot and
m_endRoot, the editable roots that contain the start and end
of the selection, respectively. We consult these every
time we remove a node, and don't want to recompute them
on every call to removeNode().</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCoreeditingDeleteSelectionCommandcpp">trunk/WebCore/editing/DeleteSelectionCommand.cpp</a></li>
<li><a href="#trunkWebCoreeditingDeleteSelectionCommandh">trunk/WebCore/editing/DeleteSelectionCommand.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestseditingdeleting50268481expectedchecksum">trunk/LayoutTests/editing/deleting/5026848-1-expected.checksum</a></li>
<li><a href="#trunkLayoutTestseditingdeleting50268481expectedpng">trunk/LayoutTests/editing/deleting/5026848-1-expected.png</a></li>
<li><a href="#trunkLayoutTestseditingdeleting50268481expectedtxt">trunk/LayoutTests/editing/deleting/5026848-1-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingdeleting50268481html">trunk/LayoutTests/editing/deleting/5026848-1.html</a></li>
<li><a href="#trunkLayoutTestseditingdeleting50268482expectedchecksum">trunk/LayoutTests/editing/deleting/5026848-2-expected.checksum</a></li>
<li><a href="#trunkLayoutTestseditingdeleting50268482expectedpng">trunk/LayoutTests/editing/deleting/5026848-2-expected.png</a></li>
<li><a href="#trunkLayoutTestseditingdeleting50268482expectedtxt">trunk/LayoutTests/editing/deleting/5026848-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingdeleting50268482html">trunk/LayoutTests/editing/deleting/5026848-2.html</a></li>
<li><a href="#trunkLayoutTestseditingdeleting50268483expectedchecksum">trunk/LayoutTests/editing/deleting/5026848-3-expected.checksum</a></li>
<li><a href="#trunkLayoutTestseditingdeleting50268483expectedpng">trunk/LayoutTests/editing/deleting/5026848-3-expected.png</a></li>
<li><a href="#trunkLayoutTestseditingdeleting50268483expectedtxt">trunk/LayoutTests/editing/deleting/5026848-3-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingdeleting50268483html">trunk/LayoutTests/editing/deleting/5026848-3.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (20706 => 20707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2007-04-04 20:39:00 UTC (rev 20706)
+++ trunk/LayoutTests/ChangeLog        2007-04-04 20:49:52 UTC (rev 20707)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2007-04-03 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by darin
+
+ <rdar://problem/5026848> Can cut/delete To Do subunits
+
+ This tests to make sure that non-editable content
+ that is in both the start and end editable roots
+ is removed:
+ * editing/deleting/5026848-1-expected.checksum: Added.
+ * editing/deleting/5026848-1-expected.png: Added.
+ * editing/deleting/5026848-1-expected.txt: Added.
+ * editing/deleting/5026848-1.html: Added.
+ This tests to make sure that non-editable content
+ that is not in both the start and end editable roots
+ is not removed:
+ * editing/deleting/5026848-2-expected.checksum: Added.
+ * editing/deleting/5026848-2-expected.png: Added.
+ * editing/deleting/5026848-2-expected.txt: Added.
+ * editing/deleting/5026848-2.html: Added.
+ This tests to make sure that editable regions
+ that are not in both the start and end editable roots
+ are cleared (not removed, unless they are in another
+ editable region):
+ * editing/deleting/5026848-3-expected.checksum: Added.
+ * editing/deleting/5026848-3-expected.png: Added.
+ * editing/deleting/5026848-3-expected.txt: Added.
+ * editing/deleting/5026848-3.html: Added.
+
</ins><span class="cx"> 2007-04-03 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><span class="cx"> Reviewed by Adam.
</span></span></pre></div>
<a id="trunkLayoutTestseditingdeleting50268481expectedchecksum"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/deleting/5026848-1-expected.checksum (0 => 20707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/deleting/5026848-1-expected.checksum         (rev 0)
+++ trunk/LayoutTests/editing/deleting/5026848-1-expected.checksum        2007-04-04 20:49:52 UTC (rev 20707)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+07421e18a1ed6f8d8061551cf40f4840
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestseditingdeleting50268481expectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/editing/deleting/5026848-1-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/editing/deleting/5026848-1-expected.png
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:mime-type
</span><span class="cx"> + application/octet-stream
</span><a id="trunkLayoutTestseditingdeleting50268481expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/deleting/5026848-1-expected.txt (0 => 20707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/deleting/5026848-1-expected.txt         (rev 0)
+++ trunk/LayoutTests/editing/deleting/5026848-1-expected.txt        2007-04-04 20:49:52 UTC (rev 20707)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+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 {P} at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 746x36
+ text run at (0,0) width 577: "This tests the deletion of non-editable content that is in both the start and end editable roots. "
+ text run at (577,0) width 141: "It should be removed. "
+ text run at (718,0) width 28: "You"
+ text run at (0,18) width 323: "shouldn't see anything in the editable region below."
+ RenderBlock {DIV} at (0,52) size 784x18
+ RenderBR {BR} at (0,0) size 0x18
+caret: position 0 of child 0 {BR} of child 3 {DIV} of child 0 {BODY} of child 0 {HTML} of document
</ins></span></pre></div>
<a id="trunkLayoutTestseditingdeleting50268481html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/deleting/5026848-1.html (0 => 20707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/deleting/5026848-1.html         (rev 0)
+++ trunk/LayoutTests/editing/deleting/5026848-1.html        2007-04-04 20:49:52 UTC (rev 20707)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+<html>
+<body>
+<p>This tests the deletion of non-editable content that is in both the start and end editable roots. It should be removed. You shouldn't see anything in the editable region below.</p>
+<div id="div" contenteditable="true">foo <span style="color: red;" contenteditable="false">bar</span> baz</div>
+
+<script>
+var div = document.getElementById("div");
+div.focus();
+document.execCommand("SelectAll");
+document.execCommand("Delete");
+</script>
+
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestseditingdeleting50268482expectedchecksum"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/deleting/5026848-2-expected.checksum (0 => 20707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/deleting/5026848-2-expected.checksum         (rev 0)
+++ trunk/LayoutTests/editing/deleting/5026848-2-expected.checksum        2007-04-04 20:49:52 UTC (rev 20707)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+1925325ef015b138ba0c501485d9df65
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestseditingdeleting50268482expectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/editing/deleting/5026848-2-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/editing/deleting/5026848-2-expected.png
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:mime-type
</span><span class="cx"> + application/octet-stream
</span><a id="trunkLayoutTestseditingdeleting50268482expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/deleting/5026848-2-expected.txt (0 => 20707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/deleting/5026848-2-expected.txt         (rev 0)
+++ trunk/LayoutTests/editing/deleting/5026848-2-expected.txt        2007-04-04 20:49:52 UTC (rev 20707)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+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 {P} at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 758x36
+ text run at (0,0) width 758: "This tests to see that selected non-editable nodes that are not in both the start and end editable root are preserved during a"
+ text run at (0,18) width 58: "deletion. "
+ text run at (58,18) width 526: "You should see two 'Non-editable' pieces on either side of the editable piece below."
+ RenderBlock {DIV} at (0,52) size 784x24
+ RenderTable {TABLE} at (0,0) size 280x24
+ RenderTableSection {TBODY} at (0,0) size 280x24
+ RenderTableRow {TR} at (0,2) size 280x20
+ RenderTableCell {TD} at (2,2) size 84x20 [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 82x18
+ text run at (1,1) width 82: "Non-editable"
+ RenderTableCell {TD} at (88,2) size 104x20 [r=0 c=1 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 56x18
+ text run at (1,1) width 56: "Editable "
+ RenderInline {SPAN} at (0,0) size 46x18
+ RenderText {#text} at (57,1) size 46x18
+ text run at (57,1) width 46: "content"
+ RenderTableCell {TD} at (194,2) size 84x20 [r=0 c=2 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 82x18
+ text run at (1,1) width 82: "Non-editable"
+ RenderBlock (anonymous) at (0,24) size 784x0
+caret: position 9 of child 0 {#text} of child 1 {TD} of child 0 {TR} of child 1 {TBODY} of child 1 {TABLE} of child 3 {DIV} of child 0 {BODY} of child 0 {HTML} of document
</ins></span></pre></div>
<a id="trunkLayoutTestseditingdeleting50268482html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/deleting/5026848-2.html (0 => 20707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/deleting/5026848-2.html         (rev 0)
+++ trunk/LayoutTests/editing/deleting/5026848-2.html        2007-04-04 20:49:52 UTC (rev 20707)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+<html>
+<body>
+<p>This tests to see that selected non-editable nodes that are not in both the start and end editable root are preserved during a deletion. You should see two 'Non-editable' pieces on either side of the editable piece below.</p>
+<div id="div" contenteditable="true">
+<table contenteditable="false">
+ <tr>
+ <td>Non-editable</td>
+ <td contenteditable="true">Editable <span id="start">content</span></td>
+ <td>Non-editable</td>
+ </tr>
+</table>
+Editable <span id="end">content</span>
+</div>
+
+<script>
+var sel = window.getSelection();
+var start = document.getElementById("start");
+var end = document.getElementById("end");
+sel.setBaseAndExtent(start, 0, end, 0);
+document.execCommand("Delete");
+</script>
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestseditingdeleting50268483expectedchecksum"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/deleting/5026848-3-expected.checksum (0 => 20707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/deleting/5026848-3-expected.checksum         (rev 0)
+++ trunk/LayoutTests/editing/deleting/5026848-3-expected.checksum        2007-04-04 20:49:52 UTC (rev 20707)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+e2168fe795fd036019af2bdafd84a4d6
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestseditingdeleting50268483expectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/editing/deleting/5026848-3-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/editing/deleting/5026848-3-expected.png
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:mime-type
</span><span class="cx"> + application/octet-stream
</span><a id="trunkLayoutTestseditingdeleting50268483expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/deleting/5026848-3-expected.txt (0 => 20707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/deleting/5026848-3-expected.txt         (rev 0)
+++ trunk/LayoutTests/editing/deleting/5026848-3-expected.txt        2007-04-04 20:49:52 UTC (rev 20707)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+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 {P} at (0,0) size 784x72
+ RenderText {#text} at (0,0) size 777x72
+ text run at (0,0) width 671: "This tests to see that selected editable nodes that are not in both the start and end editable roots are cleared. "
+ text run at (671,0) width 98: "You should see"
+ text run at (0,18) width 471: "one non-editable piece and an editable one and then two empty table cells. "
+ text run at (471,18) width 306: "The table cells are editable but are preserved and"
+ text run at (0,36) width 348: "not removed because they are in a non-editable region. "
+ text run at (348,36) width 407: "They should be completely cleared out, even the second one that"
+ text run at (0,54) width 186: "contains a non-editable piece."
+ RenderBlock {DIV} at (0,88) size 784x28
+ RenderTable {TABLE} at (0,0) size 212x28 [border: (1px outset #808080)]
+ RenderTableSection {TBODY} at (1,1) size 210x26
+ RenderTableRow {TR} at (0,2) size 210x22
+ RenderTableCell {TD} at (2,2) size 86x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,2) size 82x18
+ text run at (2,2) width 82: "Non-editable"
+ RenderTableCell {TD} at (90,2) size 106x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+ RenderText {#text} at (2,2) size 56x18
+ text run at (2,2) width 56: "Editable "
+ RenderInline {SPAN} at (0,0) size 46x18
+ RenderText {#text} at (58,2) size 46x18
+ text run at (58,2) width 46: "content"
+ RenderTableCell {TD} at (198,2) size 4x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
+ RenderTableCell {TD} at (204,2) size 4x22 [border: (1px inset #808080)] [r=0 c=3 rs=1 cs=1]
+ RenderBlock (anonymous) at (0,28) size 784x0
+caret: position 9 of child 0 {#text} of child 1 {TD} of child 0 {TR} of child 1 {TBODY} of child 1 {TABLE} of child 3 {DIV} of child 0 {BODY} of child 0 {HTML} of document
</ins></span></pre></div>
<a id="trunkLayoutTestseditingdeleting50268483html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/deleting/5026848-3.html (0 => 20707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/deleting/5026848-3.html         (rev 0)
+++ trunk/LayoutTests/editing/deleting/5026848-3.html        2007-04-04 20:49:52 UTC (rev 20707)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+<html>
+<body>
+<p>This tests to see that selected editable nodes that are not in both the start and end editable roots are cleared. You should see one non-editable piece and an editable one and then two empty table cells. The table cells are editable but are preserved and not removed because they are in a non-editable region. They should be completely cleared out, even the second one that contains a non-editable piece.</p>
+<div id="div" contenteditable="true">
+<table border="1" contenteditable="false">
+ <tr>
+ <td>Non-editable</td>
+ <td contenteditable="true">Editable <span id="start">content</span></td>
+ <!-- The following cell should be removed, even though it contains non-editable pieces. -->
+ <td contenteditable="true">Editable</td>
+ <td contenteditable="true">Edit<span contenteditable="false">(non-editable content that should be removed because its in an editable region)</span>able</td>
+ </tr>
+</table>
+Editable <span id="end">content</span>
+</div>
+
+<script>
+var sel = window.getSelection();
+var start = document.getElementById("start");
+var end = document.getElementById("end");
+sel.setBaseAndExtent(start, 0, end, 0);
+document.execCommand("Delete");
+</script>
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (20706 => 20707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2007-04-04 20:39:00 UTC (rev 20706)
+++ trunk/WebCore/ChangeLog        2007-04-04 20:49:52 UTC (rev 20707)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2007-04-03 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by darin
+
+ <rdar://problem/5026848> Can cut/delete ToDo subunits
+
+ We were removing non-editable content during a delete.
+
+ * editing/DeleteSelectionCommand.cpp:
+ (WebCore::DeleteSelectionCommand::initializePositionData):
+ Set m_startRoot and m_endRoot.
+ (WebCore::DeleteSelectionCommand::removeNode): If a node
+ is not inside both the start and end roots, remove it only
+ if it is in editable content.
+ * editing/DeleteSelectionCommand.h: Added m_startRoot and
+ m_endRoot, the editable roots that contain the start and end
+ of the selection, respectively. We consult these every
+ time we remove a node, and don't want to recompute them
+ on every call to removeNode().
+
</ins><span class="cx"> 2007-04-03 David Hyatt <hyatt@apple.com>
</span><span class="cx">
</span><span class="cx"> Fix for <rdar://problem/5108896>, make sure the assert for setEncodedSize
</span></span></pre></div>
<a id="trunkWebCoreeditingDeleteSelectionCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/editing/DeleteSelectionCommand.cpp (20706 => 20707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/editing/DeleteSelectionCommand.cpp        2007-04-04 20:39:00 UTC (rev 20706)
+++ trunk/WebCore/editing/DeleteSelectionCommand.cpp        2007-04-04 20:49:52 UTC (rev 20707)
</span><span class="lines">@@ -129,6 +129,9 @@
</span><span class="cx"> m_upstreamEnd = end.upstream();
</span><span class="cx"> m_downstreamEnd = end.downstream();
</span><span class="cx">
</span><ins>+ m_startRoot = editableRootForPosition(start);
+ m_endRoot = editableRootForPosition(end);
+
</ins><span class="cx"> Node* startCell = enclosingTableCell(m_upstreamStart.node());
</span><span class="cx"> Node* endCell = enclosingTableCell(m_downstreamEnd.node());
</span><span class="cx"> // Don't move content out of a table cell.
</span><span class="lines">@@ -238,6 +241,31 @@
</span><span class="cx">
</span><span class="cx"> void DeleteSelectionCommand::removeNode(Node *node)
</span><span class="cx"> {
</span><ins>+ if (!node)
+ return;
+
+ if (m_startRoot != m_endRoot && !(node->isDescendantOf(m_startRoot.get()) && node->isDescendantOf(m_endRoot.get()))) {
+ // If a node is not in both the start and end editable roots, remove it only if its inside an editable region.
+ if (!node->parentNode()->isContentEditable()) {
+ // Don't remove non-editable atomic nodes.
+ if (!node->firstChild())
+ return;
+ // Search this non-editable region for editable regions to empty.
+ RefPtr<Node> child = node->firstChild();
+ while (child) {
+ RefPtr<Node> nextChild = child->nextSibling();
+ removeNode(child.get());
+ // Bail if nextChild is no longer node's child.
+ if (nextChild && nextChild->parentNode() != node)
+ return;
+ child = nextChild;
+ }
+
+ // Don't remove editable regions that are inside non-editable ones, just clear them.
+ return;
+ }
+ }
+
</ins><span class="cx"> if (isTableStructureNode(node) || node == node->rootEditableElement()) {
</span><span class="cx"> // Do not remove an element of table structure; remove its contents.
</span><span class="cx"> // Likewise for the root editable element.
</span></span></pre></div>
<a id="trunkWebCoreeditingDeleteSelectionCommandh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/editing/DeleteSelectionCommand.h (20706 => 20707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/editing/DeleteSelectionCommand.h        2007-04-04 20:39:00 UTC (rev 20706)
+++ trunk/WebCore/editing/DeleteSelectionCommand.h        2007-04-04 20:49:52 UTC (rev 20707)
</span><span class="lines">@@ -76,6 +76,8 @@
</span><span class="cx"> RefPtr<Node> m_endBlock;
</span><span class="cx"> RefPtr<CSSMutableStyleDeclaration> m_typingStyle;
</span><span class="cx"> RefPtr<CSSMutableStyleDeclaration> m_deleteIntoBlockquoteStyle;
</span><ins>+ RefPtr<Node> m_startRoot;
+ RefPtr<Node> m_endRoot;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre>
</div>
</div>
</body>
</html>