<!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>[213012] 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/213012">213012</a></dd>
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd>
<dt>Date</dt> <dd>2017-02-26 15:06:54 -0800 (Sun, 26 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION (<a href="http://trac.webkit.org/projects/webkit/changeset/211312">r211312</a>): Double-clicking a word selects it along with the space that follows it
https://bugs.webkit.org/show_bug.cgi?id=168821
&lt;rdar://problem/30690431&gt;

Reviewed by Tim Horton.

Source/WebKit2:

Actually encode and decode smartInsertDeleteEnabled when sending WebPageCreationParameters over XPC.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):

Tools:

Adds the ability for TestWKWebView to send a sequence of clicks to its window, and uses this capability to
verify that double clicking to select a word in a WKWebView on Mac selects just the word, and not a trailing
space along with it.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/double-click-does-not-select-trailing-space.html: Added.
* TestWebKitAPI/Tests/mac/WKWebViewSelectionTests.mm: Copied from Tools/TestWebKitAPI/cocoa/TestWKWebView.h.
(TEST):
* TestWebKitAPI/cocoa/TestWKWebView.h:
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebViewHostWindow _mouseDownAtPoint:simulatePressure:clickCount:]):
(-[TestWKWebViewHostWindow _mouseUpAtPoint:clickCount:]):
(-[TestWKWebView mouseDownAtPoint:simulatePressure:]):
(-[TestWKWebView mouseUpAtPoint:]):
(-[TestWKWebView sendClicksAtPoint:numberOfClicks:]):
(-[TestWKWebViewHostWindow _mouseDownAtPoint:simulatePressure:]): Deleted.
(-[TestWKWebViewHostWindow _mouseUpAtPoint:]): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedWebPageCreationParameterscpp">trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsTestWebKitAPIcocoaTestWKWebViewh">trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h</a></li>
<li><a href="#trunkToolsTestWebKitAPIcocoaTestWKWebViewmm">trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2Cocoadoubleclickdoesnotselecttrailingspacehtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/double-click-does-not-select-trailing-space.html</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsmacWKWebViewSelectionTestsmm">trunk/Tools/TestWebKitAPI/Tests/mac/WKWebViewSelectionTests.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (213011 => 213012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-02-26 18:36:30 UTC (rev 213011)
+++ trunk/Source/WebKit2/ChangeLog        2017-02-26 23:06:54 UTC (rev 213012)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2017-02-26  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
+        REGRESSION (r211312): Double-clicking a word selects it along with the space that follows it
+        https://bugs.webkit.org/show_bug.cgi?id=168821
+        &lt;rdar://problem/30690431&gt;
+
+        Reviewed by Tim Horton.
+
+        Actually encode and decode smartInsertDeleteEnabled when sending WebPageCreationParameters over XPC.
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode):
+        (WebKit::WebPageCreationParameters::decode):
+
</ins><span class="cx"> 2017-02-26  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         HitTestResult's linkSuggestedFilename should sanitize download attribute
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebPageCreationParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp (213011 => 213012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp        2017-02-26 18:36:30 UTC (rev 213011)
+++ trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp        2017-02-26 23:06:54 UTC (rev 213012)
</span><span class="lines">@@ -85,6 +85,9 @@
</span><span class="cx">     encoder &lt;&lt; textAutosizingWidth;
</span><span class="cx">     encoder &lt;&lt; ignoresViewportScaleLimits;
</span><span class="cx"> #endif
</span><ins>+#if PLATFORM(COCOA)
+    encoder &lt;&lt; smartInsertDeleteEnabled;
+#endif
</ins><span class="cx">     encoder &lt;&lt; appleMailPaginationQuirkEnabled;
</span><span class="cx">     encoder &lt;&lt; shouldScaleViewToFitDocument;
</span><span class="cx">     encoder.encodeEnum(userInterfaceLayoutDirection);
</span><span class="lines">@@ -199,6 +202,10 @@
</span><span class="cx">     if (!decoder.decode(parameters.ignoresViewportScaleLimits))
</span><span class="cx">         return false;
</span><span class="cx"> #endif
</span><ins>+#if PLATFORM(COCOA)
+    if (!decoder.decode(parameters.smartInsertDeleteEnabled))
+        return false;
+#endif
</ins><span class="cx"> 
</span><span class="cx">     if (!decoder.decode(parameters.appleMailPaginationQuirkEnabled))
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (213011 => 213012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-02-26 18:36:30 UTC (rev 213011)
+++ trunk/Tools/ChangeLog        2017-02-26 23:06:54 UTC (rev 213012)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2017-02-26  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
+        REGRESSION (r211312): Double-clicking a word selects it along with the space that follows it
+        https://bugs.webkit.org/show_bug.cgi?id=168821
+        &lt;rdar://problem/30690431&gt;
+
+        Reviewed by Tim Horton.
+
+        Adds the ability for TestWKWebView to send a sequence of clicks to its window, and uses this capability to
+        verify that double clicking to select a word in a WKWebView on Mac selects just the word, and not a trailing
+        space along with it.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2Cocoa/double-click-does-not-select-trailing-space.html: Added.
+        * TestWebKitAPI/Tests/mac/WKWebViewSelectionTests.mm: Copied from Tools/TestWebKitAPI/cocoa/TestWKWebView.h.
+        (TEST):
+        * TestWebKitAPI/cocoa/TestWKWebView.h:
+        * TestWebKitAPI/cocoa/TestWKWebView.mm:
+        (-[TestWKWebViewHostWindow _mouseDownAtPoint:simulatePressure:clickCount:]):
+        (-[TestWKWebViewHostWindow _mouseUpAtPoint:clickCount:]):
+        (-[TestWKWebView mouseDownAtPoint:simulatePressure:]):
+        (-[TestWKWebView mouseUpAtPoint:]):
+        (-[TestWKWebView sendClicksAtPoint:numberOfClicks:]):
+        (-[TestWKWebViewHostWindow _mouseDownAtPoint:simulatePressure:]): Deleted.
+        (-[TestWKWebViewHostWindow _mouseUpAtPoint:]): Deleted.
+
</ins><span class="cx"> 2017-02-25  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Make check-webkit-style do some basic validation for CSSProperties.json
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (213011 => 213012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2017-02-26 18:36:30 UTC (rev 213011)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2017-02-26 23:06:54 UTC (rev 213012)
</span><span class="lines">@@ -567,6 +567,8 @@
</span><span class="cx">                 F4F137921D9B683E002BEC57 /* large-video-test-now-playing.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4F137911D9B6832002BEC57 /* large-video-test-now-playing.html */; };
</span><span class="cx">                 F4F405BC1D4C0D1C007A9707 /* full-size-autoplaying-video-with-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4F405BA1D4C0CF8007A9707 /* full-size-autoplaying-video-with-audio.html */; };
</span><span class="cx">                 F4F405BD1D4C0D1C007A9707 /* skinny-autoplaying-video-with-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4F405BB1D4C0CF8007A9707 /* skinny-autoplaying-video-with-audio.html */; };
</span><ins>+                F4FA91811E61849B007B8C1D /* WKWebViewSelectionTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4FA917F1E61849B007B8C1D /* WKWebViewSelectionTests.mm */; };
+                F4FA91831E61857B007B8C1D /* double-click-does-not-select-trailing-space.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4FA91821E618566007B8C1D /* double-click-does-not-select-trailing-space.html */; };
</ins><span class="cx">                 F660AA1115A5F631003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F660AA0F15A5F624003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp */; };
</span><span class="cx">                 F660AA1515A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F660AA1415A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp */; };
</span><span class="cx">                 F6B7BE9517469212008A3445 /* DidAssociateFormControls_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6B7BE92174691EF008A3445 /* DidAssociateFormControls_Bundle.cpp */; };
</span><span class="lines">@@ -637,6 +639,7 @@
</span><span class="cx">                         dstSubfolderSpec = 7;
</span><span class="cx">                         files = (
</span><span class="cx">                                 8361F1781E610B4E00759B25 /* link-with-download-attribute-with-slashes.html in Copy Resources */,
</span><ins>+                                F4FA91831E61857B007B8C1D /* double-click-does-not-select-trailing-space.html in Copy Resources */,
</ins><span class="cx">                                 C25CCA0D1E5141840026CB8A /* AllAhem.svg in Copy Resources */,
</span><span class="cx">                                 C25CCA0B1E5140C10026CB8A /* LineBreaking.html in Copy Resources */,
</span><span class="cx">                                 C9C60E651E53A9DC006DA181 /* autoplay-check-frame.html in Copy Resources */,
</span><span class="lines">@@ -1398,6 +1401,8 @@
</span><span class="cx">                 F4F137911D9B6832002BEC57 /* large-video-test-now-playing.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;large-video-test-now-playing.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F4F405BA1D4C0CF8007A9707 /* full-size-autoplaying-video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;full-size-autoplaying-video-with-audio.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F4F405BB1D4C0CF8007A9707 /* skinny-autoplaying-video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;skinny-autoplaying-video-with-audio.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                F4FA917F1E61849B007B8C1D /* WKWebViewSelectionTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewSelectionTests.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                F4FA91821E618566007B8C1D /* double-click-does-not-select-trailing-space.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = &quot;double-click-does-not-select-trailing-space.html&quot;; path = &quot;Tests/WebKit2Cocoa/double-click-does-not-select-trailing-space.html&quot;; sourceTree = SOURCE_ROOT; };
</ins><span class="cx">                 F660AA0C15A5F061003A1243 /* GetInjectedBundleInitializationUserDataCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetInjectedBundleInitializationUserDataCallback.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F660AA0F15A5F624003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetInjectedBundleInitializationUserDataCallback_Bundle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F660AA1215A619C8003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleInitializationUserDataCallbackWins.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -2209,6 +2214,7 @@
</span><span class="cx">                                 1A7BFC0A171A0BDB00BC5F64 /* WillSendSubmitEvent.mm */,
</span><span class="cx">                                 A5E2027215B2181900C13E14 /* WindowlessWebViewWithMedia.mm */,
</span><span class="cx">                                 764322D51B61CCA40024F801 /* WordBoundaryTypingAttributes.mm */,
</span><ins>+                                F4FA917F1E61849B007B8C1D /* WKWebViewSelectionTests.mm */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = mac;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -2216,6 +2222,7 @@
</span><span class="cx">                 C07E6CB013FD737C0038B22B /* Resources */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                F4FA91821E618566007B8C1D /* double-click-does-not-select-trailing-space.html */,
</ins><span class="cx">                                 7AEAD47D1E20114E00416EFE /* CrossPartitionFileSchemeAccess.html */,
</span><span class="cx">                                 F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */,
</span><span class="cx">                                 379028B814FABE49007E6B43 /* acceptsFirstMouse.html */,
</span><span class="lines">@@ -2624,6 +2631,7 @@
</span><span class="cx">                                 7CCE7EB71A411A7E00447C4C /* CloseNewWindowInNavigationPolicyDelegate.mm in Sources */,
</span><span class="cx">                                 7CCE7EE51A411AE600447C4C /* CloseThenTerminate.cpp in Sources */,
</span><span class="cx">                                 7C83E0BA1D0A64FB00FEBCF3 /* Coding.mm in Sources */,
</span><ins>+                                F4FA91811E61849B007B8C1D /* WKWebViewSelectionTests.mm in Sources */,
</ins><span class="cx">                                 7C3965061CDD74F90094DBB8 /* Color.cpp in Sources */,
</span><span class="cx">                                 7C3DB8E41D12129B00AE8CC3 /* CommandBackForward.mm in Sources */,
</span><span class="cx">                                 7CB184C61AA3F2100066EDFD /* ContentExtensions.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2Cocoadoubleclickdoesnotselecttrailingspacehtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/double-click-does-not-select-trailing-space.html (0 => 213012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/double-click-does-not-select-trailing-space.html                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/double-click-does-not-select-trailing-space.html        2017-02-26 23:06:54 UTC (rev 213012)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+&lt;style&gt;
+body {
+    width: 100%;
+    height: 100%;
+}
+
+#editable {
+    width: 100%;
+    height: 400px;
+    font-size: 400px;
+    white-space: nowrap;
+    border: 1px blue dashed;
+}
+&lt;/style&gt;
+&lt;div id=&quot;editable&quot; contenteditable&gt;Hello world&lt;/div&gt;
+&lt;script&gt;
+document.addEventListener(&quot;selectionchange&quot;, () =&gt; {
+    if (!getSelection().rangeCount || getSelection().isCollapsed)
+        return;
+
+    setTimeout(() =&gt; window.webkit.messageHandlers.testHandler.postMessage(&quot;selected&quot;), 0);
+});
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsmacWKWebViewSelectionTestsmmfromrev213011trunkToolsTestWebKitAPIcocoaTestWKWebViewh"></a>
<div class="copfile"><h4>Copied: trunk/Tools/TestWebKitAPI/Tests/mac/WKWebViewSelectionTests.mm (from rev 213011, trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h) (0 => 213012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/mac/WKWebViewSelectionTests.mm                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/WKWebViewSelectionTests.mm        2017-02-26 23:06:54 UTC (rev 213012)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+
+#if WK_API_ENABLED &amp;&amp; PLATFORM(MAC)
+
+#import &quot;PlatformUtilities.h&quot;
+#import &quot;TestWKWebView.h&quot;
+
+TEST(WKWebViewSelectionTests, DoubleClickDoesNotSelectTrailingSpace)
+{
+    RetainPtr&lt;TestWKWebView&gt; webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 400, 400)]);
+    [webView synchronouslyLoadTestPageNamed:@&quot;double-click-does-not-select-trailing-space&quot;];
+
+    __block bool finishedSelectingText = false;
+    [webView performAfterReceivingMessage:@&quot;selected&quot; action:^() {
+        finishedSelectingText = true;
+    }];
+    [webView sendClicksAtPoint:NSMakePoint(200, 200) numberOfClicks:2];
+    TestWebKitAPI::Util::run(&amp;finishedSelectingText);
+
+    NSString *selectedText = [webView stringByEvaluatingJavaScript:@&quot;getSelection().getRangeAt(0).toString()&quot;];
+    EXPECT_STREQ(&quot;Hello&quot;, selectedText.UTF8String);
+}
+
+#endif // WK_API_ENABLED &amp;&amp; PLATFORM(MAC)
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPIcocoaTestWKWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h (213011 => 213012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h        2017-02-26 18:36:30 UTC (rev 213011)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h        2017-02-26 23:06:54 UTC (rev 213012)
</span><span class="lines">@@ -53,6 +53,7 @@
</span><span class="cx"> // Simulates clicking with a pressure-sensitive device, if possible.
</span><span class="cx"> - (void)mouseDownAtPoint:(NSPoint)point simulatePressure:(BOOL)simulatePressure;
</span><span class="cx"> - (void)mouseUpAtPoint:(NSPoint)point;
</span><ins>+- (void)sendClicksAtPoint:(NSPoint)point numberOfClicks:(NSUInteger)numberOfClicks;
</ins><span class="cx"> - (void)typeCharacter:(char)character;
</span><span class="cx"> @end
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIcocoaTestWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm (213011 => 213012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm        2017-02-26 18:36:30 UTC (rev 213011)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm        2017-02-26 23:06:54 UTC (rev 213012)
</span><span class="lines">@@ -94,7 +94,7 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-- (void)_mouseDownAtPoint:(NSPoint)point simulatePressure:(BOOL)simulatePressure
</del><ins>+- (void)_mouseDownAtPoint:(NSPoint)point simulatePressure:(BOOL)simulatePressure clickCount:(NSUInteger)clickCount
</ins><span class="cx"> {
</span><span class="cx">     NSEventType mouseEventType = NSEventTypeLeftMouseDown;
</span><span class="cx"> 
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx">     simulatePressure = NO;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    NSEvent *event = [NSEvent mouseEventWithType:mouseEventType location:point modifierFlags:modifierFlags timestamp:GetCurrentEventTime() windowNumber:self.windowNumber context:[NSGraphicsContext currentContext] eventNumber:++gEventNumber clickCount:1 pressure:simulatePressure];
</del><ins>+    NSEvent *event = [NSEvent mouseEventWithType:mouseEventType location:point modifierFlags:modifierFlags timestamp:GetCurrentEventTime() windowNumber:self.windowNumber context:[NSGraphicsContext currentContext] eventNumber:++gEventNumber clickCount:clickCount pressure:simulatePressure];
</ins><span class="cx">     if (!simulatePressure) {
</span><span class="cx">         [self sendEvent:event];
</span><span class="cx">         return;
</span><span class="lines">@@ -126,9 +126,9 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_mouseUpAtPoint:(NSPoint)point
</del><ins>+- (void)_mouseUpAtPoint:(NSPoint)point clickCount:(NSUInteger)clickCount
</ins><span class="cx"> {
</span><del>-    [self sendEvent:[NSEvent mouseEventWithType:NSEventTypeLeftMouseUp location:point modifierFlags:0 timestamp:GetCurrentEventTime() windowNumber:self.windowNumber context:[NSGraphicsContext currentContext] eventNumber:++gEventNumber clickCount:1 pressure:0]];
</del><ins>+    [self sendEvent:[NSEvent mouseEventWithType:NSEventTypeLeftMouseUp location:point modifierFlags:0 timestamp:GetCurrentEventTime() windowNumber:self.windowNumber context:[NSGraphicsContext currentContext] eventNumber:++gEventNumber clickCount:clickCount pressure:0]];
</ins><span class="cx"> }
</span><span class="cx"> #endif // PLATFORM(MAC)
</span><span class="cx"> 
</span><span class="lines">@@ -286,14 +286,22 @@
</span><span class="cx"> @implementation TestWKWebView (MacOnly)
</span><span class="cx"> - (void)mouseDownAtPoint:(NSPoint)point simulatePressure:(BOOL)simulatePressure
</span><span class="cx"> {
</span><del>-    [_hostWindow _mouseDownAtPoint:point simulatePressure:simulatePressure];
</del><ins>+    [_hostWindow _mouseDownAtPoint:point simulatePressure:simulatePressure clickCount:1];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)mouseUpAtPoint:(NSPoint)point
</span><span class="cx"> {
</span><del>-    [_hostWindow _mouseUpAtPoint:point];
</del><ins>+    [_hostWindow _mouseUpAtPoint:point clickCount:1];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)sendClicksAtPoint:(NSPoint)point numberOfClicks:(NSUInteger)numberOfClicks
+{
+    for (NSUInteger clickCount = 1; clickCount &lt;= numberOfClicks; ++clickCount) {
+        [_hostWindow _mouseDownAtPoint:point simulatePressure:NO clickCount:clickCount];
+        [_hostWindow _mouseUpAtPoint:point clickCount:clickCount];
+    }
+}
+
</ins><span class="cx"> - (void)typeCharacter:(char)character {
</span><span class="cx">     NSString *characterAsString = [NSString stringWithFormat:@&quot;%c&quot; , character];
</span><span class="cx">     NSEventType keyDownEventType = NSEventTypeKeyDown;
</span></span></pre>
</div>
</div>

</body>
</html>