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

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

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots 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 var initialize_ElementTest = function() { 1 var initialize_ElementTest = function() {
2 2
3 InspectorTest.preloadPanel("elements"); 3 InspectorTest.preloadPanel("elements");
4 4
5 InspectorTest.inlineStyleSection = function() 5 InspectorTest.inlineStyleSection = function()
6 { 6 {
7 return WebInspector.panels.elements._stylesWidget._sectionBlocks[0].sections [0]; 7 return UI.panels.elements._stylesWidget._sectionBlocks[0].sections[0];
8 } 8 }
9 9
10 InspectorTest.computedStyleWidget = function() 10 InspectorTest.computedStyleWidget = function()
11 { 11 {
12 return WebInspector.panels.elements._computedStyleWidget; 12 return UI.panels.elements._computedStyleWidget;
13 } 13 }
14 14
15 InspectorTest.dumpComputedStyle = function(doNotAutoExpand) 15 InspectorTest.dumpComputedStyle = function(doNotAutoExpand)
16 { 16 {
17 var computed = InspectorTest.computedStyleWidget(); 17 var computed = InspectorTest.computedStyleWidget();
18 var treeOutline = computed._propertiesOutline; 18 var treeOutline = computed._propertiesOutline;
19 var children = treeOutline.rootElement().children(); 19 var children = treeOutline.rootElement().children();
20 for (var treeElement of children) { 20 for (var treeElement of children) {
21 var property = treeElement[WebInspector.ComputedStyleWidget._propertySym bol]; 21 var property = treeElement[Elements.ComputedStyleWidget._propertySymbol] ;
22 if (property.name === "width" || property.name === "height") 22 if (property.name === "width" || property.name === "height")
23 continue; 23 continue;
24 var dumpText = ""; 24 var dumpText = "";
25 dumpText += treeElement.title.querySelector(".property-name").textConten t; 25 dumpText += treeElement.title.querySelector(".property-name").textConten t;
26 dumpText += " "; 26 dumpText += " ";
27 dumpText += treeElement.title.querySelector(".property-value").textConte nt; 27 dumpText += treeElement.title.querySelector(".property-value").textConte nt;
28 InspectorTest.addResult(dumpText); 28 InspectorTest.addResult(dumpText);
29 if (doNotAutoExpand && !treeElement.expanded) 29 if (doNotAutoExpand && !treeElement.expanded)
30 continue; 30 continue;
31 for (var trace of treeElement.children()) { 31 for (var trace of treeElement.children()) {
(...skipping 11 matching lines...) Expand all
43 } 43 }
44 } 44 }
45 } 45 }
46 46
47 InspectorTest.findComputedPropertyWithName = function(name) 47 InspectorTest.findComputedPropertyWithName = function(name)
48 { 48 {
49 var computed = InspectorTest.computedStyleWidget(); 49 var computed = InspectorTest.computedStyleWidget();
50 var treeOutline = computed._propertiesOutline; 50 var treeOutline = computed._propertiesOutline;
51 var children = treeOutline.rootElement().children(); 51 var children = treeOutline.rootElement().children();
52 for (var treeElement of children) { 52 for (var treeElement of children) {
53 var property = treeElement[WebInspector.ComputedStyleWidget._propertySym bol]; 53 var property = treeElement[Elements.ComputedStyleWidget._propertySymbol] ;
54 if (property.name === name) 54 if (property.name === name)
55 return treeElement; 55 return treeElement;
56 } 56 }
57 return null; 57 return null;
58 } 58 }
59 59
60 InspectorTest.firstMatchedStyleSection = function() 60 InspectorTest.firstMatchedStyleSection = function()
61 { 61 {
62 return WebInspector.panels.elements._stylesWidget._sectionBlocks[0].sections [1]; 62 return UI.panels.elements._stylesWidget._sectionBlocks[0].sections[1];
63 } 63 }
64 64
65 InspectorTest.firstMediaTextElementInSection = function(section) 65 InspectorTest.firstMediaTextElementInSection = function(section)
66 { 66 {
67 return section.element.querySelector(".media-text"); 67 return section.element.querySelector(".media-text");
68 } 68 }
69 69
70 InspectorTest.findNode = function(matchFunction, callback) 70 InspectorTest.findNode = function(matchFunction, callback)
71 { 71 {
72 callback = InspectorTest.safeWrap(callback); 72 callback = InspectorTest.safeWrap(callback);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 function callback(node) 161 function callback(node)
162 { 162 {
163 result = node; 163 result = node;
164 } 164 }
165 InspectorTest.nodeWithId(idValue, callback); 165 InspectorTest.nodeWithId(idValue, callback);
166 return result; 166 return result;
167 } 167 }
168 168
169 InspectorTest.selectNode = function(node) 169 InspectorTest.selectNode = function(node)
170 { 170 {
171 return WebInspector.Revealer.revealPromise(node); 171 return Common.Revealer.revealPromise(node);
172 } 172 }
173 173
174 InspectorTest.selectNodeWithId = function(idValue, callback) 174 InspectorTest.selectNodeWithId = function(idValue, callback)
175 { 175 {
176 callback = InspectorTest.safeWrap(callback); 176 callback = InspectorTest.safeWrap(callback);
177 function onNodeFound(node) 177 function onNodeFound(node)
178 { 178 {
179 InspectorTest.selectNode(node).then(callback.bind(null, node)); 179 InspectorTest.selectNode(node).then(callback.bind(null, node));
180 } 180 }
181 InspectorTest.nodeWithId(idValue, onNodeFound); 181 InspectorTest.nodeWithId(idValue, onNodeFound);
182 } 182 }
183 183
184 function waitForStylesRebuild(matchFunction, callback, requireRebuild) 184 function waitForStylesRebuild(matchFunction, callback, requireRebuild)
185 { 185 {
186 (function sniff(node, rebuild) 186 (function sniff(node, rebuild)
187 { 187 {
188 if ((rebuild || !requireRebuild) && node && matchFunction(node)) { 188 if ((rebuild || !requireRebuild) && node && matchFunction(node)) {
189 callback(); 189 callback();
190 return; 190 return;
191 } 191 }
192 InspectorTest.addSniffer(WebInspector.StylesSidebarPane.prototype, "_nod eStylesUpdatedForTest", sniff); 192 InspectorTest.addSniffer(Elements.StylesSidebarPane.prototype, "_nodeSty lesUpdatedForTest", sniff);
193 })(null); 193 })(null);
194 } 194 }
195 195
196 InspectorTest.waitForStyles = function(idValue, callback, requireRebuild) 196 InspectorTest.waitForStyles = function(idValue, callback, requireRebuild)
197 { 197 {
198 callback = InspectorTest.safeWrap(callback); 198 callback = InspectorTest.safeWrap(callback);
199 199
200 function nodeWithId(node) 200 function nodeWithId(node)
201 { 201 {
202 return node.getAttribute("id") === idValue; 202 return node.getAttribute("id") === idValue;
(...skipping 10 matching lines...) Expand all
213 { 213 {
214 var classAttr = node.getAttribute("class"); 214 var classAttr = node.getAttribute("class");
215 return classAttr && classAttr.indexOf(classValue) > -1; 215 return classAttr && classAttr.indexOf(classValue) > -1;
216 } 216 }
217 217
218 waitForStylesRebuild(nodeWithClass, callback, requireRebuild); 218 waitForStylesRebuild(nodeWithClass, callback, requireRebuild);
219 } 219 }
220 220
221 InspectorTest.waitForSelectorCommitted = function(callback) 221 InspectorTest.waitForSelectorCommitted = function(callback)
222 { 222 {
223 InspectorTest.addSniffer(WebInspector.StylePropertiesSection.prototype, "_ed itingSelectorCommittedForTest", callback); 223 InspectorTest.addSniffer(Elements.StylePropertiesSection.prototype, "_editin gSelectorCommittedForTest", callback);
224 } 224 }
225 225
226 InspectorTest.waitForMediaTextCommitted = function(callback) 226 InspectorTest.waitForMediaTextCommitted = function(callback)
227 { 227 {
228 InspectorTest.addSniffer(WebInspector.StylePropertiesSection.prototype, "_ed itingMediaTextCommittedForTest", callback); 228 InspectorTest.addSniffer(Elements.StylePropertiesSection.prototype, "_editin gMediaTextCommittedForTest", callback);
229 } 229 }
230 230
231 InspectorTest.waitForStyleApplied = function(callback) 231 InspectorTest.waitForStyleApplied = function(callback)
232 { 232 {
233 InspectorTest.addSniffer(WebInspector.StylePropertyTreeElement.prototype, "s tyleTextAppliedForTest", callback); 233 InspectorTest.addSniffer(Elements.StylePropertyTreeElement.prototype, "style TextAppliedForTest", callback);
234 } 234 }
235 235
236 InspectorTest.selectNodeAndWaitForStyles = function(idValue, callback) 236 InspectorTest.selectNodeAndWaitForStyles = function(idValue, callback)
237 { 237 {
238 callback = InspectorTest.safeWrap(callback); 238 callback = InspectorTest.safeWrap(callback);
239 239
240 var targetNode; 240 var targetNode;
241 241
242 InspectorTest.waitForStyles(idValue, stylesUpdated, true); 242 InspectorTest.waitForStyles(idValue, stylesUpdated, true);
243 InspectorTest.selectNodeWithId(idValue, nodeSelected); 243 InspectorTest.selectNodeWithId(idValue, nodeSelected);
(...skipping 14 matching lines...) Expand all
258 callback = InspectorTest.safeWrap(callback); 258 callback = InspectorTest.safeWrap(callback);
259 259
260 var targetNode; 260 var targetNode;
261 261
262 waitForStylesRebuild(isPseudoElement, stylesUpdated, true); 262 waitForStylesRebuild(isPseudoElement, stylesUpdated, true);
263 InspectorTest.findNode(isPseudoElement, nodeFound) 263 InspectorTest.findNode(isPseudoElement, nodeFound)
264 264
265 function nodeFound(node) 265 function nodeFound(node)
266 { 266 {
267 targetNode = node; 267 targetNode = node;
268 WebInspector.Revealer.reveal(node); 268 Common.Revealer.reveal(node);
269 } 269 }
270 270
271 function stylesUpdated() 271 function stylesUpdated()
272 { 272 {
273 callback(targetNode); 273 callback(targetNode);
274 } 274 }
275 275
276 function isPseudoElement(node) 276 function isPseudoElement(node)
277 { 277 {
278 return node.parentNode && node.parentNode.getAttribute("id") === parentI d && node.pseudoType() == pseudoType; 278 return node.parentNode && node.parentNode.getAttribute("id") === parentI d && node.pseudoType() == pseudoType;
279 } 279 }
280 } 280 }
281 281
282 InspectorTest.selectNodeAndWaitForStylesWithComputed = function(idValue, callbac k) 282 InspectorTest.selectNodeAndWaitForStylesWithComputed = function(idValue, callbac k)
283 { 283 {
284 callback = InspectorTest.safeWrap(callback); 284 callback = InspectorTest.safeWrap(callback);
285 InspectorTest.selectNodeAndWaitForStyles(idValue, onSidebarRendered); 285 InspectorTest.selectNodeAndWaitForStyles(idValue, onSidebarRendered);
286 286
287 function onSidebarRendered(node) 287 function onSidebarRendered(node)
288 { 288 {
289 InspectorTest.computedStyleWidget().doUpdate().then(callback.bind(null, node)); 289 InspectorTest.computedStyleWidget().doUpdate().then(callback.bind(null, node));
290 } 290 }
291 } 291 }
292 292
293 InspectorTest.firstElementsTreeOutline = function() 293 InspectorTest.firstElementsTreeOutline = function()
294 { 294 {
295 return WebInspector.panels.elements._treeOutlines[0]; 295 return UI.panels.elements._treeOutlines[0];
296 } 296 }
297 297
298 InspectorTest.filterMatchedStyles = function(text) 298 InspectorTest.filterMatchedStyles = function(text)
299 { 299 {
300 var regex = text ? new RegExp(text, "i") : null; 300 var regex = text ? new RegExp(text, "i") : null;
301 InspectorTest.addResult("Filtering styles by: " + text); 301 InspectorTest.addResult("Filtering styles by: " + text);
302 WebInspector.panels.elements._stylesWidget.onFilterChanged(regex); 302 UI.panels.elements._stylesWidget.onFilterChanged(regex);
303 } 303 }
304 304
305 InspectorTest.dumpRenderedMatchedStyles = function() 305 InspectorTest.dumpRenderedMatchedStyles = function()
306 { 306 {
307 var sectionBlocks = WebInspector.panels.elements._stylesWidget._sectionBlock s; 307 var sectionBlocks = UI.panels.elements._stylesWidget._sectionBlocks;
308 for (var block of sectionBlocks) { 308 for (var block of sectionBlocks) {
309 for (var section of block.sections) { 309 for (var section of block.sections) {
310 // Skip sections which were filtered out. 310 // Skip sections which were filtered out.
311 if (section.element.classList.contains("hidden")) 311 if (section.element.classList.contains("hidden"))
312 continue; 312 continue;
313 dumpRenderedSection(section); 313 dumpRenderedSection(section);
314 } 314 }
315 } 315 }
316 316
317 function dumpRenderedSection(section) 317 function dumpRenderedSection(section)
(...skipping 27 matching lines...) Expand all
345 text += String.sprintf("%s: %s", childProperty.nameElement.textConte nt, childProperty.valueElement.textContent); 345 text += String.sprintf("%s: %s", childProperty.nameElement.textConte nt, childProperty.valueElement.textContent);
346 if (childProperty.listItemElement.classList.contains("filter-match") ) 346 if (childProperty.listItemElement.classList.contains("filter-match") )
347 text = "F" + text.substring(1); 347 text = "F" + text.substring(1);
348 InspectorTest.addResult(text); 348 InspectorTest.addResult(text);
349 } 349 }
350 } 350 }
351 } 351 }
352 352
353 InspectorTest.dumpSelectedElementStyles = function(excludeComputed, excludeMatch ed, omitLonghands, includeSelectorGroupMarks) 353 InspectorTest.dumpSelectedElementStyles = function(excludeComputed, excludeMatch ed, omitLonghands, includeSelectorGroupMarks)
354 { 354 {
355 var sectionBlocks = WebInspector.panels.elements._stylesWidget._sectionBlock s; 355 var sectionBlocks = UI.panels.elements._stylesWidget._sectionBlocks;
356 if (!excludeComputed) 356 if (!excludeComputed)
357 InspectorTest.dumpComputedStyle(); 357 InspectorTest.dumpComputedStyle();
358 for (var block of sectionBlocks) { 358 for (var block of sectionBlocks) {
359 for (var section of block.sections) { 359 for (var section of block.sections) {
360 if (section.style().parentRule && excludeMatched) 360 if (section.style().parentRule && excludeMatched)
361 continue; 361 continue;
362 if (section.element.previousSibling && section.element.previousSibli ng.className === "sidebar-separator") { 362 if (section.element.previousSibling && section.element.previousSibli ng.className === "sidebar-separator") {
363 var nodeDescription = ""; 363 var nodeDescription = "";
364 if (section.element.previousSibling.firstElementChild) 364 if (section.element.previousSibling.firstElementChild)
365 nodeDescription = section.element.previousSibling.firstEleme ntChild.shadowRoot.lastChild.textContent; 365 nodeDescription = section.element.previousSibling.firstEleme ntChild.shadowRoot.lastChild.textContent;
(...skipping 29 matching lines...) Expand all
395 InspectorTest.dumpStyleTreeOutline(section.propertiesTreeOutline, omitLongha nds ? 1 : 2); 395 InspectorTest.dumpStyleTreeOutline(section.propertiesTreeOutline, omitLongha nds ? 1 : 2);
396 InspectorTest.addResult(""); 396 InspectorTest.addResult("");
397 } 397 }
398 398
399 function extractLinkText(element) 399 function extractLinkText(element)
400 { 400 {
401 var anchor = element.nodeName === "A" ? element : element.querySelector("a") ; 401 var anchor = element.nodeName === "A" ? element : element.querySelector("a") ;
402 if (!anchor) 402 if (!anchor)
403 return element.textContent; 403 return element.textContent;
404 var anchorText = anchor.textContent; 404 var anchorText = anchor.textContent;
405 var uiLocation = anchor[WebInspector.Linkifier._uiLocationSymbol]; 405 var uiLocation = anchor[Components.Linkifier._uiLocationSymbol];
406 var anchorTarget = uiLocation ? (uiLocation.uiSourceCode.name() + ":" + (uiL ocation.lineNumber + 1) + ":" + (uiLocation.columnNumber + 1)) : ""; 406 var anchorTarget = uiLocation ? (uiLocation.uiSourceCode.name() + ":" + (uiL ocation.lineNumber + 1) + ":" + (uiLocation.columnNumber + 1)) : "";
407 return anchorText + " -> " + anchorTarget; 407 return anchorText + " -> " + anchorTarget;
408 } 408 }
409 409
410 function buildMarkedSelectors(element) 410 function buildMarkedSelectors(element)
411 { 411 {
412 var result = ""; 412 var result = "";
413 for (var node = element.firstChild; node; node = node.nextSibling) { 413 for (var node = element.firstChild; node; node = node.nextSibling) {
414 if (node.nodeType === Node.ELEMENT_NODE && node.classList.contains("sele ctor-matches")) 414 if (node.nodeType === Node.ELEMENT_NODE && node.classList.contains("sele ctor-matches"))
415 result += "[$" + node.textContent + "$]"; 415 result += "[$" + node.textContent + "$]";
(...skipping 10 matching lines...) Expand all
426 } 426 }
427 427
428 InspectorTest.toggleMatchedStyleProperty = function(propertyName, checked) 428 InspectorTest.toggleMatchedStyleProperty = function(propertyName, checked)
429 { 429 {
430 var treeItem = InspectorTest.getMatchedStylePropertyTreeItem(propertyName); 430 var treeItem = InspectorTest.getMatchedStylePropertyTreeItem(propertyName);
431 treeItem._toggleEnabled({ target: { checked: checked }, consume: function() { } }); 431 treeItem._toggleEnabled({ target: { checked: checked }, consume: function() { } });
432 } 432 }
433 433
434 InspectorTest.eventListenersWidget = function() 434 InspectorTest.eventListenersWidget = function()
435 { 435 {
436 WebInspector.viewManager.showView("elements.eventListeners"); 436 UI.viewManager.showView("elements.eventListeners");
437 return self.runtime.sharedInstance(WebInspector.EventListenersWidget); 437 return self.runtime.sharedInstance(Elements.EventListenersWidget);
438 } 438 }
439 439
440 InspectorTest.showEventListenersWidget = function() 440 InspectorTest.showEventListenersWidget = function()
441 { 441 {
442 return WebInspector.viewManager.showView("elements.eventListeners"); 442 return UI.viewManager.showView("elements.eventListeners");
443 } 443 }
444 444
445 InspectorTest.expandAndDumpSelectedElementEventListeners = function(callback) 445 InspectorTest.expandAndDumpSelectedElementEventListeners = function(callback)
446 { 446 {
447 InspectorTest.expandAndDumpEventListeners(InspectorTest.eventListenersWidget ()._eventListenersView, callback); 447 InspectorTest.expandAndDumpEventListeners(InspectorTest.eventListenersWidget ()._eventListenersView, callback);
448 } 448 }
449 449
450 InspectorTest.dumpObjectPropertySectionDeep = function(section) 450 InspectorTest.dumpObjectPropertySectionDeep = function(section)
451 { 451 {
452 function domNodeToString(node) { 452 function domNodeToString(node) {
(...skipping 19 matching lines...) Expand all
472 472
473 // FIXME: this returns the first tree item found (may fail for same-named proper ties in a style). 473 // FIXME: this returns the first tree item found (may fail for same-named proper ties in a style).
474 InspectorTest.getElementStylePropertyTreeItem = function(propertyName) 474 InspectorTest.getElementStylePropertyTreeItem = function(propertyName)
475 { 475 {
476 return InspectorTest.getFirstPropertyTreeItemForSection(InspectorTest.inline StyleSection(), propertyName); 476 return InspectorTest.getFirstPropertyTreeItemForSection(InspectorTest.inline StyleSection(), propertyName);
477 }; 477 };
478 478
479 // FIXME: this returns the first tree item found (may fail for same-named proper ties in a style). 479 // FIXME: this returns the first tree item found (may fail for same-named proper ties in a style).
480 InspectorTest.getMatchedStylePropertyTreeItem = function(propertyName) 480 InspectorTest.getMatchedStylePropertyTreeItem = function(propertyName)
481 { 481 {
482 var sectionBlocks = WebInspector.panels.elements._stylesWidget._sectionBlock s; 482 var sectionBlocks = UI.panels.elements._stylesWidget._sectionBlocks;
483 for (var block of sectionBlocks) { 483 for (var block of sectionBlocks) {
484 for (var section of block.sections) { 484 for (var section of block.sections) {
485 var treeItem = InspectorTest.getFirstPropertyTreeItemForSection(sect ion, propertyName); 485 var treeItem = InspectorTest.getFirstPropertyTreeItemForSection(sect ion, propertyName);
486 if (treeItem) 486 if (treeItem)
487 return treeItem; 487 return treeItem;
488 } 488 }
489 } 489 }
490 return null; 490 return null;
491 }; 491 };
492 492
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 616
617 var treeOutline = InspectorTest.firstElementsTreeOutline(); 617 var treeOutline = InspectorTest.firstElementsTreeOutline();
618 treeOutline.runPendingUpdates(); 618 treeOutline.runPendingUpdates();
619 print(rootNode ? treeOutline.findTreeElement(rootNode) : treeOutline.rootEle ment(), "", depth || 10000); 619 print(rootNode ? treeOutline.findTreeElement(rootNode) : treeOutline.rootEle ment(), "", depth || 10000);
620 }; 620 };
621 621
622 InspectorTest.dumpDOMUpdateHighlights = function(rootNode, callback, depth) 622 InspectorTest.dumpDOMUpdateHighlights = function(rootNode, callback, depth)
623 { 623 {
624 var hasHighlights = false; 624 var hasHighlights = false;
625 625
626 InspectorTest.addSniffer(WebInspector.ElementsTreeOutline.prototype, "_updat eModifiedNodes", didUpdate); 626 InspectorTest.addSniffer(Elements.ElementsTreeOutline.prototype, "_updateMod ifiedNodes", didUpdate);
627 627
628 function didUpdate() 628 function didUpdate()
629 { 629 {
630 var treeOutline = InspectorTest.firstElementsTreeOutline(); 630 var treeOutline = InspectorTest.firstElementsTreeOutline();
631 print(rootNode ? treeOutline.findTreeElement(rootNode) : treeOutline.roo tElement(), "", depth || 10000); 631 print(rootNode ? treeOutline.findTreeElement(rootNode) : treeOutline.roo tElement(), "", depth || 10000);
632 if (!hasHighlights) 632 if (!hasHighlights)
633 InspectorTest.addResult("<No highlights>"); 633 InspectorTest.addResult("<No highlights>");
634 if (callback) 634 if (callback)
635 callback(); 635 callback();
636 } 636 }
637 637
638 function print(treeItem, prefix, depth) 638 function print(treeItem, prefix, depth)
639 { 639 {
640 if (!treeItem.root) { 640 if (!treeItem.root) {
641 var elementXPath = WebInspector.DOMPresentationUtils.xPath(treeItem. node(), true); 641 var elementXPath = Components.DOMPresentationUtils.xPath(treeItem.no de(), true);
642 var highlightedElements = treeItem.listItemElement.querySelectorAll( ".dom-update-highlight"); 642 var highlightedElements = treeItem.listItemElement.querySelectorAll( ".dom-update-highlight");
643 for (var i = 0; i < highlightedElements.length; ++i) { 643 for (var i = 0; i < highlightedElements.length; ++i) {
644 var element = highlightedElements[i]; 644 var element = highlightedElements[i];
645 var classList = element.classList; 645 var classList = element.classList;
646 var xpath = elementXPath; 646 var xpath = elementXPath;
647 if (classList.contains("webkit-html-attribute-name")) { 647 if (classList.contains("webkit-html-attribute-name")) {
648 xpath += "/@" + element.textContent + " (empty)"; 648 xpath += "/@" + element.textContent + " (empty)";
649 } else if (classList.contains("webkit-html-attribute-value")) { 649 } else if (classList.contains("webkit-html-attribute-value")) {
650 name = element.parentElement.querySelector(".webkit-html-att ribute-name").textContent; 650 name = element.parentElement.querySelector(".webkit-html-att ribute-name").textContent;
651 xpath += "/@" + name + " " + element.textContent; 651 xpath += "/@" + name + " " + element.textContent;
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 else 899 else
900 InspectorTest.addResult(currentIndent + "[text='" + property.text + "'] disabled"); 900 InspectorTest.addResult(currentIndent + "[text='" + property.text + "'] disabled");
901 } 901 }
902 } 902 }
903 903
904 InspectorTest.dumpBreadcrumb = function(message) 904 InspectorTest.dumpBreadcrumb = function(message)
905 { 905 {
906 if (message) 906 if (message)
907 InspectorTest.addResult(message + ":"); 907 InspectorTest.addResult(message + ":");
908 var result = []; 908 var result = [];
909 var crumbs = WebInspector.panels.elements._breadcrumbs.crumbsElement; 909 var crumbs = UI.panels.elements._breadcrumbs.crumbsElement;
910 var crumb = crumbs.lastChild; 910 var crumb = crumbs.lastChild;
911 while (crumb) { 911 while (crumb) {
912 result.unshift(crumb.textContent); 912 result.unshift(crumb.textContent);
913 crumb = crumb.previousSibling; 913 crumb = crumb.previousSibling;
914 } 914 }
915 InspectorTest.addResult(result.join(" > ")); 915 InspectorTest.addResult(result.join(" > "));
916 } 916 }
917 917
918 InspectorTest.matchingSelectors = function(matchedStyles, rule) 918 InspectorTest.matchingSelectors = function(matchedStyles, rule)
919 { 919 {
920 var selectors = []; 920 var selectors = [];
921 var matchingSelectors = matchedStyles.matchingSelectors(rule); 921 var matchingSelectors = matchedStyles.matchingSelectors(rule);
922 for (var i = 0; i < matchingSelectors.length; ++i) 922 for (var i = 0; i < matchingSelectors.length; ++i)
923 selectors.push(rule.selectors[matchingSelectors[i]].text); 923 selectors.push(rule.selectors[matchingSelectors[i]].text);
924 return "[" + selectors.join(", ") + "]"; 924 return "[" + selectors.join(", ") + "]";
925 } 925 }
926 926
927 InspectorTest.addNewRuleInStyleSheet = function(styleSheetHeader, selector, call back) 927 InspectorTest.addNewRuleInStyleSheet = function(styleSheetHeader, selector, call back)
928 { 928 {
929 InspectorTest.addSniffer(WebInspector.StylesSidebarPane.prototype, "_addBlan kSection", onBlankSection.bind(null, selector, callback)); 929 InspectorTest.addSniffer(Elements.StylesSidebarPane.prototype, "_addBlankSec tion", onBlankSection.bind(null, selector, callback));
930 WebInspector.panels.elements._stylesWidget._createNewRuleInStyleSheet(styleS heetHeader); 930 UI.panels.elements._stylesWidget._createNewRuleInStyleSheet(styleSheetHeader );
931 } 931 }
932 932
933 InspectorTest.addNewRule = function(selector, callback) 933 InspectorTest.addNewRule = function(selector, callback)
934 { 934 {
935 // Click "Add new rule". 935 // Click "Add new rule".
936 document.querySelector(".styles-pane-toolbar").shadowRoot.querySelector(".la rgeicon-add").click(); 936 document.querySelector(".styles-pane-toolbar").shadowRoot.querySelector(".la rgeicon-add").click();
937 InspectorTest.addSniffer(WebInspector.StylesSidebarPane.prototype, "_addBlan kSection", onBlankSection.bind(null, selector, callback)); 937 InspectorTest.addSniffer(Elements.StylesSidebarPane.prototype, "_addBlankSec tion", onBlankSection.bind(null, selector, callback));
938 } 938 }
939 939
940 function onBlankSection(selector, callback) 940 function onBlankSection(selector, callback)
941 { 941 {
942 var section = InspectorTest.firstMatchedStyleSection(); 942 var section = InspectorTest.firstMatchedStyleSection();
943 if (typeof selector === "string") 943 if (typeof selector === "string")
944 section._selectorElement.textContent = selector; 944 section._selectorElement.textContent = selector;
945 section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter") ); 945 section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter") );
946 InspectorTest.waitForSelectorCommitted(callback.bind(null, section)); 946 InspectorTest.waitForSelectorCommitted(callback.bind(null, section));
947 } 947 }
948 948
949 InspectorTest.dumpInspectorHighlightJSON = function(idValue, callback) 949 InspectorTest.dumpInspectorHighlightJSON = function(idValue, callback)
950 { 950 {
951 InspectorTest.nodeWithId(idValue, nodeResolved); 951 InspectorTest.nodeWithId(idValue, nodeResolved);
952 952
953 function nodeResolved(node) 953 function nodeResolved(node)
954 { 954 {
955 InspectorTest.DOMAgent.getHighlightObjectForTest(node.id, report); 955 InspectorTest.DOMAgent.getHighlightObjectForTest(node.id, report);
956 } 956 }
957 957
958 function report(error, result) 958 function report(error, result)
959 { 959 {
960 InspectorTest.addResult(idValue + JSON.stringify(result, null, 2)); 960 InspectorTest.addResult(idValue + JSON.stringify(result, null, 2));
961 callback(); 961 callback();
962 } 962 }
963 } 963 }
964 964
965 InspectorTest.waitForAnimationAdded = function(callback) 965 InspectorTest.waitForAnimationAdded = function(callback)
966 { 966 {
967 InspectorTest.addSniffer(WebInspector.AnimationTimeline.prototype, "_addAnim ationGroup", callback); 967 InspectorTest.addSniffer(Animation.AnimationTimeline.prototype, "_addAnimati onGroup", callback);
968 } 968 }
969 969
970 InspectorTest.dumpAnimationTimeline = function(timeline) 970 InspectorTest.dumpAnimationTimeline = function(timeline)
971 { 971 {
972 for (var ui of timeline._uiAnimations) { 972 for (var ui of timeline._uiAnimations) {
973 InspectorTest.addResult(ui.animation().type()); 973 InspectorTest.addResult(ui.animation().type());
974 InspectorTest.addResult(ui._nameElement.innerHTML); 974 InspectorTest.addResult(ui._nameElement.innerHTML);
975 InspectorTest.addResult(ui._svg.innerHTML); 975 InspectorTest.addResult(ui._svg.innerHTML);
976 } 976 }
977 } 977 }
978 978
979 }; 979 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698