<!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>[170981] 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/170981">170981</a></dd>
<dt>Author</dt> <dd>enrica@apple.com</dd>
<dt>Date</dt> <dd>2014-07-10 16:26:19 -0700 (Thu, 10 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add a mechanism to notify the UIProcess when an editing command is done executing.
https://bugs.webkit.org/show_bug.cgi?id=134807

Reviewed by Tim Horton.

Some editing commands have an effect on some parts of the system that
run inside the UIProcess. A good example are the cursor movement commands
that require an update of the autocorrection/autosuggestion machinery.
This patch adds a way to reliably know when the command has been executed
in the WebProcess. A previous attempt at solving this problem was added in
<a href="http://trac.webkit.org/projects/webkit/changeset/170858">r170858</a> and was partially reverted in <a href="http://trac.webkit.org/projects/webkit/changeset/170948">r170948</a>.
The change also removes the selectionWillChange notification added in <a href="http://trac.webkit.org/projects/webkit/changeset/170858">r170858</a>.

* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::editorStateChanged):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::selectionWillChange): Deleted.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView executeEditCommandWithCallback:]):
(-[WKContentView _moveUp:withHistory:]):
(-[WKContentView _moveDown:withHistory:]):
(-[WKContentView _moveLeft:withHistory:]):
(-[WKContentView _moveRight:withHistory:]):
(-[WKContentView _moveToStartOfWord:withHistory:]):
(-[WKContentView _moveToStartOfParagraph:withHistory:]):
(-[WKContentView _moveToStartOfLine:withHistory:]):
(-[WKContentView _moveToStartOfDocument:withHistory:]):
(-[WKContentView _moveToEndOfWord:withHistory:]):
(-[WKContentView _moveToEndOfParagraph:withHistory:]):
(-[WKContentView _moveToEndOfLine:withHistory:]):
(-[WKContentView _moveToEndOfDocument:withHistory:]):
(-[WKContentView _selectionWillChange]): Deleted.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::executeEditCommand):
(WebKit::WebPageProxy::notifySelectionWillChange): Deleted.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::executeEditCommandWithCallback):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPageClienth">trunk/Source/WebKit2/UIProcess/PageClient.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="#trunkSourceWebKit2UIProcessiosPageClientImplIOSh">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosPageClientImplIOSmm">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionh">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm">trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagemessagesin">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170980 => 170981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-07-10 23:20:51 UTC (rev 170980)
+++ trunk/Source/WebKit2/ChangeLog        2014-07-10 23:26:19 UTC (rev 170981)
</span><span class="lines">@@ -1,3 +1,49 @@
</span><ins>+2014-07-10  Enrica Casucci  &lt;enrica@apple.com&gt;
+
+        Add a mechanism to notify the UIProcess when an editing command is done executing.
+        https://bugs.webkit.org/show_bug.cgi?id=134807
+
+        Reviewed by Tim Horton.
+
+        Some editing commands have an effect on some parts of the system that
+        run inside the UIProcess. A good example are the cursor movement commands
+        that require an update of the autocorrection/autosuggestion machinery.
+        This patch adds a way to reliably know when the command has been executed
+        in the WebProcess. A previous attempt at solving this problem was added in
+        r170858 and was partially reverted in r170948.
+        The change also removes the selectionWillChange notification added in r170858.
+
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::editorStateChanged):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::selectionWillChange): Deleted.
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView executeEditCommandWithCallback:]):
+        (-[WKContentView _moveUp:withHistory:]):
+        (-[WKContentView _moveDown:withHistory:]):
+        (-[WKContentView _moveLeft:withHistory:]):
+        (-[WKContentView _moveRight:withHistory:]):
+        (-[WKContentView _moveToStartOfWord:withHistory:]):
+        (-[WKContentView _moveToStartOfParagraph:withHistory:]):
+        (-[WKContentView _moveToStartOfLine:withHistory:]):
+        (-[WKContentView _moveToStartOfDocument:withHistory:]):
+        (-[WKContentView _moveToEndOfWord:withHistory:]):
+        (-[WKContentView _moveToEndOfParagraph:withHistory:]):
+        (-[WKContentView _moveToEndOfLine:withHistory:]):
+        (-[WKContentView _moveToEndOfDocument:withHistory:]):
+        (-[WKContentView _selectionWillChange]): Deleted.
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::executeEditCommand):
+        (WebKit::WebPageProxy::notifySelectionWillChange): Deleted.
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::executeEditCommandWithCallback):
+
</ins><span class="cx"> 2014-07-10  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Mac] NSWindow warning: adding an unknown subview opening detached Inspector
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (170980 => 170981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/PageClient.h        2014-07-10 23:20:51 UTC (rev 170980)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h        2014-07-10 23:26:19 UTC (rev 170981)
</span><span class="lines">@@ -259,7 +259,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void startAssistingNode(const AssistedNodeInformation&amp;, bool userIsInteracting, bool blurPreviousNode, API::Object* userData) = 0;
</span><span class="cx">     virtual void stopAssistingNode() = 0;
</span><del>-    virtual void selectionWillChange() = 0;
</del><span class="cx">     virtual void selectionDidChange() = 0;
</span><span class="cx">     virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&amp;, bool isCharEvent) = 0;
</span><span class="cx">     virtual void positionInformationDidChange(const InteractionInformationAtPosition&amp;) = 0;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (170980 => 170981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-07-10 23:20:51 UTC (rev 170980)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-07-10 23:26:19 UTC (rev 170981)
</span><span class="lines">@@ -3436,9 +3436,6 @@
</span><span class="cx">     m_temporarilyClosedComposition = editorState.shouldIgnoreCompositionSelectionChange &amp;&amp; (m_temporarilyClosedComposition || m_editorState.hasComposition) &amp;&amp; !editorState.hasComposition;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
-    notifySelectionWillChange();
-#endif
</del><span class="cx">     m_editorState = editorState;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (170980 => 170981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-07-10 23:20:51 UTC (rev 170980)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-07-10 23:26:19 UTC (rev 170981)
</span><span class="lines">@@ -377,6 +377,7 @@
</span><span class="cx">     void executeEditCommand(const String&amp; commandName);
</span><span class="cx">     void validateCommand(const String&amp; commandName, std::function&lt;void (const String&amp;, bool, int32_t, CallbackBase::Error)&gt;);
</span><span class="cx"> #if PLATFORM(IOS)
</span><ins>+    void executeEditCommand(const String&amp; commandName, std::function&lt;void (CallbackBase::Error)&gt;);
</ins><span class="cx">     double displayedContentScale() const { return m_lastVisibleContentRectUpdate.scale(); }
</span><span class="cx">     const WebCore::FloatRect&amp; exposedContentRect() const { return m_lastVisibleContentRectUpdate.exposedRect(); }
</span><span class="cx">     const WebCore::FloatRect&amp; unobscuredContentRect() const { return m_lastVisibleContentRectUpdate.unobscuredRect(); }
</span><span class="lines">@@ -1222,7 +1223,6 @@
</span><span class="cx">     void enableInspectorNodeSearch();
</span><span class="cx">     void disableInspectorNodeSearch();
</span><span class="cx"> #endif
</span><del>-    void notifySelectionWillChange();
</del><span class="cx">     void notifyRevealedSelection();
</span><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (170980 => 170981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2014-07-10 23:20:51 UTC (rev 170980)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2014-07-10 23:26:19 UTC (rev 170981)
</span><span class="lines">@@ -119,7 +119,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void startAssistingNode(const AssistedNodeInformation&amp;, bool userIsInteracting, bool blurPreviousNode, API::Object* userData) override;
</span><span class="cx">     virtual void stopAssistingNode() override;
</span><del>-    virtual void selectionWillChange() override;
</del><span class="cx">     virtual void selectionDidChange() override;
</span><span class="cx">     virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&amp;, bool isCharEvent) override;
</span><span class="cx">     virtual void positionInformationDidChange(const InteractionInformationAtPosition&amp;) override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (170980 => 170981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2014-07-10 23:20:51 UTC (rev 170980)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2014-07-10 23:26:19 UTC (rev 170981)
</span><span class="lines">@@ -350,11 +350,6 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PageClientImpl::selectionWillChange()
-{
-    [m_contentView _selectionWillChange];
-}
-
</del><span class="cx"> void PageClientImpl::selectionDidChange()
</span><span class="cx"> {
</span><span class="cx">     [m_contentView _selectionChanged];
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (170980 => 170981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h        2014-07-10 23:20:51 UTC (rev 170980)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h        2014-07-10 23:26:19 UTC (rev 170981)
</span><span class="lines">@@ -164,7 +164,6 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_startAssistingNode:(const WebKit::AssistedNodeInformation&amp;)information userIsInteracting:(BOOL)userIsInteracting blurPreviousNode:(BOOL)blurPreviousNode userObject:(NSObject &lt;NSSecureCoding&gt; *)userObject;
</span><span class="cx"> - (void)_stopAssistingNode;
</span><del>-- (void)_selectionWillChange;
</del><span class="cx"> - (void)_selectionChanged;
</span><span class="cx"> - (void)_updateChangedSelection;
</span><span class="cx"> - (BOOL)_interpretKeyEvent:(WebIOSEvent *)theEvent isCharEvent:(BOOL)isCharEvent;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (170980 => 170981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2014-07-10 23:20:51 UTC (rev 170980)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2014-07-10 23:26:19 UTC (rev 170981)
</span><span class="lines">@@ -2225,75 +2225,83 @@
</span><span class="cx">     return NO;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)executeEditCommandWithCallback:(NSString *)commandName
+{
+    [self beginSelectionChange];
+    _page-&gt;executeEditCommand(commandName, [self](CallbackBase::Error) {
+        [self endSelectionChange];
+    });
+}
+
</ins><span class="cx"> - (UITextInputArrowKeyHistory *)_moveUp:(BOOL)extending withHistory:(UITextInputArrowKeyHistory *)history
</span><span class="cx"> {
</span><del>-    _page-&gt;executeEditCommand(ASCIILiteral(&quot;moveUp&quot;));
</del><ins>+    [self executeEditCommandWithCallback:@&quot;moveUp&quot;];
</ins><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (UITextInputArrowKeyHistory *)_moveDown:(BOOL)extending withHistory:(UITextInputArrowKeyHistory *)history
</span><span class="cx"> {
</span><del>-    _page-&gt;executeEditCommand(ASCIILiteral(&quot;moveDown&quot;));
</del><ins>+    [self executeEditCommandWithCallback:@&quot;moveDown&quot;];
</ins><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (UITextInputArrowKeyHistory *)_moveLeft:(BOOL) extending withHistory:(UITextInputArrowKeyHistory *)history
</span><span class="cx"> {
</span><del>-    _page-&gt;executeEditCommand(ASCIILiteral(&quot;moveLeft&quot;));
</del><ins>+    [self executeEditCommandWithCallback:@&quot;moveLeft&quot;];
</ins><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (UITextInputArrowKeyHistory *)_moveRight:(BOOL) extending withHistory:(UITextInputArrowKeyHistory *)history
</span><span class="cx"> {
</span><del>-    _page-&gt;executeEditCommand(ASCIILiteral(&quot;moveRight&quot;));
</del><ins>+    [self executeEditCommandWithCallback:@&quot;moveRight&quot;];
</ins><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (UITextInputArrowKeyHistory *)_moveToStartOfWord:(BOOL)extending withHistory:(UITextInputArrowKeyHistory *)history
</span><span class="cx"> {
</span><del>-    _page-&gt;executeEditCommand(ASCIILiteral(&quot;moveWordBackward&quot;));
</del><ins>+    [self executeEditCommandWithCallback:@&quot;moveWordBackward&quot;];
</ins><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (UITextInputArrowKeyHistory *)_moveToStartOfParagraph:(BOOL) extending withHistory:(UITextInputArrowKeyHistory *)history
</span><span class="cx"> {
</span><del>-    _page-&gt;executeEditCommand(ASCIILiteral(&quot;moveToStartOfParagraph&quot;));
</del><ins>+    [self executeEditCommandWithCallback:@&quot;moveToStartOfParagraph&quot;];
</ins><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (UITextInputArrowKeyHistory *)_moveToStartOfLine:(BOOL) extending withHistory:(UITextInputArrowKeyHistory *)history
</span><span class="cx"> {
</span><del>-    _page-&gt;executeEditCommand(ASCIILiteral(&quot;moveToStartOfLine&quot;));
</del><ins>+    [self executeEditCommandWithCallback:@&quot;moveToStartOfLine&quot;];
</ins><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (UITextInputArrowKeyHistory *)_moveToStartOfDocument:(BOOL) extending withHistory:(UITextInputArrowKeyHistory *)history
</span><span class="cx"> {
</span><del>-    _page-&gt;executeEditCommand(ASCIILiteral(&quot;moveToBeginningOfDocument&quot;));
</del><ins>+    [self executeEditCommandWithCallback:@&quot;moveToBeginningOfDocument&quot;];
</ins><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (UITextInputArrowKeyHistory *)_moveToEndOfWord:(BOOL)extending withHistory:(UITextInputArrowKeyHistory *)history
</span><span class="cx"> {
</span><del>-    _page-&gt;executeEditCommand(ASCIILiteral(&quot;moveWordForward&quot;));
</del><ins>+    [self executeEditCommandWithCallback:@&quot;moveWordForward&quot;];
</ins><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (UITextInputArrowKeyHistory *)_moveToEndOfParagraph:(BOOL) extending withHistory:(UITextInputArrowKeyHistory *)history
</span><span class="cx"> {
</span><del>-    _page-&gt;executeEditCommand(ASCIILiteral(&quot;moveToEndOfParagraph&quot;));
</del><ins>+    [self executeEditCommandWithCallback:@&quot;moveToEndOfParagraph&quot;];
</ins><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (UITextInputArrowKeyHistory *)_moveToEndOfLine:(BOOL) extending withHistory:(UITextInputArrowKeyHistory *)history
</span><span class="cx"> {
</span><del>-    _page-&gt;executeEditCommand(ASCIILiteral(&quot;moveToEndOfLine&quot;));
</del><ins>+    [self executeEditCommandWithCallback:@&quot;moveToEndOfLine&quot;];
</ins><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (UITextInputArrowKeyHistory *)_moveToEndOfDocument:(BOOL) extending withHistory:(UITextInputArrowKeyHistory *)history
</span><span class="cx"> {
</span><del>-    _page-&gt;executeEditCommand(ASCIILiteral(&quot;moveToEndOfDocument&quot;));
</del><ins>+    [self executeEditCommandWithCallback:@&quot;moveToEndOfDocument&quot;];
</ins><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2504,10 +2512,6 @@
</span><span class="cx">     [_webSelectionAssistant resignedFirstResponder];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_selectionWillChange
-{
-}
-
</del><span class="cx"> - (void)_selectionChanged
</span><span class="cx"> {
</span><span class="cx">     _selectionNeedsUpdate = YES;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (170980 => 170981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-07-10 23:20:51 UTC (rev 170980)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-07-10 23:26:19 UTC (rev 170981)
</span><span class="lines">@@ -359,6 +359,17 @@
</span><span class="cx">     m_process-&gt;send(Messages::WebPage::ApplyAutocorrection(correction, originalText, callbackID), m_pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::executeEditCommand(const String&amp; commandName, std::function&lt;void (CallbackBase::Error)&gt; callbackFunction)
+{
+    if (!isValid()) {
+        callbackFunction(CallbackBase::Error::Unknown);
+        return;
+    }
+    
+    uint64_t callbackID = m_callbacks.put(WTF::move(callbackFunction), std::make_unique&lt;ProcessThrottler::BackgroundActivityToken&gt;(m_process-&gt;throttler()));
+    m_process-&gt;send(Messages::WebPage::ExecuteEditCommandWithCallback(commandName, callbackID), m_pageID);
+}
+
</ins><span class="cx"> bool WebPageProxy::applyAutocorrection(const String&amp; correction, const String&amp; originalText)
</span><span class="cx"> {
</span><span class="cx">     bool autocorrectionApplied = false;
</span><span class="lines">@@ -466,11 +477,6 @@
</span><span class="cx">     m_process-&gt;send(Messages::WebPage::ApplicationDidBecomeActive(), m_pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::notifySelectionWillChange()
-{
-    m_pageClient.selectionWillChange();
-}
-
</del><span class="cx"> void WebPageProxy::notifyRevealedSelection()
</span><span class="cx"> {
</span><span class="cx">     m_pageClient.selectionDidChange();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (170980 => 170981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-07-10 23:20:51 UTC (rev 170980)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-07-10 23:26:19 UTC (rev 170981)
</span><span class="lines">@@ -507,6 +507,7 @@
</span><span class="cx"> 
</span><span class="cx">     void dispatchAsynchronousTouchEvents(const Vector&lt;WebTouchEvent, 1&gt;&amp; queue);
</span><span class="cx">     void contentSizeCategoryDidChange(const String&amp;);
</span><ins>+    void executeEditCommandWithCallback(const String&amp;, uint64_t callbackID);
</ins><span class="cx"> #if ENABLE(INSPECTOR)
</span><span class="cx">     void showInspectorHighlight(const WebCore::Highlight&amp;);
</span><span class="cx">     void hideInspectorHighlight();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (170980 => 170981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2014-07-10 23:20:51 UTC (rev 170980)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2014-07-10 23:26:19 UTC (rev 170981)
</span><span class="lines">@@ -85,6 +85,7 @@
</span><span class="cx">     ApplicationWillEnterForeground()
</span><span class="cx">     ApplicationDidBecomeActive()
</span><span class="cx">     ContentSizeCategoryDidChange(String contentSizeCategory)
</span><ins>+    ExecuteEditCommandWithCallback(String name, uint64_t callbackID)
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (170980 => 170981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-07-10 23:20:51 UTC (rev 170980)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-07-10 23:26:19 UTC (rev 170981)
</span><span class="lines">@@ -1666,6 +1666,12 @@
</span><span class="cx">     send(Messages::WebPageProxy::StringCallback(correctionApplied ? correction : String(), callbackID));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPage::executeEditCommandWithCallback(const String&amp; commandName, uint64_t callbackID)
+{
+    executeEditCommand(commandName);
+    send(Messages::WebPageProxy::VoidCallback(callbackID));
+}
+
</ins><span class="cx"> void WebPage::syncApplyAutocorrection(const String&amp; correction, const String&amp; originalText, bool&amp; correctionApplied)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;Range&gt; range;
</span></span></pre>
</div>
</div>

</body>
</html>