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

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

Issue 2580163002: DevTools: migrate navigator icons to UI.Icon (Closed)
Patch Set: address comments Created 3 years, 12 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/treeoutline.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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 this._titleElement.textContent = x; 595 this._titleElement.textContent = x;
596 this.tooltip = x; 596 this.tooltip = x;
597 } else { 597 } else {
598 this._titleElement = x; 598 this._titleElement = x;
599 this.tooltip = ''; 599 this.tooltip = '';
600 } 600 }
601 601
602 this._listItemNode.removeChildren(); 602 this._listItemNode.removeChildren();
603 if (this._iconElement) 603 if (this._iconElement)
604 this._listItemNode.appendChild(this._iconElement); 604 this._listItemNode.appendChild(this._iconElement);
605 605 if (this._leadingIconsElement)
606 this._listItemNode.appendChild(this._leadingIconsElement);
606 this._listItemNode.appendChild(this._titleElement); 607 this._listItemNode.appendChild(this._titleElement);
607 if (this._trailingIconsElement) 608 if (this._trailingIconsElement)
608 this._listItemNode.appendChild(this._trailingIconsElement); 609 this._listItemNode.appendChild(this._trailingIconsElement);
609 this._ensureSelection(); 610 this._ensureSelection();
610 } 611 }
611 612
612 /** 613 /**
613 * @return {string} 614 * @return {string}
614 */ 615 */
615 titleAsText() { 616 titleAsText() {
(...skipping 16 matching lines...) Expand all
632 if (!this._iconElement) { 633 if (!this._iconElement) {
633 this._iconElement = createElementWithClass('div', 'icon'); 634 this._iconElement = createElementWithClass('div', 'icon');
634 this._listItemNode.insertBefore(this._iconElement, this._listItemNode.firs tChild); 635 this._listItemNode.insertBefore(this._iconElement, this._listItemNode.firs tChild);
635 this._ensureSelection(); 636 this._ensureSelection();
636 } 637 }
637 } 638 }
638 639
639 /** 640 /**
640 * @param {!Array<!UI.Icon>} icons 641 * @param {!Array<!UI.Icon>} icons
641 */ 642 */
643 setLeadingIcons(icons) {
644 if (!this._leadingIconsElement && !icons.length)
645 return;
646 if (!this._leadingIconsElement) {
647 this._leadingIconsElement = createElementWithClass('div', 'leading-icons') ;
648 this._leadingIconsElement.classList.add('icons-container');
649 this._listItemNode.insertBefore(this._leadingIconsElement, this._titleElem ent);
650 this._ensureSelection();
651 }
652 this._leadingIconsElement.removeChildren();
653 for (var icon of icons)
654 this._leadingIconsElement.appendChild(icon);
655 }
656
657 /**
658 * @param {!Array<!UI.Icon>} icons
659 */
642 setTrailingIcons(icons) { 660 setTrailingIcons(icons) {
643 if (!this._trailingIconsElement && !icons.length) 661 if (!this._trailingIconsElement && !icons.length)
644 return; 662 return;
645 if (!this._trailingIconsElement) { 663 if (!this._trailingIconsElement) {
646 this._trailingIconsElement = createElementWithClass('div', 'icons-containe r'); 664 this._trailingIconsElement = createElementWithClass('div', 'trailing-icons ');
665 this._trailingIconsElement.classList.add('icons-container');
647 this._listItemNode.appendChild(this._trailingIconsElement); 666 this._listItemNode.appendChild(this._trailingIconsElement);
648 this._ensureSelection(); 667 this._ensureSelection();
649 } 668 }
650 this._trailingIconsElement.removeChildren(); 669 this._trailingIconsElement.removeChildren();
651 for (var icon of icons) 670 for (var icon of icons)
652 this._trailingIconsElement.appendChild(icon); 671 this._trailingIconsElement.appendChild(icon);
653 } 672 }
654 673
655 /** 674 /**
656 * @param {boolean} focused 675 * @param {boolean} focused
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddingLe ft; 1177 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddingLe ft;
1159 console.assert(paddingLeftValue.endsWith('px')); 1178 console.assert(paddingLeftValue.endsWith('px'));
1160 var computedLeftPadding = parseFloat(paddingLeftValue); 1179 var computedLeftPadding = parseFloat(paddingLeftValue);
1161 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; 1180 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding;
1162 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowToggle Width && this._expandable; 1181 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowToggle Width && this._expandable;
1163 } 1182 }
1164 }; 1183 };
1165 1184
1166 /** @const */ 1185 /** @const */
1167 TreeElement._ArrowToggleWidth = 10; 1186 TreeElement._ArrowToggleWidth = 10;
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/treeoutline.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698