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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js

Issue 2660893002: DevTools: migrate ResourcesPanel icons over to UI.Icon (Closed)
Patch Set: resourceicon-* into mediumicon-* Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/inspectorCommon.css ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 604
605 if (typeof x === 'string') { 605 if (typeof x === 'string') {
606 this._titleElement.textContent = x; 606 this._titleElement.textContent = x;
607 this.tooltip = x; 607 this.tooltip = x;
608 } else { 608 } else {
609 this._titleElement = x; 609 this._titleElement = x;
610 this.tooltip = ''; 610 this.tooltip = '';
611 } 611 }
612 612
613 this._listItemNode.removeChildren(); 613 this._listItemNode.removeChildren();
614 if (this._iconElement)
615 this._listItemNode.appendChild(this._iconElement);
616 if (this._leadingIconsElement) 614 if (this._leadingIconsElement)
617 this._listItemNode.appendChild(this._leadingIconsElement); 615 this._listItemNode.appendChild(this._leadingIconsElement);
618 this._listItemNode.appendChild(this._titleElement); 616 this._listItemNode.appendChild(this._titleElement);
619 if (this._trailingIconsElement) 617 if (this._trailingIconsElement)
620 this._listItemNode.appendChild(this._trailingIconsElement); 618 this._listItemNode.appendChild(this._trailingIconsElement);
621 this._ensureSelection(); 619 this._ensureSelection();
622 } 620 }
623 621
624 /** 622 /**
625 * @return {string} 623 * @return {string}
626 */ 624 */
627 titleAsText() { 625 titleAsText() {
628 if (!this._title) 626 if (!this._title)
629 return ''; 627 return '';
630 if (typeof this._title === 'string') 628 if (typeof this._title === 'string')
631 return this._title; 629 return this._title;
632 return this._title.textContent; 630 return this._title.textContent;
633 } 631 }
634 632
635 /** 633 /**
636 * @param {!UI.InplaceEditor.Config} editingConfig 634 * @param {!UI.InplaceEditor.Config} editingConfig
637 */ 635 */
638 startEditingTitle(editingConfig) { 636 startEditingTitle(editingConfig) {
639 UI.InplaceEditor.startEditing(this._titleElement, editingConfig); 637 UI.InplaceEditor.startEditing(this._titleElement, editingConfig);
640 this.treeOutline._shadowRoot.getSelection().setBaseAndExtent(this._titleElem ent, 0, this._titleElement, 1); 638 this.treeOutline._shadowRoot.getSelection().setBaseAndExtent(this._titleElem ent, 0, this._titleElement, 1);
641 } 639 }
642 640
643 createIcon() {
644 if (!this._iconElement) {
645 this._iconElement = createElementWithClass('div', 'icon');
646 this._listItemNode.insertBefore(this._iconElement, this._listItemNode.firs tChild);
647 this._ensureSelection();
648 }
649 }
650
651 /** 641 /**
652 * @param {!Array<!UI.Icon>} icons 642 * @param {!Array<!UI.Icon>} icons
653 */ 643 */
654 setLeadingIcons(icons) { 644 setLeadingIcons(icons) {
655 if (!this._leadingIconsElement && !icons.length) 645 if (!this._leadingIconsElement && !icons.length)
656 return; 646 return;
657 if (!this._leadingIconsElement) { 647 if (!this._leadingIconsElement) {
658 this._leadingIconsElement = createElementWithClass('div', 'leading-icons') ; 648 this._leadingIconsElement = createElementWithClass('div', 'leading-icons') ;
659 this._leadingIconsElement.classList.add('icons-container'); 649 this._leadingIconsElement.classList.add('icons-container');
660 this._listItemNode.insertBefore(this._leadingIconsElement, this._titleElem ent); 650 this._listItemNode.insertBefore(this._leadingIconsElement, this._titleElem ent);
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddingLe ft; 1194 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddingLe ft;
1205 console.assert(paddingLeftValue.endsWith('px')); 1195 console.assert(paddingLeftValue.endsWith('px'));
1206 var computedLeftPadding = parseFloat(paddingLeftValue); 1196 var computedLeftPadding = parseFloat(paddingLeftValue);
1207 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; 1197 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding;
1208 return event.pageX >= left && event.pageX <= left + UI.TreeElement._ArrowTog gleWidth && this._expandable; 1198 return event.pageX >= left && event.pageX <= left + UI.TreeElement._ArrowTog gleWidth && this._expandable;
1209 } 1199 }
1210 }; 1200 };
1211 1201
1212 /** @const */ 1202 /** @const */
1213 UI.TreeElement._ArrowToggleWidth = 10; 1203 UI.TreeElement._ArrowToggleWidth = 10;
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/inspectorCommon.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698