<!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>[80141] trunk/Source/WebCore</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/80141">80141</a></dd>
<dt>Author</dt> <dd>pfeldman@chromium.org</dd>
<dt>Date</dt> <dd>2011-03-02 09:39:48 -0800 (Wed, 02 Mar 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>2011-03-02  Pavel Feldman  <pfeldman@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: remove InjectedScriptHost -> DOMAgent dependency.
        https://bugs.webkit.org/show_bug.cgi?id=55575

        * bindings/js/JSInjectedScriptHostCustom.cpp:
        (WebCore::JSInjectedScriptHost::inspectedNode):
        * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
        (WebCore::V8InjectedScriptHost::inspectedNodeCallback):
        * inspector/ConsoleMessage.cpp:
        (WebCore::ConsoleMessage::addToFrontend):
        * inspector/InjectedScript.cpp:
        (WebCore::InjectedScript::evaluateOn):
        (WebCore::InjectedScript::wrapObject):
        (WebCore::InjectedScript::wrapNode):
        (WebCore::InjectedScript::inspectNode):
        (WebCore::InjectedScript::nodeAsScriptValue):
        * inspector/InjectedScript.h:
        * inspector/InjectedScriptHost.cpp:
        (WebCore::InjectedScriptHost::addInspectedNode):
        (WebCore::InjectedScriptHost::clearInspectedNodes):
        (WebCore::InjectedScriptHost::copyText):
        (WebCore::InjectedScriptHost::inspectedNode):
        * inspector/InjectedScriptHost.h:
        * inspector/InjectedScriptHost.idl:
        * inspector/InjectedScriptSource.js:
        * inspector/Inspector.idl:
        * inspector/InspectorDOMAgent.cpp:
        (WebCore::InspectorDOMAgent::discardBindings):
        (WebCore::InspectorDOMAgent::addInspectedNode):
        (WebCore::InspectorDOMAgent::resolveNode):
        (WebCore::InspectorDOMAgent::injectedScriptForNode):
        * inspector/InspectorDOMAgent.h:
        * inspector/InspectorRuntimeAgent.cpp:
        (WebCore::InspectorRuntimeAgent::evaluateOn):
        * inspector/InspectorRuntimeAgent.h:
        * inspector/front-end/ElementsTreeOutline.js:
        (WebInspector.ElementsTreeElement.prototype._createTooltipForNode.setTooltip):
        (WebInspector.ElementsTreeElement.prototype._createTooltipForNode.resolvedNode):
        (WebInspector.ElementsTreeElement.prototype._createTooltipForNode):
        * inspector/front-end/PropertiesSidebarPane.js:
        (WebInspector.PropertiesSidebarPane.prototype.update.nodeResolved):
        (WebInspector.PropertiesSidebarPane.prototype.update.nodePrototypesReady):
        (WebInspector.PropertiesSidebarPane.prototype.update.fillSection):
        (WebInspector.PropertiesSidebarPane.prototype.update):
        * inspector/front-end/RemoteObject.js:
        (WebInspector.RemoteObject.resolveNode):
        (WebInspector.RemoteObject.prototype.pushNodeToFrontend):
        (WebInspector.RemoteObject.prototype.evaluate):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSInjectedScriptHostCustomcpp">trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsv8customV8InjectedScriptHostCustomcpp">trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorConsoleMessagecpp">trunk/Source/WebCore/inspector/ConsoleMessage.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInjectedScriptcpp">trunk/Source/WebCore/inspector/InjectedScript.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInjectedScripth">trunk/Source/WebCore/inspector/InjectedScript.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInjectedScriptHostcpp">trunk/Source/WebCore/inspector/InjectedScriptHost.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInjectedScriptHosth">trunk/Source/WebCore/inspector/InjectedScriptHost.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInjectedScriptHostidl">trunk/Source/WebCore/inspector/InjectedScriptHost.idl</a></li>
<li><a href="#trunkSourceWebCoreinspectorInjectedScriptSourcejs">trunk/Source/WebCore/inspector/InjectedScriptSource.js</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectoridl">trunk/Source/WebCore/inspector/Inspector.idl</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorDOMAgentcpp">trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorDOMAgenth">trunk/Source/WebCore/inspector/InspectorDOMAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorRuntimeAgentcpp">trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorRuntimeAgenth">trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorfrontendElementsTreeOutlinejs">trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js</a></li>
<li><a href="#trunkSourceWebCoreinspectorfrontendPropertiesSidebarPanejs">trunk/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js</a></li>
<li><a href="#trunkSourceWebCoreinspectorfrontendRemoteObjectjs">trunk/Source/WebCore/inspector/front-end/RemoteObject.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/ChangeLog      2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -1,3 +1,55 @@
</span><ins>+2011-03-02  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: remove InjectedScriptHost -> DOMAgent dependency.
+        https://bugs.webkit.org/show_bug.cgi?id=55575
+
+        * bindings/js/JSInjectedScriptHostCustom.cpp:
+        (WebCore::JSInjectedScriptHost::inspectedNode):
+        * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
+        (WebCore::V8InjectedScriptHost::inspectedNodeCallback):
+        * inspector/ConsoleMessage.cpp:
+        (WebCore::ConsoleMessage::addToFrontend):
+        * inspector/InjectedScript.cpp:
+        (WebCore::InjectedScript::evaluateOn):
+        (WebCore::InjectedScript::wrapObject):
+        (WebCore::InjectedScript::wrapNode):
+        (WebCore::InjectedScript::inspectNode):
+        (WebCore::InjectedScript::nodeAsScriptValue):
+        * inspector/InjectedScript.h:
+        * inspector/InjectedScriptHost.cpp:
+        (WebCore::InjectedScriptHost::addInspectedNode):
+        (WebCore::InjectedScriptHost::clearInspectedNodes):
+        (WebCore::InjectedScriptHost::copyText):
+        (WebCore::InjectedScriptHost::inspectedNode):
+        * inspector/InjectedScriptHost.h:
+        * inspector/InjectedScriptHost.idl:
+        * inspector/InjectedScriptSource.js:
+        * inspector/Inspector.idl:
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::discardBindings):
+        (WebCore::InspectorDOMAgent::addInspectedNode):
+        (WebCore::InspectorDOMAgent::resolveNode):
+        (WebCore::InspectorDOMAgent::injectedScriptForNode):
+        * inspector/InspectorDOMAgent.h:
+        * inspector/InspectorRuntimeAgent.cpp:
+        (WebCore::InspectorRuntimeAgent::evaluateOn):
+        * inspector/InspectorRuntimeAgent.h:
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeElement.prototype._createTooltipForNode.setTooltip):
+        (WebInspector.ElementsTreeElement.prototype._createTooltipForNode.resolvedNode):
+        (WebInspector.ElementsTreeElement.prototype._createTooltipForNode):
+        * inspector/front-end/PropertiesSidebarPane.js:
+        (WebInspector.PropertiesSidebarPane.prototype.update.nodeResolved):
+        (WebInspector.PropertiesSidebarPane.prototype.update.nodePrototypesReady):
+        (WebInspector.PropertiesSidebarPane.prototype.update.fillSection):
+        (WebInspector.PropertiesSidebarPane.prototype.update):
+        * inspector/front-end/RemoteObject.js:
+        (WebInspector.RemoteObject.resolveNode):
+        (WebInspector.RemoteObject.prototype.pushNodeToFrontend):
+        (WebInspector.RemoteObject.prototype.evaluate):
+
</ins><span class="cx"> 2011-01-21  John Knottenbelt  <jknotten@chromium.org>
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Dmitry Titov.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSInjectedScriptHostCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp  2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp     2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -135,18 +135,15 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSValue JSInjectedScriptHost::nodeForId(ExecState* exec)
</del><ins>+JSValue JSInjectedScriptHost::inspectedNode(ExecState* exec)
</ins><span class="cx"> {
</span><span class="cx">     if (exec->argumentCount() < 1)
</span><span class="cx">         return jsUndefined();
</span><span class="cx"> 
</span><del>-    Node* node = impl()->nodeForId(exec->argument(0).toInt32(exec));
</del><ins>+    Node* node = impl()->inspectedNode(exec->argument(0).toInt32(exec));
</ins><span class="cx">     if (!node)
</span><span class="cx">         return jsUndefined();
</span><span class="cx"> 
</span><del>-    if (!impl()->inspectorAgent())
-        return jsUndefined();
-
</del><span class="cx">     JSLock lock(SilenceAssertionsOnly);
</span><span class="cx">     return toJS(exec, node);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsv8customV8InjectedScriptHostCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp   2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp      2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -151,21 +151,18 @@
</span><span class="cx">     global->DeleteHiddenValue(key);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-v8::Handle<v8::Value> V8InjectedScriptHost::nodeForIdCallback(const v8::Arguments& args)
</del><ins>+v8::Handle<v8::Value> V8InjectedScriptHost::inspectedNodeCallback(const v8::Arguments& args)
</ins><span class="cx"> {
</span><del>-    INC_STATS("InjectedScriptHost.nodeForId()");
</del><ins>+    INC_STATS("InjectedScriptHost.inspectedNode()");
</ins><span class="cx">     if (args.Length() < 1)
</span><span class="cx">         return v8::Undefined();
</span><span class="cx"> 
</span><span class="cx">     InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
</span><span class="cx">     
</span><del>-    Node* node = host->nodeForId(args[0]->ToInt32()->Value());
</del><ins>+    Node* node = host->inspectedNode(args[0]->ToInt32()->Value());
</ins><span class="cx">     if (!node)
</span><span class="cx">         return v8::Undefined();
</span><span class="cx"> 
</span><del>-    if (!host->inspectorAgent())
-        return v8::Undefined();
-
</del><span class="cx">     return toV8(node);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorConsoleMessagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/ConsoleMessage.cpp (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/ConsoleMessage.cpp        2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/inspector/ConsoleMessage.cpp   2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -103,7 +103,7 @@
</span><span class="cx">         if (!injectedScript.hasNoValue()) {
</span><span class="cx">             RefPtr<InspectorArray> jsonArgs = InspectorArray::create();
</span><span class="cx">             for (unsigned i = 0; i < m_arguments->argumentCount(); ++i) {
</span><del>-                RefPtr<InspectorValue> inspectorValue = injectedScript.wrapForConsole(m_arguments->argumentAt(i));
</del><ins>+                RefPtr<InspectorValue> inspectorValue = injectedScript.wrapObject(m_arguments->argumentAt(i), "console");
</ins><span class="cx">                 if (!inspectorValue) {
</span><span class="cx">                     ASSERT_NOT_REACHED();
</span><span class="cx">                     return;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInjectedScriptcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InjectedScript.cpp (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InjectedScript.cpp        2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/inspector/InjectedScript.cpp   2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -56,6 +56,14 @@
</span><span class="cx">     makeCall(function, result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InjectedScript::evaluateOn(PassRefPtr<InspectorObject> objectId, const String& expression, RefPtr<InspectorValue>* result)
+{
+    ScriptFunctionCall function(m_injectedScriptObject, "evaluateOn");
+    function.appendArgument(objectId->toJSONString());
+    function.appendArgument(expression);
+    makeCall(function, result);
+}
+
</ins><span class="cx"> void InjectedScript::evaluateOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result)
</span><span class="cx"> {
</span><span class="cx">     ScriptFunctionCall function(m_injectedScriptObject, "evaluateOnCallFrame");
</span><span class="lines">@@ -115,21 +123,6 @@
</span><span class="cx">     makeCall(function, result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InjectedScript::getNodeProperties(long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result)
-{
-    ScriptFunctionCall function(m_injectedScriptObject, "getNodeProperties");
-    function.appendArgument(nodeId);
-    function.appendArgument(propertiesArray->toJSONString());
-    makeCall(function, result);
-}
-
-void InjectedScript::getNodePrototypes(long nodeId, RefPtr<InspectorValue>* result)
-{
-    ScriptFunctionCall function(m_injectedScriptObject, "getNodePrototypes");
-    function.appendArgument(nodeId);
-    makeCall(function, result);
-}
-
</del><span class="cx"> void InjectedScript::setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result)
</span><span class="cx"> {
</span><span class="cx">     ScriptFunctionCall function(m_injectedScriptObject, "setPropertyValue");
</span><span class="lines">@@ -157,11 +150,12 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-PassRefPtr<InspectorObject> InjectedScript::wrapForConsole(ScriptValue value)
</del><ins>+PassRefPtr<InspectorObject> InjectedScript::wrapObject(ScriptValue value, const String& groupName)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(!hasNoValue());
</span><del>-    ScriptFunctionCall wrapFunction(m_injectedScriptObject, "wrapForConsole");
</del><ins>+    ScriptFunctionCall wrapFunction(m_injectedScriptObject, "wrapObject");
</ins><span class="cx">     wrapFunction.appendArgument(value);
</span><ins>+    wrapFunction.appendArgument(groupName);
</ins><span class="cx">     wrapFunction.appendArgument(canAccessInspectedWindow());
</span><span class="cx">     bool hadException = false;
</span><span class="cx">     ScriptValue r = wrapFunction.call(hadException);
</span><span class="lines">@@ -173,11 +167,16 @@
</span><span class="cx">     return r.toInspectorValue(m_injectedScriptObject.scriptState())->asObject();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+PassRefPtr<InspectorObject> InjectedScript::wrapNode(Node* node, const String& groupName)
+{
+    return wrapObject(nodeAsScriptValue(node), groupName);
+}
+
</ins><span class="cx"> void InjectedScript::inspectNode(Node* node)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!hasNoValue());
</span><span class="cx">     ScriptFunctionCall function(m_injectedScriptObject, "inspectNode");
</span><del>-    function.appendArgument(InjectedScriptHost::nodeAsScriptValue(m_injectedScriptObject.scriptState(), node));
</del><ins>+    function.appendArgument(nodeAsScriptValue(node));
</ins><span class="cx">     RefPtr<InspectorValue> result;
</span><span class="cx">     makeCall(function, &result);
</span><span class="cx"> }
</span><span class="lines">@@ -212,6 +211,11 @@
</span><span class="cx">         *result = InspectorValue::null();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ScriptValue InjectedScript::nodeAsScriptValue(Node* node)
+{
+    return InjectedScriptHost::nodeAsScriptValue(m_injectedScriptObject.scriptState(), node);
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(INSPECTOR)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInjectedScripth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InjectedScript.h (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InjectedScript.h  2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/inspector/InjectedScript.h     2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -52,14 +52,13 @@
</span><span class="cx">     bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); }
</span><span class="cx"> 
</span><span class="cx">     void evaluate(const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
</span><ins>+    void evaluateOn(PassRefPtr<InspectorObject> objectId, const String& expression, RefPtr<InspectorValue>* result);
</ins><span class="cx">     void evaluateOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
</span><span class="cx">     void getCompletions(const String& expression, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
</span><span class="cx">     void getCompletionsOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
</span><span class="cx">     void getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result);
</span><span class="cx">     Node* nodeForObjectId(PassRefPtr<InspectorObject> objectId);
</span><span class="cx">     void resolveNode(long nodeId, RefPtr<InspectorValue>* result);
</span><del>-    void getNodeProperties(long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result);
-    void getNodePrototypes(long nodeId, RefPtr<InspectorValue>* result);
</del><span class="cx">     void setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result);
</span><span class="cx">     void releaseObject(PassRefPtr<InspectorObject> objectId);
</span><span class="cx">     
</span><span class="lines">@@ -67,7 +66,8 @@
</span><span class="cx">     PassRefPtr<InspectorValue> callFrames();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    PassRefPtr<InspectorObject> wrapForConsole(ScriptValue);
</del><ins>+    PassRefPtr<InspectorObject> wrapObject(ScriptValue, const String& groupName);
+    PassRefPtr<InspectorObject> wrapNode(Node*, const String& groupName);
</ins><span class="cx">     void inspectNode(Node*);
</span><span class="cx">     void releaseWrapperObjectGroup(const String&);
</span><span class="cx">     ScriptState* scriptState() const { return m_injectedScriptObject.scriptState(); }
</span><span class="lines">@@ -78,6 +78,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool canAccessInspectedWindow();
</span><span class="cx">     void makeCall(ScriptFunctionCall&, RefPtr<InspectorValue>* result);
</span><ins>+    ScriptValue nodeAsScriptValue(Node*);
</ins><span class="cx"> 
</span><span class="cx">     ScriptObject m_injectedScriptObject;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInjectedScriptHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InjectedScriptHost.cpp (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InjectedScriptHost.cpp    2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/inspector/InjectedScriptHost.cpp       2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -42,10 +42,10 @@
</span><span class="cx"> #include "InspectorAgent.h"
</span><span class="cx"> #include "InspectorClient.h"
</span><span class="cx"> #include "InspectorConsoleAgent.h"
</span><del>-#include "InspectorDOMAgent.h"
</del><span class="cx"> #include "InspectorDOMStorageAgent.h"
</span><span class="cx"> #include "InspectorDatabaseAgent.h"
</span><span class="cx"> #include "InspectorFrontend.h"
</span><ins>+#include "InspectorValues.h"
</ins><span class="cx"> #include "Pasteboard.h"
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(JAVASCRIPT_DEBUGGER)
</span><span class="lines">@@ -94,25 +94,28 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InjectedScriptHost::copyText(const String& text)
</del><ins>+void InjectedScriptHost::addInspectedNode(Node* node)
</ins><span class="cx"> {
</span><del>-    Pasteboard::generalPasteboard()->writePlainText(text);
</del><ins>+    m_inspectedNodes.prepend(node);
+    while (m_inspectedNodes.size() > 5)
+        m_inspectedNodes.removeLast();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Node* InjectedScriptHost::nodeForId(long nodeId)
</del><ins>+void InjectedScriptHost::clearInspectedNodes()
</ins><span class="cx"> {
</span><del>-    if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
-        return domAgent->nodeForId(nodeId);
-    return 0;
</del><ins>+    m_inspectedNodes.clear();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-long InjectedScriptHost::inspectedNode(unsigned long num)
</del><ins>+void InjectedScriptHost::copyText(const String& text)
</ins><span class="cx"> {
</span><del>-    InspectorDOMAgent* domAgent = inspectorDOMAgent();
-    if (!domAgent)
-        return 0;
</del><ins>+    Pasteboard::generalPasteboard()->writePlainText(text);
+}
</ins><span class="cx"> 
</span><del>-    return domAgent->inspectedNode(num);
</del><ins>+Node* InjectedScriptHost::inspectedNode(unsigned long num)
+{
+    if (num < m_inspectedNodes.size())
+        return m_inspectedNodes[num].get();
+    return 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(DATABASE)
</span><span class="lines">@@ -173,13 +176,6 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-InspectorDOMAgent* InjectedScriptHost::inspectorDOMAgent()
-{
-    if (!m_inspectorAgent)
-        return 0;
-    return m_inspectorAgent->domAgent();
-}
-
</del><span class="cx"> InspectorFrontend* InjectedScriptHost::frontend()
</span><span class="cx"> {
</span><span class="cx">     if (!m_inspectorAgent)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInjectedScriptHosth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InjectedScriptHost.h (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InjectedScriptHost.h      2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/inspector/InjectedScriptHost.h 2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -37,12 +37,12 @@
</span><span class="cx"> 
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><ins>+#include <wtf/Vector.h>
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class Database;
</span><span class="cx"> class InjectedScript;
</span><del>-class InspectorDOMAgent;
</del><span class="cx"> class InspectorFrontend;
</span><span class="cx"> class InspectorObject;
</span><span class="cx"> class Node;
</span><span class="lines">@@ -69,9 +69,11 @@
</span><span class="cx">     void inspectImpl(PassRefPtr<InspectorValue> objectId, PassRefPtr<InspectorValue> hints);
</span><span class="cx">     void clearConsoleMessages();
</span><span class="cx"> 
</span><ins>+    void addInspectedNode(Node*);
+    void clearInspectedNodes();
+
</ins><span class="cx">     void copyText(const String& text);
</span><del>-    Node* nodeForId(long nodeId);
-    long inspectedNode(unsigned long num);
</del><ins>+    Node* inspectedNode(unsigned long num);
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(DATABASE)
</span><span class="cx">     long databaseIdImpl(Database*);
</span><span class="lines">@@ -97,7 +99,6 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     InjectedScriptHost(InspectorAgent*);
</span><del>-    InspectorDOMAgent* inspectorDOMAgent();
</del><span class="cx">     InspectorFrontend* frontend();
</span><span class="cx">     String injectedScriptSource();
</span><span class="cx">     ScriptObject createInjectedScript(const String& source, ScriptState* scriptState, long id);
</span><span class="lines">@@ -108,6 +109,7 @@
</span><span class="cx">     long m_lastWorkerId;
</span><span class="cx">     typedef HashMap<long, InjectedScript> IdToInjectedScriptMap;
</span><span class="cx">     IdToInjectedScriptMap m_idToInjectedScript;
</span><ins>+    Vector<RefPtr<Node> > m_inspectedNodes;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInjectedScriptHostidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InjectedScriptHost.idl (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InjectedScriptHost.idl    2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/inspector/InjectedScriptHost.idl       2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -35,9 +35,8 @@
</span><span class="cx">         void clearConsoleMessages();
</span><span class="cx"> 
</span><span class="cx">         void copyText(in DOMString text);
</span><del>-        [Custom] DOMObject nodeForId(in long nodeId);
</del><span class="cx">         [Custom] void inspect(in DOMObject objectId, in DOMObject hints);
</span><del>-        long inspectedNode(in unsigned long num);
</del><ins>+        [Custom] DOMObject inspectedNode(in unsigned long num);
</ins><span class="cx">         [Custom] DOMObject internalConstructorName(in DOMObject object);
</span><span class="cx"> 
</span><span class="cx">         [Custom] DOMObject currentCallFrame();
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInjectedScriptSourcejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InjectedScriptSource.js (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InjectedScriptSource.js   2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/inspector/InjectedScriptSource.js      2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -50,10 +50,10 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> InjectedScript.prototype = {
</span><del>-    wrapForConsole: function(object, canAccessInspectedWindow)
</del><ins>+    wrapObject: function(object, groupName, canAccessInspectedWindow)
</ins><span class="cx">     {
</span><span class="cx">         if (canAccessInspectedWindow)
</span><del>-            return this._wrapObject(object, "console");
</del><ins>+            return this._wrapObject(object, groupName);
</ins><span class="cx">         var result = {};
</span><span class="cx">         result.type = typeof object;
</span><span class="cx">         result.description = this._toString(object);
</span><span class="lines">@@ -288,6 +288,20 @@
</span><span class="cx">         return this._evaluateAndWrap(inspectedWindow.eval, inspectedWindow, expression, objectGroup, false, injectCommandLineAPI);
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    evaluateOn: function(objectId, expression)
+    {
+        var parsedObjectId = this._parseObjectId(objectId);
+        var object = this._objectForId(parsedObjectId);
+        if (!object)
+            return false;
+        try {
+            inspectedWindow.console._objectToEvaluateOn = object;
+            return this._evaluateAndWrap(inspectedWindow.eval, inspectedWindow, "(function() {" + expression + "}).call(window.console._objectToEvaluateOn)", parsedObjectId.objectGroup, false, false);
+        } finally {
+            delete inspectedWindow.console._objectToEvaluateOn;
+        }
+    },
+
</ins><span class="cx">     _evaluateAndWrap: function(evalFunction, object, expression, objectGroup, isEvalOnCallFrame, injectCommandLineAPI)
</span><span class="cx">     {
</span><span class="cx">         try {
</span><span class="lines">@@ -356,13 +370,6 @@
</span><span class="cx">         return callFrame;
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    _nodeForId: function(nodeId)
-    {
-        if (!nodeId)
-            return null;
-        return InjectedScriptHost.nodeForId(nodeId);
-    },
-
</del><span class="cx">     _objectForId: function(objectId)
</span><span class="cx">     {
</span><span class="cx">         return this._idToWrappedObject[objectId.id];
</span><span class="lines">@@ -377,43 +384,11 @@
</span><span class="cx">         return object;
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    resolveNode: function(nodeId)
</del><ins>+    resolveNode: function(node)
</ins><span class="cx">     {
</span><del>-        var node = this._nodeForId(nodeId);
-        if (!node)
-            return false;
-        // FIXME: receive the object group from client.
-        return this._wrapObject(node, "prototype");
</del><ins>+        return this._wrapObject(node);
</ins><span class="cx">     },
</span><span class="cx"> 
</span><del>-    getNodeProperties: function(nodeId, properties)
-    {
-        var node = this._nodeForId(nodeId);
-        if (!node)
-            return false;
-        properties = eval("(" + properties + ")");
-        var result = {};
-        for (var i = 0; i < properties.length; ++i)
-            result[properties[i]] = node[properties[i]];
-        return result;
-    },
-
-    getNodePrototypes: function(nodeId)
-    {
-        this.releaseWrapperObjectGroup("prototypes");
-        var node = this._nodeForId(nodeId);
-        if (!node)
-            return false;
-
-        var result = [];
-        var prototype = node;
-        do {
-            result.push(this._wrapObject(prototype, "prototypes"));
-            prototype = prototype.__proto__;
-        } while (prototype)
-        return result;
-    },
-
</del><span class="cx">     _isDefined: function(object)
</span><span class="cx">     {
</span><span class="cx">         return object || this._isHTMLAllCollection(object);
</span><span class="lines">@@ -738,8 +713,7 @@
</span><span class="cx"> 
</span><span class="cx">     _inspectedNode: function(num)
</span><span class="cx">     {
</span><del>-        var nodeId = InjectedScriptHost.inspectedNode(num);
-        return injectedScript._nodeForId(nodeId);
</del><ins>+        return InjectedScriptHost.inspectedNode(num);
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     _normalizeEventTypes: function(types)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectoridl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/Inspector.idl (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/Inspector.idl     2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/inspector/Inspector.idl        2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -74,6 +74,7 @@
</span><span class="cx"> 
</span><span class="cx">     interface [Conditional=INSPECTOR] Runtime {
</span><span class="cx">         void evaluate(in String expression, in String objectGroup, in boolean includeCommandLineAPI, out Value result);
</span><ins>+        void evaluateOn(in Object objectId, in String expression, out Value result);
</ins><span class="cx">         void getCompletions(in String expression, in boolean includeCommandLineAPI, out Value result);
</span><span class="cx">         void getProperties(in Object objectId, in boolean ignoreHasOwnProperty, in boolean abbreviate, out Value result);
</span><span class="cx">         void setPropertyValue(in Object objectId, in String propertyName, in String expression, out Value result);
</span><span class="lines">@@ -159,9 +160,7 @@
</span><span class="cx">         void performSearch(in String query, in boolean runSynchronously);
</span><span class="cx">         void searchCanceled();
</span><span class="cx">         void pushNodeByPathToFrontend(in String path, out long nodeId);
</span><del>-        void resolveNode(in long nodeId, out Value result);
-        void getNodeProperties(in long nodeId, in Array propertiesArray, out Value result);
-        void getNodePrototypes(in long nodeId, out Value result);
</del><ins>+        void resolveNode(in long nodeId, in String objectGroup, out Value result);
</ins><span class="cx">         void pushNodeToFrontend(in Object objectId, out long nodeId);
</span><span class="cx"> 
</span><span class="cx">         [event] void setDocument(out Value root); // FIXME: should be requested from the front-end as getDocument.
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorDOMAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp     2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp        2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -397,20 +397,13 @@
</span><span class="cx">     m_frontend->setChildNodes(nodeId, children.release());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-long InspectorDOMAgent::inspectedNode(unsigned long num)
-{
-    if (num < m_inspectedNodes.size())
-        return m_inspectedNodes[num];
-    return 0;
-}
-
</del><span class="cx"> void InspectorDOMAgent::discardBindings()
</span><span class="cx"> {
</span><span class="cx">     m_documentNodeToIdMap.clear();
</span><span class="cx">     m_idToNode.clear();
</span><span class="cx">     releaseDanglingNodes();
</span><span class="cx">     m_childrenRequested.clear();
</span><del>-    m_inspectedNodes.clear();
</del><ins>+    m_injectedScriptHost->clearInspectedNodes();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Node* InspectorDOMAgent::nodeForId(long id)
</span><span class="lines">@@ -704,9 +697,10 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorDOMAgent::addInspectedNode(ErrorString*, long nodeId)
</span><span class="cx"> {
</span><del>-    m_inspectedNodes.prepend(nodeId);
-    while (m_inspectedNodes.size() > 5)
-        m_inspectedNodes.removeLast();
</del><ins>+    Node* node = nodeForId(nodeId);
+    if (!node)
+        return;
+    m_injectedScriptHost->addInspectedNode(node);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorDOMAgent::performSearch(ErrorString* error, const String& whitespaceTrimmedQuery, bool runSynchronously)
</span><span class="lines">@@ -805,27 +799,14 @@
</span><span class="cx">     m_searchResults.clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InspectorDOMAgent::resolveNode(ErrorString*, long nodeId, RefPtr<InspectorValue>* result)
</del><ins>+void InspectorDOMAgent::resolveNode(ErrorString* error, long nodeId, const String& objectGroup, RefPtr<InspectorValue>* result)
</ins><span class="cx"> {
</span><del>-    InjectedScript injectedScript = injectedScriptForNodeId(nodeId);
-    if (!injectedScript.hasNoValue())
-        injectedScript.resolveNode(nodeId, result);
</del><ins>+    Node* node = nodeForId(nodeId);
+    InjectedScript injectedScript = injectedScriptForNode(error, node);
+    if (error->isEmpty())
+        *result = injectedScript.wrapNode(node, objectGroup);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InspectorDOMAgent::getNodeProperties(ErrorString*, long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result)
-{
-    InjectedScript injectedScript = injectedScriptForNodeId(nodeId);
-    if (!injectedScript.hasNoValue())
-        injectedScript.getNodeProperties(nodeId, propertiesArray, result);
-}
-
-void InspectorDOMAgent::getNodePrototypes(ErrorString*, long nodeId, RefPtr<InspectorValue>* result)
-{
-    InjectedScript injectedScript = injectedScriptForNodeId(nodeId);
-    if (!injectedScript.hasNoValue())
-        injectedScript.getNodePrototypes(nodeId, result);
-}
-
</del><span class="cx"> void InspectorDOMAgent::pushNodeToFrontend(ErrorString*, PassRefPtr<InspectorObject> objectId, long* nodeId)
</span><span class="cx"> {
</span><span class="cx">     InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForObjectId(objectId.get());
</span><span class="lines">@@ -1218,26 +1199,25 @@
</span><span class="cx">         *nodeId = pushNodePathToFrontend(node);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-InjectedScript InspectorDOMAgent::injectedScriptForNodeId(long nodeId)
</del><ins>+InjectedScript InspectorDOMAgent::injectedScriptForNode(ErrorString* error, Node* node)
</ins><span class="cx"> {
</span><del>-    Frame* frame = 0;
-    if (nodeId) {
-        Node* node = nodeForId(nodeId);
-        if (node) {
-            Document* document = node->ownerDocument();
-            if (document)
-                frame = document->frame();
-        }
-    } else
-        frame = m_document->frame();
</del><ins>+    if (!node) {
+        *error = "No node with given id found.";
+        return InjectedScript();
+    }
</ins><span class="cx"> 
</span><del>-    if (frame)
-        return m_injectedScriptHost->injectedScriptFor(mainWorldScriptState(frame));
</del><ins>+    Document* document = node->ownerDocument();
+    Frame* frame = document->frame();
</ins><span class="cx"> 
</span><del>-    return InjectedScript();
</del><ins>+    InjectedScript injectedScript = m_injectedScriptHost->injectedScriptFor(mainWorldScriptState(frame));
+    if (injectedScript.hasNoValue()) {
+        *error = "No JavaScript world found for node with given id.";
+        return InjectedScript();
+    }
+
+    return injectedScript;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(INSPECTOR)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorDOMAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.h (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorDOMAgent.h       2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.h  2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx"> class Node;
</span><span class="cx"> class Page;
</span><span class="cx"> class RevalidateStyleAttributeTask;
</span><ins>+class ScriptValue;
</ins><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><span class="lines">@@ -116,9 +117,7 @@
</span><span class="cx">     void addInspectedNode(ErrorString*, long nodeId);
</span><span class="cx">     void performSearch(ErrorString*, const String& whitespaceTrimmedQuery, bool runSynchronously);
</span><span class="cx">     void searchCanceled(ErrorString*);
</span><del>-    void resolveNode(ErrorString*, long nodeId, RefPtr<InspectorValue>* result);
-    void getNodeProperties(ErrorString*, long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result);
-    void getNodePrototypes(ErrorString*, long nodeId, RefPtr<InspectorValue>* result);
</del><ins>+    void resolveNode(ErrorString*, long nodeId, const String& objectGroup, RefPtr<InspectorValue>* result);
</ins><span class="cx">     void pushNodeToFrontend(ErrorString*, PassRefPtr<InspectorObject> objectId, long* nodeId);
</span><span class="cx"> 
</span><span class="cx">     // Methods called from the InspectorInstrumentation.
</span><span class="lines">@@ -138,7 +137,6 @@
</span><span class="cx">     long pushNodePathToFrontend(Node*);
</span><span class="cx">     void pushChildNodesToFrontend(long nodeId);
</span><span class="cx">     void pushNodeByPathToFrontend(ErrorString*, const String& path, long* nodeId);
</span><del>-    long inspectedNode(unsigned long num);
</del><span class="cx">     void copyNode(ErrorString*, long nodeId);
</span><span class="cx">     void setDOMListener(DOMListener*);
</span><span class="cx"> 
</span><span class="lines">@@ -182,7 +180,7 @@
</span><span class="cx"> 
</span><span class="cx">     void discardBindings();
</span><span class="cx"> 
</span><del>-    InjectedScript injectedScriptForNodeId(long nodeId);
</del><ins>+    InjectedScript injectedScriptForNode(ErrorString*, Node*);
</ins><span class="cx"> 
</span><span class="cx">     InstrumentingAgents* m_instrumentingAgents;
</span><span class="cx">     InjectedScriptHost* m_injectedScriptHost;
</span><span class="lines">@@ -199,7 +197,6 @@
</span><span class="cx">     Deque<MatchJob*> m_pendingMatchJobs;
</span><span class="cx">     Timer<InspectorDOMAgent> m_matchJobsTimer;
</span><span class="cx">     HashSet<RefPtr<Node> > m_searchResults;
</span><del>-    Vector<long> m_inspectedNodes;
</del><span class="cx">     OwnPtr<RevalidateStyleAttributeTask> m_revalidateStyleAttrTask;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorRuntimeAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp 2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp    2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -52,6 +52,13 @@
</span><span class="cx">         injectedScript.evaluate(expression, objectGroup, includeCommandLineAPI, result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InspectorRuntimeAgent::evaluateOn(ErrorString*, PassRefPtr<InspectorObject> objectId, const String& expression, RefPtr<InspectorValue>* result)
+{
+    InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForObjectId(objectId.get());
+    if (!injectedScript.hasNoValue())
+        injectedScript.evaluateOn(objectId, expression, result);
+}
+
</ins><span class="cx"> void InspectorRuntimeAgent::getCompletions(ErrorString*, const String& expression, bool includeCommandLineAPI, RefPtr<InspectorValue>* result)
</span><span class="cx"> {
</span><span class="cx">     InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForMainFrame();
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorRuntimeAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h   2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h      2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Part of the protocol.
</span><span class="cx">     void evaluate(ErrorString*, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
</span><ins>+    void evaluateOn(ErrorString*, PassRefPtr<InspectorObject> objectId, const String& expression, RefPtr<InspectorValue>* result);
</ins><span class="cx">     void getCompletions(ErrorString*, const String& expression, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
</span><span class="cx">     void releaseObject(ErrorString*, PassRefPtr<InspectorObject> objectId);
</span><span class="cx">     void getProperties(ErrorString*, PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result);
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorfrontendElementsTreeOutlinejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js  2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js     2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -403,17 +403,35 @@
</span><span class="cx">         if (!node.nodeName || node.nodeName.toLowerCase() !== "img")
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        function setTooltip(properties)
</del><ins>+        function setTooltip(result)
</ins><span class="cx">         {
</span><del>-            if (!properties)
</del><ins>+            if (!result || result.type !== "string")
</ins><span class="cx">                 return;
</span><span class="cx"> 
</span><del>-            if (properties.offsetHeight === properties.naturalHeight && properties.offsetWidth === properties.naturalWidth)
-                this.tooltip = WebInspector.UIString("%d × %d pixels", properties.offsetWidth, properties.offsetHeight);
-            else
-                this.tooltip = WebInspector.UIString("%d × %d pixels (Natural: %d × %d pixels)", properties.offsetWidth, properties.offsetHeight, properties.naturalWidth, properties.naturalHeight);
</del><ins>+            try {
+                var properties = JSON.parse(result.description);
+                var offsetWidth = properties[0];
+                var offsetHeight = properties[1];
+                var naturalWidth = properties[2];
+                var naturalHeight = properties[3];
+                if (offsetHeight === naturalHeight && offsetWidth === naturalWidth)
+                    this.tooltip = WebInspector.UIString("%d \xd7 %d pixels", offsetWidth, offsetHeight);
+                else
+                    this.tooltip = WebInspector.UIString("%d \xd7 %d pixels (Natural: %d \xd7 %d pixels)", offsetWidth, offsetHeight, naturalWidth, naturalHeight);
+            } catch (e) {
+                console.error(e);
+            }
</ins><span class="cx">         }
</span><del>-        DOMAgent.getNodeProperties(node.id, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], setTooltip.bind(this));
</del><ins>+
+        function resolvedNode(objectPayload)
+        {
+            if (!objectPayload)
+                return;
+
+            var object = WebInspector.RemoteObject.fromPayload(objectPayload);
+            object.evaluate("return '[' + this.offsetWidth + ',' + this.offsetHeight + ',' + this.naturalWidth + ',' + this.naturalHeight + ']'", setTooltip.bind(this));
+        }
+        DOMAgent.resolveNode(node.id, "", resolvedNode.bind(this));
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     updateSelection: function()
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorfrontendPropertiesSidebarPanejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js        2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js   2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -42,15 +42,40 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function callback(prototypes)
</del><ins>+        RuntimeAgent.releaseWrapperObjectGroup(0, "dom-selection");
+        WebInspector.RemoteObject.resolveNode(node, nodeResolved.bind(this));
+
+        function nodeResolved(objectPayload)
</ins><span class="cx">         {
</span><ins>+            if (!objectPayload)
+                return;
+            var object = WebInspector.RemoteObject.fromPayload(objectPayload);
+            object.evaluate("var proto = this; result = {}; var counter = 1; while (proto) { result[counter++] = proto; proto = proto.__proto__ }; return result;", nodePrototypesReady.bind(this));
+        }
+
+        function nodePrototypesReady(objectPayload)
+        {
+            if (!objectPayload)
+                return;
+            var object = WebInspector.RemoteObject.fromPayload(objectPayload);
+            object.getOwnProperties(false, fillSection.bind(this));
+        }
+
+        function fillSection(prototypes)
+        {
+            if (!prototypes)
+                return;
+
</ins><span class="cx">             var body = this.bodyElement;
</span><span class="cx">             body.removeChildren();
</span><span class="cx">             this.sections = [];
</span><span class="cx"> 
</span><span class="cx">             // Get array of prototype user-friendly names.
</span><span class="cx">             for (var i = 0; i < prototypes.length; ++i) {
</span><del>-                var prototype = WebInspector.RemoteObject.fromPayload(prototypes[i]);
</del><ins>+                if (!parseInt(prototypes[i].name))
+                    continue;
+
+                var prototype = prototypes[i].value;
</ins><span class="cx">                 var title = prototype.description;
</span><span class="cx">                 if (title.match(/Prototype$/))
</span><span class="cx">                     title = title.replace(/Prototype$/, "");
</span><span class="lines">@@ -59,7 +84,6 @@
</span><span class="cx">                 body.appendChild(section.element);
</span><span class="cx">             }
</span><span class="cx">         }
</span><del>-        DOMAgent.getNodePrototypes(node.id, callback.bind(this));
</del><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorfrontendRemoteObjectjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/front-end/RemoteObject.js (80140 => 80141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/front-end/RemoteObject.js 2011-03-02 17:28:44 UTC (rev 80140)
+++ trunk/Source/WebCore/inspector/front-end/RemoteObject.js    2011-03-02 17:39:48 UTC (rev 80141)
</span><span class="lines">@@ -52,7 +52,7 @@
</span><span class="cx">     {
</span><span class="cx">         callback(object ? WebInspector.RemoteObject.fromPayload(object) : null);
</span><span class="cx">     }
</span><del>-    DOMAgent.resolveNode(node.id, mycallback);
</del><ins>+    DOMAgent.resolveNode(node.id, "dom-selection", mycallback);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebInspector.RemoteObject.fromPayload = function(payload)
</span><span class="lines">@@ -136,6 +136,11 @@
</span><span class="cx">             DOMAgent.pushNodeToFrontend(this._objectId, callback);
</span><span class="cx">         else
</span><span class="cx">             callback(0);
</span><ins>+    },
+
+    evaluate: function(expression, callback)
+    {
+        RuntimeAgent.evaluateOn(this._objectId, expression, callback);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>