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

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: fix formatting Created 4 years 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
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._listItemNode.insertBefore(this._leadingIconsElement, this._titleElem ent);
649 this._ensureSelection();
650 }
651 this._leadingIconsElement.removeChildren();
652 for (var icon of icons)
653 this._leadingIconsElement.appendChild(icon);
654 }
655
656 /**
657 * @param {!Array<!UI.Icon>} icons
658 */
642 setTrailingIcons(icons) { 659 setTrailingIcons(icons) {
643 if (!this._trailingIconsElement && !icons.length) 660 if (!this._trailingIconsElement && !icons.length)
644 return; 661 return;
645 if (!this._trailingIconsElement) { 662 if (!this._trailingIconsElement) {
646 this._trailingIconsElement = createElementWithClass('div', 'icons-containe r'); 663 this._trailingIconsElement = createElementWithClass('div', 'trailing-icons ');
647 this._listItemNode.appendChild(this._trailingIconsElement); 664 this._listItemNode.appendChild(this._trailingIconsElement);
648 this._ensureSelection(); 665 this._ensureSelection();
649 } 666 }
650 this._trailingIconsElement.removeChildren(); 667 this._trailingIconsElement.removeChildren();
651 for (var icon of icons) 668 for (var icon of icons)
652 this._trailingIconsElement.appendChild(icon); 669 this._trailingIconsElement.appendChild(icon);
653 } 670 }
654 671
655 /** 672 /**
656 * @param {boolean} focused 673 * @param {boolean} focused
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddingLe ft; 1175 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddingLe ft;
1159 console.assert(paddingLeftValue.endsWith('px')); 1176 console.assert(paddingLeftValue.endsWith('px'));
1160 var computedLeftPadding = parseFloat(paddingLeftValue); 1177 var computedLeftPadding = parseFloat(paddingLeftValue);
1161 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; 1178 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding;
1162 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowToggle Width && this._expandable; 1179 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowToggle Width && this._expandable;
1163 } 1180 }
1164 }; 1181 };
1165 1182
1166 /** @const */ 1183 /** @const */
1167 TreeElement._ArrowToggleWidth = 10; 1184 TreeElement._ArrowToggleWidth = 10;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698