<!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>[179705] trunk/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/179705">179705</a></dd>
<dt>Author</dt> <dd>burg@cs.washington.edu</dd>
<dt>Date</dt> <dd>2015-02-05 13:52:11 -0800 (Thu, 05 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Clean up WebInspectorProxy and use simpler inspector levels design
https://bugs.webkit.org/show_bug.cgi?id=141135

Reviewed by Timothy Hatcher.

Inspector levels used to be managed by keeping a set of WebPageGroup
instances and doing pointer comparisons to check whether the inspected
view is itself a web inspector instance. This is unnecessary, as we
can maintain a mapping from WebPageProxy* to its corresponding level.

When an inspector instance is created, it is inserted into the mapping
along with its level. An inspector's level is 1 unless its inspected page
is in the mapping, then it is one greater that the inspected page's level.

The level is provided by inspectorLevel(), rather than a member variable.
WebInspectorProxy is created in the constructor of WebPageProxy. Thus, there
would be no chance to add the inspector page's level to the mapping before the
next level inspector tries to look it up when initializing its members.

This patch introduces other miscellaneous cleanups, such as naming m_page
to m_inspectedPage, using Ref and using an enum class for the attachment side.

* UIProcess/API/C/WKInspector.cpp:
(WKInspectorGetPage):
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(resizeWebKitWebViewBaseFromAllocation):
* UIProcess/InspectorServer/efl/WebInspectorServerEfl.cpp:
* UIProcess/InspectorServer/gtk/WebInspectorServerGtk.cpp:
* UIProcess/WebInspectorProxy.cpp:
(WebKit::pageLevelMap):
(WebKit::WebInspectorProxy::WebInspectorProxy):
(WebKit::WebInspectorProxy::inspectorLevel):
(WebKit::WebInspectorProxy::inspectorPageGroupIdentifier):
(WebKit::WebInspectorProxy::inspectorPagePreferences):
(WebKit::WebInspectorProxy::invalidate):
(WebKit::WebInspectorProxy::isFront):
(WebKit::WebInspectorProxy::connect):
(WebKit::WebInspectorProxy::show):
(WebKit::WebInspectorProxy::hide):
(WebKit::WebInspectorProxy::close):
(WebKit::WebInspectorProxy::didRelaunchInspectorPageProcess):
(WebKit::WebInspectorProxy::showConsole):
(WebKit::WebInspectorProxy::showResources):
(WebKit::WebInspectorProxy::showMainResourceForFrame):
(WebKit::WebInspectorProxy::attachBottom):
(WebKit::WebInspectorProxy::attachRight):
(WebKit::WebInspectorProxy::attach):
(WebKit::WebInspectorProxy::detach):
(WebKit::WebInspectorProxy::togglePageProfiling):
(WebKit::WebInspectorProxy::isInspectorPage):
(WebKit::decidePolicyForNavigationAction):
(WebKit::WebInspectorProxy::remoteFrontendConnected):
(WebKit::WebInspectorProxy::remoteFrontendDisconnected):
(WebKit::WebInspectorProxy::dispatchMessageFromRemoteFrontend):
(WebKit::WebInspectorProxy::eagerlyCreateInspectorPage):
(WebKit::WebInspectorProxy::createInspectorPage):
(WebKit::WebInspectorProxy::didClose):
(WebKit::WebInspectorPageGroups::singleton): Deleted.
(WebKit::WebInspectorPageGroups::inspectorLevel): Deleted.
(WebKit::WebInspectorPageGroups::isInspectorPageGroup): Deleted.
(WebKit::WebInspectorPageGroups::inspectorPageGroupLevel): Deleted.
(WebKit::WebInspectorPageGroups::inspectorPageGroupForLevel): Deleted.
(WebKit::WebInspectorPageGroups::createInspectorPageGroup): Deleted.
(WebKit::WebInspectorProxy::~WebInspectorProxy): Deleted.
(WebKit::WebInspectorProxy::inspectorPageGroup): Deleted.
(WebKit::WebInspectorProxy::setAttachedWindowHeight): Deleted.
(WebKit::WebInspectorProxy::enableRemoteInspection): Deleted.
(WebKit::WebInspectorProxy::open): Deleted.
* UIProcess/WebInspectorProxy.h:
(WebKit::WebInspectorProxy::create):
(WebKit::WebInspectorProxy::inspectedPage):
(WebKit::WebInspectorProxy::page): Deleted.
* UIProcess/efl/WebInspectorProxyEfl.cpp:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
* UIProcess/gtk/WebInspectorProxyGtk.cpp:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
(WebKit::WebInspectorProxy::dockButtonClicked):
(WebKit::WebInspectorProxy::createInspectorWindow):
(WebKit::WebInspectorProxy::platformInspectedWindowHeight):
(WebKit::WebInspectorProxy::platformInspectedWindowWidth):
(WebKit::WebInspectorProxy::platformAttach):
(WebKit::WebInspectorProxy::platformDetach):
(WebKit::WebInspectorProxy::platformSetAttachedWindowHeight):
(WebKit::WebInspectorProxy::platformSetAttachedWindowWidth):
* UIProcess/mac/WebInspectorProxyMac.mm:
(-[WKWebInspectorProxyObjCAdapter attachRight:]):
(-[WKWebInspectorProxyObjCAdapter attachBottom:]):
(WebKit::WebInspectorProxy::createInspectorWindow):
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
(WebKit::WebInspectorProxy::platformBringToFront):
(WebKit::WebInspectorProxy::windowFrameDidChange):
(WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
(WebKit::WebInspectorProxy::platformInspectedWindowHeight):
(WebKit::WebInspectorProxy::platformInspectedWindowWidth):
(WebKit::WebInspectorProxy::platformAttach):
(WebKit::WebInspectorProxy::platformDetach):
(-[WKWebInspectorProxyObjCAdapter close]): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKInspectorcpp">trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessInspectorServereflWebInspectorServerEflcpp">trunk/Source/WebKit2/UIProcess/InspectorServer/efl/WebInspectorServerEfl.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessInspectorServergtkWebInspectorServerGtkcpp">trunk/Source/WebKit2/UIProcess/InspectorServer/gtk/WebInspectorServerGtk.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebInspectorProxycpp">trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebInspectorProxyh">trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcesseflWebInspectorProxyEflcpp">trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessgtkWebInspectorProxyGtkcpp">trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWebInspectorProxyMacmm">trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (179704 => 179705)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-02-05 21:48:16 UTC (rev 179704)
+++ trunk/Source/WebKit2/ChangeLog        2015-02-05 21:52:11 UTC (rev 179705)
</span><span class="lines">@@ -1,3 +1,103 @@
</span><ins>+2015-02-05  Brian J. Burg  &lt;burg@cs.washington.edu&gt;
+
+        Clean up WebInspectorProxy and use simpler inspector levels design
+        https://bugs.webkit.org/show_bug.cgi?id=141135
+
+        Reviewed by Timothy Hatcher.
+
+        Inspector levels used to be managed by keeping a set of WebPageGroup
+        instances and doing pointer comparisons to check whether the inspected
+        view is itself a web inspector instance. This is unnecessary, as we
+        can maintain a mapping from WebPageProxy* to its corresponding level.
+
+        When an inspector instance is created, it is inserted into the mapping
+        along with its level. An inspector's level is 1 unless its inspected page
+        is in the mapping, then it is one greater that the inspected page's level.
+
+        The level is provided by inspectorLevel(), rather than a member variable.
+        WebInspectorProxy is created in the constructor of WebPageProxy. Thus, there
+        would be no chance to add the inspector page's level to the mapping before the
+        next level inspector tries to look it up when initializing its members.
+
+        This patch introduces other miscellaneous cleanups, such as naming m_page
+        to m_inspectedPage, using Ref and using an enum class for the attachment side.
+
+        * UIProcess/API/C/WKInspector.cpp:
+        (WKInspectorGetPage):
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (resizeWebKitWebViewBaseFromAllocation):
+        * UIProcess/InspectorServer/efl/WebInspectorServerEfl.cpp:
+        * UIProcess/InspectorServer/gtk/WebInspectorServerGtk.cpp:
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::pageLevelMap):
+        (WebKit::WebInspectorProxy::WebInspectorProxy):
+        (WebKit::WebInspectorProxy::inspectorLevel):
+        (WebKit::WebInspectorProxy::inspectorPageGroupIdentifier):
+        (WebKit::WebInspectorProxy::inspectorPagePreferences):
+        (WebKit::WebInspectorProxy::invalidate):
+        (WebKit::WebInspectorProxy::isFront):
+        (WebKit::WebInspectorProxy::connect):
+        (WebKit::WebInspectorProxy::show):
+        (WebKit::WebInspectorProxy::hide):
+        (WebKit::WebInspectorProxy::close):
+        (WebKit::WebInspectorProxy::didRelaunchInspectorPageProcess):
+        (WebKit::WebInspectorProxy::showConsole):
+        (WebKit::WebInspectorProxy::showResources):
+        (WebKit::WebInspectorProxy::showMainResourceForFrame):
+        (WebKit::WebInspectorProxy::attachBottom):
+        (WebKit::WebInspectorProxy::attachRight):
+        (WebKit::WebInspectorProxy::attach):
+        (WebKit::WebInspectorProxy::detach):
+        (WebKit::WebInspectorProxy::togglePageProfiling):
+        (WebKit::WebInspectorProxy::isInspectorPage):
+        (WebKit::decidePolicyForNavigationAction):
+        (WebKit::WebInspectorProxy::remoteFrontendConnected):
+        (WebKit::WebInspectorProxy::remoteFrontendDisconnected):
+        (WebKit::WebInspectorProxy::dispatchMessageFromRemoteFrontend):
+        (WebKit::WebInspectorProxy::eagerlyCreateInspectorPage):
+        (WebKit::WebInspectorProxy::createInspectorPage):
+        (WebKit::WebInspectorProxy::didClose):
+        (WebKit::WebInspectorPageGroups::singleton): Deleted.
+        (WebKit::WebInspectorPageGroups::inspectorLevel): Deleted.
+        (WebKit::WebInspectorPageGroups::isInspectorPageGroup): Deleted.
+        (WebKit::WebInspectorPageGroups::inspectorPageGroupLevel): Deleted.
+        (WebKit::WebInspectorPageGroups::inspectorPageGroupForLevel): Deleted.
+        (WebKit::WebInspectorPageGroups::createInspectorPageGroup): Deleted.
+        (WebKit::WebInspectorProxy::~WebInspectorProxy): Deleted.
+        (WebKit::WebInspectorProxy::inspectorPageGroup): Deleted.
+        (WebKit::WebInspectorProxy::setAttachedWindowHeight): Deleted.
+        (WebKit::WebInspectorProxy::enableRemoteInspection): Deleted.
+        (WebKit::WebInspectorProxy::open): Deleted.
+        * UIProcess/WebInspectorProxy.h:
+        (WebKit::WebInspectorProxy::create):
+        (WebKit::WebInspectorProxy::inspectedPage):
+        (WebKit::WebInspectorProxy::page): Deleted.
+        * UIProcess/efl/WebInspectorProxyEfl.cpp:
+        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
+        * UIProcess/gtk/WebInspectorProxyGtk.cpp:
+        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
+        (WebKit::WebInspectorProxy::dockButtonClicked):
+        (WebKit::WebInspectorProxy::createInspectorWindow):
+        (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
+        (WebKit::WebInspectorProxy::platformInspectedWindowWidth):
+        (WebKit::WebInspectorProxy::platformAttach):
+        (WebKit::WebInspectorProxy::platformDetach):
+        (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight):
+        (WebKit::WebInspectorProxy::platformSetAttachedWindowWidth):
+        * UIProcess/mac/WebInspectorProxyMac.mm:
+        (-[WKWebInspectorProxyObjCAdapter attachRight:]):
+        (-[WKWebInspectorProxyObjCAdapter attachBottom:]):
+        (WebKit::WebInspectorProxy::createInspectorWindow):
+        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
+        (WebKit::WebInspectorProxy::platformBringToFront):
+        (WebKit::WebInspectorProxy::windowFrameDidChange):
+        (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
+        (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
+        (WebKit::WebInspectorProxy::platformInspectedWindowWidth):
+        (WebKit::WebInspectorProxy::platformAttach):
+        (WebKit::WebInspectorProxy::platformDetach):
+        (-[WKWebInspectorProxyObjCAdapter close]): Deleted.
+
</ins><span class="cx"> 2015-02-05  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WK2][Cocoa] Populate m_contentsFilter bloom filter from the main dispatch queue NetworkCacheStorage::initialize()
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKInspectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp (179704 => 179705)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp        2015-02-05 21:48:16 UTC (rev 179704)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp        2015-02-05 21:52:11 UTC (rev 179705)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx"> 
</span><span class="cx"> WKPageRef WKInspectorGetPage(WKInspectorRef inspectorRef)
</span><span class="cx"> {
</span><del>-    return toAPI(toImpl(inspectorRef)-&gt;page());
</del><ins>+    return toAPI(toImpl(inspectorRef)-&gt;inspectedPage());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool WKInspectorIsConnected(WKInspectorRef inspectorRef)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (179704 => 179705)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2015-02-05 21:48:16 UTC (rev 179704)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2015-02-05 21:52:11 UTC (rev 179705)
</span><span class="lines">@@ -591,7 +591,7 @@
</span><span class="cx">     if (priv-&gt;inspectorView) {
</span><span class="cx">         GtkAllocation childAllocation = viewRect;
</span><span class="cx"> 
</span><del>-        if (priv-&gt;inspectorAttachmentSide == AttachmentSideBottom) {
</del><ins>+        if (priv-&gt;inspectorAttachmentSide == AttachmentSide::Bottom) {
</ins><span class="cx">             int inspectorViewHeight = std::min(static_cast&lt;int&gt;(priv-&gt;inspectorViewSize), allocation-&gt;height);
</span><span class="cx">             childAllocation.x = 0;
</span><span class="cx">             childAllocation.y = allocation-&gt;height - inspectorViewHeight;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessInspectorServereflWebInspectorServerEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/InspectorServer/efl/WebInspectorServerEfl.cpp (179704 => 179705)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/InspectorServer/efl/WebInspectorServerEfl.cpp        2015-02-05 21:48:16 UTC (rev 179704)
+++ trunk/Source/WebKit2/UIProcess/InspectorServer/efl/WebInspectorServerEfl.cpp        2015-02-05 21:52:11 UTC (rev 179705)
</span><span class="lines">@@ -84,7 +84,7 @@
</span><span class="cx"> 
</span><span class="cx">     ClientMap::iterator end = m_clientMap.end();
</span><span class="cx">     for (ClientMap::iterator it = m_clientMap.begin(); it != end; ++it) {
</span><del>-        WebPageProxy* webPage = it-&gt;value-&gt;page();
</del><ins>+        WebPageProxy* webPage = it-&gt;value-&gt;inspectedPage();
</ins><span class="cx">         if (it != m_clientMap.begin())
</span><span class="cx">             builder.appendLiteral(&quot;, &quot;);
</span><span class="cx">         builder.appendLiteral(&quot;{ \&quot;id\&quot;: &quot;);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessInspectorServergtkWebInspectorServerGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/InspectorServer/gtk/WebInspectorServerGtk.cpp (179704 => 179705)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/InspectorServer/gtk/WebInspectorServerGtk.cpp        2015-02-05 21:48:16 UTC (rev 179704)
+++ trunk/Source/WebKit2/UIProcess/InspectorServer/gtk/WebInspectorServerGtk.cpp        2015-02-05 21:52:11 UTC (rev 179705)
</span><span class="lines">@@ -94,7 +94,7 @@
</span><span class="cx">     builder.appendLiteral(&quot;[ &quot;);
</span><span class="cx">     ClientMap::iterator end = m_clientMap.end();
</span><span class="cx">     for (ClientMap::iterator it = m_clientMap.begin(); it != end; ++it) {
</span><del>-        WebPageProxy* webPage = it-&gt;value-&gt;page();
</del><ins>+        WebPageProxy* webPage = it-&gt;value-&gt;inspectedPage();
</ins><span class="cx">         if (it != m_clientMap.begin())
</span><span class="cx">             builder.appendLiteral(&quot;, &quot;);
</span><span class="cx">         builder.appendLiteral(&quot;{ \&quot;id\&quot;: &quot;);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebInspectorProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (179704 => 179705)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp        2015-02-05 21:48:16 UTC (rev 179704)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp        2015-02-05 21:52:11 UTC (rev 179705)
</span><span class="lines">@@ -58,90 +58,45 @@
</span><span class="cx"> const unsigned WebInspectorProxy::initialWindowWidth = 1000;
</span><span class="cx"> const unsigned WebInspectorProxy::initialWindowHeight = 650;
</span><span class="cx"> 
</span><del>-class WebInspectorPageGroups {
-public:
-    static WebInspectorPageGroups&amp; singleton()
-    {
-        static NeverDestroyed&lt;WebInspectorPageGroups&gt; instance;
-        return instance;
-    }
</del><ins>+typedef HashMap&lt;WebPageProxy*, unsigned&gt; PageLevelMap;
</ins><span class="cx"> 
</span><del>-    unsigned inspectorLevel(WebPageGroup&amp; inspectedPageGroup)
-    {
-        return isInspectorPageGroup(inspectedPageGroup) ? inspectorPageGroupLevel(inspectedPageGroup) + 1 : 1;
-    }
</del><ins>+static PageLevelMap&amp; pageLevelMap()
+{
+    static NeverDestroyed&lt;PageLevelMap&gt; map;
+    return map;
+}
</ins><span class="cx"> 
</span><del>-    bool isInspectorPageGroup(WebPageGroup&amp; group)
-    {
-        return m_pageGroupLevel.contains(&amp;group);
-    }
-
-    unsigned inspectorPageGroupLevel(WebPageGroup&amp; group)
-    {
-        ASSERT(isInspectorPageGroup(group));
-        return m_pageGroupLevel.get(&amp;group);
-    }
-
-    WebPageGroup* inspectorPageGroupForLevel(unsigned level)
-    {
-        // The level is the key of the HashMap, so it cannot be 0.
-        ASSERT(level);
-
-        auto iterator = m_pageGroupByLevel.find(level);
-        if (iterator != m_pageGroupByLevel.end())
-            return iterator-&gt;value.get();
-
-        RefPtr&lt;WebPageGroup&gt; group = createInspectorPageGroup(level);
-        m_pageGroupByLevel.set(level, group.get());
-        m_pageGroupLevel.set(group.get(), level);
-        return group.get();
-    }
-
-private:
-    static PassRefPtr&lt;WebPageGroup&gt; createInspectorPageGroup(unsigned level)
-    {
-        RefPtr&lt;WebPageGroup&gt; pageGroup = WebPageGroup::create(String::format(&quot;__WebInspectorPageGroupLevel%u__&quot;, level), false, false);
-
-#ifndef NDEBUG
-        // Allow developers to inspect the Web Inspector in debug builds without changing settings.
-        pageGroup-&gt;preferences().setDeveloperExtrasEnabled(true);
-        pageGroup-&gt;preferences().setLogsPageMessagesToSystemConsoleEnabled(true);
-#endif
-
-        pageGroup-&gt;preferences().setAllowFileAccessFromFileURLs(true);
-
-        return pageGroup.release();
-    }
-
-    typedef HashMap&lt;unsigned, RefPtr&lt;WebPageGroup&gt; &gt; PageGroupByLevelMap;
-    typedef HashMap&lt;WebPageGroup*, unsigned&gt; PageGroupLevelMap;
-
-    PageGroupByLevelMap m_pageGroupByLevel;
-    PageGroupLevelMap m_pageGroupLevel;
-};
-
-WebInspectorProxy::WebInspectorProxy(WebPageProxy* page)
-    : m_page(page)
</del><ins>+WebInspectorProxy::WebInspectorProxy(WebPageProxy* inspectedPage)
+    : m_inspectedPage(inspectedPage)
</ins><span class="cx"> #if PLATFORM(MAC) &amp;&amp; WK_API_ENABLED
</span><span class="cx">     , m_closeTimer(RunLoop::main(), this, &amp;WebInspectorProxy::closeTimerFired)
</span><span class="cx"> #endif
</span><span class="cx"> {
</span><del>-    m_level = WebInspectorPageGroups::singleton().inspectorLevel(m_page-&gt;pageGroup());
-    m_page-&gt;process().addMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_page-&gt;pageID(), *this);
</del><ins>+    m_inspectedPage-&gt;process().addMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_inspectedPage-&gt;pageID(), *this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebInspectorProxy::~WebInspectorProxy()
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WebPageGroup* WebInspectorProxy::inspectorPageGroup() const
</del><ins>+unsigned WebInspectorProxy::inspectorLevel() const
</ins><span class="cx"> {
</span><del>-    return WebInspectorPageGroups::singleton().inspectorPageGroupForLevel(m_level);
</del><ins>+    auto findResult = pageLevelMap().find(inspectedPage());
+    if (findResult != pageLevelMap().end())
+        return findResult-&gt;value + 1;
+
+    return 1;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String WebInspectorProxy::inspectorPageGroupIdentifier() const
+{
+    return String::format(&quot;__WebInspectorPageGroupLevel%u__&quot;, inspectorLevel());
+}
+
</ins><span class="cx"> WebPreferences&amp; WebInspectorProxy::inspectorPagePreferences() const
</span><span class="cx"> {
</span><del>-    return inspectorPageGroup()-&gt;preferences();
</del><ins>+    ASSERT(m_inspectorPage);
+    return m_inspectorPage-&gt;pageGroup().preferences();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::invalidate()
</span><span class="lines">@@ -151,18 +106,19 @@
</span><span class="cx">         WebInspectorServer::singleton().unregisterPage(m_remoteInspectionPageId);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    m_page-&gt;process().removeMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_page-&gt;pageID());
</del><ins>+    m_inspectedPage-&gt;process().removeMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_inspectedPage-&gt;pageID());
</ins><span class="cx"> 
</span><span class="cx">     didClose();
</span><span class="cx">     platformInvalidate();
</span><span class="cx"> 
</span><del>-    m_page = nullptr;
</del><ins>+    pageLevelMap().remove(m_inspectedPage);
+    m_inspectedPage = nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Public APIs
</span><span class="cx"> bool WebInspectorProxy::isFront()
</span><span class="cx"> {
</span><del>-    if (!m_page)
</del><ins>+    if (!m_inspectedPage)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     return platformIsFront();
</span><span class="lines">@@ -170,7 +126,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::connect()
</span><span class="cx"> {
</span><del>-    if (!m_page)
</del><ins>+    if (!m_inspectedPage)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (m_showMessageSent)
</span><span class="lines">@@ -181,12 +137,12 @@
</span><span class="cx"> 
</span><span class="cx">     eagerlyCreateInspectorPage();
</span><span class="cx"> 
</span><del>-    m_page-&gt;process().send(Messages::WebInspector::Show(), m_page-&gt;pageID());
</del><ins>+    m_inspectedPage-&gt;process().send(Messages::WebInspector::Show(), m_inspectedPage-&gt;pageID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::show()
</span><span class="cx"> {
</span><del>-    if (!m_page)
</del><ins>+    if (!m_inspectedPage)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (isConnected()) {
</span><span class="lines">@@ -202,7 +158,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::hide()
</span><span class="cx"> {
</span><del>-    if (!m_page)
</del><ins>+    if (!m_inspectedPage)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_isVisible = false;
</span><span class="lines">@@ -212,86 +168,86 @@
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::close()
</span><span class="cx"> {
</span><del>-    if (!m_page)
</del><ins>+    if (!m_inspectedPage)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_page-&gt;process().send(Messages::WebInspector::Close(), m_page-&gt;pageID());
</del><ins>+    m_inspectedPage-&gt;process().send(Messages::WebInspector::Close(), m_inspectedPage-&gt;pageID());
</ins><span class="cx"> 
</span><span class="cx">     didClose();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::didRelaunchInspectorPageProcess()
</span><span class="cx"> {
</span><del>-    m_inspectorPage-&gt;process().addMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_page-&gt;pageID(), *this);
</del><ins>+    m_inspectorPage-&gt;process().addMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_inspectedPage-&gt;pageID(), *this);
</ins><span class="cx">     m_inspectorPage-&gt;process().assumeReadAccessToBaseURL(inspectorBaseURL());
</span><span class="cx"> 
</span><span class="cx">     // When didRelaunchInspectorPageProcess is called we can assume it is during a load request.
</span><span class="cx">     // Any messages we would have sent to a terminated process need to be re-sent.
</span><span class="cx"> 
</span><del>-    m_inspectorPage-&gt;process().send(Messages::WebInspectorUI::EstablishConnection(m_connectionIdentifier, m_page-&gt;pageID(), m_underTest), m_inspectorPage-&gt;pageID());
</del><ins>+    m_inspectorPage-&gt;process().send(Messages::WebInspectorUI::EstablishConnection(m_connectionIdentifier, m_inspectedPage-&gt;pageID(), m_underTest), m_inspectorPage-&gt;pageID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::showConsole()
</span><span class="cx"> {
</span><del>-    if (!m_page)
</del><ins>+    if (!m_inspectedPage)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     eagerlyCreateInspectorPage();
</span><span class="cx"> 
</span><del>-    m_page-&gt;process().send(Messages::WebInspector::ShowConsole(), m_page-&gt;pageID());
</del><ins>+    m_inspectedPage-&gt;process().send(Messages::WebInspector::ShowConsole(), m_inspectedPage-&gt;pageID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::showResources()
</span><span class="cx"> {
</span><del>-    if (!m_page)
</del><ins>+    if (!m_inspectedPage)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     eagerlyCreateInspectorPage();
</span><span class="cx"> 
</span><del>-    m_page-&gt;process().send(Messages::WebInspector::ShowResources(), m_page-&gt;pageID());
</del><ins>+    m_inspectedPage-&gt;process().send(Messages::WebInspector::ShowResources(), m_inspectedPage-&gt;pageID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::showMainResourceForFrame(WebFrameProxy* frame)
</span><span class="cx"> {
</span><del>-    if (!m_page)
</del><ins>+    if (!m_inspectedPage)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     eagerlyCreateInspectorPage();
</span><span class="cx"> 
</span><del>-    m_page-&gt;process().send(Messages::WebInspector::ShowMainResourceForFrame(frame-&gt;frameID()), m_page-&gt;pageID());
</del><ins>+    m_inspectedPage-&gt;process().send(Messages::WebInspector::ShowMainResourceForFrame(frame-&gt;frameID()), m_inspectedPage-&gt;pageID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::attachBottom()
</span><span class="cx"> {
</span><del>-    attach(AttachmentSideBottom);
</del><ins>+    attach(AttachmentSide::Bottom);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::attachRight()
</span><span class="cx"> {
</span><del>-    attach(AttachmentSideRight);
</del><ins>+    attach(AttachmentSide::Right);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::attach(AttachmentSide side)
</span><span class="cx"> {
</span><del>-    if (!m_page || !canAttach())
</del><ins>+    if (!m_inspectedPage || !canAttach())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_isAttached = true;
</span><span class="cx">     m_attachmentSide = side;
</span><span class="cx"> 
</span><del>-    inspectorPagePreferences().setInspectorAttachmentSide(side);
</del><ins>+    inspectorPagePreferences().setInspectorAttachmentSide(static_cast&lt;uint32_t&gt;(side));
</ins><span class="cx"> 
</span><span class="cx">     if (m_isVisible)
</span><span class="cx">         inspectorPagePreferences().setInspectorStartsAttached(true);
</span><span class="cx"> 
</span><del>-    m_page-&gt;process().send(Messages::WebInspector::SetAttached(true), m_page-&gt;pageID());
</del><ins>+    m_inspectedPage-&gt;process().send(Messages::WebInspector::SetAttached(true), m_inspectedPage-&gt;pageID());
</ins><span class="cx"> 
</span><span class="cx">     switch (m_attachmentSide) {
</span><del>-    case AttachmentSideBottom:
</del><ins>+    case AttachmentSide::Bottom:
</ins><span class="cx">         m_inspectorPage-&gt;process().send(Messages::WebInspectorUI::AttachedBottom(), m_inspectorPage-&gt;pageID());
</span><span class="cx">         break;
</span><span class="cx"> 
</span><del>-    case AttachmentSideRight:
</del><ins>+    case AttachmentSide::Right:
</ins><span class="cx">         m_inspectorPage-&gt;process().send(Messages::WebInspectorUI::AttachedRight(), m_inspectorPage-&gt;pageID());
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="lines">@@ -301,7 +257,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::detach()
</span><span class="cx"> {
</span><del>-    if (!m_page)
</del><ins>+    if (!m_inspectedPage)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_isAttached = false;
</span><span class="lines">@@ -309,7 +265,7 @@
</span><span class="cx">     if (m_isVisible)
</span><span class="cx">         inspectorPagePreferences().setInspectorStartsAttached(false);
</span><span class="cx"> 
</span><del>-    m_page-&gt;process().send(Messages::WebInspector::SetAttached(false), m_page-&gt;pageID());
</del><ins>+    m_inspectedPage-&gt;process().send(Messages::WebInspector::SetAttached(false), m_inspectedPage-&gt;pageID());
</ins><span class="cx">     m_inspectorPage-&gt;process().send(Messages::WebInspectorUI::Detached(), m_inspectorPage-&gt;pageID());
</span><span class="cx"> 
</span><span class="cx">     platformDetach();
</span><span class="lines">@@ -329,23 +285,18 @@
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::togglePageProfiling()
</span><span class="cx"> {
</span><del>-    if (!m_page)
</del><ins>+    if (!m_inspectedPage)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (m_isProfilingPage)
</span><del>-        m_page-&gt;process().send(Messages::WebInspector::StopPageProfiling(), m_page-&gt;pageID());
</del><ins>+        m_inspectedPage-&gt;process().send(Messages::WebInspector::StopPageProfiling(), m_inspectedPage-&gt;pageID());
</ins><span class="cx">     else
</span><del>-        m_page-&gt;process().send(Messages::WebInspector::StartPageProfiling(), m_page-&gt;pageID());
</del><ins>+        m_inspectedPage-&gt;process().send(Messages::WebInspector::StartPageProfiling(), m_inspectedPage-&gt;pageID());
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: have the WebProcess notify us on state changes.
</span><span class="cx">     m_isProfilingPage = !m_isProfilingPage;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WebInspectorProxy::isInspectorPage(WebPageProxy&amp; page)
-{
-    return WebInspectorPageGroups::singleton().isInspectorPageGroup(page.pageGroup());
-}
-
</del><span class="cx"> WebProcessPool&amp; WebInspectorProxy::inspectorProcessPool()
</span><span class="cx"> {
</span><span class="cx">     // Having our own process pool removes us from the main process pool and
</span><span class="lines">@@ -359,6 +310,11 @@
</span><span class="cx">     return *processPool;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool WebInspectorProxy::isInspectorPage(WebPageProxy&amp; webPage)
+{
+    return pageLevelMap().contains(&amp;webPage);
+}
+
</ins><span class="cx"> static bool isMainOrTestInspectorPage(const WebInspectorProxy* webInspectorProxy, WKURLRequestRef requestRef)
</span><span class="cx"> {
</span><span class="cx">     URL requestURL(URL(), toImpl(requestRef)-&gt;resourceRequest().url());
</span><span class="lines">@@ -409,7 +365,7 @@
</span><span class="cx">     toImpl(listenerRef)-&gt;ignore();
</span><span class="cx"> 
</span><span class="cx">     // And instead load it in the inspected page.
</span><del>-    webInspectorProxy-&gt;page()-&gt;loadRequest(toImpl(requestRef)-&gt;resourceRequest());
</del><ins>+    webInspectorProxy-&gt;inspectedPage()-&gt;loadRequest(toImpl(requestRef)-&gt;resourceRequest());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(INSPECTOR_SERVER)
</span><span class="lines">@@ -421,17 +377,17 @@
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::remoteFrontendConnected()
</span><span class="cx"> {
</span><del>-    m_page-&gt;process().send(Messages::WebInspector::RemoteFrontendConnected(), m_page-&gt;pageID());
</del><ins>+    m_inspectedPage-&gt;process().send(Messages::WebInspector::RemoteFrontendConnected(), m_inspectedPage-&gt;pageID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::remoteFrontendDisconnected()
</span><span class="cx"> {
</span><del>-    m_page-&gt;process().send(Messages::WebInspector::RemoteFrontendDisconnected(), m_page-&gt;pageID());
</del><ins>+    m_inspectedPage-&gt;process().send(Messages::WebInspector::RemoteFrontendDisconnected(), m_inspectedPage-&gt;pageID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::dispatchMessageFromRemoteFrontend(const String&amp; message)
</span><span class="cx"> {
</span><del>-    m_page-&gt;process().send(Messages::WebInspector::SendMessageToBackend(message), m_page-&gt;pageID());
</del><ins>+    m_inspectedPage-&gt;process().send(Messages::WebInspector::SendMessageToBackend(message), m_inspectedPage-&gt;pageID());
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -445,6 +401,8 @@
</span><span class="cx">     if (!m_inspectorPage)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    pageLevelMap().set(m_inspectorPage, inspectorLevel());
+
</ins><span class="cx">     WKPagePolicyClientV1 policyClient = {
</span><span class="cx">         { 1, this },
</span><span class="cx">         nullptr, // decidePolicyForNavigationAction_deprecatedForUseWithV0
</span><span class="lines">@@ -501,14 +459,14 @@
</span><span class="cx">     WKPageSetPagePolicyClient(toAPI(m_inspectorPage), &amp;policyClient.base);
</span><span class="cx">     WKPageSetPageLoaderClient(toAPI(m_inspectorPage), &amp;loaderClient.base);
</span><span class="cx"> 
</span><del>-    m_inspectorPage-&gt;process().addMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_page-&gt;pageID(), *this);
</del><ins>+    m_inspectorPage-&gt;process().addMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_inspectedPage-&gt;pageID(), *this);
</ins><span class="cx">     m_inspectorPage-&gt;process().assumeReadAccessToBaseURL(inspectorBaseURL());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Called by WebInspectorProxy messages
</span><span class="cx"> void WebInspectorProxy::createInspectorPage(IPC::Attachment connectionIdentifier, bool canAttach, bool underTest)
</span><span class="cx"> {
</span><del>-    if (!m_page)
</del><ins>+    if (!m_inspectedPage)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     eagerlyCreateInspectorPage();
</span><span class="lines">@@ -520,22 +478,22 @@
</span><span class="cx">     m_underTest = underTest;
</span><span class="cx">     m_connectionIdentifier = connectionIdentifier;
</span><span class="cx"> 
</span><del>-    m_inspectorPage-&gt;process().send(Messages::WebInspectorUI::EstablishConnection(m_connectionIdentifier, m_page-&gt;pageID(), m_underTest), m_inspectorPage-&gt;pageID());
</del><ins>+    m_inspectorPage-&gt;process().send(Messages::WebInspectorUI::EstablishConnection(m_connectionIdentifier, m_inspectedPage-&gt;pageID(), m_underTest), m_inspectorPage-&gt;pageID());
</ins><span class="cx"> 
</span><span class="cx">     if (!m_underTest) {
</span><span class="cx">         m_canAttach = canAttach;
</span><span class="cx">         m_isAttached = shouldOpenAttached();
</span><span class="cx">         m_attachmentSide = static_cast&lt;AttachmentSide&gt;(inspectorPagePreferences().inspectorAttachmentSide());
</span><span class="cx"> 
</span><del>-        m_page-&gt;process().send(Messages::WebInspector::SetAttached(m_isAttached), m_page-&gt;pageID());
</del><ins>+        m_inspectedPage-&gt;process().send(Messages::WebInspector::SetAttached(m_isAttached), m_inspectedPage-&gt;pageID());
</ins><span class="cx"> 
</span><span class="cx">         if (m_isAttached) {
</span><span class="cx">             switch (m_attachmentSide) {
</span><del>-            case AttachmentSideBottom:
</del><ins>+            case AttachmentSide::Bottom:
</ins><span class="cx">                 m_inspectorPage-&gt;process().send(Messages::WebInspectorUI::AttachedBottom(), m_inspectorPage-&gt;pageID());
</span><span class="cx">                 break;
</span><span class="cx"> 
</span><del>-            case AttachmentSideRight:
</del><ins>+            case AttachmentSide::Right:
</ins><span class="cx">                 m_inspectorPage-&gt;process().send(Messages::WebInspectorUI::AttachedRight(), m_inspectorPage-&gt;pageID());
</span><span class="cx">                 break;
</span><span class="cx">             }
</span><span class="lines">@@ -561,7 +519,7 @@
</span><span class="cx">     if (!m_inspectorPage)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_inspectorPage-&gt;process().removeMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_page-&gt;pageID());
</del><ins>+    m_inspectorPage-&gt;process().removeMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_inspectedPage-&gt;pageID());
</ins><span class="cx">     m_inspectorPage = nullptr;
</span><span class="cx"> 
</span><span class="cx">     m_isVisible = false;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebInspectorProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h (179704 => 179705)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h        2015-02-05 21:48:16 UTC (rev 179704)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h        2015-02-05 21:52:11 UTC (rev 179705)
</span><span class="lines">@@ -64,16 +64,16 @@
</span><span class="cx"> class WebPreferences;
</span><span class="cx"> class WebProcessPool;
</span><span class="cx"> 
</span><del>-enum AttachmentSide {
-    AttachmentSideBottom,
-    AttachmentSideRight
</del><ins>+enum class AttachmentSide {
+    Bottom,
+    Right
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class WebInspectorProxy : public API::ObjectImpl&lt;API::Object::Type::Inspector&gt;, public IPC::MessageReceiver {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;WebInspectorProxy&gt; create(WebPageProxy* page)
</del><ins>+    static Ref&lt;WebInspectorProxy&gt; create(WebPageProxy* inspectedPage)
</ins><span class="cx">     {
</span><del>-        return adoptRef(new WebInspectorProxy(page));
</del><ins>+        return adoptRef(*new WebInspectorProxy(inspectedPage));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ~WebInspectorProxy();
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx">     void invalidate();
</span><span class="cx"> 
</span><span class="cx">     // Public APIs
</span><del>-    WebPageProxy* page() const { return m_page; }
</del><ins>+    WebPageProxy* inspectedPage() const { return m_inspectedPage; }
</ins><span class="cx"> 
</span><span class="cx">     bool isConnected() const { return !!m_inspectorPage; }
</span><span class="cx">     bool isVisible() const { return m_isVisible; }
</span><span class="lines">@@ -120,7 +120,7 @@
</span><span class="cx">     bool isAttached() const { return m_isAttached; }
</span><span class="cx">     void attachRight();
</span><span class="cx">     void attachBottom();
</span><del>-    void attach(AttachmentSide = AttachmentSideBottom);
</del><ins>+    void attach(AttachmentSide = AttachmentSide::Bottom);
</ins><span class="cx">     void detach();
</span><span class="cx"> 
</span><span class="cx">     void setAttachedWindowHeight(unsigned);
</span><span class="lines">@@ -130,8 +130,8 @@
</span><span class="cx">     bool isProfilingPage() const { return m_isProfilingPage; }
</span><span class="cx">     void togglePageProfiling();
</span><span class="cx"> 
</span><del>-    static bool isInspectorPage(WebPageProxy&amp;);
</del><span class="cx">     static WebProcessPool&amp; inspectorProcessPool();
</span><ins>+    static bool isInspectorPage(WebPageProxy&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // Provided by platform WebInspectorProxy implementations.
</span><span class="cx">     String inspectorPageURL() const;
</span><span class="lines">@@ -192,9 +192,10 @@
</span><span class="cx"> 
</span><span class="cx">     void open();
</span><span class="cx"> 
</span><del>-    // FIXME: this should return the page group identifier, not an instance. The Mac port cannot
-    // directly provide a page group instance, and instances are not necessary to compute levels.
-    WebPageGroup* inspectorPageGroup() const;
</del><ins>+    // The inspector level is used to give different preferences to each inspector
+    // level by setting a per-level page group identifier.
+    unsigned inspectorLevel() const;
+    String inspectorPageGroupIdentifier() const;
</ins><span class="cx">     WebPreferences&amp; inspectorPagePreferences() const;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK) || PLATFORM(EFL)
</span><span class="lines">@@ -212,7 +213,7 @@
</span><span class="cx">     static const unsigned initialWindowWidth;
</span><span class="cx">     static const unsigned initialWindowHeight;
</span><span class="cx"> 
</span><del>-    WebPageProxy* m_page {nullptr};
</del><ins>+    WebPageProxy* m_inspectedPage {nullptr};
</ins><span class="cx">     WebPageProxy* m_inspectorPage {nullptr};
</span><span class="cx"> 
</span><span class="cx">     bool m_underTest {false};
</span><span class="lines">@@ -223,14 +224,9 @@
</span><span class="cx">     bool m_showMessageSent {false};
</span><span class="cx">     bool m_ignoreFirstBringToFront {false};
</span><span class="cx"> 
</span><del>-    // The debugger stops all the pages in the same PageGroup. Having
-    // all the inspectors in the same group will make it impossible to debug
-    // the inspector code, so we use the level to make different page groups.
-    unsigned m_level;
-    
</del><span class="cx">     IPC::Attachment m_connectionIdentifier;
</span><span class="cx"> 
</span><del>-    AttachmentSide m_attachmentSide {AttachmentSideBottom};
</del><ins>+    AttachmentSide m_attachmentSide {AttachmentSide::Bottom};
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC) &amp;&amp; WK_API_ENABLED
</span><span class="cx">     RetainPtr&lt;WKWebInspectorWKWebView&gt; m_inspectorView;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcesseflWebInspectorProxyEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp (179704 => 179705)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp        2015-02-05 21:48:16 UTC (rev 179704)
+++ trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp        2015-02-05 21:52:11 UTC (rev 179705)
</span><span class="lines">@@ -89,7 +89,7 @@
</span><span class="cx"> 
</span><span class="cx"> WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
</span><span class="cx"> {
</span><del>-    ASSERT(m_page);
</del><ins>+    ASSERT(m_inspectedPage);
</ins><span class="cx"> 
</span><span class="cx"> #ifdef HAVE_ECORE_X
</span><span class="cx">     const char* engine = &quot;opengl_x11&quot;;
</span><span class="lines">@@ -103,7 +103,8 @@
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="cx">     WKContextRef wkContext = toAPI(&amp;inspectorProcessPool());
</span><del>-    WKPageGroupRef wkPageGroup = toAPI(inspectorPageGroup());
</del><ins>+    WKRetainPtr&lt;WKStringRef&gt; wkGroupIdentifier = adoptWK(WKStringCreateWithUTF8CString(inspectorPageGroupIdentifier().utf8().data()));
+    WKPageGroupRef wkPageGroup = WKPageGroupCreateWithIdentifier(wkGroupIdentifier.get());
</ins><span class="cx"> 
</span><span class="cx">     m_inspectorView = EWKViewCreate(wkContext, wkPageGroup, ecore_evas_get(m_inspectorWindow), /* smart */ 0);
</span><span class="cx">     WKViewRef wkView = EWKViewGetWKView(m_inspectorView);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessgtkWebInspectorProxyGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp (179704 => 179705)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp        2015-02-05 21:48:16 UTC (rev 179704)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp        2015-02-05 21:52:11 UTC (rev 179705)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;WebInspectorProxy.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;WebKitWebViewBasePrivate.h&quot;
</span><ins>+#include &quot;WebPageGroup.h&quot;
</ins><span class="cx"> #include &quot;WebProcessProxy.h&quot;
</span><span class="cx"> #include &lt;WebCore/FileSystem.h&gt;
</span><span class="cx"> #include &lt;WebCore/GtkUtilities.h&gt;
</span><span class="lines">@@ -58,9 +59,10 @@
</span><span class="cx"> 
</span><span class="cx"> WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
</span><span class="cx"> {
</span><del>-    ASSERT(m_page);
</del><ins>+    ASSERT(inspectedPage());
</ins><span class="cx">     ASSERT(!m_inspectorView);
</span><del>-    m_inspectorView = GTK_WIDGET(webkitWebViewBaseCreate(&amp;inspectorProcessPool(), nullptr, inspectorPageGroup(), nullptr, nullptr));
</del><ins>+    RefPtr&lt;WebPageGroup&gt; pageGroup = WebPageGroup::create(inspectorPageGroupIdentifier(), false, false).leakRef();
+    m_inspectorView = GTK_WIDGET(webkitWebViewBaseCreate(&amp;inspectorProcessPool(), nullptr, pageGroup.get(), nullptr, nullptr));
</ins><span class="cx">     g_object_add_weak_pointer(G_OBJECT(m_inspectorView), reinterpret_cast&lt;void**&gt;(&amp;m_inspectorView));
</span><span class="cx">     return webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_inspectorView));
</span><span class="cx"> }
</span><span class="lines">@@ -68,9 +70,9 @@
</span><span class="cx"> void WebInspectorProxy::dockButtonClicked(GtkWidget* button, WebInspectorProxy* inspector)
</span><span class="cx"> {
</span><span class="cx">     if (button == inspector-&gt;m_dockBottomButton)
</span><del>-        inspector-&gt;attach(AttachmentSideBottom);
</del><ins>+        inspector-&gt;attach(AttachmentSide::Bottom);
</ins><span class="cx">     else if (button == inspector-&gt;m_dockRightButton)
</span><del>-        inspector-&gt;attach(AttachmentSideRight);
</del><ins>+        inspector-&gt;attach(AttachmentSide::Right);
</ins><span class="cx">     else
</span><span class="cx">         ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="lines">@@ -83,7 +85,7 @@
</span><span class="cx">     ASSERT(!m_inspectorWindow);
</span><span class="cx">     m_inspectorWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
</span><span class="cx"> 
</span><del>-    GtkWidget* inspectedViewParent = gtk_widget_get_toplevel(m_page-&gt;viewWidget());
</del><ins>+    GtkWidget* inspectedViewParent = gtk_widget_get_toplevel(inspectedPage()-&gt;viewWidget());
</ins><span class="cx">     if (WebCore::widgetIsOnscreenToplevelWindow(inspectedViewParent))
</span><span class="cx">         gtk_window_set_transient_for(GTK_WINDOW(m_inspectorWindow), GTK_WINDOW(inspectedViewParent));
</span><span class="cx"> 
</span><span class="lines">@@ -219,12 +221,12 @@
</span><span class="cx"> 
</span><span class="cx"> unsigned WebInspectorProxy::platformInspectedWindowHeight()
</span><span class="cx"> {
</span><del>-    return gtk_widget_get_allocated_height(m_page-&gt;viewWidget());
</del><ins>+    return gtk_widget_get_allocated_height(inspectedPage()-&gt;viewWidget());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> unsigned WebInspectorProxy::platformInspectedWindowWidth()
</span><span class="cx"> {
</span><del>-    return gtk_widget_get_allocated_width(m_page-&gt;viewWidget());
</del><ins>+    return gtk_widget_get_allocated_width(inspectedPage()-&gt;viewWidget());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::platformAttach()
</span><span class="lines">@@ -241,7 +243,7 @@
</span><span class="cx">     static const unsigned minimumAttachedWidth = 750;
</span><span class="cx">     static const unsigned minimumAttachedHeight = 250;
</span><span class="cx"> 
</span><del>-    if (m_attachmentSide == AttachmentSideBottom) {
</del><ins>+    if (m_attachmentSide == AttachmentSide::Bottom) {
</ins><span class="cx">         unsigned maximumAttachedHeight = platformInspectedWindowHeight() * 3 / 4;
</span><span class="cx">         platformSetAttachedWindowHeight(std::max(minimumAttachedHeight, std::min(defaultAttachedSize, maximumAttachedHeight)));
</span><span class="cx">     } else {
</span><span class="lines">@@ -252,13 +254,13 @@
</span><span class="cx">     if (m_client.attach(this))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    webkitWebViewBaseAddWebInspector(WEBKIT_WEB_VIEW_BASE(m_page-&gt;viewWidget()), m_inspectorView, m_attachmentSide);
</del><ins>+    webkitWebViewBaseAddWebInspector(WEBKIT_WEB_VIEW_BASE(inspectedPage()-&gt;viewWidget()), m_inspectorView, m_attachmentSide);
</ins><span class="cx">     gtk_widget_show(m_inspectorView);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::platformDetach()
</span><span class="cx"> {
</span><del>-    if (!m_page-&gt;isValid())
</del><ins>+    if (!inspectedPage()-&gt;isValid())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     GRefPtr&lt;GtkWidget&gt; inspectorView = m_inspectorView;
</span><span class="lines">@@ -280,7 +282,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_client.didChangeAttachedHeight(this, height);
</span><del>-    webkitWebViewBaseSetInspectorViewSize(WEBKIT_WEB_VIEW_BASE(m_page-&gt;viewWidget()), height);
</del><ins>+    webkitWebViewBaseSetInspectorViewSize(WEBKIT_WEB_VIEW_BASE(inspectedPage()-&gt;viewWidget()), height);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::platformSetAttachedWindowWidth(unsigned width)
</span><span class="lines">@@ -289,7 +291,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_client.didChangeAttachedWidth(this, width);
</span><del>-    webkitWebViewBaseSetInspectorViewSize(WEBKIT_WEB_VIEW_BASE(m_page-&gt;viewWidget()), width);
</del><ins>+    webkitWebViewBaseSetInspectorViewSize(WEBKIT_WEB_VIEW_BASE(inspectedPage()-&gt;viewWidget()), width);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::platformSetToolbarHeight(unsigned)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebInspectorProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm (179704 => 179705)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm        2015-02-05 21:48:16 UTC (rev 179704)
+++ trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm        2015-02-05 21:52:11 UTC (rev 179705)
</span><span class="lines">@@ -114,12 +114,12 @@
</span><span class="cx"> 
</span><span class="cx"> - (IBAction)attachRight:(id)sender
</span><span class="cx"> {
</span><del>-    static_cast&lt;WebInspectorProxy*&gt;(_inspectorProxy)-&gt;attach(AttachmentSideRight);
</del><ins>+    static_cast&lt;WebInspectorProxy*&gt;(_inspectorProxy)-&gt;attach(AttachmentSide::Right);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (IBAction)attachBottom:(id)sender
</span><span class="cx"> {
</span><del>-    static_cast&lt;WebInspectorProxy*&gt;(_inspectorProxy)-&gt;attach(AttachmentSideBottom);
</del><ins>+    static_cast&lt;WebInspectorProxy*&gt;(_inspectorProxy)-&gt;attach(AttachmentSide::Bottom);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)close
</span><span class="lines">@@ -285,7 +285,7 @@
</span><span class="cx">             WKRelease(fileURLs);
</span><span class="cx">         } else
</span><span class="cx">             WKOpenPanelResultListenerCancel(listener);
</span><del>-        
</del><ins>+
</ins><span class="cx">         WKRelease(listener);
</span><span class="cx">     }];
</span><span class="cx"> }
</span><span class="lines">@@ -348,7 +348,7 @@
</span><span class="cx">     NSRect windowFrame = NSMakeRect(0, 0, initialWindowWidth, initialWindowHeight);
</span><span class="cx"> 
</span><span class="cx">     // Restore the saved window frame, if there was one.
</span><del>-    NSString *savedWindowFrameString = page()-&gt;pageGroup().preferences().inspectorWindowFrame();
</del><ins>+    NSString *savedWindowFrameString = inspectedPage()-&gt;pageGroup().preferences().inspectorWindowFrame();
</ins><span class="cx">     NSRect savedWindowFrame = NSRectFromString(savedWindowFrameString);
</span><span class="cx">     if (!NSIsEmptyRect(savedWindowFrame))
</span><span class="cx">         windowFrame = savedWindowFrame;
</span><span class="lines">@@ -447,7 +447,7 @@
</span><span class="cx"> 
</span><span class="cx"> WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
</span><span class="cx"> {
</span><del>-    ASSERT(m_page);
</del><ins>+    ASSERT(inspectedPage());
</ins><span class="cx"> 
</span><span class="cx">     m_closeTimer.stop();
</span><span class="cx"> 
</span><span class="lines">@@ -461,20 +461,20 @@
</span><span class="cx"> 
</span><span class="cx">     NSRect initialRect;
</span><span class="cx">     if (m_isAttached) {
</span><del>-        NSRect inspectedViewFrame = m_page-&gt;wkView().frame;
</del><ins>+        NSRect inspectedViewFrame = inspectedPage()-&gt;wkView().frame;
</ins><span class="cx"> 
</span><span class="cx">         switch (m_attachmentSide) {
</span><del>-        case AttachmentSideBottom:
</del><ins>+        case AttachmentSide::Bottom:
</ins><span class="cx">             initialRect = NSMakeRect(0, 0, NSWidth(inspectedViewFrame), inspectorPagePreferences().inspectorAttachedHeight());
</span><span class="cx">             break;
</span><del>-        case AttachmentSideRight:
</del><ins>+        case AttachmentSide::Right:
</ins><span class="cx">             initialRect = NSMakeRect(0, 0, inspectorPagePreferences().inspectorAttachedWidth(), NSHeight(inspectedViewFrame));
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">     } else {
</span><span class="cx">         initialRect = NSMakeRect(0, 0, initialWindowWidth, initialWindowHeight);
</span><span class="cx"> 
</span><del>-        NSString *windowFrameString = page()-&gt;pageGroup().preferences().inspectorWindowFrame();
</del><ins>+        NSString *windowFrameString = inspectedPage()-&gt;pageGroup().preferences().inspectorWindowFrame();
</ins><span class="cx">         NSRect windowFrame = NSRectFromString(windowFrameString);
</span><span class="cx">         if (!NSIsEmptyRect(windowFrame))
</span><span class="cx">             initialRect = [NSWindow contentRectForFrameRect:windowFrame styleMask:windowStyleMask];
</span><span class="lines">@@ -489,7 +489,7 @@
</span><span class="cx"> #endif
</span><span class="cx">     preferences._allowFileAccessFromFileURLs = YES;
</span><span class="cx">     [configuration setProcessPool: ::WebKit::wrapper(inspectorProcessPool())];
</span><del>-    [configuration _setGroupIdentifier:inspectorPageGroup()-&gt;identifier()];
</del><ins>+    [configuration _setGroupIdentifier:inspectorPageGroupIdentifier()];
</ins><span class="cx"> 
</span><span class="cx">     m_inspectorView = adoptNS([[WKWebInspectorWKWebView alloc] initWithFrame:initialRect configuration:configuration.get()]);
</span><span class="cx">     ASSERT(m_inspectorView);
</span><span class="lines">@@ -610,7 +610,7 @@
</span><span class="cx">     // If the Web Inspector is no longer in the same window as the inspected view,
</span><span class="cx">     // then we need to reopen the Inspector to get it attached to the right window.
</span><span class="cx">     // This can happen when dragging tabs to another window in Safari.
</span><del>-    if (m_isAttached &amp;&amp; m_inspectorView.get().window != m_page-&gt;wkView().window) {
</del><ins>+    if (m_isAttached &amp;&amp; m_inspectorView.get().window != inspectedPage()-&gt;wkView().window) {
</ins><span class="cx">         platformOpen();
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -719,7 +719,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     NSString *frameString = NSStringFromRect([m_inspectorWindow frame]);
</span><del>-    page()-&gt;pageGroup().preferences().setInspectorWindowFrame(frameString);
</del><ins>+    inspectedPage()-&gt;pageGroup().preferences().setInspectorWindowFrame(frameString);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::inspectedViewFrameDidChange(CGFloat currentDimension)
</span><span class="lines">@@ -727,41 +727,41 @@
</span><span class="cx">     if (!m_isAttached || !m_isVisible)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    WKView *inspectedView = m_page-&gt;wkView();
</del><ins>+    WKView *inspectedView = inspectedPage()-&gt;wkView();
</ins><span class="cx">     NSRect inspectedViewFrame = [inspectedView frame];
</span><span class="cx">     NSRect inspectorFrame = NSZeroRect;
</span><span class="cx">     NSRect parentBounds = [[inspectedView superview] bounds];
</span><span class="cx">     CGFloat inspectedViewTop = NSMaxY(inspectedViewFrame);
</span><span class="cx"> 
</span><span class="cx">     switch (m_attachmentSide) {
</span><del>-        case AttachmentSideBottom: {
-            if (!currentDimension)
-                currentDimension = NSHeight([m_inspectorView frame]);
</del><ins>+    case AttachmentSide::Bottom: {
+        if (!currentDimension)
+            currentDimension = NSHeight([m_inspectorView frame]);
</ins><span class="cx"> 
</span><del>-            CGFloat parentHeight = NSHeight(parentBounds);
-            CGFloat inspectorHeight = InspectorFrontendClientLocal::constrainedAttachedWindowHeight(currentDimension, parentHeight);
</del><ins>+        CGFloat parentHeight = NSHeight(parentBounds);
+        CGFloat inspectorHeight = InspectorFrontendClientLocal::constrainedAttachedWindowHeight(currentDimension, parentHeight);
</ins><span class="cx"> 
</span><del>-            // Preserve the top position of the inspected view so banners in Safari still work.
-            inspectedViewFrame = NSMakeRect(0, inspectorHeight, NSWidth(parentBounds), inspectedViewTop - inspectorHeight);
-            inspectorFrame = NSMakeRect(0, 0, NSWidth(inspectedViewFrame), inspectorHeight);
-            break;
-        }
</del><ins>+        // Preserve the top position of the inspected view so banners in Safari still work.
+        inspectedViewFrame = NSMakeRect(0, inspectorHeight, NSWidth(parentBounds), inspectedViewTop - inspectorHeight);
+        inspectorFrame = NSMakeRect(0, 0, NSWidth(inspectedViewFrame), inspectorHeight);
+        break;
+    }
</ins><span class="cx"> 
</span><del>-        case AttachmentSideRight: {
-            if (!currentDimension)
-                currentDimension = NSWidth([m_inspectorView frame]);
</del><ins>+    case AttachmentSide::Right: {
+        if (!currentDimension)
+            currentDimension = NSWidth([m_inspectorView frame]);
</ins><span class="cx"> 
</span><del>-            CGFloat parentWidth = NSWidth(parentBounds);
-            CGFloat inspectorWidth = InspectorFrontendClientLocal::constrainedAttachedWindowWidth(currentDimension, parentWidth);
</del><ins>+        CGFloat parentWidth = NSWidth(parentBounds);
+        CGFloat inspectorWidth = InspectorFrontendClientLocal::constrainedAttachedWindowWidth(currentDimension, parentWidth);
</ins><span class="cx"> 
</span><del>-            // Preserve the top position of the inspected view so banners in Safari still work. But don't use that
-            // top position for the inspector view since the banners only stretch as wide as the the inspected view.
-            inspectedViewFrame = NSMakeRect(0, 0, parentWidth - inspectorWidth, inspectedViewTop);
-            CGFloat insetExcludingBanners = inspectedView._topContentInset - inspectedView._totalHeightOfBanners;
-            inspectorFrame = NSMakeRect(parentWidth - inspectorWidth, 0, inspectorWidth, NSHeight(parentBounds) - insetExcludingBanners);
-            break;
-        }
</del><ins>+        // Preserve the top position of the inspected view so banners in Safari still work. But don't use that
+        // top position for the inspector view since the banners only stretch as wide as the the inspected view.
+        inspectedViewFrame = NSMakeRect(0, 0, parentWidth - inspectorWidth, inspectedViewTop);
+        CGFloat insetExcludingBanners = inspectedView._topContentInset - inspectedView._totalHeightOfBanners;
+        inspectorFrame = NSMakeRect(parentWidth - inspectorWidth, 0, inspectorWidth, NSHeight(parentBounds) - insetExcludingBanners);
+        break;
</ins><span class="cx">     }
</span><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     if (NSEqualRects([m_inspectorView frame], inspectorFrame) &amp;&amp; NSEqualRects([inspectedView frame], inspectedViewFrame))
</span><span class="cx">         return;
</span><span class="lines">@@ -777,21 +777,21 @@
</span><span class="cx"> 
</span><span class="cx"> unsigned WebInspectorProxy::platformInspectedWindowHeight()
</span><span class="cx"> {
</span><del>-    WKView *inspectedView = m_page-&gt;wkView();
</del><ins>+    WKView *inspectedView = inspectedPage()-&gt;wkView();
</ins><span class="cx">     NSRect inspectedViewRect = [inspectedView frame];
</span><span class="cx">     return static_cast&lt;unsigned&gt;(inspectedViewRect.size.height);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> unsigned WebInspectorProxy::platformInspectedWindowWidth()
</span><span class="cx"> {
</span><del>-    WKView *inspectedView = m_page-&gt;wkView();
</del><ins>+    WKView *inspectedView = inspectedPage()-&gt;wkView();
</ins><span class="cx">     NSRect inspectedViewRect = [inspectedView frame];
</span><span class="cx">     return static_cast&lt;unsigned&gt;(inspectedViewRect.size.width);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::platformAttach()
</span><span class="cx"> {
</span><del>-    WKView *inspectedView = m_page-&gt;wkView();
</del><ins>+    WKView *inspectedView = inspectedPage()-&gt;wkView();
</ins><span class="cx">     [[NSNotificationCenter defaultCenter] addObserver:m_inspectorProxyObjCAdapter.get() selector:@selector(inspectedViewFrameDidChange:) name:NSViewFrameDidChangeNotification object:inspectedView];
</span><span class="cx"> 
</span><span class="cx">     if (m_inspectorWindow) {
</span><span class="lines">@@ -805,11 +805,11 @@
</span><span class="cx">     CGFloat currentDimension;
</span><span class="cx"> 
</span><span class="cx">     switch (m_attachmentSide) {
</span><del>-    case AttachmentSideBottom:
</del><ins>+    case AttachmentSide::Bottom:
</ins><span class="cx">         [m_inspectorView setAutoresizingMask:NSViewWidthSizable | NSViewMaxYMargin];
</span><span class="cx">         currentDimension = inspectorPagePreferences().inspectorAttachedHeight();
</span><span class="cx">         break;
</span><del>-    case AttachmentSideRight:
</del><ins>+    case AttachmentSide::Right:
</ins><span class="cx">         [m_inspectorView setAutoresizingMask:NSViewHeightSizable | NSViewMinXMargin];
</span><span class="cx">         currentDimension = inspectorPagePreferences().inspectorAttachedWidth();
</span><span class="cx">         break;
</span><span class="lines">@@ -824,7 +824,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::platformDetach()
</span><span class="cx"> {
</span><del>-    WKView *inspectedView = m_page-&gt;wkView();
</del><ins>+    WKView *inspectedView = inspectedPage()-&gt;wkView();
</ins><span class="cx">     [[NSNotificationCenter defaultCenter] removeObserver:m_inspectorProxyObjCAdapter.get() name:NSViewFrameDidChangeNotification object:inspectedView];
</span><span class="cx"> 
</span><span class="cx">     [m_inspectorView removeFromSuperview];
</span></span></pre>
</div>
</div>

</body>
</html>