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

Unified Diff: LayoutTests/http/tests/inspector/elements-test.js

Issue 16561003: DevTools: Inspect element mode does not select element in ShadowDOM (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: For landing Created 7 years, 6 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
Index: LayoutTests/http/tests/inspector/elements-test.js
diff --git a/LayoutTests/http/tests/inspector/elements-test.js b/LayoutTests/http/tests/inspector/elements-test.js
index 64428ef5fe952fe01948d1973361f25cf4a6460d..0694f5935d8bdbad1fe5a2dfc0758d19591ab40f 100644
--- a/LayoutTests/http/tests/inspector/elements-test.js
+++ b/LayoutTests/http/tests/inspector/elements-test.js
@@ -4,36 +4,40 @@ InspectorTest.findNode = function(matchFunction, callback)
{
callback = InspectorTest.safeWrap(callback);
var result = null;
- var topLevelChildrenRequested = false;
var pendingRequests = 0;
- function processChildren(topLevel, children)
+ function processChildren(node)
{
- pendingRequests--;
- if (result)
- return;
-
- for (var i = 0; children && i < children.length; ++i) {
- var childNode = children[i];
- if (matchFunction(childNode)) {
- result = childNode;
- callback(result);
+ try {
+ if (result)
return;
+
+ var children = (node.children() || []).concat(node.shadowRoots());
+ if (node.templateContent())
+ children.push(node.templateContent());
+
+ for (var i = 0; i < children.length; ++i) {
+ var childNode = children[i];
+ if (matchFunction(childNode)) {
+ result = childNode;
+ callback(result);
+ return;
+ }
+ pendingRequests++;
+ childNode.getChildNodes(processChildren.bind(null, childNode));
}
- pendingRequests++;
- childNode.getChildNodes(processChildren.bind(null, false));
+ } finally {
+ pendingRequests--;
}
- if (topLevel)
- topLevelChildrenRequested = true;
- if (topLevelChildrenRequested && !result && !pendingRequests)
+ if (!result && !pendingRequests)
callback(null);
}
- pendingRequests++;
WebInspector.domAgent.requestDocument(documentRequested.bind(this));
function documentRequested(doc)
{
- doc.getChildNodes(processChildren.bind(this, true));
+ pendingRequests++;
+ doc.getChildNodes(processChildren.bind(null, doc));
}
};
« no previous file with comments | « no previous file | LayoutTests/inspector/elements/edit-dom-actions.html » ('j') | Source/devtools/front_end/DOMAgent.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698