<!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>[178350] releases/WebKitGTK/webkit-2.6/Source</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/178350">178350</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-01-13 02:59:02 -0800 (Tue, 13 Jan 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/177152">r177152</a> - REGRESSION (Async Text Input): Text input method state is not reset when reloading a page
https://bugs.webkit.org/show_bug.cgi?id=139504
rdar://problem/19034674

Reviewed by Enrica Casucci.

Source/WebCore:

Explicitly notify EditorClient when a composition is voluntarily canceled by WebCore.
These are almost certainly not all the places where this happens, but this fixes the bug,
and lays the groundwork for using this new client call instead of didChangeSelection
hacks.

* editing/Editor.cpp:
(WebCore::Editor::clear):
(WebCore::Editor::cancelComposition):
* loader/EmptyClients.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::willTransitionToCommitted):
* page/EditorClient.h:

Source/WebKit/mac:

Stub out new client calls, this patch does not attempt to make any changes on WebKit1.

* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::discardedComposition):

Source/WebKit/win:

Stub out new client calls, this patch doesn't attempt to make any changes on Windows.

* WebCoreSupport/WebEditorClient.cpp:
(WebEditorClient::discardedComposition):
* WebCoreSupport/WebEditorClient.h:

Source/WebKit2:

WebKit2 used to look at EditorState changes and guess when to cancel a composition.
This was quite unreliable, and needlessly complicated - WebCore knows when it decides
to destroy a composition, so it now explicitly notifies the clients.

* UIProcess/API/mac/WKView.mm: (-[WKView _processDidExit]): Address crashing case too.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::resetStateAfterProcessExited):
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::discardedComposition):
* WebProcess/WebCoreSupport/WebEditorClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didChangeSelection):
(WebKit::WebPage::discardedComposition):
* WebProcess/WebPage/WebPage.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCoreeditingEditorcpp">releases/WebKitGTK/webkit-2.6/Source/WebCore/editing/Editor.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCoreloaderEmptyClientsh">releases/WebKitGTK/webkit-2.6/Source/WebCore/loader/EmptyClients.h</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCoreloaderFrameLoadercpp">releases/WebKitGTK/webkit-2.6/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCorepageEditorClienth">releases/WebKitGTK/webkit-2.6/Source/WebCore/page/EditorClient.h</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKitmacChangeLog">releases/WebKitGTK/webkit-2.6/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKitmacWebCoreSupportWebEditorClienth">releases/WebKitGTK/webkit-2.6/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKitmacWebCoreSupportWebEditorClientmm">releases/WebKitGTK/webkit-2.6/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKitwinChangeLog">releases/WebKitGTK/webkit-2.6/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKitwinWebCoreSupportWebEditorClientcpp">releases/WebKitGTK/webkit-2.6/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKitwinWebCoreSupportWebEditorClienth">releases/WebKitGTK/webkit-2.6/Source/WebKit/win/WebCoreSupport/WebEditorClient.h</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2ChangeLog">releases/WebKitGTK/webkit-2.6/Source/WebKit2/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2UIProcessAPImacWKViewmm">releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2UIProcessWebPageProxycpp">releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2WebProcessWebCoreSupportWebEditorClientcpp">releases/WebKitGTK/webkit-2.6/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2WebProcessWebCoreSupportWebEditorClienth">releases/WebKitGTK/webkit-2.6/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2WebProcessWebPageWebPagecpp">releases/WebKitGTK/webkit-2.6/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2WebProcessWebPageWebPageh">releases/WebKitGTK/webkit-2.6/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit26SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2014-12-11  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        REGRESSION (Async Text Input): Text input method state is not reset when reloading a page
+        https://bugs.webkit.org/show_bug.cgi?id=139504
+        rdar://problem/19034674
+
+        Reviewed by Enrica Casucci.
+
+        Explicitly notify EditorClient when a composition is voluntarily canceled by WebCore.
+        These are almost certainly not all the places where this happens, but this fixes the bug,
+        and lays the groundwork for using this new client call instead of didChangeSelection
+        hacks.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::clear):
+        (WebCore::Editor::cancelComposition):
+        * loader/EmptyClients.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::willTransitionToCommitted):
+        * page/EditorClient.h:
+
</ins><span class="cx"> 2014-12-10  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         http://omfgdogs.info/ only animates when you resize the window
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/editing/Editor.cpp (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/editing/Editor.cpp        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/editing/Editor.cpp        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -1165,7 +1165,11 @@
</span><span class="cx"> 
</span><span class="cx"> void Editor::clear()
</span><span class="cx"> {
</span><del>-    m_compositionNode = 0;
</del><ins>+    if (m_compositionNode) {
+        m_compositionNode = nullptr;
+        if (EditorClient* client = this-&gt;client())
+            client-&gt;discardedComposition(&amp;m_frame);
+    }
</ins><span class="cx">     m_customCompositionUnderlines.clear();
</span><span class="cx">     m_shouldStyleWithCSS = false;
</span><span class="cx">     m_defaultParagraphSeparator = EditorParagraphSeparatorIsDiv;
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCoreloaderEmptyClientsh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/loader/EmptyClients.h (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/loader/EmptyClients.h        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/loader/EmptyClients.h        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -449,6 +449,7 @@
</span><span class="cx">     virtual void didBeginEditing() override { }
</span><span class="cx">     virtual void respondToChangedContents() override { }
</span><span class="cx">     virtual void respondToChangedSelection(Frame*) override { }
</span><ins>+    virtual void discardedComposition(Frame*) override { }
</ins><span class="cx">     virtual void didEndEditing() override { }
</span><span class="cx">     virtual void willWriteSelectionToPasteboard(Range*) override { }
</span><span class="cx">     virtual void didWriteSelectionToPasteboard() override { }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/loader/FrameLoader.cpp (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/loader/FrameLoader.cpp        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/loader/FrameLoader.cpp        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -528,8 +528,10 @@
</span><span class="cx">     if (m_frame.editor().hasComposition()) {
</span><span class="cx">         // The text was already present in DOM, so it's better to confirm than to cancel the composition.
</span><span class="cx">         m_frame.editor().confirmComposition();
</span><del>-        if (EditorClient* editorClient = m_frame.editor().client())
</del><ins>+        if (EditorClient* editorClient = m_frame.editor().client()) {
</ins><span class="cx">             editorClient-&gt;respondToChangedSelection(&amp;m_frame);
</span><ins>+            editorClient-&gt;discardedComposition(&amp;m_frame);
+        }
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCorepageEditorClienth"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/page/EditorClient.h (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/page/EditorClient.h        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/page/EditorClient.h        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -97,7 +97,11 @@
</span><span class="cx">     virtual void willWriteSelectionToPasteboard(Range*) = 0;
</span><span class="cx">     virtual void didWriteSelectionToPasteboard() = 0;
</span><span class="cx">     virtual void getClientPasteboardDataForRange(Range*, Vector&lt;String&gt;&amp; pasteboardTypes, Vector&lt;RefPtr&lt;SharedBuffer&gt;&gt;&amp; pasteboardData) = 0;
</span><del>-    
</del><ins>+
+    // Notify an input method that a composition was voluntarily discarded by WebCore, so that it could clean up too.
+    // This function is not called when a composition is closed per a request from an input method.
+    virtual void discardedComposition(Frame*) = 0;
+
</ins><span class="cx">     virtual void registerUndoStep(PassRefPtr&lt;UndoStep&gt;) = 0;
</span><span class="cx">     virtual void registerRedoStep(PassRefPtr&lt;UndoStep&gt;) = 0;
</span><span class="cx">     virtual void clearUndoRedoOperations() = 0;
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit/mac/ChangeLog (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit/mac/ChangeLog        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit/mac/ChangeLog        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-12-11  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        REGRESSION (Async Text Input): Text input method state is not reset when reloading a page
+        https://bugs.webkit.org/show_bug.cgi?id=139504
+        rdar://problem/19034674
+
+        Reviewed by Enrica Casucci.
+
+        Stub out new client calls, this patch does not attempt to make any changes on WebKit1.
+
+        * WebCoreSupport/WebEditorClient.h:
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::discardedComposition):
+
</ins><span class="cx"> 2014-09-19  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Multithreaded WebGL is a bad idea - remove it
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKitmacWebCoreSupportWebEditorClienth"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -114,6 +114,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void respondToChangedContents() override;
</span><span class="cx">     virtual void respondToChangedSelection(WebCore::Frame*) override;
</span><ins>+    virtual void discardedComposition(WebCore::Frame*) override;
</ins><span class="cx"> 
</span><span class="cx">     virtual void registerUndoStep(PassRefPtr&lt;WebCore::UndoStep&gt;) override;
</span><span class="cx">     virtual void registerRedoStep(PassRefPtr&lt;WebCore::UndoStep&gt;) override;
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKitmacWebCoreSupportWebEditorClientmm"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -361,6 +361,11 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebEditorClient::discardedComposition(Frame*)
+{
+    // The effects of this function are currently achieved via -[WebHTMLView _updateSelectionForInputManager].
+}
+
</ins><span class="cx"> void WebEditorClient::didEndEditing()
</span><span class="cx"> {
</span><span class="cx"> #if !PLATFORM(IOS)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit/win/ChangeLog (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit/win/ChangeLog        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit/win/ChangeLog        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-12-11  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        REGRESSION (Async Text Input): Text input method state is not reset when reloading a page
+        https://bugs.webkit.org/show_bug.cgi?id=139504
+        rdar://problem/19034674
+
+        Reviewed by Enrica Casucci.
+
+        Stub out new client calls, this patch doesn't attempt to make any changes on Windows.
+
+        * WebCoreSupport/WebEditorClient.cpp:
+        (WebEditorClient::discardedComposition):
+        * WebCoreSupport/WebEditorClient.h:
+
</ins><span class="cx"> 2014-09-06  Brian J. Burg  &lt;burg@cs.washington.edu&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: convert DockSide to an enum class
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKitwinWebCoreSupportWebEditorClientcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -220,6 +220,11 @@
</span><span class="cx">     notifyCenter-&gt;postNotificationName(webViewDidChangeSelectionNotificationName, static_cast&lt;IWebView*&gt;(m_webView), 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebEditorClient::discardedComposition(Frame*)
+{
+    notImplemented();
+}
+
</ins><span class="cx"> void WebEditorClient::didEndEditing()
</span><span class="cx"> {
</span><span class="cx">     notImplemented();
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKitwinWebCoreSupportWebEditorClienth"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit/win/WebCoreSupport/WebEditorClient.h (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit/win/WebCoreSupport/WebEditorClient.h        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit/win/WebCoreSupport/WebEditorClient.h        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void respondToChangedContents();
</span><span class="cx">     virtual void respondToChangedSelection(WebCore::Frame*);
</span><ins>+    virtual void discardedComposition(WebCore::Frame*) override;
</ins><span class="cx"> 
</span><span class="cx">     bool shouldDeleteRange(WebCore::Range*);
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit2/ChangeLog (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/ChangeLog        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/ChangeLog        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-12-11  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        REGRESSION (Async Text Input): Text input method state is not reset when reloading a page
+        https://bugs.webkit.org/show_bug.cgi?id=139504
+        rdar://problem/19034674
+
+        Reviewed by Enrica Casucci.
+
+        WebKit2 used to look at EditorState changes and guess when to cancel a composition.
+        This was quite unreliable, and needlessly complicated - WebCore knows when it decides
+        to destroy a composition, so it now explicitly notifies the clients.
+
+        * UIProcess/API/mac/WKView.mm: (-[WKView _processDidExit]): Address crashing case too.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::resetStateAfterProcessExited):
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::discardedComposition):
+        * WebProcess/WebCoreSupport/WebEditorClient.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::didChangeSelection):
+        (WebKit::WebPage::discardedComposition):
+        * WebProcess/WebPage/WebPage.h:
+
</ins><span class="cx"> 2014-12-11  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Timers might never be fired during animations
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/mac/WKView.mm (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -2825,6 +2825,8 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_processDidExit
</span><span class="cx"> {
</span><ins>+    [self _notifyInputContextAboutDiscardedComposition];
+
</ins><span class="cx">     if (_data-&gt;_layerHostingView)
</span><span class="cx">         [self _setAcceleratedCompositingModeRootLayer:nil];
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/WebPageProxy.cpp (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -4462,6 +4462,11 @@
</span><span class="cx">     m_isValid = false;
</span><span class="cx">     m_isPageSuspended = false;
</span><span class="cx"> 
</span><ins>+    m_editorState = EditorState();
+#if PLATFORM(MAC) &amp;&amp; !USE(ASYNC_NSTEXTINPUTCLIENT)
+    m_temporarilyClosedComposition = false;
+#endif
+
</ins><span class="cx">     if (m_mainFrame) {
</span><span class="cx">         m_urlAtProcessExit = m_mainFrame-&gt;url();
</span><span class="cx">         m_loadStateAtProcessExit = m_mainFrame-&gt;frameLoadState().m_state;
</span><span class="lines">@@ -4488,12 +4493,6 @@
</span><span class="cx">     m_touchEventQueue.clear();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    // FIXME: Reset m_editorState.
-    // FIXME: Notify input methods about abandoned composition.
-#if PLATFORM(MAC) &amp;&amp; !USE(ASYNC_NSTEXTINPUTCLIENT)
-    m_temporarilyClosedComposition = false;
-#endif
-
</del><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
</span><span class="cx">     m_pageClient.dismissDictionaryLookupPanel();
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2WebProcessWebCoreSupportWebEditorClientcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -199,6 +199,11 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebEditorClient::discardedComposition(Frame*)
+{
+    m_page-&gt;discardedComposition();
+}
+
</ins><span class="cx"> void WebEditorClient::didEndEditing()
</span><span class="cx"> {
</span><span class="cx">     static NeverDestroyed&lt;String&gt; WebViewDidEndEditingNotification(ASCIILiteral(&quot;WebViewDidEndEditingNotification&quot;));
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2WebProcessWebCoreSupportWebEditorClienth"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -64,6 +64,7 @@
</span><span class="cx">     virtual void didBeginEditing() override;
</span><span class="cx">     virtual void respondToChangedContents() override;
</span><span class="cx">     virtual void respondToChangedSelection(WebCore::Frame*) override;
</span><ins>+    virtual void discardedComposition(WebCore::Frame*) override;
</ins><span class="cx">     virtual void didEndEditing() override;
</span><span class="cx">     virtual void willWriteSelectionToPasteboard(WebCore::Range*) override;
</span><span class="cx">     virtual void didWriteSelectionToPasteboard() override;
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -4314,6 +4314,7 @@
</span><span class="cx"> #if PLATFORM(MAC) &amp;&amp; USE(ASYNC_NSTEXTINPUTCLIENT)
</span><span class="cx">     Frame&amp; frame = m_page-&gt;focusController().focusedOrMainFrame();
</span><span class="cx">     // Abandon the current inline input session if selection changed for any other reason but an input method direct action.
</span><ins>+    // FIXME: This logic should be in WebCore.
</ins><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 class="cx">     // FIXME: We can't cancel composition when selection changes to NoSelection, but we probably should.
</span><span class="cx">     if (frame.editor().hasComposition() &amp;&amp; !frame.editor().ignoreCompositionSelectionChange() &amp;&amp; !frame.selection().isNone()) {
</span><span class="lines">@@ -4330,6 +4331,11 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPage::discardedComposition()
+{
+    send(Messages::WebPageProxy::CompositionWasCanceled(editorState()));
+}
+
</ins><span class="cx"> void WebPage::setMinimumLayoutSize(const IntSize&amp; minimumLayoutSize)
</span><span class="cx"> {
</span><span class="cx">     if (m_minimumLayoutSize == minimumLayoutSize)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit2/WebProcess/WebPage/WebPage.h (178349 => 178350)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/WebProcess/WebPage/WebPage.h        2015-01-13 10:53:38 UTC (rev 178349)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/WebProcess/WebPage/WebPage.h        2015-01-13 10:59:02 UTC (rev 178350)
</span><span class="lines">@@ -579,6 +579,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     void didChangeSelection();
</span><ins>+    void discardedComposition();
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     void registerUIProcessAccessibilityTokens(const IPC::DataReference&amp; elemenToken, const IPC::DataReference&amp; windowToken);
</span></span></pre>
</div>
</div>

</body>
</html>