| Index: Source/core/inspector/InspectorDOMAgent.cpp
|
| diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp
|
| index 85d4f897659b244078a0b9ee3f1b10e9e17e2ed6..e35a68f2a58264647d6e9e20458dc9b8f181c32a 100644
|
| --- a/Source/core/inspector/InspectorDOMAgent.cpp
|
| +++ b/Source/core/inspector/InspectorDOMAgent.cpp
|
| @@ -72,7 +72,7 @@
|
| #include "core/inspector/InspectorHistory.h"
|
| #include "core/inspector/InspectorIdentifiers.h"
|
| #include "core/inspector/InspectorOverlay.h"
|
| -#include "core/inspector/InspectorResolver.h"
|
| +#include "core/inspector/InspectorPageAgent.h"
|
| #include "core/inspector/InspectorState.h"
|
| #include "core/inspector/InstrumentingAgents.h"
|
| #include "core/layout/HitTestResult.h"
|
| @@ -292,9 +292,9 @@
|
| }
|
| }
|
|
|
| -InspectorDOMAgent::InspectorDOMAgent(LocalFrame* inspectedFrame, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay)
|
| +InspectorDOMAgent::InspectorDOMAgent(InspectorPageAgent* pageAgent, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay)
|
| : InspectorBaseAgent<InspectorDOMAgent, InspectorFrontend::DOM>("DOM")
|
| - , m_inspectedFrame(inspectedFrame)
|
| + , m_pageAgent(pageAgent)
|
| , m_injectedScriptManager(injectedScriptManager)
|
| , m_overlay(overlay)
|
| , m_domListener(nullptr)
|
| @@ -537,7 +537,7 @@
|
| m_state->setBoolean(DOMAgentState::domAgentEnabled, true);
|
| m_history = adoptPtrWillBeNoop(new InspectorHistory());
|
| m_domEditor = adoptPtrWillBeNoop(new DOMEditor(m_history.get()));
|
| - m_document = m_inspectedFrame->document();
|
| + m_document = m_pageAgent->inspectedFrame()->document();
|
| m_instrumentingAgents->setInspectorDOMAgent(this);
|
| if (m_listener)
|
| m_listener->domAgentWasEnabled();
|
| @@ -1312,7 +1312,7 @@
|
| if (nodeId) {
|
| node = assertNode(errorString, *nodeId);
|
| } else if (backendNodeId) {
|
| - node = InspectorResolver::resolveNode(m_inspectedFrame, *backendNodeId);
|
| + node = DOMNodeIds::nodeForId(*backendNodeId);
|
| } else if (objectId) {
|
| InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(*objectId);
|
| node = injectedScript.nodeForObjectId(*objectId);
|
| @@ -1332,26 +1332,20 @@
|
| }
|
|
|
| void InspectorDOMAgent::highlightFrame(
|
| - ErrorString* errorString,
|
| + ErrorString*,
|
| const String& frameId,
|
| const RefPtr<JSONObject>* color,
|
| const RefPtr<JSONObject>* outlineColor)
|
| {
|
| - LocalFrame* frame = InspectorResolver::resolveFrame(m_inspectedFrame, frameId);
|
| - if (!frame) {
|
| - *errorString = "No frame for given id found";
|
| - return;
|
| - }
|
| - FrameOwner* owner = frame->owner();
|
| + LocalFrame* frame = m_pageAgent->frameForId(frameId);
|
| // FIXME: Inspector doesn't currently work cross process.
|
| - if (!owner || !owner->isLocal())
|
| - return;
|
| - HTMLFrameOwnerElement* ownerElement = toHTMLFrameOwnerElement(owner);
|
| - OwnPtr<InspectorHighlightConfig> highlightConfig = adoptPtr(new InspectorHighlightConfig());
|
| - highlightConfig->showInfo = true; // Always show tooltips for frames.
|
| - highlightConfig->content = parseColor(color);
|
| - highlightConfig->contentOutline = parseColor(outlineColor);
|
| - m_overlay->highlightNode(ownerElement, 0 /* eventTarget */, *highlightConfig, false);
|
| + if (frame && frame->deprecatedLocalOwner()) {
|
| + OwnPtr<InspectorHighlightConfig> highlightConfig = adoptPtr(new InspectorHighlightConfig());
|
| + highlightConfig->showInfo = true; // Always show tooltips for frames.
|
| + highlightConfig->content = parseColor(color);
|
| + highlightConfig->contentOutline = parseColor(outlineColor);
|
| + m_overlay->highlightNode(frame->deprecatedLocalOwner(), 0 /* eventTarget */, *highlightConfig, false);
|
| + }
|
| }
|
|
|
| void InspectorDOMAgent::hideHighlight(ErrorString*)
|
| @@ -1822,7 +1816,7 @@
|
|
|
| void InspectorDOMAgent::domContentLoadedEventFired(LocalFrame* frame)
|
| {
|
| - if (frame != m_inspectedFrame)
|
| + if (frame != m_pageAgent->inspectedFrame())
|
| return;
|
|
|
| // Re-push document once it is loaded.
|
| @@ -1854,12 +1848,13 @@
|
|
|
| void InspectorDOMAgent::didCommitLoad(LocalFrame*, DocumentLoader* loader)
|
| {
|
| - if (loader->frame() != m_inspectedFrame) {
|
| + LocalFrame* inspectedFrame = m_pageAgent->inspectedFrame();
|
| + if (loader->frame() != inspectedFrame) {
|
| invalidateFrameOwnerElement(loader->frame());
|
| return;
|
| }
|
|
|
| - setDocument(m_inspectedFrame->document());
|
| + setDocument(inspectedFrame->document());
|
| }
|
|
|
| void InspectorDOMAgent::didInsertDOMNode(Node* node)
|
| @@ -2044,7 +2039,7 @@
|
| if (!document)
|
| return;
|
|
|
| - if (frame != m_inspectedFrame)
|
| + if (frame != m_pageAgent->inspectedFrame())
|
| return;
|
|
|
| // Only update the main frame document, nested frame document updates are not required
|
| @@ -2149,7 +2144,8 @@
|
| return;
|
| }
|
|
|
| - if (Node* node = InspectorResolver::resolveNode(m_inspectedFrame, backendNodeId))
|
| + Node* node = DOMNodeIds::nodeForId(backendNodeId);
|
| + if (node && node->document().frame() && node->document().frame()->instrumentingAgents() == m_pageAgent->inspectedFrame()->instrumentingAgents())
|
| result->addItem(pushNodePathToFrontend(node));
|
| else
|
| result->addItem(0);
|
| @@ -2227,7 +2223,7 @@
|
| DEFINE_TRACE(InspectorDOMAgent)
|
| {
|
| visitor->trace(m_domListener);
|
| - visitor->trace(m_inspectedFrame);
|
| + visitor->trace(m_pageAgent);
|
| visitor->trace(m_injectedScriptManager);
|
| visitor->trace(m_overlay);
|
| #if ENABLE(OILPAN)
|
|
|