Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1168)

Unified Diff: Source/core/inspector/InspectorDOMAgent.cpp

Issue 964493002: DevTools: improve TTIE, do not select body before the target element upon inspect element. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: headless test fixed Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/InspectorDOMAgent.h ('k') | Source/core/inspector/InspectorInspectorAgent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorDOMAgent.cpp
diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp
index d31a9a94015ffd8763c4524c5bc4207238c79b3f..78356fdee2c6bf522f764cb628e47159fbf3f0ca 100644
--- a/Source/core/inspector/InspectorDOMAgent.cpp
+++ b/Source/core/inspector/InspectorDOMAgent.cpp
@@ -319,6 +319,7 @@ InspectorDOMAgent::InspectorDOMAgent(InspectorPageAgent* pageAgent, InjectedScri
, m_searchingForNode(NotSearching)
, m_suppressAttributeModifiedEvent(false)
, m_listener(nullptr)
+ , m_backendNodeIdToInspect(0)
{
}
@@ -586,10 +587,12 @@ Element* InspectorDOMAgent::assertEditableElement(ErrorString* errorString, int
void InspectorDOMAgent::innerEnable()
{
m_state->setBoolean(DOMAgentState::domAgentEnabled, true);
- m_document = nullptr;
- setDocument(m_pageAgent->inspectedFrame()->document());
+ m_document = m_pageAgent->inspectedFrame()->document();
if (m_listener)
m_listener->domAgentWasEnabled();
+ if (m_backendNodeIdToInspect)
+ m_frontend->inspectNodeRequested(m_backendNodeIdToInspect);
+ m_backendNodeIdToInspect = 0;
}
void InspectorDOMAgent::enable(ErrorString*)
@@ -1326,19 +1329,22 @@ bool InspectorDOMAgent::handleTouchEvent(LocalFrame* frame, const PlatformTouchE
void InspectorDOMAgent::inspect(Node* inspectedNode)
{
- if (!m_frontend || !inspectedNode)
+ if (!inspectedNode)
return;
Node* node = inspectedNode;
while (node && !node->isElementNode() && !node->isDocumentNode() && !node->isDocumentFragment())
node = node->parentOrShadowHostNode();
-
if (!node)
return;
- int nodeId = pushNodePathToFrontend(node);
- if (nodeId)
- m_frontend->inspectNodeRequested(nodeId);
+ int backendNodeId = InspectorNodeIds::idForNode(node);
+ if (!m_frontend || !enabled()) {
+ m_backendNodeIdToInspect = backendNodeId;
+ return;
+ }
+
+ m_frontend->inspectNodeRequested(backendNodeId);
}
bool InspectorDOMAgent::handleMouseMove(LocalFrame* frame, const PlatformMouseEvent& event)
« no previous file with comments | « Source/core/inspector/InspectorDOMAgent.h ('k') | Source/core/inspector/InspectorInspectorAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698