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

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

Issue 1002293002: DevTools: [SSP] refactor internal representations of sections (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address comments Created 5 years, 9 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
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.sidebarPanes.styles.sections[0][0]; 7 return WebInspector.panels.elements.sidebarPanes.styles._sectionBlocks[0].se ctions[0];
8 } 8 }
9 9
10 InspectorTest.computedStyleSidebarPane = function() 10 InspectorTest.computedStyleSidebarPane = function()
11 { 11 {
12 return WebInspector.panels.elements.sidebarPanes.styles._computedStylePane; 12 return WebInspector.panels.elements.sidebarPanes.styles._computedStylePane;
13 } 13 }
14 14
15 InspectorTest.dumpComputedStyle = function() 15 InspectorTest.dumpComputedStyle = function()
16 { 16 {
17 var computed = InspectorTest.computedStyleSidebarPane(); 17 var computed = InspectorTest.computedStyleSidebarPane();
(...skipping 15 matching lines...) Expand all
33 var item = items[i]; 33 var item = items[i];
34 var property = item[WebInspector.ComputedStyleSidebarPane._propertySymbo l]; 34 var property = item[WebInspector.ComputedStyleSidebarPane._propertySymbo l];
35 if (property.name === name) 35 if (property.name === name)
36 return item; 36 return item;
37 } 37 }
38 return null; 38 return null;
39 } 39 }
40 40
41 InspectorTest.firstMatchedStyleSection = function() 41 InspectorTest.firstMatchedStyleSection = function()
42 { 42 {
43 return WebInspector.panels.elements.sidebarPanes.styles.sections[0][1]; 43 return WebInspector.panels.elements.sidebarPanes.styles._sectionBlocks[0].se ctions[1];
44 } 44 }
45 45
46 InspectorTest.firstMediaTextElementInSection = function(section) 46 InspectorTest.firstMediaTextElementInSection = function(section)
47 { 47 {
48 return section.element.querySelector(".media-text"); 48 return section.element.querySelector(".media-text");
49 } 49 }
50 50
51 InspectorTest.findNode = function(matchFunction, callback) 51 InspectorTest.findNode = function(matchFunction, callback)
52 { 52 {
53 callback = InspectorTest.safeWrap(callback); 53 callback = InspectorTest.safeWrap(callback);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 InspectorTest.filterMatchedStyles = function(text) 253 InspectorTest.filterMatchedStyles = function(text)
254 { 254 {
255 var regex = text ? new RegExp(text, "i") : null; 255 var regex = text ? new RegExp(text, "i") : null;
256 InspectorTest.addResult("Filtering styles by: " + text); 256 InspectorTest.addResult("Filtering styles by: " + text);
257 WebInspector.panels.elements.sidebarPanes.styles._onFilterChanged(regex); 257 WebInspector.panels.elements.sidebarPanes.styles._onFilterChanged(regex);
258 } 258 }
259 259
260 InspectorTest.dumpRenderedMatchedStyles = function() 260 InspectorTest.dumpRenderedMatchedStyles = function()
261 { 261 {
262 var styleSections = WebInspector.panels.elements.sidebarPanes.styles.section s; 262 var sectionBlocks = WebInspector.panels.elements.sidebarPanes.styles._sectio nBlocks;
263 for (var pseudoId in styleSections) { 263 for (var block of sectionBlocks) {
264 var sections = styleSections[pseudoId].slice(); 264 for (var section of block.sections) {
265 for (var i = 0; i < sections.length; ++i) {
266 var section = sections[i];
267 // Skip sections which were filtered out. 265 // Skip sections which were filtered out.
268 if (section.element.classList.contains("hidden")) 266 if (section.element.classList.contains("hidden"))
269 continue; 267 continue;
270 dumpRenderedSection(section); 268 dumpRenderedSection(section);
271 } 269 }
272 } 270 }
273 271
274 function dumpRenderedSection(section) 272 function dumpRenderedSection(section)
275 { 273 {
276 InspectorTest.addResult(section._selectorElement.textContent + " {"); 274 InspectorTest.addResult(section._selectorElement.textContent + " {");
(...skipping 25 matching lines...) Expand all
302 text += String.sprintf("%s: %s", childProperty.nameElement.textConte nt, childProperty.valueElement.textContent); 300 text += String.sprintf("%s: %s", childProperty.nameElement.textConte nt, childProperty.valueElement.textContent);
303 if (childProperty.listItemElement.classList.contains("filter-match") ) 301 if (childProperty.listItemElement.classList.contains("filter-match") )
304 text = "F" + text.substring(1); 302 text = "F" + text.substring(1);
305 InspectorTest.addResult(text); 303 InspectorTest.addResult(text);
306 } 304 }
307 } 305 }
308 } 306 }
309 307
310 InspectorTest.dumpSelectedElementStyles = function(excludeComputed, excludeMatch ed, omitLonghands, includeSelectorGroupMarks) 308 InspectorTest.dumpSelectedElementStyles = function(excludeComputed, excludeMatch ed, omitLonghands, includeSelectorGroupMarks)
311 { 309 {
312 var styleSections = WebInspector.panels.elements.sidebarPanes.styles.section s; 310 var sectionBlocks = WebInspector.panels.elements.sidebarPanes.styles._sectio nBlocks;
313 if (!excludeComputed) 311 if (!excludeComputed)
314 InspectorTest.dumpComputedStyle(); 312 InspectorTest.dumpComputedStyle();
315 for (var pseudoId in styleSections) { 313 for (var block of sectionBlocks) {
316 var sections = styleSections[pseudoId].slice(); 314 for (var section of block.sections) {
317 for (var i = 0; i < sections.length; ++i) {
318 var section = sections[i];
319 if (section.rule() && excludeMatched) 315 if (section.rule() && excludeMatched)
320 continue; 316 continue;
321 if (section.element.previousSibling && section.element.previousSibli ng.className === "sidebar-separator") { 317 if (section.element.previousSibling && section.element.previousSibli ng.className === "sidebar-separator") {
322 var nodeDescription = ""; 318 var nodeDescription = "";
323 if (section.element.previousSibling.firstElementChild) 319 if (section.element.previousSibling.firstElementChild)
324 nodeDescription = section.element.previousSibling.firstEleme ntChild.shadowRoot.lastChild.textContent; 320 nodeDescription = section.element.previousSibling.firstEleme ntChild.shadowRoot.lastChild.textContent;
325 InspectorTest.addResult("======== " + section.element.previousSi bling.textContent + nodeDescription + " ========"); 321 InspectorTest.addResult("======== " + section.element.previousSi bling.textContent + nodeDescription + " ========");
326 } 322 }
327 printStyleSection(section, omitLonghands, includeSelectorGroupMarks) ; 323 printStyleSection(section, omitLonghands, includeSelectorGroupMarks) ;
328 } 324 }
329 InspectorTest.addResult("");
330 } 325 }
331 } 326 }
332 327
333 function printStyleSection(section, omitLonghands, includeSelectorGroupMarks) 328 function printStyleSection(section, omitLonghands, includeSelectorGroupMarks)
334 { 329 {
335 if (!section) 330 if (!section)
336 return; 331 return;
337 InspectorTest.addResult("[expanded] " + (section.element.classList.contains( "no-affect") ? "[no-affect] " : "")); 332 InspectorTest.addResult("[expanded] " + (section.element.classList.contains( "no-affect") ? "[no-affect] " : ""));
338 var chainEntries = section.titleElement.querySelectorAll(".media-list .media "); 333 var chainEntries = section.titleElement.querySelectorAll(".media-list .media ");
339 chainEntries = Array.prototype.slice.call(chainEntries); 334 chainEntries = Array.prototype.slice.call(chainEntries);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 457
463 // FIXME: this returns the first tree item found (may fail for same-named proper ties in a style). 458 // FIXME: this returns the first tree item found (may fail for same-named proper ties in a style).
464 InspectorTest.getElementStylePropertyTreeItem = function(propertyName) 459 InspectorTest.getElementStylePropertyTreeItem = function(propertyName)
465 { 460 {
466 return InspectorTest.getFirstPropertyTreeItemForSection(InspectorTest.inline StyleSection(), propertyName); 461 return InspectorTest.getFirstPropertyTreeItemForSection(InspectorTest.inline StyleSection(), propertyName);
467 }; 462 };
468 463
469 // FIXME: this returns the first tree item found (may fail for same-named proper ties in a style). 464 // FIXME: this returns the first tree item found (may fail for same-named proper ties in a style).
470 InspectorTest.getMatchedStylePropertyTreeItem = function(propertyName) 465 InspectorTest.getMatchedStylePropertyTreeItem = function(propertyName)
471 { 466 {
472 var sections = WebInspector.panels.elements.sidebarPanes.styles.sections; 467 var sectionBlocks = WebInspector.panels.elements.sidebarPanes.styles._sectio nBlocks;
473 for (var pseudoId in sections) { 468 for (var block of sectionBlocks) {
474 var styleSections = sections[pseudoId]; 469 for (var section of block.sections) {
475 for (var i = 0; i < styleSections.length; ++i) { 470 var treeItem = InspectorTest.getFirstPropertyTreeItemForSection(sect ion, propertyName);
476 var treeItem = InspectorTest.getFirstPropertyTreeItemForSection(styl eSections[i], propertyName);
477 if (treeItem) 471 if (treeItem)
478 return treeItem; 472 return treeItem;
479 } 473 }
480 } 474 }
481 return null; 475 return null;
482 }; 476 };
483 477
484 InspectorTest.getFirstPropertyTreeItemForSection = function(section, propertyNam e) 478 InspectorTest.getFirstPropertyTreeItemForSection = function(section, propertyNam e)
485 { 479 {
486 var outline = section.propertiesTreeOutline.rootElement(); 480 var outline = section.propertiesTreeOutline.rootElement();
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 for (var nodeUI of timeline._nodesMap.values()) { 962 for (var nodeUI of timeline._nodesMap.values()) {
969 for (nodeRow of nodeUI._rows) { 963 for (nodeRow of nodeUI._rows) {
970 for (var ui of nodeRow.animations) { 964 for (var ui of nodeRow.animations) {
971 InspectorTest.addResult(ui._svg.innerHTML); 965 InspectorTest.addResult(ui._svg.innerHTML);
972 } 966 }
973 } 967 }
974 } 968 }
975 } 969 }
976 970
977 }; 971 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698