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

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

Issue 7147011: Merge 88331 - 2011-06-07 Andrey Kosyakov <caseq@chromium.org> (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/782/
Patch Set: Created 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/inspector/console/console-shadow-dom-access.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var initialize_ElementTest = function() { 1 var initialize_ElementTest = function() {
2 2
3 InspectorTest.findNode = function(matchFunction, callback) 3 InspectorTest.findNode = function(matchFunction, callback)
4 { 4 {
5 callback = InspectorTest.safeWrap(callback); 5 callback = InspectorTest.safeWrap(callback);
6 var result = null; 6 var result = null;
7 var topLevelChildrenRequested = false; 7 var topLevelChildrenRequested = false;
8 var pendingRequests = 0; 8 var pendingRequests = 0;
9 function processChildren(topLevel, children) 9 function processChildren(topLevel, children)
10 { 10 {
11 pendingRequests--; 11 pendingRequests--;
12 if (result) 12 if (result)
13 return; 13 return;
14 14
15 for (var i = 0; children && i < children.length; ++i) { 15 for (var i = 0; children && i < children.length; ++i) {
16 var childNode = children[i]; 16 var childNode = children[i];
17 if (matchFunction(childNode)) { 17 if (matchFunction(childNode)) {
18 result = childNode; 18 result = childNode;
19 callback(result); 19 callback(result);
20 return; 20 return;
21 } 21 }
22 if (childNode.shadowRoot && matchFunction(childNode.shadowRoot)) { 22 if (childNode.shadowRoot && matchFunction(childNode.shadowRoot)) {
23 result = childNode.shadowRoot; 23 result = childNode.shadowRoot;
24 callback(result); 24 callback(result);
25 return; 25 return;
26 } 26 }
27 pendingRequests++; 27 pendingRequests++;
28 childNode.getChildNodes(processChildren.bind(null, false)); 28 childNode.getChildNodes(processChildren.bind(null, false));
29 if (childNode.shadowRoot) {
30 pendingRequests++;
31 childNode.shadowRoot.getChildNodes(processChildren.bind(null, fa lse));
32 }
33 } 29 }
34 30
35 if (topLevel) 31 if (topLevel)
36 topLevelChildrenRequested = true; 32 topLevelChildrenRequested = true;
37 if (topLevelChildrenRequested && !result && !pendingRequests) 33 if (topLevelChildrenRequested && !result && !pendingRequests)
38 callback(null); 34 callback(null);
39 } 35 }
40 pendingRequests++; 36 pendingRequests++;
41 37
42 WebInspector.domAgent.requestDocument(documentRequested.bind(this)); 38 WebInspector.domAgent.requestDocument(documentRequested.bind(this));
43 function documentRequested(doc) 39 function documentRequested(doc)
44 { 40 {
45 doc.getChildNodes(processChildren.bind(null, true)); 41 doc.getChildNodes(processChildren.bind(this, true));
46 } 42 }
47 }; 43 };
48 44
49 InspectorTest.nodeWithId = function(idValue, callback) 45 InspectorTest.nodeWithId = function(idValue, callback)
50 { 46 {
51 function nodeIdMatches(node) 47 function nodeIdMatches(node)
52 { 48 {
53 return node.getAttribute("id") === idValue; 49 return node.getAttribute("id") === idValue;
54 } 50 }
55 InspectorTest.findNode(nodeIdMatches, callback); 51 InspectorTest.findNode(nodeIdMatches, callback);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 }; 231 };
236 232
237 InspectorTest.rangeText = function(range) 233 InspectorTest.rangeText = function(range)
238 { 234 {
239 if (!range) 235 if (!range)
240 return "[undefined-undefined]"; 236 return "[undefined-undefined]";
241 return "[" + range.start + "-" + range.end + "]"; 237 return "[" + range.start + "-" + range.end + "]";
242 }; 238 };
243 239
244 }; 240 };
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector/console/console-shadow-dom-access.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698