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

Side by Side Diff: Source/devtools/front_end/ElementsTreeOutline.js

Issue 218703002: DevTools: [wip] move Elements panel off WebInspector.domModel and single tree outline. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review comment addressed (and much more) Created 6 years, 8 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 13 matching lines...) Expand all
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @extends {TreeOutline} 33 * @extends {TreeOutline}
34 * @param {!WebInspector.Target} target
34 * @param {boolean=} omitRootDOMNode 35 * @param {boolean=} omitRootDOMNode
35 * @param {boolean=} selectEnabled 36 * @param {boolean=} selectEnabled
36 * @param {function(!WebInspector.ContextMenu, !WebInspector.DOMNode)=} contextM enuCallback 37 * @param {function(!WebInspector.ContextMenu, !WebInspector.DOMNode)=} contextM enuCallback
37 * @param {function(!DOMAgent.NodeId, string, boolean)=} setPseudoClassCallback 38 * @param {function(!WebInspector.DOMNode, string, boolean)=} setPseudoClassCall back
38 */ 39 */
39 WebInspector.ElementsTreeOutline = function(omitRootDOMNode, selectEnabled, cont extMenuCallback, setPseudoClassCallback) 40 WebInspector.ElementsTreeOutline = function(target, omitRootDOMNode, selectEnabl ed, contextMenuCallback, setPseudoClassCallback)
40 { 41 {
42 this._target = target;
43 this._domModel = target.domModel;
41 this.element = document.createElement("ol"); 44 this.element = document.createElement("ol");
42 this.element.className = "elements-tree-outline"; 45 this.element.className = "elements-tree-outline";
43 this.element.addEventListener("mousedown", this._onmousedown.bind(this), fal se); 46 this.element.addEventListener("mousedown", this._onmousedown.bind(this), fal se);
44 this.element.addEventListener("mousemove", this._onmousemove.bind(this), fal se); 47 this.element.addEventListener("mousemove", this._onmousemove.bind(this), fal se);
45 this.element.addEventListener("mouseout", this._onmouseout.bind(this), false ); 48 this.element.addEventListener("mouseout", this._onmouseout.bind(this), false );
46 this.element.addEventListener("dragstart", this._ondragstart.bind(this), fal se); 49 this.element.addEventListener("dragstart", this._ondragstart.bind(this), fal se);
47 this.element.addEventListener("dragover", this._ondragover.bind(this), false ); 50 this.element.addEventListener("dragover", this._ondragover.bind(this), false );
48 this.element.addEventListener("dragleave", this._ondragleave.bind(this), fal se); 51 this.element.addEventListener("dragleave", this._ondragleave.bind(this), fal se);
49 this.element.addEventListener("drop", this._ondrop.bind(this), false); 52 this.element.addEventListener("drop", this._ondrop.bind(this), false);
50 this.element.addEventListener("dragend", this._ondragend.bind(this), false); 53 this.element.addEventListener("dragend", this._ondragend.bind(this), false);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 "\u200f": "rlm", 96 "\u200f": "rlm",
94 "\u202a": "#8234", // LRE 97 "\u202a": "#8234", // LRE
95 "\u202b": "#8235", // RLE 98 "\u202b": "#8235", // RLE
96 "\u202c": "#8236", // PDF 99 "\u202c": "#8236", // PDF
97 "\u202d": "#8237", // LRO 100 "\u202d": "#8237", // LRO
98 "\u202e": "#8238" // RLO 101 "\u202e": "#8238" // RLO
99 } 102 }
100 103
101 WebInspector.ElementsTreeOutline.prototype = { 104 WebInspector.ElementsTreeOutline.prototype = {
102 /** 105 /**
106 * @return {!WebInspector.Target}
107 */
108 target: function()
109 {
110 return this._target;
111 },
112
113 /**
114 * @return {!WebInspector.DOMModel}
115 */
116 domModel: function()
117 {
118 return this._domModel;
119 },
120
121 /**
103 * @param {number} width 122 * @param {number} width
104 */ 123 */
105 setVisibleWidth: function(width) 124 setVisibleWidth: function(width)
106 { 125 {
107 this._visibleWidth = width; 126 this._visibleWidth = width;
108 if (this._multilineEditing) 127 if (this._multilineEditing)
109 this._multilineEditing.setWidth(this._visibleWidth); 128 this._multilineEditing.setWidth(this._visibleWidth);
110 }, 129 },
111 130
112 _createNodeDecorators: function() 131 _createNodeDecorators: function()
113 { 132 {
114 this._nodeDecorators = []; 133 this._nodeDecorators = [];
115 this._nodeDecorators.push(new WebInspector.ElementsTreeOutline.PseudoSta teDecorator()); 134 this._nodeDecorators.push(new WebInspector.ElementsTreeOutline.PseudoSta teDecorator());
116 }, 135 },
117 136
118 wireToDomAgent: function() 137 wireToDOMModel: function()
119 { 138 {
120 this._elementsTreeUpdater = new WebInspector.ElementsTreeUpdater(this); 139 this._elementsTreeUpdater = new WebInspector.ElementsTreeUpdater(this._t arget.domModel, this);
121 }, 140 },
122 141
123 /** 142 /**
124 * @param {boolean} visible 143 * @param {boolean} visible
125 */ 144 */
126 setVisible: function(visible) 145 setVisible: function(visible)
127 { 146 {
128 this._visible = visible; 147 this._visible = visible;
129 if (!this._visible) 148 if (!this._visible)
130 return; 149 return;
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 if (this._previousHoveredElement) { 409 if (this._previousHoveredElement) {
391 this._previousHoveredElement.hovered = false; 410 this._previousHoveredElement.hovered = false;
392 delete this._previousHoveredElement; 411 delete this._previousHoveredElement;
393 } 412 }
394 413
395 if (element) { 414 if (element) {
396 element.hovered = true; 415 element.hovered = true;
397 this._previousHoveredElement = element; 416 this._previousHoveredElement = element;
398 } 417 }
399 418
400 WebInspector.domModel.highlightDOMNode(element && element._node ? elemen t._node.id : 0); 419 if (element && element._node)
420 element._node.highlight();
421 else
422 this._domModel.hideDOMNodeHighlight();
401 }, 423 },
402 424
403 _onmouseout: function(event) 425 _onmouseout: function(event)
404 { 426 {
405 var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY) ; 427 var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY) ;
406 if (nodeUnderMouse && nodeUnderMouse.isDescendant(this.element)) 428 if (nodeUnderMouse && nodeUnderMouse.isDescendant(this.element))
407 return; 429 return;
408 430
409 if (this._previousHoveredElement) { 431 if (this._previousHoveredElement) {
410 this._previousHoveredElement.hovered = false; 432 this._previousHoveredElement.hovered = false;
411 delete this._previousHoveredElement; 433 delete this._previousHoveredElement;
412 } 434 }
413 435
414 WebInspector.domModel.hideDOMNodeHighlight(); 436 this._domModel.hideDOMNodeHighlight();
415 }, 437 },
416 438
417 _ondragstart: function(event) 439 _ondragstart: function(event)
418 { 440 {
419 if (!window.getSelection().isCollapsed) 441 if (!window.getSelection().isCollapsed)
420 return false; 442 return false;
421 if (event.target.nodeName === "A") 443 if (event.target.nodeName === "A")
422 return false; 444 return false;
423 445
424 var treeElement = this._treeElementFromEvent(event); 446 var treeElement = this._treeElementFromEvent(event);
425 if (!treeElement) 447 if (!treeElement)
426 return false; 448 return false;
427 449
428 if (!this._isValidDragSourceOrTarget(treeElement)) 450 if (!this._isValidDragSourceOrTarget(treeElement))
429 return false; 451 return false;
430 452
431 if (treeElement._node.nodeName() === "BODY" || treeElement._node.nodeNam e() === "HEAD") 453 if (treeElement._node.nodeName() === "BODY" || treeElement._node.nodeNam e() === "HEAD")
432 return false; 454 return false;
433 455
434 event.dataTransfer.setData("text/plain", treeElement.listItemElement.tex tContent); 456 event.dataTransfer.setData("text/plain", treeElement.listItemElement.tex tContent);
435 event.dataTransfer.effectAllowed = "copyMove"; 457 event.dataTransfer.effectAllowed = "copyMove";
436 this._treeElementBeingDragged = treeElement; 458 this._treeElementBeingDragged = treeElement;
437 459
438 WebInspector.domModel.hideDOMNodeHighlight(); 460 this._domModel.hideDOMNodeHighlight();
439 461
440 return true; 462 return true;
441 }, 463 },
442 464
443 _ondragover: function(event) 465 _ondragover: function(event)
444 { 466 {
445 if (!this._treeElementBeingDragged) 467 if (!this._treeElementBeingDragged)
446 return false; 468 return false;
447 469
448 var treeElement = this._treeElementFromEvent(event); 470 var treeElement = this._treeElementFromEvent(event);
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 * @param {!DOMAgent.NodeId=} nodeId 681 * @param {!DOMAgent.NodeId=} nodeId
660 */ 682 */
661 _selectNodeAfterEdit: function(wasExpanded, error, nodeId) 683 _selectNodeAfterEdit: function(wasExpanded, error, nodeId)
662 { 684 {
663 if (error) 685 if (error)
664 return; 686 return;
665 687
666 // Select it and expand if necessary. We force tree update so that it pr ocesses dom events and is up to date. 688 // Select it and expand if necessary. We force tree update so that it pr ocesses dom events and is up to date.
667 this._updateModifiedNodes(); 689 this._updateModifiedNodes();
668 690
669 var newNode = nodeId ? WebInspector.domModel.nodeForId(nodeId) : null; 691 var newNode = nodeId ? this._domModel.nodeForId(nodeId) : null;
670 if (!newNode) 692 if (!newNode)
671 return; 693 return;
672 694
673 this.selectDOMNode(newNode, true); 695 this.selectDOMNode(newNode, true);
674 696
675 var newTreeItem = this.findTreeElement(newNode); 697 var newTreeItem = this.findTreeElement(newNode);
676 if (wasExpanded) { 698 if (wasExpanded) {
677 if (newTreeItem) 699 if (newTreeItem)
678 newTreeItem.expand(); 700 newTreeItem.expand();
679 } 701 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 style.id = styleTagId; 746 style.id = styleTagId;
725 style.type = "text/css"; 747 style.type = "text/css";
726 style.textContent = styleRules; 748 style.textContent = styleRules;
727 document.head.appendChild(style); 749 document.head.appendChild(style);
728 } 750 }
729 751
730 object.callFunction(toggleClassAndInjectStyleRule, [{ value: pseudoT ype }], userCallback); 752 object.callFunction(toggleClassAndInjectStyleRule, [{ value: pseudoT ype }], userCallback);
731 object.release(); 753 object.release();
732 } 754 }
733 755
734 WebInspector.RemoteObject.resolveNode(effectiveNode, "", resolvedNode); 756 effectiveNode.resolveToObject("", resolvedNode);
735 }, 757 },
736 758
737 __proto__: TreeOutline.prototype 759 __proto__: TreeOutline.prototype
738 } 760 }
739 761
740 /** 762 /**
741 * @interface 763 * @interface
742 */ 764 */
743 WebInspector.ElementsTreeOutline.ElementDecorator = function() 765 WebInspector.ElementsTreeOutline.ElementDecorator = function()
744 { 766 {
(...skipping 19 matching lines...) Expand all
764 786
765 /** 787 /**
766 * @constructor 788 * @constructor
767 * @implements {WebInspector.ElementsTreeOutline.ElementDecorator} 789 * @implements {WebInspector.ElementsTreeOutline.ElementDecorator}
768 */ 790 */
769 WebInspector.ElementsTreeOutline.PseudoStateDecorator = function() 791 WebInspector.ElementsTreeOutline.PseudoStateDecorator = function()
770 { 792 {
771 WebInspector.ElementsTreeOutline.ElementDecorator.call(this); 793 WebInspector.ElementsTreeOutline.ElementDecorator.call(this);
772 } 794 }
773 795
774 WebInspector.ElementsTreeOutline.PseudoStateDecorator.PropertyName = "pseudoStat e";
775
776 WebInspector.ElementsTreeOutline.PseudoStateDecorator.prototype = { 796 WebInspector.ElementsTreeOutline.PseudoStateDecorator.prototype = {
777 /** 797 /**
778 * @param {!WebInspector.DOMNode} node 798 * @param {!WebInspector.DOMNode} node
779 * @return {?string} 799 * @return {?string}
780 */ 800 */
781 decorate: function(node) 801 decorate: function(node)
782 { 802 {
783 if (node.nodeType() !== Node.ELEMENT_NODE) 803 if (node.nodeType() !== Node.ELEMENT_NODE)
784 return null; 804 return null;
785 var propertyValue = node.getUserProperty(WebInspector.ElementsTreeOutlin e.PseudoStateDecorator.PropertyName); 805 var propertyValue = node.getUserProperty(WebInspector.CSSStyleModel.Pseu doStatePropertyName);
786 if (!propertyValue) 806 if (!propertyValue)
787 return null; 807 return null;
788 return WebInspector.UIString("Element state: %s", ":" + propertyValue.jo in(", :")); 808 return WebInspector.UIString("Element state: %s", ":" + propertyValue.jo in(", :"));
789 }, 809 },
790 810
791 /** 811 /**
792 * @param {!WebInspector.DOMNode} node 812 * @param {!WebInspector.DOMNode} node
793 * @return {?string} 813 * @return {?string}
794 */ 814 */
795 decorateAncestor: function(node) 815 decorateAncestor: function(node)
796 { 816 {
797 if (node.nodeType() !== Node.ELEMENT_NODE) 817 if (node.nodeType() !== Node.ELEMENT_NODE)
798 return null; 818 return null;
799 819
800 var descendantCount = node.descendantUserPropertyCount(WebInspector.Elem entsTreeOutline.PseudoStateDecorator.PropertyName); 820 var descendantCount = node.descendantUserPropertyCount(WebInspector.CSSS tyleModel.PseudoStatePropertyName);
801 if (!descendantCount) 821 if (!descendantCount)
802 return null; 822 return null;
803 if (descendantCount === 1) 823 if (descendantCount === 1)
804 return WebInspector.UIString("%d descendant with forced state", desc endantCount); 824 return WebInspector.UIString("%d descendant with forced state", desc endantCount);
805 return WebInspector.UIString("%d descendants with forced state", descend antCount); 825 return WebInspector.UIString("%d descendants with forced state", descend antCount);
806 } 826 }
807 } 827 }
808 828
809 /** 829 /**
810 * @constructor 830 * @constructor
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 /** 1265 /**
1246 * @override 1266 * @override
1247 * @param {boolean=} selectedByUser 1267 * @param {boolean=} selectedByUser
1248 * @return {boolean} 1268 * @return {boolean}
1249 */ 1269 */
1250 onselect: function(selectedByUser) 1270 onselect: function(selectedByUser)
1251 { 1271 {
1252 this.treeOutline.suppressRevealAndSelect = true; 1272 this.treeOutline.suppressRevealAndSelect = true;
1253 this.treeOutline.selectDOMNode(this._node, selectedByUser); 1273 this.treeOutline.selectDOMNode(this._node, selectedByUser);
1254 if (selectedByUser) 1274 if (selectedByUser)
1255 WebInspector.domModel.highlightDOMNode(this._node.id); 1275 this._node.highlight();
1256 this.updateSelection(); 1276 this.updateSelection();
1257 this.treeOutline.suppressRevealAndSelect = false; 1277 this.treeOutline.suppressRevealAndSelect = false;
1258 return true; 1278 return true;
1259 }, 1279 },
1260 1280
1261 /** 1281 /**
1262 * @override 1282 * @override
1263 * @return {boolean} 1283 * @return {boolean}
1264 */ 1284 */
1265 ondelete: function() 1285 ondelete: function()
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Scroll into view" : "Scroll into View"), this._scrollIntoView.bind (this)); 1424 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Scroll into view" : "Scroll into View"), this._scrollIntoView.bind (this));
1405 }, 1425 },
1406 1426
1407 _populateForcedPseudoStateItems: function(subMenu) 1427 _populateForcedPseudoStateItems: function(subMenu)
1408 { 1428 {
1409 const pseudoClasses = ["active", "hover", "focus", "visited"]; 1429 const pseudoClasses = ["active", "hover", "focus", "visited"];
1410 var node = this._node; 1430 var node = this._node;
1411 var forcedPseudoState = (node ? node.getUserProperty("pseudoState") : nu ll) || []; 1431 var forcedPseudoState = (node ? node.getUserProperty("pseudoState") : nu ll) || [];
1412 for (var i = 0; i < pseudoClasses.length; ++i) { 1432 for (var i = 0; i < pseudoClasses.length; ++i) {
1413 var pseudoClassForced = forcedPseudoState.indexOf(pseudoClasses[i]) >= 0; 1433 var pseudoClassForced = forcedPseudoState.indexOf(pseudoClasses[i]) >= 0;
1414 subMenu.appendCheckboxItem(":" + pseudoClasses[i], this.treeOutline. _setPseudoClassCallback.bind(null, node.id, pseudoClasses[i], !pseudoClassForced ), pseudoClassForced, false); 1434 subMenu.appendCheckboxItem(":" + pseudoClasses[i], this.treeOutline. _setPseudoClassCallback.bind(null, node, pseudoClasses[i], !pseudoClassForced), pseudoClassForced, false);
1415 } 1435 }
1416 }, 1436 },
1417 1437
1418 _populateTextContextMenu: function(contextMenu, textNode) 1438 _populateTextContextMenu: function(contextMenu, textNode)
1419 { 1439 {
1420 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Edit text" : "Edit Text"), this._startEditingTextNode.bind(this, t extNode)); 1440 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Edit text" : "Edit Text"), this._startEditingTextNode.bind(this, t extNode));
1421 this._populateNodeContextMenu(contextMenu); 1441 this._populateNodeContextMenu(contextMenu);
1422 }, 1442 },
1423 1443
1424 _populateNodeContextMenu: function(contextMenu) 1444 _populateNodeContextMenu: function(contextMenu)
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
2369 */ 2389 */
2370 function scrollIntoView() 2390 function scrollIntoView()
2371 { 2391 {
2372 this.scrollIntoViewIfNeeded(true); 2392 this.scrollIntoViewIfNeeded(true);
2373 } 2393 }
2374 2394
2375 if (object) 2395 if (object)
2376 object.callFunction(scrollIntoView); 2396 object.callFunction(scrollIntoView);
2377 } 2397 }
2378 2398
2379 WebInspector.RemoteObject.resolveNode(this._node, "", scrollIntoViewCall back); 2399 this._node.resolveToObject("", scrollIntoViewCallback);
2380 }, 2400 },
2381 2401
2382 /** 2402 /**
2383 * @return {!Array.<!WebInspector.DOMModel>} 2403 * @return {!Array.<!WebInspector.DOMModel>}
2384 */ 2404 */
2385 _visibleShadowRoots: function() 2405 _visibleShadowRoots: function()
2386 { 2406 {
2387 var roots = this._node.shadowRoots(); 2407 var roots = this._node.shadowRoots();
2388 if (roots.length && !WebInspector.settings.showUAShadowDOM.get()) { 2408 if (roots.length && !WebInspector.settings.showUAShadowDOM.get()) {
2389 roots = roots.filter(function(root) { 2409 roots = roots.filter(function(root) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2431 _updateHasChildren: function() 2451 _updateHasChildren: function()
2432 { 2452 {
2433 this.hasChildren = !this._elementCloseTag && !this._showInlineText() && this._visibleChildCount() > 0; 2453 this.hasChildren = !this._elementCloseTag && !this._showInlineText() && this._visibleChildCount() > 0;
2434 }, 2454 },
2435 2455
2436 __proto__: TreeElement.prototype 2456 __proto__: TreeElement.prototype
2437 } 2457 }
2438 2458
2439 /** 2459 /**
2440 * @constructor 2460 * @constructor
2461 * @param {!WebInspector.DOMModel} domModel
2441 * @param {!WebInspector.ElementsTreeOutline} treeOutline 2462 * @param {!WebInspector.ElementsTreeOutline} treeOutline
2442 */ 2463 */
2443 WebInspector.ElementsTreeUpdater = function(treeOutline) 2464 WebInspector.ElementsTreeUpdater = function(domModel, treeOutline)
2444 { 2465 {
2445 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.NodeInse rted, this._nodeInserted, this); 2466 domModel.addEventListener(WebInspector.DOMModel.Events.NodeInserted, this._n odeInserted, this);
2446 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.NodeRemo ved, this._nodeRemoved, this); 2467 domModel.addEventListener(WebInspector.DOMModel.Events.NodeRemoved, this._no deRemoved, this);
2447 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.AttrModi fied, this._attributesUpdated, this); 2468 domModel.addEventListener(WebInspector.DOMModel.Events.AttrModified, this._a ttributesUpdated, this);
2448 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.AttrRemo ved, this._attributesUpdated, this); 2469 domModel.addEventListener(WebInspector.DOMModel.Events.AttrRemoved, this._at tributesUpdated, this);
2449 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.Characte rDataModified, this._characterDataModified, this); 2470 domModel.addEventListener(WebInspector.DOMModel.Events.CharacterDataModified , this._characterDataModified, this);
2450 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.Document Updated, this._documentUpdated, this); 2471 domModel.addEventListener(WebInspector.DOMModel.Events.DocumentUpdated, this ._documentUpdated, this);
2451 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.ChildNod eCountUpdated, this._childNodeCountUpdated, this); 2472 domModel.addEventListener(WebInspector.DOMModel.Events.ChildNodeCountUpdated , this._childNodeCountUpdated, this);
2452 2473
2474 this._domModel = domModel;
2453 this._treeOutline = treeOutline; 2475 this._treeOutline = treeOutline;
2454 /** @type {!Map.<!WebInspector.DOMNode, !WebInspector.ElementsTreeUpdater.Up dateEntry>} */ 2476 /** @type {!Map.<!WebInspector.DOMNode, !WebInspector.ElementsTreeUpdater.Up dateEntry>} */
2455 this._recentlyModifiedNodes = new Map(); 2477 this._recentlyModifiedNodes = new Map();
2456 } 2478 }
2457 2479
2458 WebInspector.ElementsTreeUpdater.prototype = { 2480 WebInspector.ElementsTreeUpdater.prototype = {
2459 /** 2481 /**
2460 * @param {!WebInspector.DOMNode} node 2482 * @param {!WebInspector.DOMNode} node
2461 * @param {boolean} isUpdated 2483 * @param {boolean} isUpdated
2462 * @param {!WebInspector.DOMNode=} parentNode 2484 * @param {!WebInspector.DOMNode=} parentNode
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2582 } 2604 }
2583 this._recentlyModifiedNodes.clear(); 2605 this._recentlyModifiedNodes.clear();
2584 2606
2585 this._treeOutline._fireElementsTreeUpdated(nodes); 2607 this._treeOutline._fireElementsTreeUpdated(nodes);
2586 }, 2608 },
2587 2609
2588 _reset: function() 2610 _reset: function()
2589 { 2611 {
2590 this._treeOutline.rootDOMNode = null; 2612 this._treeOutline.rootDOMNode = null;
2591 this._treeOutline.selectDOMNode(null, false); 2613 this._treeOutline.selectDOMNode(null, false);
2592 WebInspector.domModel.hideDOMNodeHighlight(); 2614 this._domModel.hideDOMNodeHighlight();
2593 this._recentlyModifiedNodes.clear(); 2615 this._recentlyModifiedNodes.clear();
2594 } 2616 }
2595 } 2617 }
2596 2618
2597 /** 2619 /**
2598 * @constructor 2620 * @constructor
2599 * @param {boolean} isUpdated 2621 * @param {boolean} isUpdated
2600 * @param {!WebInspector.DOMNode=} parent 2622 * @param {!WebInspector.DOMNode=} parent
2601 */ 2623 */
2602 WebInspector.ElementsTreeUpdater.UpdateEntry = function(isUpdated, parent) 2624 WebInspector.ElementsTreeUpdater.UpdateEntry = function(isUpdated, parent)
(...skipping 13 matching lines...) Expand all
2616 2638
2617 WebInspector.ElementsTreeOutline.Renderer.prototype = { 2639 WebInspector.ElementsTreeOutline.Renderer.prototype = {
2618 /** 2640 /**
2619 * @param {!Object} object 2641 * @param {!Object} object
2620 * @return {?Element} 2642 * @return {?Element}
2621 */ 2643 */
2622 render: function(object) 2644 render: function(object)
2623 { 2645 {
2624 if (!(object instanceof WebInspector.DOMNode)) 2646 if (!(object instanceof WebInspector.DOMNode))
2625 return null; 2647 return null;
2626 var treeOutline = new WebInspector.ElementsTreeOutline(false, false); 2648 var node = /** @type {!WebInspector.DOMNode} */ (object);
2627 treeOutline.rootDOMNode = /** @type {!WebInspector.DOMNode} */ (object); 2649 var treeOutline = new WebInspector.ElementsTreeOutline(node.target(), fa lse, false);
2650 treeOutline.rootDOMNode = node;
2628 treeOutline.element.classList.add("outline-disclosure"); 2651 treeOutline.element.classList.add("outline-disclosure");
2629 if (!treeOutline.children[0].hasChildren) 2652 if (!treeOutline.children[0].hasChildren)
2630 treeOutline.element.classList.add("single-node"); 2653 treeOutline.element.classList.add("single-node");
2631 treeOutline.setVisible(true); 2654 treeOutline.setVisible(true);
2632 treeOutline.element.treeElementForTest = treeOutline.children[0]; 2655 treeOutline.element.treeElementForTest = treeOutline.children[0];
2633 return treeOutline.element; 2656 return treeOutline.element;
2634 } 2657 }
2635 } 2658 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/ElementsPanel.js ('k') | Source/devtools/front_end/EventListenersSidebarPane.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698