| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 this.element = this.contentElement; | 48 this.element = this.contentElement; |
| 49 } | 49 } |
| 50 | 50 |
| 51 /** @enum {symbol} */ | 51 /** @enum {symbol} */ |
| 52 TreeOutline.Events = { | 52 TreeOutline.Events = { |
| 53 ElementAttached: Symbol("ElementAttached"), | 53 ElementAttached: Symbol("ElementAttached"), |
| 54 ElementExpanded: Symbol("ElementExpanded"), | 54 ElementExpanded: Symbol("ElementExpanded"), |
| 55 ElementCollapsed: Symbol("ElementCollapsed"), | 55 ElementCollapsed: Symbol("ElementCollapsed"), |
| 56 ElementSelected: Symbol("ElementSelected") | 56 ElementSelected: Symbol("ElementSelected") |
| 57 } | 57 }; |
| 58 | 58 |
| 59 TreeOutline.prototype = { | 59 TreeOutline.prototype = { |
| 60 _createRootElement: function() | 60 _createRootElement: function() |
| 61 { | 61 { |
| 62 this._rootElement = new TreeElement(); | 62 this._rootElement = new TreeElement(); |
| 63 this._rootElement.treeOutline = this; | 63 this._rootElement.treeOutline = this; |
| 64 this._rootElement.root = true; | 64 this._rootElement.root = true; |
| 65 this._rootElement.selectable = false; | 65 this._rootElement.selectable = false; |
| 66 this._rootElement.expanded = true; | 66 this._rootElement.expanded = true; |
| 67 this._rootElement._childrenListNode.classList.remove("children"); | 67 this._rootElement._childrenListNode.classList.remove("children"); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 */ | 302 */ |
| 303 function deferredScrollIntoView() | 303 function deferredScrollIntoView() |
| 304 { | 304 { |
| 305 this._treeElementToScrollIntoView.listItemElement.scrollIntoViewIfNe
eded(this._centerUponScrollIntoView); | 305 this._treeElementToScrollIntoView.listItemElement.scrollIntoViewIfNe
eded(this._centerUponScrollIntoView); |
| 306 delete this._treeElementToScrollIntoView; | 306 delete this._treeElementToScrollIntoView; |
| 307 delete this._centerUponScrollIntoView; | 307 delete this._centerUponScrollIntoView; |
| 308 } | 308 } |
| 309 }, | 309 }, |
| 310 | 310 |
| 311 __proto__: WebInspector.Object.prototype | 311 __proto__: WebInspector.Object.prototype |
| 312 } | 312 }; |
| 313 | 313 |
| 314 /** | 314 /** |
| 315 * @constructor | 315 * @constructor |
| 316 * @extends {TreeOutline} | 316 * @extends {TreeOutline} |
| 317 */ | 317 */ |
| 318 function TreeOutlineInShadow() | 318 function TreeOutlineInShadow() |
| 319 { | 319 { |
| 320 TreeOutline.call(this); | 320 TreeOutline.call(this); |
| 321 this.contentElement.classList.add("tree-outline"); | 321 this.contentElement.classList.add("tree-outline"); |
| 322 | 322 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 341 { | 341 { |
| 342 this._disclosureElement.classList.add("tree-outline-disclosure-hide-over
flow"); | 342 this._disclosureElement.classList.add("tree-outline-disclosure-hide-over
flow"); |
| 343 }, | 343 }, |
| 344 | 344 |
| 345 makeDense: function() | 345 makeDense: function() |
| 346 { | 346 { |
| 347 this.contentElement.classList.add("tree-outline-dense"); | 347 this.contentElement.classList.add("tree-outline-dense"); |
| 348 }, | 348 }, |
| 349 | 349 |
| 350 __proto__: TreeOutline.prototype | 350 __proto__: TreeOutline.prototype |
| 351 } | 351 }; |
| 352 | 352 |
| 353 /** | 353 /** |
| 354 * @constructor | 354 * @constructor |
| 355 * @param {(string|!Node)=} title | 355 * @param {(string|!Node)=} title |
| 356 * @param {boolean=} expandable | 356 * @param {boolean=} expandable |
| 357 */ | 357 */ |
| 358 function TreeElement(title, expandable) | 358 function TreeElement(title, expandable) |
| 359 { | 359 { |
| 360 /** @type {?TreeOutline} */ | 360 /** @type {?TreeOutline} */ |
| 361 this.treeOutline = null; | 361 this.treeOutline = null; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 this.removeChildAtIndex(childIndex); | 585 this.removeChildAtIndex(childIndex); |
| 586 }, | 586 }, |
| 587 | 587 |
| 588 removeChildren: function() | 588 removeChildren: function() |
| 589 { | 589 { |
| 590 if (!this.root && this.treeOutline && this.treeOutline.selectedTreeEleme
nt && this.treeOutline.selectedTreeElement.hasAncestorOrSelf(this)) | 590 if (!this.root && this.treeOutline && this.treeOutline.selectedTreeEleme
nt && this.treeOutline.selectedTreeElement.hasAncestorOrSelf(this)) |
| 591 this.select(true); | 591 this.select(true); |
| 592 | 592 |
| 593 for (var i = 0; this._children && i < this._children.length; ++i) { | 593 for (var i = 0; this._children && i < this._children.length; ++i) { |
| 594 var child = this._children[i]; | 594 var child = this._children[i]; |
| 595 child.previousSibling = null | 595 child.previousSibling = null; |
| 596 child.nextSibling = null; | 596 child.nextSibling = null; |
| 597 child.parent = null; | 597 child.parent = null; |
| 598 | 598 |
| 599 if (this.treeOutline) | 599 if (this.treeOutline) |
| 600 this.treeOutline._unbindTreeElement(child); | 600 this.treeOutline._unbindTreeElement(child); |
| 601 for (var current = child.firstChild(); this.treeOutline && current;
current = current.traverseNextTreeElement(false, child, true)) | 601 for (var current = child.firstChild(); this.treeOutline && current;
current = current.traverseNextTreeElement(false, child, true)) |
| 602 this.treeOutline._unbindTreeElement(current); | 602 this.treeOutline._unbindTreeElement(current); |
| 603 child._detach(); | 603 child._detach(); |
| 604 } | 604 } |
| 605 this._children = []; | 605 this._children = []; |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 */ | 1150 */ |
| 1151 isEventWithinDisclosureTriangle: function(event) | 1151 isEventWithinDisclosureTriangle: function(event) |
| 1152 { | 1152 { |
| 1153 // FIXME: We should not use getComputedStyle(). For that we need to get
rid of using ::before for disclosure triangle. (http://webk.it/74446) | 1153 // FIXME: We should not use getComputedStyle(). For that we need to get
rid of using ::before for disclosure triangle. (http://webk.it/74446) |
| 1154 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi
ngLeft; | 1154 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi
ngLeft; |
| 1155 console.assert(paddingLeftValue.endsWith("px")); | 1155 console.assert(paddingLeftValue.endsWith("px")); |
| 1156 var computedLeftPadding = parseFloat(paddingLeftValue); | 1156 var computedLeftPadding = parseFloat(paddingLeftValue); |
| 1157 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; | 1157 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; |
| 1158 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo
ggleWidth && this._expandable; | 1158 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo
ggleWidth && this._expandable; |
| 1159 } | 1159 } |
| 1160 } | 1160 }; |
| OLD | NEW |