<!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>[181418] 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/181418">181418</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2015-03-11 17:33:07 -0700 (Wed, 11 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>&lt;attachment&gt; shouldn't use &quot;user-select: all&quot;
https://bugs.webkit.org/show_bug.cgi?id=142453

Reviewed by Darin Adler.

It turns out that &quot;user-select: all&quot; is rife with bugs; in lieu of fixing them
all (at least for now), let's not use &quot;user-select: all&quot; in the default stylesheet
for &lt;attachment&gt;. It's really overkill anyway, since &lt;attachment&gt; can't have children.
The only &quot;user-select: all&quot; behavior we actually want is select-on-click.
So, we'll implement that in a slightly different way.

Tests: fast/attachment/attachment-select-on-click-inside-user-select-all.html
       fast/attachment/attachment-select-on-click.html

* css/html.css:
(attachment):
No more &quot;user-select: all&quot;.

(attachment:focus): Deleted.
We stopped using attachment focus a while back and forgot to remove this.

* dom/Node.h:
(WebCore::Node::shouldSelectOnMouseDown):
Add a virtual function that Node subclasses can override to indicate they
should be selected on mouse down.

* html/HTMLAttachmentElement.h:
Override the aforementioned virtual function; &lt;attachment&gt; should always
be selected on mouse down.

* page/EventHandler.cpp:
(WebCore::nodeToSelectOnMouseDownForNode):
Determine which node should be selected when a mousedown hits the given node.
If there's any &quot;user-select: all&quot;, we go with the outermost &quot;user-select: all&quot;.
Otherwise, we give the node a chance to say that it wants to be selected itself.

(WebCore::expandSelectionToRespectSelectOnMouseDown):
Rename this function, it's not just about &quot;user-select: all&quot; anymore.
Make use of nodeToSelectOnMouseDownForNode.

(WebCore::EventHandler::selectClosestWordFromHitTestResult):
(WebCore::EventHandler::selectClosestWordOrLinkFromMouseEvent):
(WebCore::EventHandler::handleMousePressEventTripleClick):
(WebCore::EventHandler::handleMousePressEventSingleClick):
(WebCore::expandSelectionToRespectUserSelectAll): Deleted.
Adjust to the new names.

* fast/attachment/attachment-select-on-click-inside-user-select-all.html: Added.
* fast/attachment/attachment-select-on-click.html: Added.
* platform/mac/fast/attachment/attachment-select-on-click-expected.png: Added.
* platform/mac/fast/attachment/attachment-select-on-click-expected.txt: Added.
* platform/mac/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.png: Added.
* platform/mac/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt: Added.
* platform/mac-mavericks/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt: Added.
* platform/mac-mavericks/fast/attachment/attachment-select-on-click-expected.txt: Added.
Add two tests. One, for the basic functionality of clicking on an
&lt;attachment&gt; to select it. The second, to test that clicking on an
&lt;attachment&gt; inside a larger &quot;user-select: all&quot; element still selects
the whole &quot;user-select: all&quot; element.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecsshtmlcss">trunk/Source/WebCore/css/html.css</a></li>
<li><a href="#trunkSourceWebCoredomNodeh">trunk/Source/WebCore/dom/Node.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAttachmentElementh">trunk/Source/WebCore/html/HTMLAttachmentElement.h</a></li>
<li><a href="#trunkSourceWebCorepageEventHandlercpp">trunk/Source/WebCore/page/EventHandler.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastattachmentattachmentselectonclickinsideuserselectallhtml">trunk/LayoutTests/fast/attachment/attachment-select-on-click-inside-user-select-all.html</a></li>
<li><a href="#trunkLayoutTestsfastattachmentattachmentselectonclickhtml">trunk/LayoutTests/fast/attachment/attachment-select-on-click.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastattachmentattachmentselectonclickexpectedpng">trunk/LayoutTests/platform/mac/fast/attachment/attachment-select-on-click-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastattachmentattachmentselectonclickexpectedtxt">trunk/LayoutTests/platform/mac/fast/attachment/attachment-select-on-click-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastattachmentattachmentselectonclickinsideuserselectallexpectedpng">trunk/LayoutTests/platform/mac/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastattachmentattachmentselectonclickinsideuserselectallexpectedtxt">trunk/LayoutTests/platform/mac/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacmavericksfastattachmentattachmentselectonclickexpectedtxt">trunk/LayoutTests/platform/mac-mavericks/fast/attachment/attachment-select-on-click-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacmavericksfastattachmentattachmentselectonclickinsideuserselectallexpectedtxt">trunk/LayoutTests/platform/mac-mavericks/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (181417 => 181418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-03-12 00:29:45 UTC (rev 181417)
+++ trunk/LayoutTests/ChangeLog        2015-03-12 00:33:07 UTC (rev 181418)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2015-03-11  Timothy Horton  &lt;timothy_horton@apple.com&gt;
+
+        &lt;attachment&gt; shouldn't use &quot;user-select: all&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=142453
+
+        Reviewed by Darin Adler.
+
+        * fast/attachment/attachment-select-on-click-inside-user-select-all.html: Added.
+        * fast/attachment/attachment-select-on-click.html: Added.
+        * platform/mac/fast/attachment/attachment-select-on-click-expected.png: Added.
+        * platform/mac/fast/attachment/attachment-select-on-click-expected.txt: Added.
+        * platform/mac/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.png: Added.
+        * platform/mac/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt: Added.
+        * platform/mac-mavericks/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt: Added.
+        * platform/mac-mavericks/fast/attachment/attachment-select-on-click-expected.txt: Added.
+        Add two tests. One, for the basic functionality of clicking on an
+        &lt;attachment&gt; to select it. The second, to test that clicking on an
+        &lt;attachment&gt; inside a larger &quot;user-select: all&quot; element still selects
+        the whole &quot;user-select: all&quot; element.
+
</ins><span class="cx"> 2015-03-11  Matthew Mirman  &lt;mmirman@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Update windows test results
</span></span></pre></div>
<a id="trunkLayoutTestsfastattachmentattachmentselectonclickinsideuserselectallhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/attachment/attachment-select-on-click-inside-user-select-all.html (0 => 181418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/attachment/attachment-select-on-click-inside-user-select-all.html                                (rev 0)
+++ trunk/LayoutTests/fast/attachment/attachment-select-on-click-inside-user-select-all.html        2015-03-12 00:33:07 UTC (rev 181418)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;div style=&quot;-webkit-user-select: all;&quot;&gt;text before &lt;attachment id=&quot;attachment&quot;&gt;&lt;/attachment&gt; text after&lt;/div&gt;
+&lt;script&gt;
+var file;
+if (window.internals)
+    file = window.internals.createFile(&quot;resources/test-file.txt&quot;);
+
+var attachment = document.getElementById('attachment');
+attachment.file = file;
+
+window.onload = function () {
+    if (!window.eventSender)
+        return;
+    eventSender.mouseMoveTo(attachment.offsetLeft + 10, attachment.offsetTop + 10);
+    eventSender.mouseDown(0);
+    eventSender.mouseUp(0);
+}
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastattachmentattachmentselectonclickhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/attachment/attachment-select-on-click.html (0 => 181418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/attachment/attachment-select-on-click.html                                (rev 0)
+++ trunk/LayoutTests/fast/attachment/attachment-select-on-click.html        2015-03-12 00:33:07 UTC (rev 181418)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;div&gt;text before &lt;attachment id=&quot;attachment&quot;&gt;&lt;/attachment&gt; text after&lt;/div&gt;
+&lt;script&gt;
+var file;
+if (window.internals)
+    file = window.internals.createFile(&quot;resources/test-file.txt&quot;);
+
+var attachment = document.getElementById('attachment');
+attachment.file = file;
+
+window.onload = function () {
+    if (!window.eventSender)
+        return;
+    eventSender.mouseMoveTo(attachment.offsetLeft + 10, attachment.offsetTop + 10);
+    eventSender.mouseDown(0);
+    eventSender.mouseUp(0);
+}
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastattachmentattachmentselectonclickexpectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/platform/mac/fast/attachment/attachment-select-on-click-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/platform/mac/fast/attachment/attachment-select-on-click-expected.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsplatformmacfastattachmentattachmentselectonclickexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/fast/attachment/attachment-select-on-click-expected.txt (0 => 181418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/attachment/attachment-select-on-click-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/attachment/attachment-select-on-click-expected.txt        2015-03-12 00:33:07 UTC (rev 181418)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x93
+  RenderBlock {HTML} at (0,0) size 800x93
+    RenderBody {BODY} at (8,8) size 784x77
+      RenderBlock {DIV} at (0,0) size 784x77
+        RenderText {#text} at (0,54) size 73x18
+          text run at (0,54) width 73: &quot;text before &quot;
+        RenderAttachment {ATTACHMENT} at (72,0) size 75x77
+        RenderText {#text} at (146,54) size 63x18
+          text run at (146,54) width 63: &quot; text after&quot;
+selection start: position 0 of child 1 {ATTACHMENT} of child 1 {DIV} of body
+selection end:   position 1 of child 1 {ATTACHMENT} of child 1 {DIV} of body
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastattachmentattachmentselectonclickinsideuserselectallexpectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/platform/mac/fast/attachment/attachment-select-on-click-inside-user-select-all-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/platform/mac/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsplatformmacfastattachmentattachmentselectonclickinsideuserselectallexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt (0 => 181418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt        2015-03-12 00:33:07 UTC (rev 181418)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x93
+  RenderBlock {HTML} at (0,0) size 800x93
+    RenderBody {BODY} at (8,8) size 784x77
+      RenderBlock {DIV} at (0,0) size 784x77
+        RenderText {#text} at (0,54) size 73x18
+          text run at (0,54) width 73: &quot;text before &quot;
+        RenderAttachment {ATTACHMENT} at (72,0) size 75x77
+        RenderText {#text} at (146,54) size 63x18
+          text run at (146,54) width 63: &quot; text after&quot;
+selection start: position 0 of child 0 {#text} of child 1 {DIV} of body
+selection end:   position 11 of child 2 {#text} of child 1 {DIV} of body
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacmavericksfastattachmentattachmentselectonclickexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-mavericks/fast/attachment/attachment-select-on-click-expected.txt (0 => 181418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-mavericks/fast/attachment/attachment-select-on-click-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac-mavericks/fast/attachment/attachment-select-on-click-expected.txt        2015-03-12 00:33:07 UTC (rev 181418)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x93
+  RenderBlock {HTML} at (0,0) size 800x93
+    RenderBody {BODY} at (8,8) size 784x77
+      RenderBlock {DIV} at (0,0) size 784x77
+        RenderText {#text} at (0,54) size 73x18
+          text run at (0,54) width 73: &quot;text before &quot;
+        RenderAttachment {ATTACHMENT} at (72,0) size 79x77
+        RenderText {#text} at (150,54) size 63x18
+          text run at (150,54) width 63: &quot; text after&quot;
+selection start: position 0 of child 1 {ATTACHMENT} of child 1 {DIV} of body
+selection end:   position 1 of child 1 {ATTACHMENT} of child 1 {DIV} of body
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacmavericksfastattachmentattachmentselectonclickinsideuserselectallexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-mavericks/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt (0 => 181418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-mavericks/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac-mavericks/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt        2015-03-12 00:33:07 UTC (rev 181418)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x93
+  RenderBlock {HTML} at (0,0) size 800x93
+    RenderBody {BODY} at (8,8) size 784x77
+      RenderBlock {DIV} at (0,0) size 784x77
+        RenderText {#text} at (0,54) size 73x18
+          text run at (0,54) width 73: &quot;text before &quot;
+        RenderAttachment {ATTACHMENT} at (72,0) size 79x77
+        RenderText {#text} at (150,54) size 63x18
+          text run at (150,54) width 63: &quot; text after&quot;
+selection start: position 0 of child 0 {#text} of child 1 {DIV} of body
+selection end:   position 11 of child 2 {#text} of child 1 {DIV} of body
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181417 => 181418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-12 00:29:45 UTC (rev 181417)
+++ trunk/Source/WebCore/ChangeLog        2015-03-12 00:33:07 UTC (rev 181418)
</span><span class="lines">@@ -1,3 +1,52 @@
</span><ins>+2015-03-11  Timothy Horton  &lt;timothy_horton@apple.com&gt;
+
+        &lt;attachment&gt; shouldn't use &quot;user-select: all&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=142453
+
+        Reviewed by Darin Adler.
+
+        It turns out that &quot;user-select: all&quot; is rife with bugs; in lieu of fixing them
+        all (at least for now), let's not use &quot;user-select: all&quot; in the default stylesheet
+        for &lt;attachment&gt;. It's really overkill anyway, since &lt;attachment&gt; can't have children.
+        The only &quot;user-select: all&quot; behavior we actually want is select-on-click.
+        So, we'll implement that in a slightly different way.
+
+        Tests: fast/attachment/attachment-select-on-click-inside-user-select-all.html
+               fast/attachment/attachment-select-on-click.html
+
+        * css/html.css:
+        (attachment):
+        No more &quot;user-select: all&quot;.
+
+        (attachment:focus): Deleted.
+        We stopped using attachment focus a while back and forgot to remove this.
+
+        * dom/Node.h:
+        (WebCore::Node::shouldSelectOnMouseDown):
+        Add a virtual function that Node subclasses can override to indicate they
+        should be selected on mouse down.
+
+        * html/HTMLAttachmentElement.h:
+        Override the aforementioned virtual function; &lt;attachment&gt; should always
+        be selected on mouse down.
+
+        * page/EventHandler.cpp:
+        (WebCore::nodeToSelectOnMouseDownForNode):
+        Determine which node should be selected when a mousedown hits the given node.
+        If there's any &quot;user-select: all&quot;, we go with the outermost &quot;user-select: all&quot;.
+        Otherwise, we give the node a chance to say that it wants to be selected itself.
+
+        (WebCore::expandSelectionToRespectSelectOnMouseDown):
+        Rename this function, it's not just about &quot;user-select: all&quot; anymore.
+        Make use of nodeToSelectOnMouseDownForNode.
+
+        (WebCore::EventHandler::selectClosestWordFromHitTestResult):
+        (WebCore::EventHandler::selectClosestWordOrLinkFromMouseEvent):
+        (WebCore::EventHandler::handleMousePressEventTripleClick):
+        (WebCore::EventHandler::handleMousePressEventSingleClick):
+        (WebCore::expandSelectionToRespectUserSelectAll): Deleted.
+        Adjust to the new names.
+
</ins><span class="cx"> 2015-03-11  Geoffrey Garen  &lt;ggaren@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Users of Heap::deprecatedReportExtraMemory should switch to reportExtraMemoryAllocated+reportExtraMemoryVisited
</span></span></pre></div>
<a id="trunkSourceWebCorecsshtmlcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/html.css (181417 => 181418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/html.css        2015-03-12 00:29:45 UTC (rev 181417)
+++ trunk/Source/WebCore/css/html.css        2015-03-12 00:33:07 UTC (rev 181418)
</span><span class="lines">@@ -1211,12 +1211,7 @@
</span><span class="cx"> #if defined(ENABLE_ATTACHMENT_ELEMENT) &amp;&amp; ENABLE_ATTACHMENT_ELEMENT
</span><span class="cx"> attachment {
</span><span class="cx">     -webkit-appearance: attachment;
</span><del>-    -webkit-user-select: all;
</del><span class="cx"> }
</span><del>-
-attachment:focus {
-    outline: none;
-}
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> /* page */
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.h (181417 => 181418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.h        2015-03-12 00:29:45 UTC (rev 181417)
+++ trunk/Source/WebCore/dom/Node.h        2015-03-12 00:33:07 UTC (rev 181418)
</span><span class="lines">@@ -431,6 +431,8 @@
</span><span class="cx">     // Whether or not a selection can be started in this object
</span><span class="cx">     virtual bool canStartSelection() const;
</span><span class="cx"> 
</span><ins>+    virtual bool shouldSelectOnMouseDown() { return false; }
+
</ins><span class="cx">     // Getting points into and out of screen space
</span><span class="cx">     FloatPoint convertToPage(const FloatPoint&amp;) const;
</span><span class="cx">     FloatPoint convertFromPage(const FloatPoint&amp;) const;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAttachmentElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAttachmentElement.h (181417 => 181418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAttachmentElement.h        2015-03-12 00:29:45 UTC (rev 181417)
+++ trunk/Source/WebCore/html/HTMLAttachmentElement.h        2015-03-12 00:33:07 UTC (rev 181418)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual RenderPtr&lt;RenderElement&gt; createElementRenderer(Ref&lt;RenderStyle&gt;&amp;&amp;) override;
</span><span class="cx"> 
</span><ins>+    virtual bool shouldSelectOnMouseDown() override { return true; }
</ins><span class="cx">     virtual bool canContainRangeEndPoint() const override { return false; }
</span><span class="cx">     virtual void parseAttribute(const QualifiedName&amp;, const AtomicString&amp;) override;
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCorepageEventHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EventHandler.cpp (181417 => 181418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EventHandler.cpp        2015-03-12 00:29:45 UTC (rev 181417)
+++ trunk/Source/WebCore/page/EventHandler.cpp        2015-03-12 00:33:07 UTC (rev 181418)
</span><span class="lines">@@ -522,22 +522,30 @@
</span><span class="cx">     return node-&gt;dispatchEvent(Event::create(eventNames().selectstartEvent, true, true));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static VisibleSelection expandSelectionToRespectUserSelectAll(Node* targetNode, const VisibleSelection&amp; selection)
</del><ins>+static Node* nodeToSelectOnMouseDownForNode(Node&amp; targetNode)
</ins><span class="cx"> {
</span><span class="cx"> #if ENABLE(USERSELECT_ALL)
</span><del>-    Node* rootUserSelectAll = Position::rootUserSelectAllForNode(targetNode);
-    if (!rootUserSelectAll)
</del><ins>+    if (Node* rootUserSelectAll = Position::rootUserSelectAllForNode(&amp;targetNode))
+        return rootUserSelectAll;
+#endif
+
+    if (targetNode.shouldSelectOnMouseDown())
+        return &amp;targetNode;
+
+    return nullptr;
+}
+
+static VisibleSelection expandSelectionToRespectSelectOnMouseDown(Node&amp; targetNode, const VisibleSelection&amp; selection)
+{
+    Node* nodeToSelect = nodeToSelectOnMouseDownForNode(targetNode);
+    if (!nodeToSelect)
</ins><span class="cx">         return selection;
</span><span class="cx"> 
</span><span class="cx">     VisibleSelection newSelection(selection);
</span><del>-    newSelection.setBase(positionBeforeNode(rootUserSelectAll).upstream(CanCrossEditingBoundary));
-    newSelection.setExtent(positionAfterNode(rootUserSelectAll).downstream(CanCrossEditingBoundary));
</del><ins>+    newSelection.setBase(positionBeforeNode(nodeToSelect).upstream(CanCrossEditingBoundary));
+    newSelection.setExtent(positionAfterNode(nodeToSelect).downstream(CanCrossEditingBoundary));
</ins><span class="cx"> 
</span><span class="cx">     return newSelection;
</span><del>-#else
-    UNUSED_PARAM(targetNode);
-    return selection;
-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool EventHandler::updateSelectionForMouseDownDispatchingSelectStart(Node* targetNode, const VisibleSelection&amp; selection, TextGranularity granularity)
</span><span class="lines">@@ -575,7 +583,7 @@
</span><span class="cx">         if (appendTrailingWhitespace == ShouldAppendTrailingWhitespace &amp;&amp; newSelection.isRange())
</span><span class="cx">             newSelection.appendTrailingWhitespace();
</span><span class="cx"> 
</span><del>-        updateSelectionForMouseDownDispatchingSelectStart(targetNode, expandSelectionToRespectUserSelectAll(targetNode, newSelection), WordGranularity);
</del><ins>+        updateSelectionForMouseDownDispatchingSelectStart(targetNode, expandSelectionToRespectSelectOnMouseDown(targetNode, newSelection), WordGranularity);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -601,7 +609,7 @@
</span><span class="cx">         if (pos.isNotNull() &amp;&amp; pos.deepEquivalent().deprecatedNode()-&gt;isDescendantOf(URLElement))
</span><span class="cx">             newSelection = VisibleSelection::selectionFromContentsOfNode(URLElement);
</span><span class="cx"> 
</span><del>-        updateSelectionForMouseDownDispatchingSelectStart(targetNode, expandSelectionToRespectUserSelectAll(targetNode, newSelection), WordGranularity);
</del><ins>+        updateSelectionForMouseDownDispatchingSelectStart(targetNode, expandSelectionToRespectSelectOnMouseDown(targetNode, newSelection), WordGranularity);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -639,7 +647,7 @@
</span><span class="cx">         newSelection.expandUsingGranularity(ParagraphGranularity);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return updateSelectionForMouseDownDispatchingSelectStart(targetNode, expandSelectionToRespectUserSelectAll(targetNode, newSelection), ParagraphGranularity);
</del><ins>+    return updateSelectionForMouseDownDispatchingSelectStart(targetNode, expandSelectionToRespectSelectOnMouseDown(targetNode, newSelection), ParagraphGranularity);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static int textDistance(const Position&amp; start, const Position&amp; end)
</span><span class="lines">@@ -677,7 +685,7 @@
</span><span class="cx">     TextGranularity granularity = CharacterGranularity;
</span><span class="cx"> 
</span><span class="cx">     if (extendSelection &amp;&amp; newSelection.isCaretOrRange()) {
</span><del>-        VisibleSelection selectionInUserSelectAll = expandSelectionToRespectUserSelectAll(targetNode, VisibleSelection(pos));
</del><ins>+        VisibleSelection selectionInUserSelectAll = expandSelectionToRespectSelectOnMouseDown(targetNode, VisibleSelection(pos));
</ins><span class="cx">         if (selectionInUserSelectAll.isRange()) {
</span><span class="cx">             if (comparePositions(selectionInUserSelectAll.start(), newSelection.start()) &lt; 0)
</span><span class="cx">                 pos = selectionInUserSelectAll.start();
</span><span class="lines">@@ -704,7 +712,7 @@
</span><span class="cx">             newSelection.expandUsingGranularity(m_frame.selection().granularity());
</span><span class="cx">         }
</span><span class="cx">     } else
</span><del>-        newSelection = expandSelectionToRespectUserSelectAll(targetNode, visiblePos);
</del><ins>+        newSelection = expandSelectionToRespectSelectOnMouseDown(targetNode, visiblePos);
</ins><span class="cx"> 
</span><span class="cx">     bool handled = updateSelectionForMouseDownDispatchingSelectStart(targetNode, newSelection, granularity);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>