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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components/DOMPresentationUtils.js

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 4 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
5 * Copyright (C) 2009 Joseph Pecoraro 5 * Copyright (C) 2009 Joseph Pecoraro
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
(...skipping 11 matching lines...) Expand all
22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 23 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 WebInspector.DOMPresentationUtils = {} 32 WebInspector.DOMPresentationUtils = {};
33 33
34 /** 34 /**
35 * @param {!WebInspector.DOMNode} node 35 * @param {!WebInspector.DOMNode} node
36 * @param {!Element} parentElement 36 * @param {!Element} parentElement
37 */ 37 */
38 WebInspector.DOMPresentationUtils.decorateNodeLabel = function(node, parentEleme nt) 38 WebInspector.DOMPresentationUtils.decorateNodeLabel = function(node, parentEleme nt)
39 { 39 {
40 var originalNode = node; 40 var originalNode = node;
41 var isPseudo = node.nodeType() === Node.ELEMENT_NODE && node.pseudoType(); 41 var isPseudo = node.nodeType() === Node.ELEMENT_NODE && node.pseudoType();
42 if (isPseudo && node.parentNode) 42 if (isPseudo && node.parentNode)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 } 78 }
79 79
80 if (isPseudo) { 80 if (isPseudo) {
81 var pseudoElement = parentElement.createChild("span", "extra node-label- pseudo"); 81 var pseudoElement = parentElement.createChild("span", "extra node-label- pseudo");
82 var pseudoText = "::" + originalNode.pseudoType(); 82 var pseudoText = "::" + originalNode.pseudoType();
83 pseudoElement.createTextChild(pseudoText); 83 pseudoElement.createTextChild(pseudoText);
84 title += pseudoText; 84 title += pseudoText;
85 } 85 }
86 parentElement.title = title; 86 parentElement.title = title;
87 } 87 };
88 88
89 /** 89 /**
90 * @param {!Element} container 90 * @param {!Element} container
91 * @param {string} nodeTitle 91 * @param {string} nodeTitle
92 */ 92 */
93 WebInspector.DOMPresentationUtils.createSpansForNodeTitle = function(container, nodeTitle) 93 WebInspector.DOMPresentationUtils.createSpansForNodeTitle = function(container, nodeTitle)
94 { 94 {
95 var match = nodeTitle.match(/([^#.]+)(#[^.]+)?(\..*)?/); 95 var match = nodeTitle.match(/([^#.]+)(#[^.]+)?(\..*)?/);
96 container.createChild("span", "webkit-html-tag-name").textContent = match[1] ; 96 container.createChild("span", "webkit-html-tag-name").textContent = match[1] ;
97 if (match[2]) 97 if (match[2])
98 container.createChild("span", "webkit-html-attribute-value").textContent = match[2]; 98 container.createChild("span", "webkit-html-attribute-value").textContent = match[2];
99 if (match[3]) 99 if (match[3])
100 container.createChild("span", "webkit-html-attribute-name").textContent = match[3]; 100 container.createChild("span", "webkit-html-attribute-name").textContent = match[3];
101 } 101 };
102 102
103 /** 103 /**
104 * @param {?WebInspector.DOMNode} node 104 * @param {?WebInspector.DOMNode} node
105 * @param {string=} idref 105 * @param {string=} idref
106 * @return {!Node} 106 * @return {!Node}
107 */ 107 */
108 WebInspector.DOMPresentationUtils.linkifyNodeReference = function(node, idref) 108 WebInspector.DOMPresentationUtils.linkifyNodeReference = function(node, idref)
109 { 109 {
110 if (!node) 110 if (!node)
111 return createTextNode(WebInspector.UIString("<node>")); 111 return createTextNode(WebInspector.UIString("<node>"));
112 112
113 var root = createElementWithClass("span", "monospace"); 113 var root = createElementWithClass("span", "monospace");
114 var shadowRoot = WebInspector.createShadowRootWithCoreStyles(root, "componen ts/domUtils.css"); 114 var shadowRoot = WebInspector.createShadowRootWithCoreStyles(root, "componen ts/domUtils.css");
115 var link = shadowRoot.createChild("div", "node-link"); 115 var link = shadowRoot.createChild("div", "node-link");
116 116
117 if (idref) 117 if (idref)
118 link.createChild("span", "node-label-id").createTextChild("#" + idref); 118 link.createChild("span", "node-label-id").createTextChild("#" + idref);
119 else 119 else
120 WebInspector.DOMPresentationUtils.decorateNodeLabel(node, link); 120 WebInspector.DOMPresentationUtils.decorateNodeLabel(node, link);
121 121
122 link.addEventListener("click", WebInspector.Revealer.reveal.bind(WebInspecto r.Revealer, node, undefined), false); 122 link.addEventListener("click", WebInspector.Revealer.reveal.bind(WebInspecto r.Revealer, node, undefined), false);
123 link.addEventListener("mouseover", node.highlight.bind(node, undefined, unde fined), false); 123 link.addEventListener("mouseover", node.highlight.bind(node, undefined, unde fined), false);
124 link.addEventListener("mouseleave", WebInspector.DOMModel.hideDOMNodeHighlig ht.bind(WebInspector.DOMModel), false); 124 link.addEventListener("mouseleave", WebInspector.DOMModel.hideDOMNodeHighlig ht.bind(WebInspector.DOMModel), false);
125 125
126 return root; 126 return root;
127 } 127 };
128 128
129 /** 129 /**
130 * @param {!WebInspector.DeferredDOMNode} deferredNode 130 * @param {!WebInspector.DeferredDOMNode} deferredNode
131 * @return {!Node} 131 * @return {!Node}
132 */ 132 */
133 WebInspector.DOMPresentationUtils.linkifyDeferredNodeReference = function(deferr edNode) 133 WebInspector.DOMPresentationUtils.linkifyDeferredNodeReference = function(deferr edNode)
134 { 134 {
135 var root = createElement("div"); 135 var root = createElement("div");
136 var shadowRoot = WebInspector.createShadowRootWithCoreStyles(root, "componen ts/domUtils.css"); 136 var shadowRoot = WebInspector.createShadowRootWithCoreStyles(root, "componen ts/domUtils.css");
137 var link = shadowRoot.createChild("div", "node-link"); 137 var link = shadowRoot.createChild("div", "node-link");
138 link.createChild("content"); 138 link.createChild("content");
139 link.addEventListener("click", deferredNode.resolve.bind(deferredNode, onDef erredNodeResolved), false); 139 link.addEventListener("click", deferredNode.resolve.bind(deferredNode, onDef erredNodeResolved), false);
140 link.addEventListener("mousedown", (e) => e.consume(), false); 140 link.addEventListener("mousedown", (e) => e.consume(), false);
141 141
142 /** 142 /**
143 * @param {?WebInspector.DOMNode} node 143 * @param {?WebInspector.DOMNode} node
144 */ 144 */
145 function onDeferredNodeResolved(node) 145 function onDeferredNodeResolved(node)
146 { 146 {
147 WebInspector.Revealer.reveal(node); 147 WebInspector.Revealer.reveal(node);
148 } 148 }
149 149
150 return root; 150 return root;
151 } 151 };
152 152
153 /** 153 /**
154 * @param {!WebInspector.Target} target 154 * @param {!WebInspector.Target} target
155 * @param {string} originalImageURL 155 * @param {string} originalImageURL
156 * @param {boolean} showDimensions 156 * @param {boolean} showDimensions
157 * @param {function(!Element=)} userCallback 157 * @param {function(!Element=)} userCallback
158 * @param {!Object=} precomputedFeatures 158 * @param {!Object=} precomputedFeatures
159 */ 159 */
160 WebInspector.DOMPresentationUtils.buildImagePreviewContents = function(target, o riginalImageURL, showDimensions, userCallback, precomputedFeatures) 160 WebInspector.DOMPresentationUtils.buildImagePreviewContents = function(target, o riginalImageURL, showDimensions, userCallback, precomputedFeatures)
161 { 161 {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 description = WebInspector.UIString("%d \xd7 %d pixels (Natural: %d \xd7 %d pixels)", offsetWidth, offsetHeight, naturalWidth, naturalHeight); 211 description = WebInspector.UIString("%d \xd7 %d pixels (Natural: %d \xd7 %d pixels)", offsetWidth, offsetHeight, naturalWidth, naturalHeight);
212 } 212 }
213 213
214 container.createChild("tr").createChild("td", "image-container").appendC hild(imageElement); 214 container.createChild("tr").createChild("td", "image-container").appendC hild(imageElement);
215 if (description) 215 if (description)
216 container.createChild("tr").createChild("td").createChild("span", "d escription").textContent = description; 216 container.createChild("tr").createChild("td").createChild("span", "d escription").textContent = description;
217 if (imageURL !== originalImageURL) 217 if (imageURL !== originalImageURL)
218 container.createChild("tr").createChild("td").createChild("span", "d escription").textContent = String.sprintf("currentSrc: %s", imageURL.trimMiddle( 100)); 218 container.createChild("tr").createChild("td").createChild("span", "d escription").textContent = String.sprintf("currentSrc: %s", imageURL.trimMiddle( 100));
219 userCallback(container); 219 userCallback(container);
220 } 220 }
221 } 221 };
222 222
223 /** 223 /**
224 * @param {!WebInspector.Target} target 224 * @param {!WebInspector.Target} target
225 * @param {!WebInspector.Linkifier} linkifier 225 * @param {!WebInspector.Linkifier} linkifier
226 * @param {!RuntimeAgent.StackTrace=} stackTrace 226 * @param {!RuntimeAgent.StackTrace=} stackTrace
227 * @return {!Element} 227 * @return {!Element}
228 */ 228 */
229 WebInspector.DOMPresentationUtils.buildStackTracePreviewContents = function(targ et, linkifier, stackTrace) 229 WebInspector.DOMPresentationUtils.buildStackTracePreviewContents = function(targ et, linkifier, stackTrace)
230 { 230 {
231 var element = createElement("span"); 231 var element = createElement("span");
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 var row = contentElement.createChild("tr"); 265 var row = contentElement.createChild("tr");
266 row.createChild("td").textContent = "\n"; 266 row.createChild("td").textContent = "\n";
267 row.createChild("td", "stack-preview-async-description").textContent = W ebInspector.asyncStackTraceLabel(asyncStackTrace.description); 267 row.createChild("td", "stack-preview-async-description").textContent = W ebInspector.asyncStackTraceLabel(asyncStackTrace.description);
268 row.createChild("td"); 268 row.createChild("td");
269 row.createChild("td"); 269 row.createChild("td");
270 appendStackTrace(asyncStackTrace); 270 appendStackTrace(asyncStackTrace);
271 asyncStackTrace = asyncStackTrace.parent; 271 asyncStackTrace = asyncStackTrace.parent;
272 } 272 }
273 273
274 return element; 274 return element;
275 } 275 };
276 276
277 /** 277 /**
278 * @param {!WebInspector.DOMNode} node 278 * @param {!WebInspector.DOMNode} node
279 * @param {boolean=} justSelector 279 * @param {boolean=} justSelector
280 * @return {string} 280 * @return {string}
281 */ 281 */
282 WebInspector.DOMPresentationUtils.fullQualifiedSelector = function(node, justSel ector) 282 WebInspector.DOMPresentationUtils.fullQualifiedSelector = function(node, justSel ector)
283 { 283 {
284 if (node.nodeType() !== Node.ELEMENT_NODE) 284 if (node.nodeType() !== Node.ELEMENT_NODE)
285 return node.localName() || node.nodeName().toLowerCase(); 285 return node.localName() || node.nodeName().toLowerCase();
286 return WebInspector.DOMPresentationUtils.cssPath(node, justSelector); 286 return WebInspector.DOMPresentationUtils.cssPath(node, justSelector);
287 } 287 };
288 288
289 /** 289 /**
290 * @param {!WebInspector.DOMNode} node 290 * @param {!WebInspector.DOMNode} node
291 * @return {string} 291 * @return {string}
292 */ 292 */
293 WebInspector.DOMPresentationUtils.simpleSelector = function(node) 293 WebInspector.DOMPresentationUtils.simpleSelector = function(node)
294 { 294 {
295 var lowerCaseName = node.localName() || node.nodeName().toLowerCase(); 295 var lowerCaseName = node.localName() || node.nodeName().toLowerCase();
296 if (node.nodeType() !== Node.ELEMENT_NODE) 296 if (node.nodeType() !== Node.ELEMENT_NODE)
297 return lowerCaseName; 297 return lowerCaseName;
298 if (lowerCaseName === "input" && node.getAttribute("type") && !node.getAttri bute("id") && !node.getAttribute("class")) 298 if (lowerCaseName === "input" && node.getAttribute("type") && !node.getAttri bute("id") && !node.getAttribute("class"))
299 return lowerCaseName + "[type=\"" + node.getAttribute("type") + "\"]"; 299 return lowerCaseName + "[type=\"" + node.getAttribute("type") + "\"]";
300 if (node.getAttribute("id")) 300 if (node.getAttribute("id"))
301 return lowerCaseName + "#" + node.getAttribute("id"); 301 return lowerCaseName + "#" + node.getAttribute("id");
302 if (node.getAttribute("class")) 302 if (node.getAttribute("class"))
303 return (lowerCaseName === "div" ? "" : lowerCaseName) + "." + node.getAt tribute("class").trim().replace(/\s+/g, "."); 303 return (lowerCaseName === "div" ? "" : lowerCaseName) + "." + node.getAt tribute("class").trim().replace(/\s+/g, ".");
304 return lowerCaseName; 304 return lowerCaseName;
305 } 305 };
306 306
307 /** 307 /**
308 * @param {!WebInspector.DOMNode} node 308 * @param {!WebInspector.DOMNode} node
309 * @param {boolean=} optimized 309 * @param {boolean=} optimized
310 * @return {string} 310 * @return {string}
311 */ 311 */
312 WebInspector.DOMPresentationUtils.cssPath = function(node, optimized) 312 WebInspector.DOMPresentationUtils.cssPath = function(node, optimized)
313 { 313 {
314 if (node.nodeType() !== Node.ELEMENT_NODE) 314 if (node.nodeType() !== Node.ELEMENT_NODE)
315 return ""; 315 return "";
316 316
317 var steps = []; 317 var steps = [];
318 var contextNode = node; 318 var contextNode = node;
319 while (contextNode) { 319 while (contextNode) {
320 var step = WebInspector.DOMPresentationUtils._cssPathStep(contextNode, ! !optimized, contextNode === node); 320 var step = WebInspector.DOMPresentationUtils._cssPathStep(contextNode, ! !optimized, contextNode === node);
321 if (!step) 321 if (!step)
322 break; // Error - bail out early. 322 break; // Error - bail out early.
323 steps.push(step); 323 steps.push(step);
324 if (step.optimized) 324 if (step.optimized)
325 break; 325 break;
326 contextNode = contextNode.parentNode; 326 contextNode = contextNode.parentNode;
327 } 327 }
328 328
329 steps.reverse(); 329 steps.reverse();
330 return steps.join(" > "); 330 return steps.join(" > ");
331 } 331 };
332 332
333 /** 333 /**
334 * @param {!WebInspector.DOMNode} node 334 * @param {!WebInspector.DOMNode} node
335 * @param {boolean} optimized 335 * @param {boolean} optimized
336 * @param {boolean} isTargetNode 336 * @param {boolean} isTargetNode
337 * @return {?WebInspector.DOMNodePathStep} 337 * @return {?WebInspector.DOMNodePathStep}
338 */ 338 */
339 WebInspector.DOMPresentationUtils._cssPathStep = function(node, optimized, isTar getNode) 339 WebInspector.DOMPresentationUtils._cssPathStep = function(node, optimized, isTar getNode)
340 { 340 {
341 if (node.nodeType() !== Node.ELEMENT_NODE) 341 if (node.nodeType() !== Node.ELEMENT_NODE)
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 if (isTargetNode && nodeName.toLowerCase() === "input" && node.getAttribute( "type") && !node.getAttribute("id") && !node.getAttribute("class")) 481 if (isTargetNode && nodeName.toLowerCase() === "input" && node.getAttribute( "type") && !node.getAttribute("id") && !node.getAttribute("class"))
482 result += "[type=\"" + node.getAttribute("type") + "\"]"; 482 result += "[type=\"" + node.getAttribute("type") + "\"]";
483 if (needsNthChild) { 483 if (needsNthChild) {
484 result += ":nth-child(" + (ownIndex + 1) + ")"; 484 result += ":nth-child(" + (ownIndex + 1) + ")";
485 } else if (needsClassNames) { 485 } else if (needsClassNames) {
486 for (var prefixedName of prefixedOwnClassNamesArray) 486 for (var prefixedName of prefixedOwnClassNamesArray)
487 result += "." + escapeIdentifierIfNeeded(prefixedName.substr(1)); 487 result += "." + escapeIdentifierIfNeeded(prefixedName.substr(1));
488 } 488 }
489 489
490 return new WebInspector.DOMNodePathStep(result, false); 490 return new WebInspector.DOMNodePathStep(result, false);
491 } 491 };
492 492
493 /** 493 /**
494 * @param {!WebInspector.DOMNode} node 494 * @param {!WebInspector.DOMNode} node
495 * @param {boolean=} optimized 495 * @param {boolean=} optimized
496 * @return {string} 496 * @return {string}
497 */ 497 */
498 WebInspector.DOMPresentationUtils.xPath = function(node, optimized) 498 WebInspector.DOMPresentationUtils.xPath = function(node, optimized)
499 { 499 {
500 if (node.nodeType() === Node.DOCUMENT_NODE) 500 if (node.nodeType() === Node.DOCUMENT_NODE)
501 return "/"; 501 return "/";
502 502
503 var steps = []; 503 var steps = [];
504 var contextNode = node; 504 var contextNode = node;
505 while (contextNode) { 505 while (contextNode) {
506 var step = WebInspector.DOMPresentationUtils._xPathValue(contextNode, op timized); 506 var step = WebInspector.DOMPresentationUtils._xPathValue(contextNode, op timized);
507 if (!step) 507 if (!step)
508 break; // Error - bail out early. 508 break; // Error - bail out early.
509 steps.push(step); 509 steps.push(step);
510 if (step.optimized) 510 if (step.optimized)
511 break; 511 break;
512 contextNode = contextNode.parentNode; 512 contextNode = contextNode.parentNode;
513 } 513 }
514 514
515 steps.reverse(); 515 steps.reverse();
516 return (steps.length && steps[0].optimized ? "" : "/") + steps.join("/"); 516 return (steps.length && steps[0].optimized ? "" : "/") + steps.join("/");
517 } 517 };
518 518
519 /** 519 /**
520 * @param {!WebInspector.DOMNode} node 520 * @param {!WebInspector.DOMNode} node
521 * @param {boolean=} optimized 521 * @param {boolean=} optimized
522 * @return {?WebInspector.DOMNodePathStep} 522 * @return {?WebInspector.DOMNodePathStep}
523 */ 523 */
524 WebInspector.DOMPresentationUtils._xPathValue = function(node, optimized) 524 WebInspector.DOMPresentationUtils._xPathValue = function(node, optimized)
525 { 525 {
526 var ownValue; 526 var ownValue;
527 var ownIndex = WebInspector.DOMPresentationUtils._xPathIndex(node); 527 var ownIndex = WebInspector.DOMPresentationUtils._xPathIndex(node);
(...skipping 24 matching lines...) Expand all
552 break; 552 break;
553 default: 553 default:
554 ownValue = ""; 554 ownValue = "";
555 break; 555 break;
556 } 556 }
557 557
558 if (ownIndex > 0) 558 if (ownIndex > 0)
559 ownValue += "[" + ownIndex + "]"; 559 ownValue += "[" + ownIndex + "]";
560 560
561 return new WebInspector.DOMNodePathStep(ownValue, node.nodeType() === Node.D OCUMENT_NODE); 561 return new WebInspector.DOMNodePathStep(ownValue, node.nodeType() === Node.D OCUMENT_NODE);
562 } 562 };
563 563
564 /** 564 /**
565 * @param {!WebInspector.DOMNode} node 565 * @param {!WebInspector.DOMNode} node
566 * @return {number} 566 * @return {number}
567 */ 567 */
568 WebInspector.DOMPresentationUtils._xPathIndex = function(node) 568 WebInspector.DOMPresentationUtils._xPathIndex = function(node)
569 { 569 {
570 // Returns -1 in case of error, 0 if no siblings matching the same expressio n, <XPath index among the same expression-matching sibling nodes> otherwise. 570 // Returns -1 in case of error, 0 if no siblings matching the same expressio n, <XPath index among the same expression-matching sibling nodes> otherwise.
571 function areNodesSimilar(left, right) 571 function areNodesSimilar(left, right)
572 { 572 {
(...skipping 26 matching lines...) Expand all
599 return 0; 599 return 0;
600 var ownIndex = 1; // XPath indices start with 1. 600 var ownIndex = 1; // XPath indices start with 1.
601 for (var i = 0; i < siblings.length; ++i) { 601 for (var i = 0; i < siblings.length; ++i) {
602 if (areNodesSimilar(node, siblings[i])) { 602 if (areNodesSimilar(node, siblings[i])) {
603 if (siblings[i] === node) 603 if (siblings[i] === node)
604 return ownIndex; 604 return ownIndex;
605 ++ownIndex; 605 ++ownIndex;
606 } 606 }
607 } 607 }
608 return -1; // An error occurred: |node| not found in parent's children. 608 return -1; // An error occurred: |node| not found in parent's children.
609 } 609 };
610 610
611 /** 611 /**
612 * @constructor 612 * @constructor
613 * @param {string} value 613 * @param {string} value
614 * @param {boolean} optimized 614 * @param {boolean} optimized
615 */ 615 */
616 WebInspector.DOMNodePathStep = function(value, optimized) 616 WebInspector.DOMNodePathStep = function(value, optimized)
617 { 617 {
618 this.value = value; 618 this.value = value;
619 this.optimized = optimized || false; 619 this.optimized = optimized || false;
620 } 620 };
621 621
622 WebInspector.DOMNodePathStep.prototype = { 622 WebInspector.DOMNodePathStep.prototype = {
623 /** 623 /**
624 * @override 624 * @override
625 * @return {string} 625 * @return {string}
626 */ 626 */
627 toString: function() 627 toString: function()
628 { 628 {
629 return this.value; 629 return this.value;
630 } 630 }
631 } 631 };
632 632
633 /** 633 /**
634 * @interface 634 * @interface
635 */ 635 */
636 WebInspector.DOMPresentationUtils.MarkerDecorator = function() 636 WebInspector.DOMPresentationUtils.MarkerDecorator = function()
637 { 637 {
638 } 638 };
639 639
640 WebInspector.DOMPresentationUtils.MarkerDecorator.prototype = { 640 WebInspector.DOMPresentationUtils.MarkerDecorator.prototype = {
641 /** 641 /**
642 * @param {!WebInspector.DOMNode} node 642 * @param {!WebInspector.DOMNode} node
643 * @return {?{title: string, color: string}} 643 * @return {?{title: string, color: string}}
644 */ 644 */
645 decorate: function(node) { } 645 decorate: function(node) { }
646 } 646 };
647 647
648 /** 648 /**
649 * @constructor 649 * @constructor
650 * @implements {WebInspector.DOMPresentationUtils.MarkerDecorator} 650 * @implements {WebInspector.DOMPresentationUtils.MarkerDecorator}
651 * @param {!Runtime.Extension} extension 651 * @param {!Runtime.Extension} extension
652 */ 652 */
653 WebInspector.DOMPresentationUtils.GenericDecorator = function(extension) 653 WebInspector.DOMPresentationUtils.GenericDecorator = function(extension)
654 { 654 {
655 this._title = WebInspector.UIString(extension.title()); 655 this._title = WebInspector.UIString(extension.title());
656 this._color = extension.descriptor()["color"]; 656 this._color = extension.descriptor()["color"];
657 } 657 };
658 658
659 WebInspector.DOMPresentationUtils.GenericDecorator.prototype = { 659 WebInspector.DOMPresentationUtils.GenericDecorator.prototype = {
660 /** 660 /**
661 * @override 661 * @override
662 * @param {!WebInspector.DOMNode} node 662 * @param {!WebInspector.DOMNode} node
663 * @return {?{title: string, color: string}} 663 * @return {?{title: string, color: string}}
664 */ 664 */
665 decorate: function(node) 665 decorate: function(node)
666 { 666 {
667 return { title: this._title, color: this._color }; 667 return { title: this._title, color: this._color };
668 } 668 }
669 } 669 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698