<!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
        
        &lt;rdar://problem/5026848&gt; 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
        
        &lt;rdar://problem/5026848&gt; 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  &lt;justin.garcia@apple.com&gt;
+
+        Reviewed by darin
+        
+        &lt;rdar://problem/5026848&gt; 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  &lt;andersca@apple.com&gt;
</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: &quot;This tests the deletion of non-editable content that is in both the start and end editable roots. &quot;
+          text run at (577,0) width 141: &quot;It should be removed. &quot;
+          text run at (718,0) width 28: &quot;You&quot;
+          text run at (0,18) width 323: &quot;shouldn't see anything in the editable region below.&quot;
+      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>+&lt;html&gt;
+&lt;body&gt;
+&lt;p&gt;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.&lt;/p&gt;
+&lt;div id=&quot;div&quot; contenteditable=&quot;true&quot;&gt;foo &lt;span style=&quot;color: red;&quot; contenteditable=&quot;false&quot;&gt;bar&lt;/span&gt; baz&lt;/div&gt;
+
+&lt;script&gt;
+var div = document.getElementById(&quot;div&quot;);
+div.focus();
+document.execCommand(&quot;SelectAll&quot;);
+document.execCommand(&quot;Delete&quot;);
+&lt;/script&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</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: &quot;This tests to see that selected non-editable nodes that are not in both the start and end editable root are preserved during a&quot;
+          text run at (0,18) width 58: &quot;deletion. &quot;
+          text run at (58,18) width 526: &quot;You should see two 'Non-editable' pieces on either side of the editable piece below.&quot;
+      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: &quot;Non-editable&quot;
+              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: &quot;Editable &quot;
+                RenderInline {SPAN} at (0,0) size 46x18
+                  RenderText {#text} at (57,1) size 46x18
+                    text run at (57,1) width 46: &quot;content&quot;
+              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: &quot;Non-editable&quot;
+        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>+&lt;html&gt;
+&lt;body&gt;
+&lt;p&gt;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.&lt;/p&gt;
+&lt;div id=&quot;div&quot; contenteditable=&quot;true&quot;&gt;
+&lt;table contenteditable=&quot;false&quot;&gt;
+    &lt;tr&gt;
+        &lt;td&gt;Non-editable&lt;/td&gt;
+        &lt;td contenteditable=&quot;true&quot;&gt;Editable &lt;span id=&quot;start&quot;&gt;content&lt;/span&gt;&lt;/td&gt;
+        &lt;td&gt;Non-editable&lt;/td&gt;
+    &lt;/tr&gt;
+&lt;/table&gt;
+Editable &lt;span id=&quot;end&quot;&gt;content&lt;/span&gt;
+&lt;/div&gt;
+
+&lt;script&gt;
+var sel = window.getSelection();
+var start = document.getElementById(&quot;start&quot;);
+var end = document.getElementById(&quot;end&quot;);
+sel.setBaseAndExtent(start, 0, end, 0);
+document.execCommand(&quot;Delete&quot;);
+&lt;/script&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</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: &quot;This tests to see that selected editable nodes that are not in both the start and end editable roots are cleared. &quot;
+          text run at (671,0) width 98: &quot;You should see&quot;
+          text run at (0,18) width 471: &quot;one non-editable piece and an editable one and then two empty table cells. &quot;
+          text run at (471,18) width 306: &quot;The table cells are editable but are preserved and&quot;
+          text run at (0,36) width 348: &quot;not removed because they are in a non-editable region. &quot;
+          text run at (348,36) width 407: &quot;They should be completely cleared out, even the second one that&quot;
+          text run at (0,54) width 186: &quot;contains a non-editable piece.&quot;
+      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: &quot;Non-editable&quot;
+              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: &quot;Editable &quot;
+                RenderInline {SPAN} at (0,0) size 46x18
+                  RenderText {#text} at (58,2) size 46x18
+                    text run at (58,2) width 46: &quot;content&quot;
+              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>+&lt;html&gt;
+&lt;body&gt;
+&lt;p&gt;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.&lt;/p&gt;
+&lt;div id=&quot;div&quot; contenteditable=&quot;true&quot;&gt;
+&lt;table border=&quot;1&quot; contenteditable=&quot;false&quot;&gt;
+    &lt;tr&gt;
+        &lt;td&gt;Non-editable&lt;/td&gt;
+        &lt;td contenteditable=&quot;true&quot;&gt;Editable &lt;span id=&quot;start&quot;&gt;content&lt;/span&gt;&lt;/td&gt;
+        &lt;!-- The following cell should be removed, even though it contains non-editable pieces. --&gt;
+        &lt;td contenteditable=&quot;true&quot;&gt;Editable&lt;/td&gt;
+        &lt;td contenteditable=&quot;true&quot;&gt;Edit&lt;span contenteditable=&quot;false&quot;&gt;(non-editable content that should be removed because its in an editable region)&lt;/span&gt;able&lt;/td&gt;
+    &lt;/tr&gt;
+&lt;/table&gt;
+Editable &lt;span id=&quot;end&quot;&gt;content&lt;/span&gt;
+&lt;/div&gt;
+
+&lt;script&gt;
+var sel = window.getSelection();
+var start = document.getElementById(&quot;start&quot;);
+var end = document.getElementById(&quot;end&quot;);
+sel.setBaseAndExtent(start, 0, end, 0);
+document.execCommand(&quot;Delete&quot;);
+&lt;/script&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</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  &lt;justin.garcia@apple.com&gt;
+
+        Reviewed by darin
+        
+        &lt;rdar://problem/5026848&gt; 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  &lt;hyatt@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix for &lt;rdar://problem/5108896&gt;, 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 &amp;&amp; !(node-&gt;isDescendantOf(m_startRoot.get()) &amp;&amp; node-&gt;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-&gt;parentNode()-&gt;isContentEditable()) {
+            // Don't remove non-editable atomic nodes.
+            if (!node-&gt;firstChild())
+                return;
+            // Search this non-editable region for editable regions to empty.
+            RefPtr&lt;Node&gt; child = node-&gt;firstChild();
+            while (child) {
+                RefPtr&lt;Node&gt; nextChild = child-&gt;nextSibling();
+                removeNode(child.get());
+                // Bail if nextChild is no longer node's child.
+                if (nextChild &amp;&amp; nextChild-&gt;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-&gt;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&lt;Node&gt; m_endBlock;
</span><span class="cx">     RefPtr&lt;CSSMutableStyleDeclaration&gt; m_typingStyle;
</span><span class="cx">     RefPtr&lt;CSSMutableStyleDeclaration&gt; m_deleteIntoBlockquoteStyle;
</span><ins>+    RefPtr&lt;Node&gt; m_startRoot;
+    RefPtr&lt;Node&gt; m_endRoot;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre>
</div>
</div>

</body>
</html>