| 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 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * @unrestricted | 30 * @unrestricted |
| 31 */ | 31 */ |
| 32 var TreeOutline = class extends WebInspector.Object { | 32 var TreeOutline = class extends Common.Object { |
| 33 /** | 33 /** |
| 34 * @param {boolean=} nonFocusable | 34 * @param {boolean=} nonFocusable |
| 35 */ | 35 */ |
| 36 constructor(nonFocusable) { | 36 constructor(nonFocusable) { |
| 37 super(); | 37 super(); |
| 38 this._createRootElement(); | 38 this._createRootElement(); |
| 39 | 39 |
| 40 this.selectedTreeElement = null; | 40 this.selectedTreeElement = null; |
| 41 this.expandTreeElementsWhenArrowing = false; | 41 this.expandTreeElementsWhenArrowing = false; |
| 42 /** @type {?function(!TreeElement, !TreeElement):number} */ | 42 /** @type {?function(!TreeElement, !TreeElement):number} */ |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 if (!this.selectedTreeElement.revealed()) { | 217 if (!this.selectedTreeElement.revealed()) { |
| 218 this.selectedTreeElement.reveal(); | 218 this.selectedTreeElement.reveal(); |
| 219 handled = true; | 219 handled = true; |
| 220 } else { | 220 } else { |
| 221 handled = this.selectedTreeElement.descendOrExpand(event.altKey); | 221 handled = this.selectedTreeElement.descendOrExpand(event.altKey); |
| 222 } | 222 } |
| 223 } else if (event.keyCode === 8 /* Backspace */ || event.keyCode === 46 /* De
lete */) | 223 } else if (event.keyCode === 8 /* Backspace */ || event.keyCode === 46 /* De
lete */) |
| 224 handled = this.selectedTreeElement.ondelete(); | 224 handled = this.selectedTreeElement.ondelete(); |
| 225 else if (isEnterKey(event)) | 225 else if (isEnterKey(event)) |
| 226 handled = this.selectedTreeElement.onenter(); | 226 handled = this.selectedTreeElement.onenter(); |
| 227 else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Space.code) | 227 else if (event.keyCode === UI.KeyboardShortcut.Keys.Space.code) |
| 228 handled = this.selectedTreeElement.onspace(); | 228 handled = this.selectedTreeElement.onspace(); |
| 229 | 229 |
| 230 if (handled) | 230 if (handled) |
| 231 event.consume(true); | 231 event.consume(true); |
| 232 } | 232 } |
| 233 | 233 |
| 234 /** | 234 /** |
| 235 * @param {!TreeElement} treeElement | 235 * @param {!TreeElement} treeElement |
| 236 * @param {boolean} center | 236 * @param {boolean} center |
| 237 */ | 237 */ |
| (...skipping 24 matching lines...) Expand all Loading... |
| 262 /** | 262 /** |
| 263 * @unrestricted | 263 * @unrestricted |
| 264 */ | 264 */ |
| 265 var TreeOutlineInShadow = class extends TreeOutline { | 265 var TreeOutlineInShadow = class extends TreeOutline { |
| 266 constructor() { | 266 constructor() { |
| 267 super(); | 267 super(); |
| 268 this.contentElement.classList.add('tree-outline'); | 268 this.contentElement.classList.add('tree-outline'); |
| 269 | 269 |
| 270 // Redefine element to the external one. | 270 // Redefine element to the external one. |
| 271 this.element = createElement('div'); | 271 this.element = createElement('div'); |
| 272 this._shadowRoot = WebInspector.createShadowRootWithCoreStyles(this.element,
'ui/treeoutline.css'); | 272 this._shadowRoot = UI.createShadowRootWithCoreStyles(this.element, 'ui/treeo
utline.css'); |
| 273 this._disclosureElement = this._shadowRoot.createChild('div', 'tree-outline-
disclosure'); | 273 this._disclosureElement = this._shadowRoot.createChild('div', 'tree-outline-
disclosure'); |
| 274 this._disclosureElement.appendChild(this.contentElement); | 274 this._disclosureElement.appendChild(this.contentElement); |
| 275 this._renderSelection = true; | 275 this._renderSelection = true; |
| 276 } | 276 } |
| 277 | 277 |
| 278 /** | 278 /** |
| 279 * @param {string} cssFile | 279 * @param {string} cssFile |
| 280 */ | 280 */ |
| 281 registerRequiredCSS(cssFile) { | 281 registerRequiredCSS(cssFile) { |
| 282 WebInspector.appendStyle(this._shadowRoot, cssFile); | 282 UI.appendStyle(this._shadowRoot, cssFile); |
| 283 } | 283 } |
| 284 | 284 |
| 285 hideOverflow() { | 285 hideOverflow() { |
| 286 this._disclosureElement.classList.add('tree-outline-disclosure-hide-overflow
'); | 286 this._disclosureElement.classList.add('tree-outline-disclosure-hide-overflow
'); |
| 287 } | 287 } |
| 288 | 288 |
| 289 makeDense() { | 289 makeDense() { |
| 290 this.contentElement.classList.add('tree-outline-dense'); | 290 this.contentElement.classList.add('tree-outline-dense'); |
| 291 } | 291 } |
| 292 }; | 292 }; |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 */ | 592 */ |
| 593 titleAsText() { | 593 titleAsText() { |
| 594 if (!this._title) | 594 if (!this._title) |
| 595 return ''; | 595 return ''; |
| 596 if (typeof this._title === 'string') | 596 if (typeof this._title === 'string') |
| 597 return this._title; | 597 return this._title; |
| 598 return this._title.textContent; | 598 return this._title.textContent; |
| 599 } | 599 } |
| 600 | 600 |
| 601 /** | 601 /** |
| 602 * @param {!WebInspector.InplaceEditor.Config} editingConfig | 602 * @param {!UI.InplaceEditor.Config} editingConfig |
| 603 */ | 603 */ |
| 604 startEditingTitle(editingConfig) { | 604 startEditingTitle(editingConfig) { |
| 605 WebInspector.InplaceEditor.startEditing(this._titleElement, editingConfig); | 605 UI.InplaceEditor.startEditing(this._titleElement, editingConfig); |
| 606 this.treeOutline._shadowRoot.getSelection().setBaseAndExtent(this._titleElem
ent, 0, this._titleElement, 1); | 606 this.treeOutline._shadowRoot.getSelection().setBaseAndExtent(this._titleElem
ent, 0, this._titleElement, 1); |
| 607 } | 607 } |
| 608 | 608 |
| 609 createIcon() { | 609 createIcon() { |
| 610 if (!this._iconElement) { | 610 if (!this._iconElement) { |
| 611 this._iconElement = createElementWithClass('div', 'icon'); | 611 this._iconElement = createElementWithClass('div', 'icon'); |
| 612 this._listItemNode.insertBefore(this._iconElement, this._listItemNode.firs
tChild); | 612 this._listItemNode.insertBefore(this._iconElement, this._listItemNode.firs
tChild); |
| 613 this._ensureSelection(); | 613 this._ensureSelection(); |
| 614 } | 614 } |
| 615 } | 615 } |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1113 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddingLe
ft; | 1113 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddingLe
ft; |
| 1114 console.assert(paddingLeftValue.endsWith('px')); | 1114 console.assert(paddingLeftValue.endsWith('px')); |
| 1115 var computedLeftPadding = parseFloat(paddingLeftValue); | 1115 var computedLeftPadding = parseFloat(paddingLeftValue); |
| 1116 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; | 1116 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; |
| 1117 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowToggle
Width && this._expandable; | 1117 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowToggle
Width && this._expandable; |
| 1118 } | 1118 } |
| 1119 }; | 1119 }; |
| 1120 | 1120 |
| 1121 /** @const */ | 1121 /** @const */ |
| 1122 TreeElement._ArrowToggleWidth = 10; | 1122 TreeElement._ArrowToggleWidth = 10; |
| OLD | NEW |