<!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>[201894] trunk/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/201894">201894</a></dd>
<dt>Author</dt> <dd>achristensen@apple.com</dd>
<dt>Date</dt> <dd>2016-06-09 16:53:36 -0700 (Thu, 09 Jun 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Clean up EditorClient lifetime
https://bugs.webkit.org/show_bug.cgi?id=158588

Reviewed by Anders Carlsson.

Source/WebCore:

No new tests.  This patch does two things, all of which do not change behavior:
1. Use a std::unique_ptr&lt;EditorClient&gt; owned by the Page instead of allocating
with new in WebKit/WebKit2 and deleting in WebEditorClient::pageDestroyed.
2. Give the Page a PageConfiguration&amp;&amp; instead of a PageConfiguration&amp; in its constructor.

* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::overlayPage):
* loader/EmptyClients.cpp:
(WebCore::fillWithEmptyClients):
* loader/EmptyClients.h:
(WebCore::EmptyEditorClient::EmptyEditorClient):
(WebCore::EmptyEditorClient::~EmptyEditorClient):
* page/EditorClient.h:
(WebCore::EditorClient::~EditorClient):
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::~Page):
(WebCore::Page::setViewMode):
(WebCore::Page::clearUndoRedoOperations):
(WebCore::Page::inLowQualityImageInterpolationMode):
(WebCore::Page::invalidateStylesForAllLinks):
(WebCore::Page::invalidateStylesForLink):
(WebCore::Page::invalidateInjectedStyleSheetCacheInAllFrames):
(WebCore::Page::setDebugger):
(WebCore::Page::setIsVisibleInternal):
(WebCore::Page::setAllowsMediaDocumentInlinePlayback):
* page/Page.h:
(WebCore::Page::canStartMedia):
(WebCore::Page::editorClient):
(WebCore::Page::plugInClient):
(WebCore::Page::mainFrame):
(WebCore::Page::group):
* page/PageConfiguration.cpp:
* page/PageConfiguration.h:
* page/mac/PageMac.mm:
(WebCore::Page::addSchedulePair):
(WebCore::Page::removeSchedulePair):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged):

Source/WebKit/mac:

* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::WebEditorClient):
(WebEditorClient::pageDestroyed): Deleted.
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):

Source/WebKit2:

* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::generateTextCheckingRequestID):
(WebKit::WebEditorClient::shouldDeleteRange):
(WebKit::WebEditorClient::pageDestroyed): Deleted.
* WebProcess/WebCoreSupport/WebEditorClient.h:
(WebKit::WebEditorClient::WebEditorClient):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_shouldDispatchFakeMouseMoveEvents):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorOverlaycpp">trunk/Source/WebCore/inspector/InspectorOverlay.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderEmptyClientscpp">trunk/Source/WebCore/loader/EmptyClients.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderEmptyClientsh">trunk/Source/WebCore/loader/EmptyClients.h</a></li>
<li><a href="#trunkSourceWebCorepageEditorClienth">trunk/Source/WebCore/page/EditorClient.h</a></li>
<li><a href="#trunkSourceWebCorepagePagecpp">trunk/Source/WebCore/page/Page.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageh">trunk/Source/WebCore/page/Page.h</a></li>
<li><a href="#trunkSourceWebCorepagePageConfigurationcpp">trunk/Source/WebCore/page/PageConfiguration.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageConfigurationh">trunk/Source/WebCore/page/PageConfiguration.h</a></li>
<li><a href="#trunkSourceWebCorepagemacPageMacmm">trunk/Source/WebCore/page/mac/PageMac.mm</a></li>
<li><a href="#trunkSourceWebCoresvggraphicsSVGImagecpp">trunk/Source/WebCore/svg/graphics/SVGImage.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebEditorClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebEditorClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebEditorClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebEditorClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebCore/ChangeLog        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -1,3 +1,50 @@
</span><ins>+2016-06-09  Alex Christensen  &lt;achristensen@webkit.org&gt;
+
+        Clean up EditorClient lifetime
+        https://bugs.webkit.org/show_bug.cgi?id=158588
+
+        Reviewed by Anders Carlsson.
+
+        No new tests.  This patch does two things, all of which do not change behavior:
+        1. Use a std::unique_ptr&lt;EditorClient&gt; owned by the Page instead of allocating
+        with new in WebKit/WebKit2 and deleting in WebEditorClient::pageDestroyed.
+        2. Give the Page a PageConfiguration&amp;&amp; instead of a PageConfiguration&amp; in its constructor.
+
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::overlayPage):
+        * loader/EmptyClients.cpp:
+        (WebCore::fillWithEmptyClients):
+        * loader/EmptyClients.h:
+        (WebCore::EmptyEditorClient::EmptyEditorClient):
+        (WebCore::EmptyEditorClient::~EmptyEditorClient):
+        * page/EditorClient.h:
+        (WebCore::EditorClient::~EditorClient):
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        (WebCore::Page::~Page):
+        (WebCore::Page::setViewMode):
+        (WebCore::Page::clearUndoRedoOperations):
+        (WebCore::Page::inLowQualityImageInterpolationMode):
+        (WebCore::Page::invalidateStylesForAllLinks):
+        (WebCore::Page::invalidateStylesForLink):
+        (WebCore::Page::invalidateInjectedStyleSheetCacheInAllFrames):
+        (WebCore::Page::setDebugger):
+        (WebCore::Page::setIsVisibleInternal):
+        (WebCore::Page::setAllowsMediaDocumentInlinePlayback):
+        * page/Page.h:
+        (WebCore::Page::canStartMedia):
+        (WebCore::Page::editorClient):
+        (WebCore::Page::plugInClient):
+        (WebCore::Page::mainFrame):
+        (WebCore::Page::group):
+        * page/PageConfiguration.cpp:
+        * page/PageConfiguration.h:
+        * page/mac/PageMac.mm:
+        (WebCore::Page::addSchedulePair):
+        (WebCore::Page::removeSchedulePair):
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::dataChanged):
+
</ins><span class="cx"> 2016-06-09  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION: Web Inspector: IndexedDB does not show ObjectStore data
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorOverlaycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -866,7 +866,7 @@
</span><span class="cx"> 
</span><span class="cx">     PageConfiguration pageConfiguration;
</span><span class="cx">     fillWithEmptyClients(pageConfiguration);
</span><del>-    m_overlayPage = std::make_unique&lt;Page&gt;(pageConfiguration);
</del><ins>+    m_overlayPage = std::make_unique&lt;Page&gt;(WTFMove(pageConfiguration));
</ins><span class="cx"> 
</span><span class="cx">     Settings&amp; settings = m_page.settings();
</span><span class="cx">     Settings&amp; overlaySettings = m_overlayPage-&gt;settings();
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderEmptyClientscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/EmptyClients.cpp        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -129,9 +129,8 @@
</span><span class="cx">     pageConfiguration.dragClient = &amp;dummyDragClient.get();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    static NeverDestroyed&lt;EmptyEditorClient&gt; dummyEditorClient;
-    pageConfiguration.editorClient = &amp;dummyEditorClient.get();
-
</del><ins>+    pageConfiguration.editorClient = std::make_unique&lt;EmptyEditorClient&gt;();
+    
</ins><span class="cx">     static NeverDestroyed&lt;EmptyInspectorClient&gt; dummyInspectorClient;
</span><span class="cx">     pageConfiguration.inspectorClient = &amp;dummyInspectorClient.get();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderEmptyClientsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/EmptyClients.h (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/EmptyClients.h        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebCore/loader/EmptyClients.h        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -40,7 +40,6 @@
</span><span class="cx"> #include &quot;FocusDirection.h&quot;
</span><span class="cx"> #include &quot;FrameLoaderClient.h&quot;
</span><span class="cx"> #include &quot;InspectorClient.h&quot;
</span><del>-#include &quot;Page.h&quot;
</del><span class="cx"> #include &quot;ProgressTrackerClient.h&quot;
</span><span class="cx"> #include &quot;ResourceError.h&quot;
</span><span class="cx"> #include &quot;TextCheckerClient.h&quot;
</span><span class="lines">@@ -71,6 +70,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class GraphicsContext3D;
</span><ins>+class Page;
</ins><span class="cx"> 
</span><span class="cx"> class EmptyChromeClient : public ChromeClient {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="lines">@@ -436,7 +436,6 @@
</span><span class="cx"> public:
</span><span class="cx">     EmptyEditorClient() { }
</span><span class="cx">     virtual ~EmptyEditorClient() { }
</span><del>-    void pageDestroyed() override { }
</del><span class="cx"> 
</span><span class="cx">     bool shouldDeleteRange(Range*) override { return false; }
</span><span class="cx">     bool smartInsertDeleteEnabled() override { return false; }
</span></span></pre></div>
<a id="trunkSourceWebCorepageEditorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EditorClient.h (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EditorClient.h        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebCore/page/EditorClient.h        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -70,7 +70,6 @@
</span><span class="cx"> class EditorClient {
</span><span class="cx"> public:
</span><span class="cx">     virtual ~EditorClient() {  }
</span><del>-    virtual void pageDestroyed() = 0;
</del><span class="cx"> 
</span><span class="cx">     virtual bool shouldDeleteRange(Range*) = 0;
</span><span class="cx">     virtual bool smartInsertDeleteEnabled() = 0; 
</span></span></pre></div>
<a id="trunkSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.cpp (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.cpp        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebCore/page/Page.cpp        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -156,7 +156,7 @@
</span><span class="cx"> 
</span><span class="cx"> static const ViewState::Flags PageInitialViewState = ViewState::IsVisible | ViewState::IsInWindow;
</span><span class="cx"> 
</span><del>-Page::Page(PageConfiguration&amp; pageConfiguration)
</del><ins>+Page::Page(PageConfiguration&amp;&amp; pageConfiguration)
</ins><span class="cx">     : m_chrome(std::make_unique&lt;Chrome&gt;(*this, *pageConfiguration.chromeClient))
</span><span class="cx">     , m_dragCaretController(std::make_unique&lt;DragCaretController&gt;())
</span><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><span class="lines">@@ -179,7 +179,7 @@
</span><span class="cx">     , m_backForwardController(std::make_unique&lt;BackForwardController&gt;(*this, WTFMove(pageConfiguration.backForwardClient)))
</span><span class="cx">     , m_mainFrame(MainFrame::create(*this, pageConfiguration))
</span><span class="cx">     , m_theme(RenderTheme::themeForPage(this))
</span><del>-    , m_editorClient(*pageConfiguration.editorClient)
</del><ins>+    , m_editorClient(WTFMove(pageConfiguration.editorClient))
</ins><span class="cx">     , m_plugInClient(pageConfiguration.plugInClient)
</span><span class="cx">     , m_validationMessageClient(pageConfiguration.validationMessageClient)
</span><span class="cx">     , m_diagnosticLoggingClient(WTFMove(pageConfiguration.diagnosticLoggingClient))
</span><span class="lines">@@ -238,6 +238,7 @@
</span><span class="cx">     , m_sessionID(SessionID::defaultSessionID())
</span><span class="cx">     , m_isClosing(false)
</span><span class="cx"> {
</span><ins>+    ASSERT(m_editorClient);
</ins><span class="cx">     updateTimerThrottlingState();
</span><span class="cx"> 
</span><span class="cx">     m_storageNamespaceProvider-&gt;addPage(*this);
</span><span class="lines">@@ -283,7 +284,6 @@
</span><span class="cx">         frame-&gt;detachFromPage();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_editorClient.pageDestroyed();
</del><span class="cx">     if (m_plugInClient)
</span><span class="cx">         m_plugInClient-&gt;pageDestroyed();
</span><span class="cx">     if (m_alternativeTextClient)
</span><span class="lines">@@ -412,8 +412,6 @@
</span><span class="cx"> 
</span><span class="cx">     m_viewMode = viewMode;
</span><span class="cx"> 
</span><del>-    if (!m_mainFrame)
-        return;
</del><span class="cx"> 
</span><span class="cx">     if (m_mainFrame-&gt;view())
</span><span class="cx">         m_mainFrame-&gt;view()-&gt;forceLayout();
</span><span class="lines">@@ -750,7 +748,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Page::clearUndoRedoOperations()
</span><span class="cx"> {
</span><del>-    m_editorClient.clearUndoRedoOperations();
</del><ins>+    m_editorClient-&gt;clearUndoRedoOperations();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool Page::inLowQualityImageInterpolationMode() const
</span><span class="lines">@@ -1122,7 +1120,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Page::invalidateStylesForAllLinks()
</span><span class="cx"> {
</span><del>-    for (Frame* frame = m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext()) {
</del><ins>+    for (Frame* frame = &amp;m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext()) {
</ins><span class="cx">         if (!frame-&gt;document())
</span><span class="cx">             continue;
</span><span class="cx">         frame-&gt;document()-&gt;visitedLinkState().invalidateStyleForAllLinks();
</span><span class="lines">@@ -1131,7 +1129,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Page::invalidateStylesForLink(LinkHash linkHash)
</span><span class="cx"> {
</span><del>-    for (Frame* frame = m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext()) {
</del><ins>+    for (Frame* frame = &amp;m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext()) {
</ins><span class="cx">         if (!frame-&gt;document())
</span><span class="cx">             continue;
</span><span class="cx">         frame-&gt;document()-&gt;visitedLinkState().invalidateStyleForLink(linkHash);
</span><span class="lines">@@ -1140,7 +1138,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Page::invalidateInjectedStyleSheetCacheInAllFrames()
</span><span class="cx"> {
</span><del>-    for (Frame* frame = m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext()) {
</del><ins>+    for (Frame* frame = &amp;m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext()) {
</ins><span class="cx">         Document* document = frame-&gt;document();
</span><span class="cx">         if (!document)
</span><span class="cx">             continue;
</span><span class="lines">@@ -1156,7 +1154,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_debugger = debugger;
</span><span class="cx"> 
</span><del>-    for (Frame* frame = m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext())
</del><ins>+    for (Frame* frame = &amp;m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext())
</ins><span class="cx">         frame-&gt;script().attachDebugger(m_debugger);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1487,7 +1485,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;Ref&lt;Document&gt;&gt; documents;
</span><del>-    for (Frame* frame = m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext())
</del><ins>+    for (Frame* frame = &amp;m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext())
</ins><span class="cx">         documents.append(*frame-&gt;document());
</span><span class="cx"> 
</span><span class="cx">     for (auto&amp; document : documents)
</span><span class="lines">@@ -1985,7 +1983,7 @@
</span><span class="cx">     m_allowsMediaDocumentInlinePlayback = flag;
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;Ref&lt;Document&gt;&gt; documents;
</span><del>-    for (Frame* frame = m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext())
</del><ins>+    for (Frame* frame = &amp;m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext())
</ins><span class="cx">         documents.append(*frame-&gt;document());
</span><span class="cx"> 
</span><span class="cx">     for (auto&amp; document : documents)
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.h (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.h        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebCore/page/Page.h        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -18,8 +18,7 @@
</span><span class="cx">  * Boston, MA 02110-1301, USA.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef Page_h
-#define Page_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;FindOptions.h&quot;
</span><span class="cx"> #include &quot;FrameLoaderTypes.h&quot;
</span><span class="lines">@@ -141,7 +140,7 @@
</span><span class="cx">     WEBCORE_EXPORT static void updateStyleForAllPagesAfterGlobalChangeInEnvironment();
</span><span class="cx">     WEBCORE_EXPORT static void clearPreviousItemFromAllPages(HistoryItem*);
</span><span class="cx"> 
</span><del>-    WEBCORE_EXPORT explicit Page(PageConfiguration&amp;);
</del><ins>+    WEBCORE_EXPORT explicit Page(PageConfiguration&amp;&amp;);
</ins><span class="cx">     WEBCORE_EXPORT ~Page();
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT uint64_t renderTreeSize() const;
</span><span class="lines">@@ -158,11 +157,11 @@
</span><span class="cx">     WEBCORE_EXPORT void setCanStartMedia(bool);
</span><span class="cx">     bool canStartMedia() const { return m_canStartMedia; }
</span><span class="cx"> 
</span><del>-    EditorClient&amp; editorClient() { return m_editorClient; }
</del><ins>+    EditorClient&amp; editorClient() const { return *m_editorClient; }
</ins><span class="cx">     PlugInClient* plugInClient() const { return m_plugInClient; }
</span><span class="cx"> 
</span><del>-    MainFrame&amp; mainFrame() { ASSERT(m_mainFrame); return *m_mainFrame; }
-    const MainFrame&amp; mainFrame() const { ASSERT(m_mainFrame); return *m_mainFrame; }
</del><ins>+    MainFrame&amp; mainFrame() { return m_mainFrame.get(); }
+    const MainFrame&amp; mainFrame() const { return m_mainFrame.get(); }
</ins><span class="cx"> 
</span><span class="cx">     bool inPageCache() const;
</span><span class="cx"> 
</span><span class="lines">@@ -578,13 +577,13 @@
</span><span class="cx">     const std::unique_ptr&lt;ProgressTracker&gt; m_progress;
</span><span class="cx"> 
</span><span class="cx">     const std::unique_ptr&lt;BackForwardController&gt; m_backForwardController;
</span><del>-    const RefPtr&lt;MainFrame&gt; m_mainFrame;
</del><ins>+    Ref&lt;MainFrame&gt; m_mainFrame;
</ins><span class="cx"> 
</span><span class="cx">     mutable RefPtr&lt;PluginData&gt; m_pluginData;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;RenderTheme&gt; m_theme;
</span><span class="cx"> 
</span><del>-    EditorClient&amp; m_editorClient;
</del><ins>+    std::unique_ptr&lt;EditorClient&gt; m_editorClient;
</ins><span class="cx">     PlugInClient* m_plugInClient;
</span><span class="cx">     ValidationMessageClient* m_validationMessageClient;
</span><span class="cx">     std::unique_ptr&lt;DiagnosticLoggingClient&gt; m_diagnosticLoggingClient;
</span><span class="lines">@@ -724,5 +723,3 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><del>-    
-#endif // Page_h
</del></span></pre></div>
<a id="trunkSourceWebCorepagePageConfigurationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageConfiguration.cpp (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageConfiguration.cpp        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebCore/page/PageConfiguration.cpp        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;BackForwardClient.h&quot;
</span><span class="cx"> #include &quot;DatabaseProvider.h&quot;
</span><span class="cx"> #include &quot;DiagnosticLoggingClient.h&quot;
</span><ins>+#include &quot;EditorClient.h&quot;
</ins><span class="cx"> #include &quot;StorageNamespaceProvider.h&quot;
</span><span class="cx"> #include &quot;UserContentController.h&quot;
</span><span class="cx"> #include &quot;VisitedLinkStore.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageConfigurationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageConfiguration.h (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageConfiguration.h        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebCore/page/PageConfiguration.h        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx"> #if ENABLE(CONTEXT_MENUS)
</span><span class="cx">     ContextMenuClient* contextMenuClient { nullptr };
</span><span class="cx"> #endif
</span><del>-    EditorClient* editorClient { nullptr };
</del><ins>+    std::unique_ptr&lt;EditorClient&gt; editorClient;
</ins><span class="cx">     DragClient* dragClient { nullptr };
</span><span class="cx">     InspectorClient* inspectorClient { nullptr };
</span><span class="cx">     PlugInClient* plugInClient { nullptr };
</span></span></pre></div>
<a id="trunkSourceWebCorepagemacPageMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/mac/PageMac.mm (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/mac/PageMac.mm        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebCore/page/mac/PageMac.mm        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx">     m_scheduledRunLoopPairs-&gt;add(pair.ptr());
</span><span class="cx"> 
</span><span class="cx"> #if !USE(CFNETWORK)
</span><del>-    for (Frame* frame = m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext()) {
</del><ins>+    for (Frame* frame = &amp;m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext()) {
</ins><span class="cx">         if (DocumentLoader* documentLoader = frame-&gt;loader().documentLoader())
</span><span class="cx">             documentLoader-&gt;schedule(pair);
</span><span class="cx">         if (DocumentLoader* documentLoader = frame-&gt;loader().provisionalDocumentLoader())
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx">     m_scheduledRunLoopPairs-&gt;remove(pair.ptr());
</span><span class="cx"> 
</span><span class="cx"> #if !USE(CFNETWORK)
</span><del>-    for (Frame* frame = m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext()) {
</del><ins>+    for (Frame* frame = &amp;m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext()) {
</ins><span class="cx">         if (DocumentLoader* documentLoader = frame-&gt;loader().documentLoader())
</span><span class="cx">             documentLoader-&gt;unschedule(pair);
</span><span class="cx">         if (DocumentLoader* documentLoader = frame-&gt;loader().provisionalDocumentLoader())
</span></span></pre></div>
<a id="trunkSourceWebCoresvggraphicsSVGImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -390,7 +390,7 @@
</span><span class="cx">         // This will become an issue when SVGImage will be able to load other
</span><span class="cx">         // SVGImage objects, but we're safe now, because SVGImage can only be
</span><span class="cx">         // loaded by a top-level document.
</span><del>-        m_page = std::make_unique&lt;Page&gt;(pageConfiguration);
</del><ins>+        m_page = std::make_unique&lt;Page&gt;(WTFMove(pageConfiguration));
</ins><span class="cx">         m_page-&gt;settings().setMediaEnabled(false);
</span><span class="cx">         m_page-&gt;settings().setScriptEnabled(false);
</span><span class="cx">         m_page-&gt;settings().setPluginsEnabled(false);
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebKit/mac/ChangeLog        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-06-09  Alex Christensen  &lt;achristensen@webkit.org&gt;
+
+        Clean up EditorClient lifetime
+        https://bugs.webkit.org/show_bug.cgi?id=158588
+
+        Reviewed by Anders Carlsson.
+
+        * WebCoreSupport/WebEditorClient.h:
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::WebEditorClient):
+        (WebEditorClient::pageDestroyed): Deleted.
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+        (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
+
</ins><span class="cx"> 2016-06-09  Andy Estes  &lt;aestes@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Define printing{Minimum,Maximum}ShrinkFactor in only one place
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebEditorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -51,8 +51,6 @@
</span><span class="cx">     void didCheckSucceed(int sequence, NSArray *results);
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    void pageDestroyed() override;
-
</del><span class="cx">     bool isGrammarCheckingEnabled() override;
</span><span class="cx">     void toggleGrammarChecking() override;
</span><span class="cx">     bool isContinuousSpellCheckingEnabled() override;
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebEditorClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -183,11 +183,6 @@
</span><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span><del>-void WebEditorClient::pageDestroyed()
-{
-    delete this;
-}
-
</del><span class="cx"> WebEditorClient::WebEditorClient(WebView *webView)
</span><span class="cx">     : m_webView(webView)
</span><span class="cx">     , m_undoTarget(adoptNS([[WebEditorUndoTarget alloc] init]))
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -1004,7 +1004,7 @@
</span><span class="cx"> #import &lt;WebKitAdditions/WebViewInitialization.mm&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    pageConfiguration.editorClient = new WebEditorClient(self);
</del><ins>+    pageConfiguration.editorClient = std::make_unique&lt;WebEditorClient&gt;(self);
</ins><span class="cx">     pageConfiguration.alternativeTextClient = new WebAlternativeTextClient(self);
</span><span class="cx">     pageConfiguration.loaderClientForMainFrame = new WebFrameLoaderClient;
</span><span class="cx">     pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(self);
</span><span class="lines">@@ -1013,7 +1013,7 @@
</span><span class="cx">     pageConfiguration.storageNamespaceProvider = &amp;_private-&gt;group-&gt;storageNamespaceProvider();
</span><span class="cx">     pageConfiguration.userContentProvider = &amp;_private-&gt;group-&gt;userContentController();
</span><span class="cx">     pageConfiguration.visitedLinkStore = &amp;_private-&gt;group-&gt;visitedLinkStore();
</span><del>-    _private-&gt;page = new Page(pageConfiguration);
</del><ins>+    _private-&gt;page = new Page(WTFMove(pageConfiguration));
</ins><span class="cx"> 
</span><span class="cx">     _private-&gt;page-&gt;setGroupName(groupName);
</span><span class="cx"> 
</span><span class="lines">@@ -1248,7 +1248,7 @@
</span><span class="cx"> #import &lt;WebKitAdditions/WebViewInitialization.mm&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    pageConfiguration.editorClient = new WebEditorClient(self);
</del><ins>+    pageConfiguration.editorClient = std::make_unique&lt;WebEditorClient&gt;(self);
</ins><span class="cx">     pageConfiguration.inspectorClient = new WebInspectorClient(self);
</span><span class="cx">     pageConfiguration.loaderClientForMainFrame = new WebFrameLoaderClient;
</span><span class="cx">     pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(self);
</span><span class="lines">@@ -1258,7 +1258,7 @@
</span><span class="cx">     pageConfiguration.userContentProvider = &amp;_private-&gt;group-&gt;userContentController();
</span><span class="cx">     pageConfiguration.visitedLinkStore = &amp;_private-&gt;group-&gt;visitedLinkStore();
</span><span class="cx"> 
</span><del>-    _private-&gt;page = new Page(pageConfiguration);
</del><ins>+    _private-&gt;page = new Page(WTFMove(pageConfiguration));
</ins><span class="cx">     
</span><span class="cx">     [self setSmartInsertDeleteEnabled:YES];
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebKit2/ChangeLog        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-06-09  Alex Christensen  &lt;achristensen@webkit.org&gt;
+
+        Clean up EditorClient lifetime
+        https://bugs.webkit.org/show_bug.cgi?id=158588
+
+        Reviewed by Anders Carlsson.
+
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::generateTextCheckingRequestID):
+        (WebKit::WebEditorClient::shouldDeleteRange):
+        (WebKit::WebEditorClient::pageDestroyed): Deleted.
+        * WebProcess/WebCoreSupport/WebEditorClient.h:
+        (WebKit::WebEditorClient::WebEditorClient):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_shouldDispatchFakeMouseMoveEvents):
+
</ins><span class="cx"> 2016-06-09  Andy Estes  &lt;aestes@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WKWebView does not render PDF pages in AirPrint
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebEditorClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -70,11 +70,6 @@
</span><span class="cx">     return uniqueTextCheckingRequestID++;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebEditorClient::pageDestroyed()
-{
-    delete this;
-}
-
</del><span class="cx"> bool WebEditorClient::shouldDeleteRange(Range* range)
</span><span class="cx"> {
</span><span class="cx">     bool result = m_page-&gt;injectedBundleEditorClient().shouldDeleteRange(m_page, range);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebEditorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -41,8 +41,6 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    void pageDestroyed() override;
-
</del><span class="cx">     bool shouldDeleteRange(WebCore::Range*) override;
</span><span class="cx">     bool smartInsertDeleteEnabled() override;
</span><span class="cx">     bool isSelectTrailingWhitespaceEnabled() override;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (201893 => 201894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-06-09 23:48:08 UTC (rev 201893)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-06-09 23:53:36 UTC (rev 201894)
</span><span class="lines">@@ -389,7 +389,7 @@
</span><span class="cx"> #if ENABLE(CONTEXT_MENUS)
</span><span class="cx">     pageConfiguration.contextMenuClient = new WebContextMenuClient(this);
</span><span class="cx"> #endif
</span><del>-    pageConfiguration.editorClient = new WebEditorClient(this);
</del><ins>+    pageConfiguration.editorClient = std::make_unique&lt;WebEditorClient&gt;(this);
</ins><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><span class="cx">     pageConfiguration.dragClient = new WebDragClient(this);
</span><span class="cx"> #endif
</span><span class="lines">@@ -414,7 +414,7 @@
</span><span class="cx"> #include &lt;WebKitAdditions/WebPageInitialization.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    m_page = std::make_unique&lt;Page&gt;(pageConfiguration);
</del><ins>+    m_page = std::make_unique&lt;Page&gt;(WTFMove(pageConfiguration));
</ins><span class="cx">     updatePreferences(parameters.store);
</span><span class="cx"> 
</span><span class="cx">     m_drawingArea = DrawingArea::create(*this, parameters);
</span></span></pre>
</div>
</div>

</body>
</html>