<!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>[19991] trunk</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/19991">19991</a></dd>
<dt>Author</dt> <dd>justing</dd>
<dt>Date</dt> <dd>2007-03-06 16:11:50 -0800 (Tue, 06 Mar 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>LayoutTests:

        Reviewed by kevin
        
        &lt;http://bugs.webkit.org/show_bug.cgi?id=12245&gt;
        FCKeditor: Remove Format sometimes doesn't work
        &lt;rdar://problem/4786404&gt;
        Underline style is not removed from selection after performing Remove Format

        Added:
        * editing/execCommand/4786404-1-expected.checksum: Added.
        * editing/execCommand/4786404-1-expected.png: Added.
        * editing/execCommand/4786404-1-expected.txt: Added.
        * editing/execCommand/4786404-1.html: Added.
        * editing/execCommand/4786404-2-expected.checksum: Added.
        * editing/execCommand/4786404-2-expected.png: Added.
        * editing/execCommand/4786404-2-expected.txt: Added.
        * editing/execCommand/4786404-2.html: Added.
        Demonstrate fixes:
        * editing/execCommand/4920488-expected.checksum:
        * editing/execCommand/4920488-expected.png:
        * editing/execCommand/4920488-expected.txt:
        * editing/execCommand/4920742-1-expected.checksum:
        * editing/execCommand/4920742-1-expected.png:
        * editing/execCommand/4920742-1-expected.txt:
        * editing/execCommand/remove-formatting-2-expected.checksum:
        * editing/execCommand/remove-formatting-2-expected.png:
        * editing/execCommand/remove-formatting-2-expected.txt:
        Ditto, also added a FIXME:
        * editing/execCommand/remove-formatting-expected.checksum:
        * editing/execCommand/remove-formatting-expected.png:
        * editing/execCommand/remove-formatting-expected.txt:
        * editing/execCommand/remove-formatting.html:

WebCore:

        Reviewed by kevin
        
        &lt;http://bugs.webkit.org/show_bug.cgi?id=12245&gt;
        FCKeditor: Remove Format sometimes doesn't work
        &lt;rdar://problem/4786404&gt;
        Underline style is not removed from selection after performing Remove Format

        * editing/Editor.cpp:
        (WebCore::Editor::removeFormattingAndStyle): Re-wrote this.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestseditingexecCommand4920488expectedchecksum">trunk/LayoutTests/editing/execCommand/4920488-expected.checksum</a></li>
<li><a href="#trunkLayoutTestseditingexecCommand4920488expectedpng">trunk/LayoutTests/editing/execCommand/4920488-expected.png</a></li>
<li><a href="#trunkLayoutTestseditingexecCommand4920488expectedtxt">trunk/LayoutTests/editing/execCommand/4920488-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingexecCommand49207421expectedchecksum">trunk/LayoutTests/editing/execCommand/4920742-1-expected.checksum</a></li>
<li><a href="#trunkLayoutTestseditingexecCommand49207421expectedpng">trunk/LayoutTests/editing/execCommand/4920742-1-expected.png</a></li>
<li><a href="#trunkLayoutTestseditingexecCommand49207421expectedtxt">trunk/LayoutTests/editing/execCommand/4920742-1-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingexecCommandremoveformatting2expectedchecksum">trunk/LayoutTests/editing/execCommand/remove-formatting-2-expected.checksum</a></li>
<li><a href="#trunkLayoutTestseditingexecCommandremoveformatting2expectedpng">trunk/LayoutTests/editing/execCommand/remove-formatting-2-expected.png</a></li>
<li><a href="#trunkLayoutTestseditingexecCommandremoveformatting2expectedtxt">trunk/LayoutTests/editing/execCommand/remove-formatting-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingexecCommandremoveformattingexpectedchecksum">trunk/LayoutTests/editing/execCommand/remove-formatting-expected.checksum</a></li>
<li><a href="#trunkLayoutTestseditingexecCommandremoveformattingexpectedpng">trunk/LayoutTests/editing/execCommand/remove-formatting-expected.png</a></li>
<li><a href="#trunkLayoutTestseditingexecCommandremoveformattingexpectedtxt">trunk/LayoutTests/editing/execCommand/remove-formatting-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingexecCommandremoveformattinghtml">trunk/LayoutTests/editing/execCommand/remove-formatting.html</a></li>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCoreeditingEditorcpp">trunk/WebCore/editing/Editor.cpp</a></li>
<li><a href="#trunkWebCoreeditingInsertTextCommandcpp">trunk/WebCore/editing/InsertTextCommand.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestseditingexecCommand47864041expectedchecksum">trunk/LayoutTests/editing/execCommand/4786404-1-expected.checksum</a></li>
<li><a href="#trunkLayoutTestseditingexecCommand47864041expectedpng">trunk/LayoutTests/editing/execCommand/4786404-1-expected.png</a></li>
<li><a href="#trunkLayoutTestseditingexecCommand47864041expectedtxt">trunk/LayoutTests/editing/execCommand/4786404-1-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingexecCommand47864041html">trunk/LayoutTests/editing/execCommand/4786404-1.html</a></li>
<li><a href="#trunkLayoutTestseditingexecCommand47864042expectedchecksum">trunk/LayoutTests/editing/execCommand/4786404-2-expected.checksum</a></li>
<li><a href="#trunkLayoutTestseditingexecCommand47864042expectedpng">trunk/LayoutTests/editing/execCommand/4786404-2-expected.png</a></li>
<li><a href="#trunkLayoutTestseditingexecCommand47864042expectedtxt">trunk/LayoutTests/editing/execCommand/4786404-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingexecCommand47864042html">trunk/LayoutTests/editing/execCommand/4786404-2.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (19990 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2007-03-06 23:45:03 UTC (rev 19990)
+++ trunk/LayoutTests/ChangeLog        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2007-03-06  Justin Garcia  &lt;justin.garcia@apple.com&gt;
+
+        Reviewed by kevin
+        
+        &lt;http://bugs.webkit.org/show_bug.cgi?id=12245&gt;
+        FCKeditor: Remove Format sometimes doesn't work
+        &lt;rdar://problem/4786404&gt;
+        Underline style is not removed from selection after performing Remove Format
+
+        Added:
+        * editing/execCommand/4786404-1-expected.checksum: Added.
+        * editing/execCommand/4786404-1-expected.png: Added.
+        * editing/execCommand/4786404-1-expected.txt: Added.
+        * editing/execCommand/4786404-1.html: Added.
+        * editing/execCommand/4786404-2-expected.checksum: Added.
+        * editing/execCommand/4786404-2-expected.png: Added.
+        * editing/execCommand/4786404-2-expected.txt: Added.
+        * editing/execCommand/4786404-2.html: Added.
+        Demonstrate fixes:
+        * editing/execCommand/4920488-expected.checksum:
+        * editing/execCommand/4920488-expected.png:
+        * editing/execCommand/4920488-expected.txt:
+        * editing/execCommand/4920742-1-expected.checksum:
+        * editing/execCommand/4920742-1-expected.png:
+        * editing/execCommand/4920742-1-expected.txt:
+        * editing/execCommand/remove-formatting-2-expected.checksum:
+        * editing/execCommand/remove-formatting-2-expected.png:
+        * editing/execCommand/remove-formatting-2-expected.txt:
+        Ditto, also added a FIXME:
+        * editing/execCommand/remove-formatting-expected.checksum:
+        * editing/execCommand/remove-formatting-expected.png:
+        * editing/execCommand/remove-formatting-expected.txt:
+        * editing/execCommand/remove-formatting.html:
+
</ins><span class="cx"> 2007-03-06  Kevin Decker &lt;kdecker@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Adele.
</span></span></pre></div>
<a id="trunkLayoutTestseditingexecCommand47864041expectedchecksum"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/execCommand/4786404-1-expected.checksum (0 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/4786404-1-expected.checksum                                (rev 0)
+++ trunk/LayoutTests/editing/execCommand/4786404-1-expected.checksum        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+1775394c7d651a729d009b4604871c29
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestseditingexecCommand47864041expectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/editing/execCommand/4786404-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/execCommand/4786404-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="trunkLayoutTestseditingexecCommand47864041expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/execCommand/4786404-1-expected.txt (0 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/4786404-1-expected.txt                                (rev 0)
+++ trunk/LayoutTests/editing/execCommand/4786404-1-expected.txt        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -0,0 +1,15 @@
</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 [color=#999999]
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 784x36
+          text run at (0,0) width 784: &quot;This tests for a bug where performing the Remove Format operation on content would apply the document's style to&quot;
+          text run at (0,18) width 267: &quot;it, not the editable regions default style. &quot;
+          text run at (267,18) width 377: &quot;The text below should not be bold, and should be black.&quot;
+      RenderBlock {DIV} at (0,52) size 784x18 [color=#000000]
+        RenderText {#text} at (0,0) size 71x18
+          text run at (0,0) width 71: &quot;foo bar baz&quot;
+selection start: position 0 of child 0 {#text} of child 3 {DIV} of child 0 {BODY} of child 0 {HTML} of document
+selection end:   position 11 of child 0 {#text} of child 3 {DIV} of child 0 {BODY} of child 0 {HTML} of document
</ins></span></pre></div>
<a id="trunkLayoutTestseditingexecCommand47864041html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/execCommand/4786404-1.html (0 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/4786404-1.html                                (rev 0)
+++ trunk/LayoutTests/editing/execCommand/4786404-1.html        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;html style=&quot;font-weight: bold;&quot;&gt;
+&lt;body style=&quot;color: #999;&quot;&gt;
+&lt;p&gt;This tests for a bug where performing the Remove Format operation on content would apply the document's style to it, not the editable regions default style.  The text below should not be bold, and should be black.&lt;/p&gt;
+&lt;div id=&quot;div&quot; contenteditable=&quot;true&quot; style=&quot;font-weight: normal; color: black;&quot;&gt;foo &lt;i&gt;bar&lt;/i&gt; baz&lt;/div&gt;
+
+&lt;script&gt;
+var div = document.getElementById(&quot;div&quot;);
+div.focus();
+
+document.execCommand(&quot;RemoveFormat&quot;);
+&lt;/script&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestseditingexecCommand47864042expectedchecksum"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/execCommand/4786404-2-expected.checksum (0 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/4786404-2-expected.checksum                                (rev 0)
+++ trunk/LayoutTests/editing/execCommand/4786404-2-expected.checksum        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+d7881285eb08dbcb83e40ecddc3d20d8
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestseditingexecCommand47864042expectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/editing/execCommand/4786404-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/execCommand/4786404-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="trunkLayoutTestseditingexecCommand47864042expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/execCommand/4786404-2-expected.txt (0 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/4786404-2-expected.txt                                (rev 0)
+++ trunk/LayoutTests/editing/execCommand/4786404-2-expected.txt        2007-03-07 00:11:50 UTC (rev 19991)
</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 772x36
+          text run at (0,0) width 772: &quot;This tests for a bug where performing the Remove Format operation on a selection that started in underlined content would&quot;
+          text run at (0,18) width 212: &quot;underline everything operated on.&quot;
+      RenderBlock {DIV} at (0,52) size 784x18
+        RenderText {#text} at (0,0) size 71x18
+          text run at (0,0) width 71: &quot;foo bar baz&quot;
+selection start: position 0 of child 0 {#text} of child 3 {DIV} of child 0 {BODY} of child 0 {HTML} of document
+selection end:   position 11 of child 0 {#text} of child 3 {DIV} of child 0 {BODY} of child 0 {HTML} of document
</ins></span></pre></div>
<a id="trunkLayoutTestseditingexecCommand47864042html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/execCommand/4786404-2.html (0 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/4786404-2.html                                (rev 0)
+++ trunk/LayoutTests/editing/execCommand/4786404-2.html        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;html&gt;
+&lt;body&gt;
+&lt;p&gt;This tests for a bug where performing the Remove Format operation on a selection that started in underlined content would underline everything operated on.&lt;/p&gt;
+&lt;div id=&quot;div&quot; contenteditable=&quot;true&quot;&gt;&lt;u&gt;foo&lt;/u&gt; bar baz&lt;/div&gt;
+
+&lt;script&gt;
+var div = document.getElementById(&quot;div&quot;);
+div.focus();
+
+document.execCommand(&quot;RemoveFormat&quot;);
+&lt;/script&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestseditingexecCommand4920488expectedchecksum"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/execCommand/4920488-expected.checksum (19990 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/4920488-expected.checksum        2007-03-06 23:45:03 UTC (rev 19990)
+++ trunk/LayoutTests/editing/execCommand/4920488-expected.checksum        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -1 +1 @@
</span><del>-ce64c3b7059dab375961686ca2aa0956
</del><span class="cx">\ No newline at end of file
</span><ins>+f1af284cf9d2fd4ef5765735acd654b0
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestseditingexecCommand4920488expectedpng"></a>
<div class="binary"><h4>Modified: trunk/LayoutTests/editing/execCommand/4920488-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestseditingexecCommand4920488expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/execCommand/4920488-expected.txt (19990 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/4920488-expected.txt        2007-03-06 23:45:03 UTC (rev 19990)
+++ trunk/LayoutTests/editing/execCommand/4920488-expected.txt        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -12,4 +12,5 @@
</span><span class="cx">       RenderBlock {DIV} at (0,52) size 784x18
</span><span class="cx">         RenderText {#text} at (0,0) size 53x18
</span><span class="cx">           text run at (0,0) width 53: &quot;dogfood&quot;
</span><del>-caret: position 7 of child 0 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
</del><ins>+selection start: position 0 of child 0 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
+selection end:   position 7 of child 0 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
</ins></span></pre></div>
<a id="trunkLayoutTestseditingexecCommand49207421expectedchecksum"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/execCommand/4920742-1-expected.checksum (19990 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/4920742-1-expected.checksum        2007-03-06 23:45:03 UTC (rev 19990)
+++ trunk/LayoutTests/editing/execCommand/4920742-1-expected.checksum        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -1 +1 @@
</span><del>-d84e33037e7df15531f6b5323e760175
</del><span class="cx">\ No newline at end of file
</span><ins>+7be99d72a3228d92356e5ed05a43097c
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestseditingexecCommand49207421expectedpng"></a>
<div class="binary"><h4>Modified: trunk/LayoutTests/editing/execCommand/4920742-1-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestseditingexecCommand49207421expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/execCommand/4920742-1-expected.txt (19990 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/4920742-1-expected.txt        2007-03-06 23:45:03 UTC (rev 19990)
+++ trunk/LayoutTests/editing/execCommand/4920742-1-expected.txt        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -13,12 +13,11 @@
</span><span class="cx">             text run at (126,18) width 185: &quot;It should be on the last line.&quot;
</span><span class="cx">       RenderBlock {DIV} at (0,52) size 784x54
</span><span class="cx">         RenderBlock (anonymous) at (0,0) size 784x0
</span><del>-        RenderBlock {DIV} at (0,0) size 784x54
-          RenderBlock {DIV} at (0,0) size 784x18
-            RenderText {#text} at (0,0) size 21x18
-              text run at (0,0) width 21: &quot;foo&quot;
-          RenderBlock {DIV} at (0,18) size 784x18
-            RenderBR {BR} at (0,0) size 0x18
-          RenderBlock (anonymous) at (0,36) size 784x18
-            RenderBR {BR} at (0,0) size 0x18
-caret: position 0 of child 0 {BR} of child 1 {DIV} of child 0 {DIV} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
</del><ins>+        RenderBlock {DIV} at (0,0) size 784x18
+          RenderText {#text} at (0,0) size 21x18
+            text run at (0,0) width 21: &quot;foo&quot;
+        RenderBlock {DIV} at (0,18) size 784x18
+          RenderBR {BR} at (0,0) size 0x18
+        RenderBlock {DIV} at (0,36) size 784x18
+          RenderBR {BR} at (0,0) size 0x18
+caret: position 0 of child 0 {BR} of child 2 {DIV} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
</ins></span></pre></div>
<a id="trunkLayoutTestseditingexecCommandremoveformatting2expectedchecksum"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/execCommand/remove-formatting-2-expected.checksum (19990 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/remove-formatting-2-expected.checksum        2007-03-06 23:45:03 UTC (rev 19990)
+++ trunk/LayoutTests/editing/execCommand/remove-formatting-2-expected.checksum        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -1 +1 @@
</span><del>-d7ae305d9b161eed95c6b7a643adce6c
</del><span class="cx">\ No newline at end of file
</span><ins>+8b7372effa7d6b934935cfa3e3f056b6
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestseditingexecCommandremoveformatting2expectedpng"></a>
<div class="binary"><h4>Modified: trunk/LayoutTests/editing/execCommand/remove-formatting-2-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestseditingexecCommandremoveformatting2expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/execCommand/remove-formatting-2-expected.txt (19990 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/remove-formatting-2-expected.txt        2007-03-06 23:45:03 UTC (rev 19990)
+++ trunk/LayoutTests/editing/execCommand/remove-formatting-2-expected.txt        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -2,9 +2,12 @@
</span><span class="cx"> EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
</span><span class="cx"> EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
</span><span class="cx"> EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
</span><del>-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 4 of #text &gt; DIV &gt; BODY &gt; HTML &gt; #document to 4 of #text &gt; DIV &gt; BODY &gt; HTML &gt; #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
</del><ins>+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV &gt; BODY &gt; HTML &gt; #document to 0 of DIV &gt; BODY &gt; HTML &gt; #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
</ins><span class="cx"> EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
</span><span class="cx"> EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
</span><ins>+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV &gt; BODY &gt; HTML &gt; #document to 0 of DIV &gt; BODY &gt; HTML &gt; #document toDOMRange:range from 0 of #text &gt; DIV &gt; BODY &gt; HTML &gt; #document to 4 of #text &gt; DIV &gt; BODY &gt; HTML &gt; #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
</ins><span class="cx"> layer at (0,0) size 800x600
</span><span class="cx">   RenderView at (0,0) size 800x600
</span><span class="cx"> layer at (0,0) size 800x600
</span><span class="lines">@@ -15,8 +18,7 @@
</span><span class="cx">           text run at (0,0) width 722: &quot;This tests that RemoveFormat not only removes style from the selected part of the DOM, but that it also applies the&quot;
</span><span class="cx">           text run at (0,18) width 625: &quot;document default style to the selection if that's necessary in order to leave the selected text unstyled.&quot;
</span><span class="cx">       RenderBlock {DIV} at (0,52) size 784x18
</span><del>-        RenderText {#text} at (0,0) size 28x18
-          text run at (0,0) width 28: &quot;This&quot;
-        RenderText {#text} at (28,0) size 277x18
-          text run at (28,0) width 277: &quot; text should look the same as the text above.&quot;
-caret: position 4 of child 0 {#text} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
</del><ins>+        RenderText {#text} at (0,0) size 305x18
+          text run at (0,0) width 305: &quot;This text should look the same as the text above.&quot;
+selection start: position 0 of child 0 {#text} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+selection end:   position 4 of child 0 {#text} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
</ins></span></pre></div>
<a id="trunkLayoutTestseditingexecCommandremoveformattingexpectedchecksum"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/execCommand/remove-formatting-expected.checksum (19990 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/remove-formatting-expected.checksum        2007-03-06 23:45:03 UTC (rev 19990)
+++ trunk/LayoutTests/editing/execCommand/remove-formatting-expected.checksum        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -1 +1 @@
</span><del>-0b20b5f332955ebe0fda257b29b3c264
</del><span class="cx">\ No newline at end of file
</span><ins>+312d1fb518c4df3350a75a0a4eb3fb6b
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestseditingexecCommandremoveformattingexpectedpng"></a>
<div class="binary"><h4>Modified: trunk/LayoutTests/editing/execCommand/remove-formatting-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestseditingexecCommandremoveformattingexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/execCommand/remove-formatting-expected.txt (19990 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/remove-formatting-expected.txt        2007-03-06 23:45:03 UTC (rev 19990)
+++ trunk/LayoutTests/editing/execCommand/remove-formatting-expected.txt        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -3,37 +3,47 @@
</span><span class="cx"> EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV &gt; BODY &gt; HTML &gt; #document to 0 of DIV &gt; BODY &gt; HTML &gt; #document toDOMRange:range from 0 of #text &gt; B &gt; DIV &gt; BODY &gt; HTML &gt; #document to 3 of #text &gt; SPAN &gt; DIV &gt; BODY &gt; HTML &gt; #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
</span><span class="cx"> EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
</span><span class="cx"> EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
</span><del>-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 9 of #text &gt; DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document to 9 of #text &gt; DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
</del><ins>+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV &gt; BODY &gt; HTML &gt; #document to 0 of DIV &gt; BODY &gt; HTML &gt; #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
</ins><span class="cx"> EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
</span><span class="cx"> EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
</span><ins>+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document to 0 of DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 11 of #text &gt; DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document to 11 of #text &gt; DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text &gt; DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document to 11 of #text &gt; DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document toDOMRange:range from 0 of DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document to 0 of DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text &gt; DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document to 9 of #text &gt; DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
</ins><span class="cx"> layer at (0,0) size 800x600
</span><span class="cx">   RenderView at (0,0) size 800x600
</span><span class="cx"> layer at (0,0) size 800x600
</span><span class="cx">   RenderBlock {HTML} at (0,0) size 800x600
</span><span class="cx">     RenderBody {BODY} at (8,8) size 784x576
</span><del>-      RenderBlock {P} at (0,0) size 784x18
-        RenderText {#text} at (0,0) size 321x18
-          text run at (0,0) width 321: &quot;This is a test for execCommand(\&quot;RemoveFormat\&quot;)&quot;
-      RenderBlock {DIV} at (0,34) size 784x54
-        RenderBlock {DIV} at (0,0) size 784x18
</del><ins>+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 329x18
+          text run at (0,0) width 329: &quot;This is a test for execCommand(\&quot;RemoveFormat\&quot;). &quot;
+        RenderInline {B} at (0,0) size 747x36
+          RenderText {#text} at (329,0) size 747x36
+            text run at (329,0) width 418: &quot;It demonstrates a bug: everything in the editable region below&quot;
+            text run at (0,18) width 576: &quot;should be selected, as everything was selected before Remove Format was performed.&quot;
+      RenderBlock {DIV} at (0,52) size 784x54
+        RenderBlock (anonymous) at (0,0) size 784x18
</ins><span class="cx">           RenderText {#text} at (0,0) size 63x18
</span><span class="cx">             text run at (0,0) width 63: &quot;foobarbaz&quot;
</span><span class="cx">         RenderBlock {DIV} at (0,18) size 784x18
</span><del>-          RenderText {#text} at (0,0) size 21x18
-            text run at (0,0) width 21: &quot;foo&quot;
-          RenderInline {SPAN} at (0,0) size 11x18
-            RenderText {#text} at (21,0) size 11x18
-              text run at (21,0) width 11: &quot;\x{9}&quot;
-          RenderText {#text} at (32,0) size 20x18
-            text run at (32,0) width 20: &quot;bar&quot;
-          RenderInline {SPAN} at (0,0) size 12x18
-            RenderText {#text} at (52,0) size 12x18
-              text run at (52,0) width 12: &quot;\x{9}&quot;
-          RenderText {#text} at (64,0) size 22x18
-            text run at (64,0) width 22: &quot;baz&quot;
</del><ins>+          RenderText {#text} at (0,0) size 71x18
+            text run at (0,0) width 71: &quot;foo\x{9}bar\x{9}baz&quot;
</ins><span class="cx">         RenderBlock {DIV} at (0,36) size 784x18
</span><span class="cx">           RenderText {#text} at (0,0) size 63x18
</span><span class="cx">             text run at (0,0) width 63: &quot;foobarbaz&quot;
</span><del>-        RenderBlock (anonymous) at (0,54) size 784x0
-      RenderBlock {UL} at (0,104) size 784x0
-caret: position 9 of child 0 {#text} of child 2 {DIV} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
</del><ins>+      RenderBlock {UL} at (0,122) size 784x0
+selection start: position 0 of child 0 {#text} of child 3 {DIV} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+selection end:   position 9 of child 0 {#text} of child 3 {DIV} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
</ins></span></pre></div>
<a id="trunkLayoutTestseditingexecCommandremoveformattinghtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/execCommand/remove-formatting.html (19990 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/remove-formatting.html        2007-03-06 23:45:03 UTC (rev 19990)
+++ trunk/LayoutTests/editing/execCommand/remove-formatting.html        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> if (window.layoutTestController)
</span><span class="cx">      layoutTestController.dumpEditingCallbacks();
</span><span class="cx"> &lt;/script&gt;
</span><del>-&lt;p&gt;This is a test for execCommand(&quot;RemoveFormat&quot;)&lt;/p&gt;
</del><ins>+&lt;p&gt;This is a test for execCommand(&quot;RemoveFormat&quot;).  &lt;b&gt;It demonstrates a bug: everything in the editable region below should be selected, as everything was selected before Remove Format was performed.&lt;/b&gt;&lt;/p&gt;
</ins><span class="cx"> &lt;div id=&quot;test&quot; contenteditable=&quot;true&quot;&gt;
</span><span class="cx"> &lt;b&gt;foo&lt;/b&gt;&lt;a href=&quot;http://www.google.com/&quot;&gt;bar&lt;/a&gt;&lt;i&gt;baz&lt;/i&gt;&lt;br&gt;
</span><span class="cx"> &lt;table border=&quot;1&quot;&gt;&lt;tr&gt;&lt;td&gt;foo&lt;/td&gt;&lt;td&gt;bar&lt;/td&gt;&lt;td&gt;baz&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
</span></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (19990 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2007-03-06 23:45:03 UTC (rev 19990)
+++ trunk/WebCore/ChangeLog        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2007-03-06  Justin Garcia  &lt;justin.garcia@apple.com&gt;
+
+        Reviewed by kevin
+        
+        &lt;http://bugs.webkit.org/show_bug.cgi?id=12245&gt;
+        FCKeditor: Remove Format sometimes doesn't work
+        &lt;rdar://problem/4786404&gt;
+        Underline style is not removed from selection after performing Remove Format
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::removeFormattingAndStyle): Re-wrote this.
+
</ins><span class="cx"> 2007-03-07  Nikolas Zimmermann  &lt;zimmermann@kde.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Oliver.
</span></span></pre></div>
<a id="trunkWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/editing/Editor.cpp (19990 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/editing/Editor.cpp        2007-03-06 23:45:03 UTC (rev 19990)
+++ trunk/WebCore/editing/Editor.cpp        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -508,26 +508,22 @@
</span><span class="cx">     Document* document = m_frame-&gt;document();
</span><span class="cx">     
</span><span class="cx">     // Make a plain text string from the selection to remove formatting like tables and lists.
</span><del>-    RefPtr&lt;DocumentFragment&gt; text = createFragmentFromText(m_frame-&gt;selectionController()-&gt;toRange().get(), m_frame-&gt;selectionController()-&gt;toString());
</del><ins>+    String string = m_frame-&gt;selectionController()-&gt;toString();
</ins><span class="cx">     
</span><del>-    // Put the fragment made from that string into a style span with the document's
-    // default style to make sure that it is unstyled regardless of where it is inserted.
-    Position pos(document-&gt;documentElement(), 0);
-    RefPtr&lt;CSSComputedStyleDeclaration&gt; computedStyle = pos.computedStyle();
</del><ins>+    // Get the default style for this editable root, it's the style that we'll give the
+    // content that we're operating on.
+    Node* root = m_frame-&gt;selectionController()-&gt;rootEditableElement();
+    RefPtr&lt;CSSComputedStyleDeclaration&gt; computedStyle = new CSSComputedStyleDeclaration(root);
</ins><span class="cx">     RefPtr&lt;CSSMutableStyleDeclaration&gt; defaultStyle = computedStyle-&gt;copyInheritableProperties();
</span><span class="cx">     
</span><del>-    RefPtr&lt;Element&gt; span = createStyleSpanElement(document);
-    span-&gt;setAttribute(styleAttr, defaultStyle-&gt;cssText());
</del><ins>+    // Delete the selected content.
+    // FIXME: We should be able to leave this to insertText, but its delete operation
+    // doesn't preserve the style we're about to set.
+    deleteSelectionWithSmartDelete(false);
</ins><span class="cx">     
</span><del>-    ExceptionCode ec;
-    
-    while (text-&gt;firstChild())
-        span-&gt;appendChild(text-&gt;firstChild(), ec);
-    
-    RefPtr&lt;DocumentFragment&gt; fragment = new DocumentFragment(document);
-    fragment-&gt;appendChild(span, ec);
-    
-    applyCommand(new ReplaceSelectionCommand(document, fragment, false, false, false, true, EditActionUnspecified));
</del><ins>+    // Insert the content with the default style.
+    m_frame-&gt;setTypingStyle(defaultStyle.get());
+    TypingCommand::insertText(document, string, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Editor::setLastEditCommand(PassRefPtr&lt;EditCommand&gt; lastEditCommand) 
</span></span></pre></div>
<a id="trunkWebCoreeditingInsertTextCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/editing/InsertTextCommand.cpp (19990 => 19991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/editing/InsertTextCommand.cpp        2007-03-06 23:45:03 UTC (rev 19990)
+++ trunk/WebCore/editing/InsertTextCommand.cpp        2007-03-07 00:11:50 UTC (rev 19991)
</span><span class="lines">@@ -100,6 +100,7 @@
</span><span class="cx">         return;
</span><span class="cx">     
</span><span class="cx">     // Delete the current selection.
</span><ins>+    // FIXME: This delete operation blows away the typing style.
</ins><span class="cx">     if (endingSelection().isRange())
</span><span class="cx">         deleteSelection(false, true, true, false);
</span><span class="cx">     
</span></span></pre>
</div>
</div>

</body>
</html>