<!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>[201298] trunk/Source/WebKit2</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/201298">201298</a></dd>
<dt>Author</dt> <dd>bdakin@apple.com</dd>
<dt>Date</dt> <dd>2016-05-23 15:06:57 -0700 (Mon, 23 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Need SPI for clients to require a user action to get an editing controls 
manager
https://bugs.webkit.org/show_bug.cgi?id=157992
-and corresponding-
rdar://problem/26379927

Reviewed by Tim Horton.

New SPI _setRequiresUserActionForEditingControlsManager. The SPI defaults to 
False, which means that by default there is no user action requirement to 
have an editing controls manager. The SPI is on WKViewPrivate and 
WKWebViewConfigurationPrivate, and it’s implemented in WebViewImpl.
* UIProcess/API/Cocoa/WKViewPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _requiresUserActionForEditingControlsManager]):
(-[WKWebViewConfiguration _setRequiresUserActionForEditingControlsManager:]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView _requiresUserActionForEditingControlsManager]):
(-[WKView _setRequiresUserActionForEditingControlsManager:]):
* UIProcess/Cocoa/WebViewImpl.h:
(WebKit::WebViewImpl::setRequiresUserActionForEditingControlsManager):
(WebKit::WebViewImpl::requiresUserActionForEditingControlsManager):

New message allows the WebProcess to tell the UI process whether the current 
web page has had any selection changes based on user interaction.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setHasHadSelectionChangesFromUserInteraction):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::hasHadSelectionChangesFromUserInteraction):
* UIProcess/WebPageProxy.messages.in:

m_userIsInteracting m_hasFocusedDueToUserInteraction used to be iOS only, but 
now we want to track them for Mac as well.
* WebProcess/WebPage/WebPage.cpp:

Handling mouse events and key events will toggle m_userIsInteracting.
(WebKit::WebPage::mouseEvent):
(WebKit::WebPage::keyEvent):

m_userIsInteracting is no longer iOS-only.
(WebKit::WebPage::setInitialFocus):

Send a message to the UI process on page transition to re-set 
hasHadSelectionChangesFromUserInteraction to false.
(WebKit::WebPage::didStartPageTransition):

Send a message to the UI process if this is the first selection change to 
happen as a result of a user action.
(WebKit::WebPage::didChangeSelection):
* WebProcess/WebPage/WebPage.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewConfigurationmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewConfigurationPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewmm">trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebViewImplh">trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxymessagesin">trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (201297 => 201298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/ChangeLog        2016-05-23 22:06:57 UTC (rev 201298)
</span><span class="lines">@@ -1,3 +1,61 @@
</span><ins>+2016-05-23  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+        Need SPI for clients to require a user action to get an editing controls 
+        manager
+        https://bugs.webkit.org/show_bug.cgi?id=157992
+        -and corresponding-
+        rdar://problem/26379927
+
+        Reviewed by Tim Horton.
+
+        New SPI _setRequiresUserActionForEditingControlsManager. The SPI defaults to 
+        False, which means that by default there is no user action requirement to 
+        have an editing controls manager. The SPI is on WKViewPrivate and 
+        WKWebViewConfigurationPrivate, and it’s implemented in WebViewImpl.
+        * UIProcess/API/Cocoa/WKViewPrivate.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _initializeWithConfiguration:]):
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration init]):
+        (-[WKWebViewConfiguration copyWithZone:]):
+        (-[WKWebViewConfiguration _requiresUserActionForEditingControlsManager]):
+        (-[WKWebViewConfiguration _setRequiresUserActionForEditingControlsManager:]):
+        * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _requiresUserActionForEditingControlsManager]):
+        (-[WKView _setRequiresUserActionForEditingControlsManager:]):
+        * UIProcess/Cocoa/WebViewImpl.h:
+        (WebKit::WebViewImpl::setRequiresUserActionForEditingControlsManager):
+        (WebKit::WebViewImpl::requiresUserActionForEditingControlsManager):
+
+        New message allows the WebProcess to tell the UI process whether the current 
+        web page has had any selection changes based on user interaction.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::setHasHadSelectionChangesFromUserInteraction):
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::hasHadSelectionChangesFromUserInteraction):
+        * UIProcess/WebPageProxy.messages.in:
+
+        m_userIsInteracting m_hasFocusedDueToUserInteraction used to be iOS only, but 
+        now we want to track them for Mac as well.
+        * WebProcess/WebPage/WebPage.cpp:
+
+        Handling mouse events and key events will toggle m_userIsInteracting.
+        (WebKit::WebPage::mouseEvent):
+        (WebKit::WebPage::keyEvent):
+
+        m_userIsInteracting is no longer iOS-only.
+        (WebKit::WebPage::setInitialFocus):
+
+        Send a message to the UI process on page transition to re-set 
+        hasHadSelectionChangesFromUserInteraction to false.
+        (WebKit::WebPage::didStartPageTransition):
+
+        Send a message to the UI process if this is the first selection change to 
+        happen as a result of a user action.
+        (WebKit::WebPage::didChangeSelection):
+        * WebProcess/WebPage/WebPage.h:
+
</ins><span class="cx"> 2016-05-23  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Add logging for NSURLSession calls
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h (201297 => 201298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h        2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h        2016-05-23 22:06:57 UTC (rev 201298)
</span><span class="lines">@@ -87,6 +87,8 @@
</span><span class="cx"> @property (strong, nonatomic, setter=_setInspectorAttachmentView:) NSView *_inspectorAttachmentView WK_AVAILABLE(10_11, NA);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+@property (nonatomic, readwrite, setter=_setRequiresUserActionForEditingControlsManager:) BOOL _requiresUserActionForEditingControlsManager;
+
</ins><span class="cx"> - (NSView*)fullScreenPlaceholderView;
</span><span class="cx"> - (NSWindow*)createFullScreenWindow;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (201297 => 201298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2016-05-23 22:06:57 UTC (rev 201298)
</span><span class="lines">@@ -536,6 +536,7 @@
</span><span class="cx">     _page = &amp;_impl-&gt;page();
</span><span class="cx"> 
</span><span class="cx">     _impl-&gt;setAutomaticallyAdjustsContentInsets(true);
</span><ins>+    _impl-&gt;setRequiresUserActionForEditingControlsManager([configuration _requiresUserActionForEditingControlsManager]);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     _page-&gt;setBackgroundExtendsBeyondPage(true);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewConfigurationmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (201297 => 201298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm        2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm        2016-05-23 22:06:57 UTC (rev 201298)
</span><span class="lines">@@ -120,6 +120,7 @@
</span><span class="cx">     BOOL _showsURLsInToolTips;
</span><span class="cx">     BOOL _serviceControlsEnabled;
</span><span class="cx">     BOOL _imageControlsEnabled;
</span><ins>+    BOOL _requiresUserActionForEditingControlsManager;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if USE(APPLE_INTERNAL_SDK)
</span><span class="lines">@@ -168,6 +169,7 @@
</span><span class="cx">     _showsURLsInToolTips = NO;
</span><span class="cx">     _serviceControlsEnabled = NO;
</span><span class="cx">     _imageControlsEnabled = NO;
</span><ins>+    _requiresUserActionForEditingControlsManager = NO;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET)
</span><span class="lines">@@ -290,6 +292,7 @@
</span><span class="cx">     configuration-&gt;_showsURLsInToolTips = self-&gt;_showsURLsInToolTips;
</span><span class="cx">     configuration-&gt;_serviceControlsEnabled = self-&gt;_serviceControlsEnabled;
</span><span class="cx">     configuration-&gt;_imageControlsEnabled = self-&gt;_imageControlsEnabled;
</span><ins>+    configuration-&gt;_requiresUserActionForEditingControlsManager = self-&gt;_requiresUserActionForEditingControlsManager;
</ins><span class="cx"> #endif
</span><span class="cx"> #if ENABLE(DATA_DETECTION) &amp;&amp; PLATFORM(IOS)
</span><span class="cx">     configuration-&gt;_dataDetectorTypes = self-&gt;_dataDetectorTypes;
</span><span class="lines">@@ -676,6 +679,17 @@
</span><span class="cx"> {
</span><span class="cx">     _imageControlsEnabled = imageControlsEnabled;
</span><span class="cx"> }
</span><ins>+
+- (BOOL)_requiresUserActionForEditingControlsManager
+{
+    return _requiresUserActionForEditingControlsManager;
+}
+
+- (void)_setRequiresUserActionForEditingControlsManager:(BOOL)requiresUserAction
+{
+    _requiresUserActionForEditingControlsManager = requiresUserAction;
+}
+
</ins><span class="cx"> #endif // PLATFORM(MAC)
</span><span class="cx"> 
</span><span class="cx"> #if USE(APPLE_INTERNAL_SDK)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewConfigurationPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h (201297 => 201298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h        2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h        2016-05-23 22:06:57 UTC (rev 201298)
</span><span class="lines">@@ -63,6 +63,7 @@
</span><span class="cx"> @property (nonatomic, setter=_setShowsURLsInToolTips:) BOOL _showsURLsInToolTips WK_AVAILABLE(WK_MAC_TBA, NA);
</span><span class="cx"> @property (nonatomic, setter=_setServiceControlsEnabled:) BOOL _serviceControlsEnabled WK_AVAILABLE(WK_MAC_TBA, NA);
</span><span class="cx"> @property (nonatomic, setter=_setImageControlsEnabled:) BOOL _imageControlsEnabled WK_AVAILABLE(WK_MAC_TBA, NA);
</span><ins>+@property (nonatomic, readwrite, setter=_setRequiresUserActionForEditingControlsManager:) BOOL _requiresUserActionForEditingControlsManager WK_AVAILABLE(WK_MAC_TBA, NA);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> @property (nonatomic, strong, setter=_setVisitedLinkProvider:) _WKVisitedLinkProvider *_visitedLinkProvider WK_DEPRECATED(10_10, WK_MAC_TBA, 8_0, WK_IOS_TBA, &quot;Please use _visitedLinkStore instead&quot;);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (201297 => 201298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2016-05-23 22:06:57 UTC (rev 201298)
</span><span class="lines">@@ -1107,6 +1107,16 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+- (BOOL)_requiresUserActionForEditingControlsManager
+{
+    return _data-&gt;_impl-&gt;requiresUserActionForEditingControlsManager();
+}
+
+- (void)_setRequiresUserActionForEditingControlsManager:(BOOL)requiresUserAction
+{
+    _data-&gt;_impl-&gt;setRequiresUserActionForEditingControlsManager(requiresUserAction);
+}
+
</ins><span class="cx"> - (NSView *)fullScreenPlaceholderView
</span><span class="cx"> {
</span><span class="cx">     return _data-&gt;_impl-&gt;fullScreenPlaceholderView();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebViewImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (201297 => 201298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h        2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h        2016-05-23 22:06:57 UTC (rev 201298)
</span><span class="lines">@@ -478,6 +478,9 @@
</span><span class="cx"> 
</span><span class="cx">     bool windowIsFrontWindowUnderMouse(NSEvent *);
</span><span class="cx"> 
</span><ins>+    void setRequiresUserActionForEditingControlsManager(bool requiresUserActionForEditingControlsManager) { m_requiresUserActionForEditingControlsManager = requiresUserActionForEditingControlsManager; }
+    bool requiresUserActionForEditingControlsManager() const { return m_requiresUserActionForEditingControlsManager; }
+
</ins><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101200 
</span><span class="cx">     void handleAcceptedCandidate(NSTextCheckingResult *acceptedCandidate);
</span><span class="cx"> #if USE(APPLE_INTERNAL_SDK)
</span><span class="lines">@@ -635,6 +638,7 @@
</span><span class="cx"> #endif
</span><span class="cx">     NSRange m_softSpaceRange { NSNotFound, 0 };
</span><span class="cx">     bool m_isHandlingAcceptedCandidate { false };
</span><ins>+    bool m_requiresUserActionForEditingControlsManager { false };
</ins><span class="cx"> };
</span><span class="cx">     
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (201297 => 201298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2016-05-23 22:06:57 UTC (rev 201298)
</span><span class="lines">@@ -4076,6 +4076,11 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+void WebPageProxy::setHasHadSelectionChangesFromUserInteraction(bool hasHadUserSelectionChanges)
+{
+    m_hasHadSelectionChangesFromUserInteraction = hasHadUserSelectionChanges;
+}
+
</ins><span class="cx"> // BackForwardList
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::backForwardAddItem(uint64_t itemID)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (201297 => 201298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2016-05-23 22:06:57 UTC (rev 201298)
</span><span class="lines">@@ -1108,6 +1108,8 @@
</span><span class="cx"> 
</span><span class="cx">     UserInterfaceLayoutDirection userInterfaceLayoutDirection();
</span><span class="cx"> 
</span><ins>+    bool hasHadSelectionChangesFromUserInteraction() const { return m_hasHadSelectionChangesFromUserInteraction; }
+
</ins><span class="cx"> private:
</span><span class="cx">     WebPageProxy(PageClient&amp;, WebProcessProxy&amp;, uint64_t pageID, Ref&lt;API::PageConfiguration&gt;&amp;&amp;);
</span><span class="cx">     void platformInitialize();
</span><span class="lines">@@ -1265,6 +1267,7 @@
</span><span class="cx"> 
</span><span class="cx">     void editorStateChanged(const EditorState&amp;);
</span><span class="cx">     void compositionWasCanceled(const EditorState&amp;);
</span><ins>+    void setHasHadSelectionChangesFromUserInteraction(bool);
</ins><span class="cx"> 
</span><span class="cx">     // Back/Forward list management
</span><span class="cx">     void backForwardAddItem(uint64_t itemID);
</span><span class="lines">@@ -1807,6 +1810,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool m_isResourceCachingDisabled { false };
</span><span class="cx"> 
</span><ins>+    bool m_hasHadSelectionChangesFromUserInteraction { false };
+
</ins><span class="cx"> #if ENABLE(MEDIA_SESSION)
</span><span class="cx">     bool m_hasMediaSessionWithActiveMediaElements { false };
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (201297 => 201298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2016-05-23 22:06:57 UTC (rev 201298)
</span><span class="lines">@@ -233,6 +233,7 @@
</span><span class="cx">     # Editor notifications
</span><span class="cx">     EditorStateChanged(struct WebKit::EditorState editorState)
</span><span class="cx">     CompositionWasCanceled(struct WebKit::EditorState editorState)
</span><ins>+    SetHasHadSelectionChangesFromUserInteraction(bool hasHadUserSelectionChanges)
</ins><span class="cx"> 
</span><span class="cx">     # Find messages
</span><span class="cx">     DidCountStringMatches(String string, uint32_t matchCount)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (201297 => 201298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-05-23 22:06:57 UTC (rev 201298)
</span><span class="lines">@@ -341,6 +341,7 @@
</span><span class="cx">     , m_hasWheelEventHandlers(false)
</span><span class="cx">     , m_cachedPageCount(0)
</span><span class="cx">     , m_autoSizingShouldExpandToViewHeight(false)
</span><ins>+    , m_userIsInteracting(false)
</ins><span class="cx"> #if ENABLE(CONTEXT_MENUS)
</span><span class="cx">     , m_isShowingContextMenu(false)
</span><span class="cx"> #endif
</span><span class="lines">@@ -350,7 +351,6 @@
</span><span class="cx">     , m_scaleWasSetByUIProcess(false)
</span><span class="cx">     , m_userHasChangedPageScaleFactor(false)
</span><span class="cx">     , m_hasStablePageScaleFactor(true)
</span><del>-    , m_userIsInteracting(false)
</del><span class="cx">     , m_hasPendingBlurNotification(false)
</span><span class="cx">     , m_useTestingViewportConfiguration(false)
</span><span class="cx">     , m_isInStableState(true)
</span><span class="lines">@@ -2173,6 +2173,8 @@
</span><span class="cx"> 
</span><span class="cx"> void WebPage::mouseEvent(const WebMouseEvent&amp; mouseEvent)
</span><span class="cx"> {
</span><ins>+    m_userIsInteracting = true;
+
</ins><span class="cx">     m_page-&gt;pageThrottler().didReceiveUserInput();
</span><span class="cx"> 
</span><span class="cx">     bool shouldHandleEvent = true;
</span><span class="lines">@@ -2189,6 +2191,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (!shouldHandleEvent) {
</span><span class="cx">         send(Messages::WebPageProxy::DidReceiveEvent(static_cast&lt;uint32_t&gt;(mouseEvent.type()), false));
</span><ins>+        m_userIsInteracting = false;
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -2214,6 +2217,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     send(Messages::WebPageProxy::DidReceiveEvent(static_cast&lt;uint32_t&gt;(mouseEvent.type()), handled));
</span><ins>+    m_userIsInteracting = false;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool handleWheelEvent(const WebWheelEvent&amp; wheelEvent, Page* page)
</span><span class="lines">@@ -2249,6 +2253,8 @@
</span><span class="cx"> 
</span><span class="cx"> void WebPage::keyEvent(const WebKeyboardEvent&amp; keyboardEvent)
</span><span class="cx"> {
</span><ins>+    m_userIsInteracting = true;
+
</ins><span class="cx">     m_page-&gt;pageThrottler().didReceiveUserInput();
</span><span class="cx"> 
</span><span class="cx">     CurrentEvent currentEvent(keyboardEvent);
</span><span class="lines">@@ -2259,6 +2265,8 @@
</span><span class="cx">         handled = performDefaultBehaviorForKeyEvent(keyboardEvent);
</span><span class="cx"> 
</span><span class="cx">     send(Messages::WebPageProxy::DidReceiveEvent(static_cast&lt;uint32_t&gt;(keyboardEvent.type()), handled));
</span><ins>+
+    m_userIsInteracting = false;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::validateCommand(const String&amp; commandName, uint64_t callbackID)
</span><span class="lines">@@ -2461,9 +2469,7 @@
</span><span class="cx">     if (!m_page)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
</del><span class="cx">     TemporaryChange&lt;bool&gt; userIsInteractingChange { m_userIsInteracting, true };
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx">     Frame&amp; frame = m_page-&gt;focusController().focusedOrMainFrame();
</span><span class="cx">     frame.document()-&gt;setFocusedElement(0);
</span><span class="lines">@@ -2558,8 +2564,14 @@
</span><span class="cx"> void WebPage::didStartPageTransition()
</span><span class="cx"> {
</span><span class="cx">     m_drawingArea-&gt;setLayerTreeStateIsFrozen(true);
</span><del>-#if PLATFORM(IOS)
</del><ins>+
+#if PLATFORM(MAC)
+    bool hasPreviouslyFocusedDueToUserInteraction = m_hasFocusedDueToUserInteraction;
+#endif
</ins><span class="cx">     m_hasFocusedDueToUserInteraction = false;
</span><ins>+#if PLATFORM(MAC)
+    if (hasPreviouslyFocusedDueToUserInteraction)
+        send(Messages::WebPageProxy::SetHasHadSelectionChangesFromUserInteraction(m_hasFocusedDueToUserInteraction));
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -4697,6 +4709,11 @@
</span><span class="cx">     m_isEditorStateMissingPostLayoutData = editorState.isMissingPostLayoutData;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><ins>+    bool hasPreviouslyFocusedDueToUserInteraction = m_hasFocusedDueToUserInteraction;
+    m_hasFocusedDueToUserInteraction |= m_userIsInteracting;
+    if (!hasPreviouslyFocusedDueToUserInteraction &amp;&amp; m_hasFocusedDueToUserInteraction)
+        send(Messages::WebPageProxy::SetHasHadSelectionChangesFromUserInteraction(m_hasFocusedDueToUserInteraction));
+
</ins><span class="cx">     // Abandon the current inline input session if selection changed for any other reason but an input method direct action.
</span><span class="cx">     // FIXME: This logic should be in WebCore.
</span><span class="cx">     // FIXME: Many changes that affect composition node do not go through didChangeSelection(). We need to do something when DOM manipulation affects the composition, because otherwise input method's idea about it will be different from Editor's.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (201297 => 201298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2016-05-23 22:06:57 UTC (rev 201298)
</span><span class="lines">@@ -1376,6 +1376,9 @@
</span><span class="cx">     WebCore::IntSize m_minimumLayoutSize;
</span><span class="cx">     bool m_autoSizingShouldExpandToViewHeight;
</span><span class="cx"> 
</span><ins>+    bool m_userIsInteracting;
+    bool m_hasFocusedDueToUserInteraction { false };
+
</ins><span class="cx"> #if ENABLE(CONTEXT_MENUS)
</span><span class="cx">     bool m_isShowingContextMenu;
</span><span class="cx"> #endif
</span><span class="lines">@@ -1400,8 +1403,6 @@
</span><span class="cx">     bool m_scaleWasSetByUIProcess;
</span><span class="cx">     bool m_userHasChangedPageScaleFactor;
</span><span class="cx">     bool m_hasStablePageScaleFactor;
</span><del>-    bool m_userIsInteracting;
-    bool m_hasFocusedDueToUserInteraction { false };
</del><span class="cx">     bool m_hasPendingBlurNotification;
</span><span class="cx">     bool m_useTestingViewportConfiguration;
</span><span class="cx">     bool m_isInStableState;
</span></span></pre>
</div>
</div>

</body>
</html>