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

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/43044">43044</a></dd>
<dt>Author</dt> <dd>mitz@apple.com</dd>
<dt>Date</dt> <dd>2009-04-29 20:03:29 -0700 (Wed, 29 Apr 2009)</dd>
</dl>

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

        Reviewed by Simon Fraser.

        - WebCore part of &lt;rdar://problem/6609509&gt; Select All and then Delete
          should put Mail editing back into the same state as a new message

        Test: editing/deleting/in-visibly-empty-root.html

        * WebCore.base.exp: Exported VisibleSelection::isAll(bool).
        * editing/SelectionController.h:
        (WebCore::SelectionController::isAll): Added. Calls through to
        VisibleSelection.
        * editing/TypingCommand.cpp:
        (WebCore::TypingCommand::makeEditableRootEmpty): Added. Removes all children
        of the root editable element the selection is in, other than a
        placeholder. Returns true iff it did anything.
        (WebCore::TypingCommand::deleteKeyPressed): When there is only a single
        visible position in the root editable element, but it has children other
        than a placeholder, remove those children.
        * editing/TypingCommand.h:
        * editing/VisiblePosition.h:
        Added a StayInEditableContent enum and a FIXME.
        * editing/VisibleSelection.cpp:
        (WebCore::VisibleSelection::isAll): Added. Returns whether the
        selection encompasses all visible positions, either in the document or
        in the editable root.
        * editing/VisibleSelection.h:

WebKit/mac:

        Reviewed by Simon Fraser.

        - WebKit part of &lt;rdar://problem/6609509&gt; Select All and then Delete
          should put Mail editing back into the same state as a new message

        * WebView/WebView.mm:
        (-[WebView _selectionIsCaret]): Added.
        (-[WebView _selectionIsAll]): Added. Returns whether the selection
        encompasses the entire document.
        * WebView/WebViewPrivate.h:

LayoutTests:

        Reviewed by Simon Fraser.

        - test and updated results for &lt;rdar://problem/6609509&gt; Select All and
          then Delete should put Mail editing back into the same state as a new
          message

        * editing/deleting/in-visibly-empty-root-expected.txt: Added.
        * editing/deleting/in-visibly-empty-root.html: Added.
        * platform/mac/editing/deleting/delete-at-start-or-end-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmaceditingdeletingdeleteatstartorendexpectedtxt">trunk/LayoutTests/platform/mac/editing/deleting/delete-at-start-or-end-expected.txt</a></li>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCoreWebCorebaseexp">trunk/WebCore/WebCore.base.exp</a></li>
<li><a href="#trunkWebCoreeditingSelectionControllerh">trunk/WebCore/editing/SelectionController.h</a></li>
<li><a href="#trunkWebCoreeditingTypingCommandcpp">trunk/WebCore/editing/TypingCommand.cpp</a></li>
<li><a href="#trunkWebCoreeditingTypingCommandh">trunk/WebCore/editing/TypingCommand.h</a></li>
<li><a href="#trunkWebCoreeditingVisiblePositionh">trunk/WebCore/editing/VisiblePosition.h</a></li>
<li><a href="#trunkWebCoreeditingVisibleSelectioncpp">trunk/WebCore/editing/VisibleSelection.cpp</a></li>
<li><a href="#trunkWebCoreeditingVisibleSelectionh">trunk/WebCore/editing/VisibleSelection.h</a></li>
<li><a href="#trunkWebKitmacChangeLog">trunk/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkWebKitmacWebViewWebViewmm">trunk/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkWebKitmacWebViewWebViewPrivateh">trunk/WebKit/mac/WebView/WebViewPrivate.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestseditingdeletinginvisiblyemptyrootexpectedtxt">trunk/LayoutTests/editing/deleting/in-visibly-empty-root-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingdeletinginvisiblyemptyroothtml">trunk/LayoutTests/editing/deleting/in-visibly-empty-root.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (43043 => 43044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2009-04-30 02:19:20 UTC (rev 43043)
+++ trunk/LayoutTests/ChangeLog        2009-04-30 03:03:29 UTC (rev 43044)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2009-04-29  Dan Bernstein  &lt;mitz@apple.com&gt;
+
+        Reviewed by Simon Fraser.
+
+        - test and updated results for &lt;rdar://problem/6609509&gt; Select All and
+          then Delete should put Mail editing back into the same state as a new
+          message
+
+        * editing/deleting/in-visibly-empty-root-expected.txt: Added.
+        * editing/deleting/in-visibly-empty-root.html: Added.
+        * platform/mac/editing/deleting/delete-at-start-or-end-expected.txt:
+
</ins><span class="cx"> 2009-04-23  Eric Seidel  &lt;eric@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Oliver Hunt.
</span></span></pre></div>
<a id="trunkLayoutTestseditingdeletinginvisiblyemptyrootexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/deleting/in-visibly-empty-root-expected.txt (0 => 43044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/deleting/in-visibly-empty-root-expected.txt                                (rev 0)
+++ trunk/LayoutTests/editing/deleting/in-visibly-empty-root-expected.txt        2009-04-30 03:03:29 UTC (rev 43044)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+Test that a backward delete in an editable root that contains only a single visible position removes all children of the editable root.
+
+
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestseditingdeletinginvisiblyemptyroothtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/deleting/in-visibly-empty-root.html (0 => 43044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/deleting/in-visibly-empty-root.html                                (rev 0)
+++ trunk/LayoutTests/editing/deleting/in-visibly-empty-root.html        2009-04-30 03:03:29 UTC (rev 43044)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+&lt;p&gt;
+    Test that a backward delete in an editable root that contains only a single
+    visible position removes all children of the editable root.
+&lt;/p&gt;
+&lt;div id=&quot;editable-root&quot; contenteditable&gt;
+    &lt;div id=&quot;square&quot; style=&quot;background-color: red; height: 100px; width: 100px;&quot;&gt;Lorem ipsum dolor sit amet&lt;/div&gt;
+&lt;/div&gt;
+&lt;div id=&quot;result&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+
+    var root = document.getElementById(&quot;editable-root&quot;);
+    var square = document.getElementById(&quot;square&quot;);
+    root.focus();
+    document.execCommand(&quot;delete&quot;, &quot;backward&quot;);
+    if (!square.parentNode)
+        document.getElementById(&quot;result&quot;).innerText = &quot;FAIL: first delete removed the container&quot;;
+    else {
+        document.execCommand(&quot;delete&quot;, &quot;backward&quot;);
+        document.getElementById(&quot;result&quot;).innerText = square.parentNode ? &quot;FAIL: second delete did not remove the container&quot; : &quot;PASS&quot;;
+    }
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmaceditingdeletingdeleteatstartorendexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/editing/deleting/delete-at-start-or-end-expected.txt (43043 => 43044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/editing/deleting/delete-at-start-or-end-expected.txt        2009-04-30 02:19:20 UTC (rev 43043)
+++ trunk/LayoutTests/platform/mac/editing/deleting/delete-at-start-or-end-expected.txt        2009-04-30 03:03:29 UTC (rev 43044)
</span><span class="lines">@@ -1,6 +1,8 @@
</span><span class="cx"> EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV &gt; BODY &gt; HTML &gt; #document to 1 of DIV &gt; BODY &gt; HTML &gt; #document
</span><span class="cx"> EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
</span><span class="cx"> EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
</span><ins>+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></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (43043 => 43044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2009-04-30 02:19:20 UTC (rev 43043)
+++ trunk/WebCore/ChangeLog        2009-04-30 03:03:29 UTC (rev 43044)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2009-04-29  Dan Bernstein  &lt;mitz@apple.com&gt;
+
+        Reviewed by Simon Fraser.
+
+        - WebCore part of &lt;rdar://problem/6609509&gt; Select All and then Delete
+          should put Mail editing back into the same state as a new message
+
+        Test: editing/deleting/in-visibly-empty-root.html
+
+        * WebCore.base.exp: Exported VisibleSelection::isAll(bool).
+        * editing/SelectionController.h:
+        (WebCore::SelectionController::isAll): Added. Calls through to
+        VisibleSelection.
+        * editing/TypingCommand.cpp:
+        (WebCore::TypingCommand::makeEditableRootEmpty): Added. Removes all children
+        of the root editable element the selection is in, other than a
+        placeholder. Returns true iff it did anything.
+        (WebCore::TypingCommand::deleteKeyPressed): When there is only a single
+        visible position in the root editable element, but it has children other
+        than a placeholder, remove those children.
+        * editing/TypingCommand.h:
+        * editing/VisiblePosition.h:
+        Added a StayInEditableContent enum and a FIXME.
+        * editing/VisibleSelection.cpp:
+        (WebCore::VisibleSelection::isAll): Added. Returns whether the
+        selection encompasses all visible positions, either in the document or
+        in the editable root.
+        * editing/VisibleSelection.h:
+
</ins><span class="cx"> 2009-04-29  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix style nit.
</span></span></pre></div>
<a id="trunkWebCoreWebCorebaseexp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/WebCore.base.exp (43043 => 43044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/WebCore.base.exp        2009-04-30 02:19:20 UTC (rev 43043)
+++ trunk/WebCore/WebCore.base.exp        2009-04-30 03:03:29 UTC (rev 43044)
</span><span class="lines">@@ -828,6 +828,7 @@
</span><span class="cx"> __ZNK7WebCore16VisibleSelection17toNormalizedRangeEv
</span><span class="cx"> __ZNK7WebCore16VisibleSelection19rootEditableElementEv
</span><span class="cx"> __ZNK7WebCore16VisibleSelection23isContentRichlyEditableEv
</span><ins>+__ZNK7WebCore16VisibleSelection5isAllENS_21StayInEditableContentE
</ins><span class="cx"> __ZNK7WebCore17ResourceErrorBase8lazyInitEv
</span><span class="cx"> __ZNK7WebCore19AnimationController24numberOfActiveAnimationsEv
</span><span class="cx"> __ZNK7WebCore19InspectorController17drawNodeHighlightERNS_15GraphicsContextE
</span></span></pre></div>
<a id="trunkWebCoreeditingSelectionControllerh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/editing/SelectionController.h (43043 => 43044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/editing/SelectionController.h        2009-04-30 02:19:20 UTC (rev 43043)
+++ trunk/WebCore/editing/SelectionController.h        2009-04-30 03:03:29 UTC (rev 43044)
</span><span class="lines">@@ -102,6 +102,7 @@
</span><span class="cx">     bool isRange() const { return m_sel.isRange(); }
</span><span class="cx">     bool isCaretOrRange() const { return m_sel.isCaretOrRange(); }
</span><span class="cx">     bool isInPasswordField() const;
</span><ins>+    bool isAll(StayInEditableContent stayInEditableContent = MustStayInEditableContent) const { return m_sel.isAll(stayInEditableContent); }
</ins><span class="cx">     
</span><span class="cx">     PassRefPtr&lt;Range&gt; toNormalizedRange() const { return m_sel.toNormalizedRange(); }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoreeditingTypingCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/editing/TypingCommand.cpp (43043 => 43044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/editing/TypingCommand.cpp        2009-04-30 02:19:20 UTC (rev 43043)
+++ trunk/WebCore/editing/TypingCommand.cpp        2009-04-30 03:03:29 UTC (rev 43044)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include &quot;Editor.h&quot;
</span><span class="cx"> #include &quot;Element.h&quot;
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><ins>+#include &quot;HTMLNames.h&quot;
</ins><span class="cx"> #include &quot;InsertLineBreakCommand.h&quot;
</span><span class="cx"> #include &quot;InsertParagraphSeparatorCommand.h&quot;
</span><span class="cx"> #include &quot;InsertTextCommand.h&quot;
</span><span class="lines">@@ -44,6 +45,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+using namespace HTMLNames;
+
</ins><span class="cx"> TypingCommand::TypingCommand(Document *document, ETypingCommand commandType, const String &amp;textToInsert, bool selectInsertedText, TextGranularity granularity, bool killRing)
</span><span class="cx">     : CompositeEditCommand(document), 
</span><span class="cx">       m_commandType(commandType), 
</span><span class="lines">@@ -379,6 +382,27 @@
</span><span class="cx">     typingAddedToOpenCommand();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool TypingCommand::makeEditableRootEmpty()
+{
+    Element* root = endingSelection().rootEditableElement();
+    if (!root-&gt;firstChild())
+        return false;
+
+    if (root-&gt;firstChild() == root-&gt;lastChild() &amp;&amp; root-&gt;firstElementChild() &amp;&amp; root-&gt;firstElementChild()-&gt;hasTagName(brTag)) {
+        // If there is a single child and it could be a placeholder, leave it alone.
+        if (root-&gt;renderer() &amp;&amp; root-&gt;renderer()-&gt;isBlockFlow())
+            return false;
+    }
+
+    while (Node* child = root-&gt;firstChild())
+        removeNode(child);
+
+    addBlockPlaceholderIfNeeded(root);
+    setEndingSelection(VisibleSelection(Position(root, 0), DOWNSTREAM));
+
+    return true;
+}
+
</ins><span class="cx"> void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing)
</span><span class="cx"> {
</span><span class="cx">     VisibleSelection selectionToDelete;
</span><span class="lines">@@ -403,12 +427,17 @@
</span><span class="cx">             if (killRing &amp;&amp; selection.isCaret() &amp;&amp; granularity != CharacterGranularity) 
</span><span class="cx">                 selection.modify(SelectionController::EXTEND, SelectionController::BACKWARD, CharacterGranularity); 
</span><span class="cx">             
</span><del>-            // When the caret is at the start of the editable area in an empty list item, break out of the list item.
</del><span class="cx">             if (endingSelection().visibleStart().previous(true).isNull()) {
</span><ins>+                // When the caret is at the start of the editable area in an empty list item, break out of the list item.
</ins><span class="cx">                 if (breakOutOfEmptyListItem()) {
</span><span class="cx">                     typingAddedToOpenCommand();
</span><span class="cx">                     return;
</span><span class="cx">                 }
</span><ins>+                // When there are no visible positions in the editing root, delete its entire contents.
+                if (endingSelection().visibleStart().next(true).isNull() &amp;&amp; makeEditableRootEmpty()) {
+                    typingAddedToOpenCommand();
+                    return;
+                }
</ins><span class="cx">             }
</span><span class="cx">             
</span><span class="cx">             VisiblePosition visibleStart(endingSelection().visibleStart());
</span></span></pre></div>
<a id="trunkWebCoreeditingTypingCommandh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/editing/TypingCommand.h (43043 => 43044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/editing/TypingCommand.h        2009-04-30 02:19:20 UTC (rev 43043)
+++ trunk/WebCore/editing/TypingCommand.h        2009-04-30 03:03:29 UTC (rev 43044)
</span><span class="lines">@@ -83,6 +83,7 @@
</span><span class="cx"> 
</span><span class="cx">     void markMisspellingsAfterTyping();
</span><span class="cx">     void typingAddedToOpenCommand();
</span><ins>+    bool makeEditableRootEmpty();
</ins><span class="cx">     
</span><span class="cx">     ETypingCommand m_commandType;
</span><span class="cx">     String m_textToInsert;
</span></span></pre></div>
<a id="trunkWebCoreeditingVisiblePositionh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/editing/VisiblePosition.h (43043 => 43044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/editing/VisiblePosition.h        2009-04-30 02:19:20 UTC (rev 43043)
+++ trunk/WebCore/editing/VisiblePosition.h        2009-04-30 03:03:29 UTC (rev 43044)
</span><span class="lines">@@ -47,6 +47,8 @@
</span><span class="cx"> 
</span><span class="cx"> class InlineBox;
</span><span class="cx"> 
</span><ins>+enum StayInEditableContent { MayLeaveEditableContent, MustStayInEditableContent };
+
</ins><span class="cx"> class VisiblePosition {
</span><span class="cx"> public:
</span><span class="cx">     // NOTE: UPSTREAM affinity will be used only if pos is at end of a wrapped line,
</span><span class="lines">@@ -64,6 +66,8 @@
</span><span class="cx">     EAffinity affinity() const { ASSERT(m_affinity == UPSTREAM || m_affinity == DOWNSTREAM); return m_affinity; }
</span><span class="cx">     void setAffinity(EAffinity affinity) { m_affinity = affinity; }
</span><span class="cx"> 
</span><ins>+    // FIXME: Change the following functions' parameter from a boolean to StayInEditableContent.
+
</ins><span class="cx">     // next() and previous() will increment/decrement by a character cluster.
</span><span class="cx">     VisiblePosition next(bool stayInEditableContent = false) const;
</span><span class="cx">     VisiblePosition previous(bool stayInEditableContent = false) const;
</span></span></pre></div>
<a id="trunkWebCoreeditingVisibleSelectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/editing/VisibleSelection.cpp (43043 => 43044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/editing/VisibleSelection.cpp        2009-04-30 02:19:20 UTC (rev 43043)
+++ trunk/WebCore/editing/VisibleSelection.cpp        2009-04-30 03:03:29 UTC (rev 43044)
</span><span class="lines">@@ -222,6 +222,11 @@
</span><span class="cx">     return searchRange.release();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool VisibleSelection::isAll(StayInEditableContent stayInEditableContent) const
+{
+    return visibleStart().previous(stayInEditableContent).isNull() &amp;&amp; visibleEnd().next(stayInEditableContent).isNull();
+}
+
</ins><span class="cx"> void VisibleSelection::appendTrailingWhitespace()
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;Range&gt; searchRange = makeSearchRange(m_end);
</span></span></pre></div>
<a id="trunkWebCoreeditingVisibleSelectionh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/editing/VisibleSelection.h (43043 => 43044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/editing/VisibleSelection.h        2009-04-30 02:19:20 UTC (rev 43043)
+++ trunk/WebCore/editing/VisibleSelection.h        2009-04-30 03:03:29 UTC (rev 43044)
</span><span class="lines">@@ -76,6 +76,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool isBaseFirst() const { return m_baseIsFirst; }
</span><span class="cx"> 
</span><ins>+    bool isAll(StayInEditableContent) const;
+
</ins><span class="cx">     void appendTrailingWhitespace();
</span><span class="cx"> 
</span><span class="cx">     bool expandUsingGranularity(TextGranularity granularity);
</span></span></pre></div>
<a id="trunkWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/mac/ChangeLog (43043 => 43044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/mac/ChangeLog        2009-04-30 02:19:20 UTC (rev 43043)
+++ trunk/WebKit/mac/ChangeLog        2009-04-30 03:03:29 UTC (rev 43044)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2009-04-29  Dan Bernstein  &lt;mitz@apple.com&gt;
+
+        Reviewed by Simon Fraser.
+
+        - WebKit part of &lt;rdar://problem/6609509&gt; Select All and then Delete
+          should put Mail editing back into the same state as a new message
+
+        * WebView/WebView.mm:
+        (-[WebView _selectionIsCaret]): Added.
+        (-[WebView _selectionIsAll]): Added. Returns whether the selection
+        encompasses the entire document.
+        * WebView/WebViewPrivate.h:
+
</ins><span class="cx"> 2009-04-29  Douglas Davidson  &lt;ddavidso@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Justin Garcia.
</span></span></pre></div>
<a id="trunkWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/mac/WebView/WebView.mm (43043 => 43044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/mac/WebView/WebView.mm        2009-04-30 02:19:20 UTC (rev 43043)
+++ trunk/WebKit/mac/WebView/WebView.mm        2009-04-30 03:03:29 UTC (rev 43044)
</span><span class="lines">@@ -4803,6 +4803,22 @@
</span><span class="cx">     [[self _selectedOrMainFrame] _replaceSelectionWithNode:node selectReplacement:YES smartReplace:NO matchStyle:matchStyle];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (BOOL)_selectionIsCaret
+{
+    Frame* coreFrame = core([self _selectedOrMainFrame]);
+    if (!coreFrame)
+        return NO;
+    return coreFrame-&gt;selection()-&gt;isCaret();
+}
+
+- (BOOL)_selectionIsAll
+{
+    Frame* coreFrame = core([self _selectedOrMainFrame]);
+    if (!coreFrame)
+        return NO;
+    return coreFrame-&gt;selection()-&gt;isAll(MayLeaveEditableContent);
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> static WebFrameView *containingFrameView(NSView *view)
</span></span></pre></div>
<a id="trunkWebKitmacWebViewWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/mac/WebView/WebViewPrivate.h (43043 => 43044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/mac/WebView/WebViewPrivate.h        2009-04-30 02:19:20 UTC (rev 43043)
+++ trunk/WebKit/mac/WebView/WebViewPrivate.h        2009-04-30 03:03:29 UTC (rev 43044)
</span><span class="lines">@@ -492,6 +492,8 @@
</span><span class="cx"> @interface WebView (WebViewEditingInMail)
</span><span class="cx"> - (void)_insertNewlineInQuotedContent;
</span><span class="cx"> - (void)_replaceSelectionWithNode:(DOMNode *)node matchStyle:(BOOL)matchStyle;
</span><ins>+- (BOOL)_selectionIsCaret;
+- (BOOL)_selectionIsAll;
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @interface NSObject (WebFrameLoadDelegatePrivate)
</span></span></pre>
</div>
</div>

</body>
</html>