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

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

Issue 671463002: DevTools: make flame chart a web component. (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 30 matching lines...) Expand all
41 41
42 this._splitView = new WebInspector.SplitView(true, true, "elementsPanelSplit ViewState", 325, 325); 42 this._splitView = new WebInspector.SplitView(true, true, "elementsPanelSplit ViewState", 325, 325);
43 this._splitView.addEventListener(WebInspector.SplitView.Events.SidebarSizeCh anged, this._updateTreeOutlineVisibleWidth.bind(this)); 43 this._splitView.addEventListener(WebInspector.SplitView.Events.SidebarSizeCh anged, this._updateTreeOutlineVisibleWidth.bind(this));
44 this._splitView.show(this.element); 44 this._splitView.show(this.element);
45 45
46 this._searchableView = new WebInspector.SearchableView(this); 46 this._searchableView = new WebInspector.SearchableView(this);
47 this._searchableView.setMinimumSize(25, 19); 47 this._searchableView.setMinimumSize(25, 19);
48 this._searchableView.show(this._splitView.mainElement()); 48 this._searchableView.show(this._splitView.mainElement());
49 var stackElement = this._searchableView.element; 49 var stackElement = this._searchableView.element;
50 50
51 this.contentElement = stackElement.createChild("div"); 51 this._contentElement = stackElement.createChild("div");
52 this.contentElement.id = "elements-content"; 52 this._contentElement.id = "elements-content";
53 if (!WebInspector.settings.domWordWrap.get()) 53 if (!WebInspector.settings.domWordWrap.get())
54 this.contentElement.classList.add("nowrap"); 54 this._contentElement.classList.add("nowrap");
55 WebInspector.settings.domWordWrap.addChangeListener(this._domWordWrapSetting Changed.bind(this)); 55 WebInspector.settings.domWordWrap.addChangeListener(this._domWordWrapSetting Changed.bind(this));
56 56
57 this._splitView.sidebarElement().addEventListener("contextmenu", this._sideb arContextMenuEventFired.bind(this), false); 57 this._splitView.sidebarElement().addEventListener("contextmenu", this._sideb arContextMenuEventFired.bind(this), false);
58 58
59 var crumbsContainer = stackElement.createChild("div"); 59 var crumbsContainer = stackElement.createChild("div");
60 crumbsContainer.id = "elements-crumbs"; 60 crumbsContainer.id = "elements-crumbs";
61 this.crumbsElement = crumbsContainer.createChild("div", "crumbs"); 61 this.crumbsElement = crumbsContainer.createChild("div", "crumbs");
62 this.crumbsElement.addEventListener("mousemove", this._mouseMovedInCrumbs.bi nd(this), false); 62 this.crumbsElement.addEventListener("mousemove", this._mouseMovedInCrumbs.bi nd(this), false);
63 this.crumbsElement.addEventListener("mouseout", this._mouseMovedOutOfCrumbs. bind(this), false); 63 this.crumbsElement.addEventListener("mouseout", this._mouseMovedOutOfCrumbs. bind(this), false);
64 64
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 searchableView: function() 189 searchableView: function()
190 { 190 {
191 return this._searchableView; 191 return this._searchableView;
192 }, 192 },
193 193
194 wasShown: function() 194 wasShown: function()
195 { 195 {
196 for (var i = 0; i < this._treeOutlines.length; ++i) { 196 for (var i = 0; i < this._treeOutlines.length; ++i) {
197 var treeOutline = this._treeOutlines[i]; 197 var treeOutline = this._treeOutlines[i];
198 // Attach heavy component lazily 198 // Attach heavy component lazily
199 if (treeOutline.element.parentElement !== this.contentElement) 199 if (treeOutline.element.parentElement !== this._contentElement)
200 this.contentElement.appendChild(treeOutline.element); 200 this._contentElement.appendChild(treeOutline.element);
201 } 201 }
202 WebInspector.Panel.prototype.wasShown.call(this); 202 WebInspector.Panel.prototype.wasShown.call(this);
203 this.updateBreadcrumb(); 203 this.updateBreadcrumb();
204 204
205 for (var i = 0; i < this._treeOutlines.length; ++i) { 205 for (var i = 0; i < this._treeOutlines.length; ++i) {
206 var treeOutline = this._treeOutlines[i]; 206 var treeOutline = this._treeOutlines[i];
207 treeOutline.updateSelection(); 207 treeOutline.updateSelection();
208 treeOutline.setVisible(true); 208 treeOutline.setVisible(true);
209 209
210 if (!treeOutline.rootDOMNode) 210 if (!treeOutline.rootDOMNode)
211 if (treeOutline.domModel().existingDocument()) 211 if (treeOutline.domModel().existingDocument())
212 this._documentUpdated(treeOutline.domModel(), treeOutline.do mModel().existingDocument()); 212 this._documentUpdated(treeOutline.domModel(), treeOutline.do mModel().existingDocument());
213 else 213 else
214 treeOutline.domModel().requestDocument(); 214 treeOutline.domModel().requestDocument();
215 } 215 }
216 216
217 }, 217 },
218 218
219 willHide: function() 219 willHide: function()
220 { 220 {
221 for (var i = 0; i < this._treeOutlines.length; ++i) { 221 for (var i = 0; i < this._treeOutlines.length; ++i) {
222 var treeOutline = this._treeOutlines[i]; 222 var treeOutline = this._treeOutlines[i];
223 treeOutline.domModel().hideDOMNodeHighlight(); 223 treeOutline.domModel().hideDOMNodeHighlight();
224 treeOutline.setVisible(false); 224 treeOutline.setVisible(false);
225 // Detach heavy component on hide 225 // Detach heavy component on hide
226 this.contentElement.removeChild(treeOutline.element); 226 this._contentElement.removeChild(treeOutline.element);
227 } 227 }
228 this._popoverHelper.hidePopover(); 228 this._popoverHelper.hidePopover();
229 WebInspector.Panel.prototype.willHide.call(this); 229 WebInspector.Panel.prototype.willHide.call(this);
230 }, 230 },
231 231
232 onResize: function() 232 onResize: function()
233 { 233 {
234 this._updateTreeOutlineVisibleWidth(); 234 this._updateTreeOutlineVisibleWidth();
235 }, 235 },
236 236
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 this._currentSearchResultIndex = -1; 436 this._currentSearchResultIndex = -1;
437 437
438 if (shouldJump) 438 if (shouldJump)
439 this._jumpToSearchResult(jumpBackwards ? -1 : 0); 439 this._jumpToSearchResult(jumpBackwards ? -1 : 0);
440 } 440 }
441 }, 441 },
442 442
443 _domWordWrapSettingChanged: function(event) 443 _domWordWrapSettingChanged: function(event)
444 { 444 {
445 if (event.data) 445 if (event.data)
446 this.contentElement.classList.remove("nowrap"); 446 this._contentElement.classList.remove("nowrap");
447 else 447 else
448 this.contentElement.classList.add("nowrap"); 448 this._contentElement.classList.add("nowrap");
449 449
450 var selectedNode = this.selectedDOMNode(); 450 var selectedNode = this.selectedDOMNode();
451 if (!selectedNode) 451 if (!selectedNode)
452 return; 452 return;
453 453
454 var treeElement = this._treeElementForNode(selectedNode); 454 var treeElement = this._treeElementForNode(selectedNode);
455 if (treeElement) 455 if (treeElement)
456 treeElement.updateSelection(); // Recalculate selection highlight di mensions. 456 treeElement.updateSelection(); // Recalculate selection highlight di mensions.
457 }, 457 },
458 458
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 } 848 }
849 849
850 // Find the focused crumb index. 850 // Find the focused crumb index.
851 if (crumb === focusedCrumb) 851 if (crumb === focusedCrumb)
852 focusedIndex = i; 852 focusedIndex = i;
853 853
854 crumb.classList.remove("compact", "collapsed", "hidden"); 854 crumb.classList.remove("compact", "collapsed", "hidden");
855 } 855 }
856 856
857 // Layout 1: Measure total and normal crumb sizes 857 // Layout 1: Measure total and normal crumb sizes
858 var contentElementWidth = this.contentElement.offsetWidth; 858 var contentElementWidth = this._contentElement.offsetWidth;
859 var normalSizes = []; 859 var normalSizes = [];
860 for (var i = 0; i < crumbs.childNodes.length; ++i) { 860 for (var i = 0; i < crumbs.childNodes.length; ++i) {
861 var crumb = crumbs.childNodes[i]; 861 var crumb = crumbs.childNodes[i];
862 normalSizes[i] = crumb.offsetWidth; 862 normalSizes[i] = crumb.offsetWidth;
863 } 863 }
864 864
865 // Layout 2: Measure collapsed crumb sizes 865 // Layout 2: Measure collapsed crumb sizes
866 var compactSizes = []; 866 var compactSizes = [];
867 for (var i = 0; i < crumbs.childNodes.length; ++i) { 867 for (var i = 0; i < crumbs.childNodes.length; ++i) {
868 var crumb = crumbs.childNodes[i]; 868 var crumb = crumbs.childNodes[i];
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 1555
1556 WebInspector.ElementsPanelFactory.prototype = { 1556 WebInspector.ElementsPanelFactory.prototype = {
1557 /** 1557 /**
1558 * @return {!WebInspector.Panel} 1558 * @return {!WebInspector.Panel}
1559 */ 1559 */
1560 createPanel: function() 1560 createPanel: function()
1561 { 1561 {
1562 return WebInspector.ElementsPanel.instance(); 1562 return WebInspector.ElementsPanel.instance();
1563 } 1563 }
1564 } 1564 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698