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

Side by Side Diff: Source/devtools/front_end/elements/ElementsPanel.js

Issue 662793002: [DevTools] Replace usages of document with custom functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 this.crumbsElement.addEventListener("mousemove", this._mouseMovedInCrumbs.bi nd(this), false); 63 this.crumbsElement.addEventListener("mousemove", this._mouseMovedInCrumbs.bi nd(this), false);
64 this.crumbsElement.addEventListener("mouseout", this._mouseMovedOutOfCrumbs. bind(this), false); 64 this.crumbsElement.addEventListener("mouseout", this._mouseMovedOutOfCrumbs. bind(this), false);
65 65
66 this.sidebarPanes = {}; 66 this.sidebarPanes = {};
67 this.sidebarPanes.platformFonts = new WebInspector.PlatformFontsSidebarPane( ); 67 this.sidebarPanes.platformFonts = new WebInspector.PlatformFontsSidebarPane( );
68 this.sidebarPanes.computedStyle = new WebInspector.ComputedStyleSidebarPane( ); 68 this.sidebarPanes.computedStyle = new WebInspector.ComputedStyleSidebarPane( );
69 this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(this.sidebarPa nes.computedStyle, this._setPseudoClassForNode.bind(this)); 69 this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(this.sidebarPa nes.computedStyle, this._setPseudoClassForNode.bind(this));
70 this.sidebarPanes.styles.addEventListener(WebInspector.StylesSidebarPane.Eve nts.SelectorEditingStarted, this._onEditingSelectorStarted.bind(this)); 70 this.sidebarPanes.styles.addEventListener(WebInspector.StylesSidebarPane.Eve nts.SelectorEditingStarted, this._onEditingSelectorStarted.bind(this));
71 this.sidebarPanes.styles.addEventListener(WebInspector.StylesSidebarPane.Eve nts.SelectorEditingEnded, this._onEditingSelectorEnded.bind(this)); 71 this.sidebarPanes.styles.addEventListener(WebInspector.StylesSidebarPane.Eve nts.SelectorEditingEnded, this._onEditingSelectorEnded.bind(this));
72 72
73 this._matchedStylesFilterBoxContainer = document.createElement("div"); 73 this._matchedStylesFilterBoxContainer = createElement("div");
74 this._matchedStylesFilterBoxContainer.className = "sidebar-pane-filter-box"; 74 this._matchedStylesFilterBoxContainer.className = "sidebar-pane-filter-box";
75 this._computedStylesFilterBoxContainer = document.createElement("div"); 75 this._computedStylesFilterBoxContainer = createElement("div");
76 this._computedStylesFilterBoxContainer.className = "sidebar-pane-filter-box" ; 76 this._computedStylesFilterBoxContainer.className = "sidebar-pane-filter-box" ;
77 this.sidebarPanes.styles.setFilterBoxContainers(this._matchedStylesFilterBox Container, this._computedStylesFilterBoxContainer); 77 this.sidebarPanes.styles.setFilterBoxContainers(this._matchedStylesFilterBox Container, this._computedStylesFilterBoxContainer);
78 78
79 this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane(); 79 this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane();
80 this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane(); 80 this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane();
81 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this); 81 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this);
82 this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPan e(); 82 this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPan e();
83 this.sidebarPanes.animations = new WebInspector.AnimationsSidebarPane(this.s idebarPanes.styles); 83 this.sidebarPanes.animations = new WebInspector.AnimationsSidebarPane(this.s idebarPanes.styles);
84 84
85 this.sidebarPanes.styles.addEventListener(WebInspector.SidebarPane.EventType s.wasShown, this.updateStyles.bind(this, false)); 85 this.sidebarPanes.styles.addEventListener(WebInspector.SidebarPane.EventType s.wasShown, this.updateStyles.bind(this, false));
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 } else 767 } else
768 panel.selectDOMNode(crumb.representedObject, true); 768 panel.selectDOMNode(crumb.representedObject, true);
769 769
770 event.preventDefault(); 770 event.preventDefault();
771 } 771 }
772 772
773 for (var current = this.selectedDOMNode(); current; current = current.pa rentNode) { 773 for (var current = this.selectedDOMNode(); current; current = current.pa rentNode) {
774 if (current.nodeType() === Node.DOCUMENT_NODE) 774 if (current.nodeType() === Node.DOCUMENT_NODE)
775 continue; 775 continue;
776 776
777 crumb = document.createElement("span"); 777 crumb = createElement("span");
778 crumb.className = "crumb"; 778 crumb.className = "crumb";
779 crumb.representedObject = current; 779 crumb.representedObject = current;
780 crumb.addEventListener("mousedown", selectCrumbFunction, false); 780 crumb.addEventListener("mousedown", selectCrumbFunction, false);
781 781
782 var crumbTitle = ""; 782 var crumbTitle = "";
783 switch (current.nodeType()) { 783 switch (current.nodeType()) {
784 case Node.ELEMENT_NODE: 784 case Node.ELEMENT_NODE:
785 if (current.pseudoType()) 785 if (current.pseudoType())
786 crumbTitle = "::" + current.pseudoType(); 786 crumbTitle = "::" + current.pseudoType();
787 else 787 else
(...skipping 14 matching lines...) Expand all
802 802
803 case Node.DOCUMENT_FRAGMENT_NODE: 803 case Node.DOCUMENT_FRAGMENT_NODE:
804 crumbTitle = current.shadowRootType() ? "#shadow-root" : curre nt.nodeNameInCorrectCase(); 804 crumbTitle = current.shadowRootType() ? "#shadow-root" : curre nt.nodeNameInCorrectCase();
805 break; 805 break;
806 806
807 default: 807 default:
808 crumbTitle = current.nodeNameInCorrectCase(); 808 crumbTitle = current.nodeNameInCorrectCase();
809 } 809 }
810 810
811 if (!crumb.childNodes.length) { 811 if (!crumb.childNodes.length) {
812 var nameElement = document.createElement("span"); 812 var nameElement = createElement("span");
813 nameElement.textContent = crumbTitle; 813 nameElement.textContent = crumbTitle;
814 crumb.appendChild(nameElement); 814 crumb.appendChild(nameElement);
815 crumb.title = crumbTitle; 815 crumb.title = crumbTitle;
816 } 816 }
817 817
818 if (current === this.selectedDOMNode()) 818 if (current === this.selectedDOMNode())
819 crumb.classList.add("selected"); 819 crumb.classList.add("selected");
820 crumbs.insertBefore(crumb, crumbs.firstChild); 820 crumbs.insertBefore(crumb, crumbs.firstChild);
821 } 821 }
822 822
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 this._splitView.setVertical(!vertically); 1333 this._splitView.setVertical(!vertically);
1334 1334
1335 var computedPane = new WebInspector.SidebarPane(WebInspector.UIString("C omputed")); 1335 var computedPane = new WebInspector.SidebarPane(WebInspector.UIString("C omputed"));
1336 computedPane.element.classList.add("composite"); 1336 computedPane.element.classList.add("composite");
1337 computedPane.element.classList.add("fill"); 1337 computedPane.element.classList.add("fill");
1338 var expandComputed = computedPane.expand.bind(computedPane); 1338 var expandComputed = computedPane.expand.bind(computedPane);
1339 1339
1340 computedPane.bodyElement.classList.add("metrics-and-computed"); 1340 computedPane.bodyElement.classList.add("metrics-and-computed");
1341 this.sidebarPanes.computedStyle.setExpandCallback(expandComputed); 1341 this.sidebarPanes.computedStyle.setExpandCallback(expandComputed);
1342 1342
1343 var matchedStylePanesWrapper = document.createElement("div"); 1343 var matchedStylePanesWrapper = createElement("div");
1344 matchedStylePanesWrapper.className = "style-panes-wrapper"; 1344 matchedStylePanesWrapper.className = "style-panes-wrapper";
1345 var computedStylePanesWrapper = document.createElement("div"); 1345 var computedStylePanesWrapper = createElement("div");
1346 computedStylePanesWrapper.className = "style-panes-wrapper"; 1346 computedStylePanesWrapper.className = "style-panes-wrapper";
1347 1347
1348 /** 1348 /**
1349 * @param {boolean} inComputedStyle 1349 * @param {boolean} inComputedStyle
1350 * @this {WebInspector.ElementsPanel} 1350 * @this {WebInspector.ElementsPanel}
1351 */ 1351 */
1352 function showMetrics(inComputedStyle) 1352 function showMetrics(inComputedStyle)
1353 { 1353 {
1354 if (inComputedStyle) 1354 if (inComputedStyle)
1355 this.sidebarPanes.metrics.show(computedStylePanesWrapper, this.s idebarPanes.computedStyle.element); 1355 this.sidebarPanes.metrics.show(computedStylePanesWrapper, this.s idebarPanes.computedStyle.element);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 1545
1546 WebInspector.ElementsPanelFactory.prototype = { 1546 WebInspector.ElementsPanelFactory.prototype = {
1547 /** 1547 /**
1548 * @return {!WebInspector.Panel} 1548 * @return {!WebInspector.Panel}
1549 */ 1549 */
1550 createPanel: function() 1550 createPanel: function()
1551 { 1551 {
1552 return WebInspector.ElementsPanel.instance(); 1552 return WebInspector.ElementsPanel.instance();
1553 } 1553 }
1554 } 1554 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/elements/AnimationsSidebarPane.js ('k') | Source/devtools/front_end/elements/ElementsTreeOutline.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698