<!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>[205711] branches/safari-602-branch</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/205711">205711</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2016-09-09 01:42:27 -0700 (Fri, 09 Sep 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/205381">r205381</a>. rdar://problem/27806012</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari602branchLayoutTestsChangeLog">branches/safari-602-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari602branchLayoutTestseditingsecureinputremovedpasswordinputexpectedtxt">branches/safari-602-branch/LayoutTests/editing/secure-input/removed-password-input-expected.txt</a></li>
<li><a href="#branchessafari602branchSourceWebCoreChangeLog">branches/safari-602-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari602branchSourceWebCoreeditingFrameSelectioncpp">branches/safari-602-branch/Source/WebCore/editing/FrameSelection.cpp</a></li>
<li><a href="#branchessafari602branchSourceWebCoreloaderEmptyClientsh">branches/safari-602-branch/Source/WebCore/loader/EmptyClients.h</a></li>
<li><a href="#branchessafari602branchSourceWebCorepageEditorClienth">branches/safari-602-branch/Source/WebCore/page/EditorClient.h</a></li>
<li><a href="#branchessafari602branchSourceWebKitmacChangeLog">branches/safari-602-branch/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#branchessafari602branchSourceWebKitmacWebCoreSupportWebEditorClienth">branches/safari-602-branch/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h</a></li>
<li><a href="#branchessafari602branchSourceWebKitmacWebCoreSupportWebEditorClientmm">branches/safari-602-branch/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm</a></li>
<li><a href="#branchessafari602branchSourceWebKit2ChangeLog">branches/safari-602-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari602branchSourceWebKit2WebProcessWebCoreSupportWebEditorClientcpp">branches/safari-602-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp</a></li>
<li><a href="#branchessafari602branchSourceWebKit2WebProcessWebCoreSupportWebEditorClienth">branches/safari-602-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h</a></li>
<li><a href="#branchessafari602branchSourceWebKit2WebProcessWebPageWebPagecpp">branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#branchessafari602branchSourceWebKit2WebProcessWebPageWebPageh">branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari602branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/LayoutTests/ChangeLog (205710 => 205711)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/ChangeLog        2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/LayoutTests/ChangeLog        2016-09-09 08:42:27 UTC (rev 205711)
</span><span class="lines">@@ -1,5 +1,22 @@
</span><span class="cx"> 2016-09-09  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r205381. rdar://problem/27806012
+
+    2016-09-02  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+            Need to updateEditorState if an element change edit-ability without changing
+            selection
+            https://bugs.webkit.org/show_bug.cgi?id=161546
+            -and corresponding-
+            rdar://problem/27806012
+
+            Reviewed by Ryosuke Niwa.
+
+            This patch seems to have fixed a bug!
+            * editing/secure-input/removed-password-input-expected.txt:
+
+2016-09-09  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
</ins><span class="cx">         Merge r205246. rdar://problem/28162589
</span><span class="cx"> 
</span><span class="cx">     2016-08-31  Antti Koivisto  &lt;antti@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari602branchLayoutTestseditingsecureinputremovedpasswordinputexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/LayoutTests/editing/secure-input/removed-password-input-expected.txt (205710 => 205711)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/editing/secure-input/removed-password-input-expected.txt        2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/LayoutTests/editing/secure-input/removed-password-input-expected.txt        2016-09-09 08:42:27 UTC (rev 205711)
</span><span class="lines">@@ -7,7 +7,7 @@
</span><span class="cx"> PASS testRunner.secureEventInputIsEnabled is true
</span><span class="cx"> 
</span><span class="cx"> After deleting the input:
</span><del>-FAIL testRunner.secureEventInputIsEnabled should be false. Was true.
</del><ins>+PASS testRunner.secureEventInputIsEnabled is false
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/ChangeLog (205710 => 205711)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/ChangeLog        2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebCore/ChangeLog        2016-09-09 08:42:27 UTC (rev 205711)
</span><span class="lines">@@ -1,5 +1,25 @@
</span><span class="cx"> 2016-09-09  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r205381. rdar://problem/27806012
+
+    2016-09-02  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+            Need to updateEditorState if an element change edit-ability without changing
+            selection
+            https://bugs.webkit.org/show_bug.cgi?id=161546
+            -and corresponding-
+            rdar://problem/27806012
+
+            Reviewed by Ryosuke Niwa.
+
+            Call into the client in case edited state needs to be updated.
+            * editing/FrameSelection.cpp:
+            (WebCore::FrameSelection::updateAppearanceAfterLayout):
+            * loader/EmptyClients.h:
+            * page/EditorClient.h:
+
+2016-09-09  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
</ins><span class="cx">         Merge r205365. rdar://problem/28020157
</span><span class="cx"> 
</span><span class="cx">     2016-07-08  Jer Noble  &lt;jer.noble@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreeditingFrameSelectioncpp"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/editing/FrameSelection.cpp (205710 => 205711)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/editing/FrameSelection.cpp        2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebCore/editing/FrameSelection.cpp        2016-09-09 08:42:27 UTC (rev 205711)
</span><span class="lines">@@ -2379,6 +2379,9 @@
</span><span class="cx"> 
</span><span class="cx"> void FrameSelection::updateAppearanceAfterLayout()
</span><span class="cx"> {
</span><ins>+    if (auto* client = m_frame-&gt;editor().client())
+        client-&gt;updateEditorStateAfterLayoutIfEditabilityChanged();
+
</ins><span class="cx">     setCaretRectNeedsUpdate();
</span><span class="cx">     updateAndRevealSelection(AXTextStateChangeIntent());
</span><span class="cx">     updateDataDetectorsForSelection();
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreloaderEmptyClientsh"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/loader/EmptyClients.h (205710 => 205711)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/loader/EmptyClients.h        2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebCore/loader/EmptyClients.h        2016-09-09 08:42:27 UTC (rev 205711)
</span><span class="lines">@@ -465,6 +465,7 @@
</span><span class="cx">     void respondToChangedContents() override { }
</span><span class="cx">     void respondToChangedSelection(Frame*) override { }
</span><span class="cx">     void didChangeSelectionAndUpdateLayout() override { }
</span><ins>+    void updateEditorStateAfterLayoutIfEditabilityChanged() override { }
</ins><span class="cx">     void discardedComposition(Frame*) override { }
</span><span class="cx">     void didEndEditing() override { }
</span><span class="cx">     void willWriteSelectionToPasteboard(Range*) override { }
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCorepageEditorClienth"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/page/EditorClient.h (205710 => 205711)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/page/EditorClient.h        2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebCore/page/EditorClient.h        2016-09-09 08:42:27 UTC (rev 205711)
</span><span class="lines">@@ -94,6 +94,7 @@
</span><span class="cx">     virtual void respondToChangedContents() = 0;
</span><span class="cx">     virtual void respondToChangedSelection(Frame*) = 0;
</span><span class="cx">     virtual void didChangeSelectionAndUpdateLayout() = 0;
</span><ins>+    virtual void updateEditorStateAfterLayoutIfEditabilityChanged() = 0;
</ins><span class="cx">     virtual void didEndEditing() = 0;
</span><span class="cx">     virtual void willWriteSelectionToPasteboard(Range*) = 0;
</span><span class="cx">     virtual void didWriteSelectionToPasteboard() = 0;
</span></span></pre></div>
<a id="branchessafari602branchSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit/mac/ChangeLog (205710 => 205711)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit/mac/ChangeLog        2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebKit/mac/ChangeLog        2016-09-09 08:42:27 UTC (rev 205711)
</span><span class="lines">@@ -1,5 +1,29 @@
</span><span class="cx"> 2016-09-09  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r205381. rdar://problem/27806012
+
+    2016-09-02  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+            Need to updateEditorState if an element change edit-ability without changing
+            selection
+            https://bugs.webkit.org/show_bug.cgi?id=161546
+            -and corresponding-
+            rdar://problem/27806012
+
+            Reviewed by Ryosuke Niwa.
+
+            Every time WebEditorClient::respondToChangedSelection is called, we now save
+            whether the last state was contentEditable. That way in
+            updateEditorStateAfterLayoutIfNeeded() we can assess whether or not edit-ability
+            has changed.
+
+            * WebCoreSupport/WebEditorClient.h:
+            * WebCoreSupport/WebEditorClient.mm:
+            (WebEditorClient::respondToChangedSelection):
+            (WebEditorClient:: updateEditorStateAfterLayoutIfEditabilityChanged):
+
+2016-09-09  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
</ins><span class="cx">         Merge r205365. rdar://problem/28020157
</span><span class="cx"> 
</span><span class="cx">     2016-07-08  Jer Noble  &lt;jer.noble@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari602branchSourceWebKitmacWebCoreSupportWebEditorClienth"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h (205710 => 205711)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h        2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h        2016-09-09 08:42:27 UTC (rev 205711)
</span><span class="lines">@@ -112,6 +112,7 @@
</span><span class="cx">     void respondToChangedContents() override;
</span><span class="cx">     void respondToChangedSelection(WebCore::Frame*) override;
</span><span class="cx">     void didChangeSelectionAndUpdateLayout() override { }
</span><ins>+    void updateEditorStateAfterLayoutIfEditabilityChanged() override;
</ins><span class="cx">     void discardedComposition(WebCore::Frame*) override;
</span><span class="cx"> 
</span><span class="cx">     void registerUndoStep(PassRefPtr&lt;WebCore::UndoStep&gt;) override;
</span><span class="lines">@@ -191,6 +192,9 @@
</span><span class="cx">     NSInteger m_lastCandidateRequestSequenceNumber;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    enum class EditorStateIsContentEditable { No, Yes, Unset };
+    EditorStateIsContentEditable m_lastEditorStateWasContentEditable { EditorStateIsContentEditable::Unset };
+
</ins><span class="cx">     WeakPtrFactory&lt;WebEditorClient&gt; m_weakPtrFactory;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari602branchSourceWebKitmacWebCoreSupportWebEditorClientmm"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm (205710 => 205711)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm        2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm        2016-09-09 08:42:27 UTC (rev 205711)
</span><span class="lines">@@ -348,6 +348,7 @@
</span><span class="cx">     if ([documentView isKindOfClass:[WebHTMLView class]]) {
</span><span class="cx">         [(WebHTMLView *)documentView _selectionChanged];
</span><span class="cx">         [m_webView updateWebViewAdditions];
</span><ins>+        m_lastEditorStateWasContentEditable = [(WebHTMLView *)documentView _isEditable] ? EditorStateIsContentEditable::Yes : EditorStateIsContentEditable::No;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="lines">@@ -627,6 +628,26 @@
</span><span class="cx">     m_haveUndoRedoOperations = YES;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebEditorClient::updateEditorStateAfterLayoutIfEditabilityChanged()
+{
+    // FIXME: We should update EditorStateIsContentEditable to track whether the state is richly
+    // editable or plainttext-only.
+    if (m_lastEditorStateWasContentEditable == EditorStateIsContentEditable::Unset)
+        return;
+
+    Frame* frame = core([m_webView _selectedOrMainFrame]);
+    if (!frame)
+        return;
+
+    NSView&lt;WebDocumentView&gt; *documentView = [[kit(frame) frameView] documentView];
+    if (![documentView isKindOfClass:[WebHTMLView class]])
+        return;
+
+    EditorStateIsContentEditable editorStateIsContentEditable = [(WebHTMLView *)documentView _isEditable] ? EditorStateIsContentEditable::Yes : EditorStateIsContentEditable::No;
+    if (m_lastEditorStateWasContentEditable != editorStateIsContentEditable)
+        [m_webView updateWebViewAdditions];
+}
+
</ins><span class="cx"> void WebEditorClient::registerUndoStep(PassRefPtr&lt;UndoStep&gt; cmd)
</span><span class="cx"> {
</span><span class="cx">     registerUndoOrRedoStep(cmd, false);
</span></span></pre></div>
<a id="branchessafari602branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/ChangeLog (205710 => 205711)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/ChangeLog        2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebKit2/ChangeLog        2016-09-09 08:42:27 UTC (rev 205711)
</span><span class="lines">@@ -1,5 +1,32 @@
</span><span class="cx"> 2016-09-09  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r205381. rdar://problem/27806012
+
+    2016-09-02  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+            Need to updateEditorState if an element change edit-ability without changing
+            selection
+            https://bugs.webkit.org/show_bug.cgi?id=161546
+            -and corresponding-
+            rdar://problem/27806012
+
+            Reviewed by Ryosuke Niwa.
+
+            Every time WebPage::editorState() is called, we now save whether the last state
+            was contentEditable. That way in updateEditorStateAfterLayoutIfNeeded() we can
+            assess whether or not edit-ability has changed.
+
+            * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+            (WebKit::WebEditorClient:: updateEditorStateAfterLayoutIfEditabilityChanged):
+            * WebProcess/WebCoreSupport/WebEditorClient.h:
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::editorState):
+            (WebKit::WebPage:: updateEditorStateAfterLayoutIfEditabilityChanged):
+            (WebKit::WebPage::didStartPageTransition):
+            * WebProcess/WebPage/WebPage.h:
+
+2016-09-09  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
</ins><span class="cx">         Merge r205371. rdar://problem/28020157
</span><span class="cx"> 
</span><span class="cx">     2016-09-02  Jer Noble  &lt;jer.noble@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari602branchSourceWebKit2WebProcessWebCoreSupportWebEditorClientcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp (205710 => 205711)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp        2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp        2016-09-09 08:42:27 UTC (rev 205711)
</span><span class="lines">@@ -201,6 +201,11 @@
</span><span class="cx">     m_page-&gt;sendPostLayoutEditorStateIfNeeded();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebEditorClient::updateEditorStateAfterLayoutIfEditabilityChanged()
+{
+    m_page-&gt;updateEditorStateAfterLayoutIfEditabilityChanged();
+}
+
</ins><span class="cx"> void WebEditorClient::discardedComposition(Frame*)
</span><span class="cx"> {
</span><span class="cx">     m_page-&gt;discardedComposition();
</span></span></pre></div>
<a id="branchessafari602branchSourceWebKit2WebProcessWebCoreSupportWebEditorClienth"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h (205710 => 205711)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h        2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h        2016-09-09 08:42:27 UTC (rev 205711)
</span><span class="lines">@@ -64,6 +64,7 @@
</span><span class="cx">     void respondToChangedContents() override;
</span><span class="cx">     void respondToChangedSelection(WebCore::Frame*) override;
</span><span class="cx">     void didChangeSelectionAndUpdateLayout() override;
</span><ins>+    void updateEditorStateAfterLayoutIfEditabilityChanged() override;
</ins><span class="cx">     void discardedComposition(WebCore::Frame*) override;
</span><span class="cx">     void didEndEditing() override;
</span><span class="cx">     void willWriteSelectionToPasteboard(WebCore::Range*) override;
</span></span></pre></div>
<a id="branchessafari602branchSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (205710 => 205711)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-09-09 08:42:27 UTC (rev 205711)
</span><span class="lines">@@ -894,9 +894,24 @@
</span><span class="cx"> 
</span><span class="cx">     platformEditorState(frame, result, shouldIncludePostLayoutData);
</span><span class="cx"> 
</span><ins>+    m_lastEditorStateWasContentEditable = result.isContentEditable ? EditorStateIsContentEditable::Yes : EditorStateIsContentEditable::No;
+
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPage::updateEditorStateAfterLayoutIfEditabilityChanged()
+{
+    // FIXME: We should update EditorStateIsContentEditable to track whether the state is richly
+    // editable or plainttext-only.
+    if (m_lastEditorStateWasContentEditable == EditorStateIsContentEditable::Unset)
+        return;
+
+    Frame&amp; frame = m_page-&gt;focusController().focusedOrMainFrame();
+    EditorStateIsContentEditable editorStateIsContentEditable = frame.selection().selection().isContentEditable() ? EditorStateIsContentEditable::Yes : EditorStateIsContentEditable::No;
+    if (m_lastEditorStateWasContentEditable != editorStateIsContentEditable)
+        send(Messages::WebPageProxy::EditorStateChanged(editorState()));
+}
+
</ins><span class="cx"> String WebPage::renderTreeExternalRepresentation() const
</span><span class="cx"> {
</span><span class="cx">     return externalRepresentation(m_mainFrame-&gt;coreFrame(), RenderAsTextBehaviorNormal);
</span><span class="lines">@@ -2612,6 +2627,7 @@
</span><span class="cx"> #endif
</span><span class="cx">     m_hasEverFocusedElementDueToUserInteractionSincePageTransition = false;
</span><span class="cx">     m_isAssistingNodeDueToUserInteraction = false;
</span><ins>+    m_lastEditorStateWasContentEditable = EditorStateIsContentEditable::Unset;
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     if (hasPreviouslyFocusedDueToUserInteraction)
</span><span class="cx">         send(Messages::WebPageProxy::SetHasHadSelectionChangesFromUserInteraction(m_hasEverFocusedElementDueToUserInteractionSincePageTransition));
</span></span></pre></div>
<a id="branchessafari602branchSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h (205710 => 205711)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h        2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h        2016-09-09 08:42:27 UTC (rev 205711)
</span><span class="lines">@@ -362,6 +362,7 @@
</span><span class="cx">     enum class IncludePostLayoutDataHint { No, Yes };
</span><span class="cx">     EditorState editorState(IncludePostLayoutDataHint = IncludePostLayoutDataHint::Yes) const;
</span><span class="cx">     void sendPostLayoutEditorStateIfNeeded();
</span><ins>+    void updateEditorStateAfterLayoutIfEditabilityChanged();
</ins><span class="cx"> 
</span><span class="cx">     String renderTreeExternalRepresentation() const;
</span><span class="cx">     String renderTreeExternalRepresentationForPrinting() const;
</span><span class="lines">@@ -1470,6 +1471,9 @@
</span><span class="cx">     bool m_shouldDispatchFakeMouseMoveEvents;
</span><span class="cx">     bool m_isEditorStateMissingPostLayoutData { false };
</span><span class="cx"> 
</span><ins>+    enum class EditorStateIsContentEditable { No, Yes, Unset };
+    mutable EditorStateIsContentEditable m_lastEditorStateWasContentEditable { EditorStateIsContentEditable::Unset };
+
</ins><span class="cx"> #if PLATFORM(GTK)
</span><span class="cx">     bool m_inputMethodEnabled { false };
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>

</body>
</html>