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

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

Issue 2637443004: DevTools: bring back old landing page in timeline/performance. (Closed)
Patch Set: review comments addressed Created 3 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 renderAsLinks() { 215 renderAsLinks() {
216 this._contentElement.classList.add('toolbar-render-as-links'); 216 this._contentElement.classList.add('toolbar-render-as-links');
217 } 217 }
218 218
219 /** 219 /**
220 * @param {boolean} enabled 220 * @param {boolean} enabled
221 */ 221 */
222 setEnabled(enabled) { 222 setEnabled(enabled) {
223 this._enabled = enabled; 223 this._enabled = enabled;
224 for (var item of this._items) 224 for (var item of this._items)
225 item._applyEnabledState(); 225 item._applyEnabledState(this._enabled && item._enabled);
226 } 226 }
227 227
228 /** 228 /**
229 * @param {!UI.ToolbarItem} item 229 * @param {!UI.ToolbarItem} item
230 */ 230 */
231 appendToolbarItem(item) { 231 appendToolbarItem(item) {
232 this._items.push(item); 232 this._items.push(item);
233 item._toolbar = this; 233 item._toolbar = this;
234 if (!this._enabled) 234 if (!this._enabled)
235 item._applyEnabledState(); 235 item._applyEnabledState(false);
236 if (this._reverse) 236 if (this._reverse)
237 this._contentElement.insertBefore(item.element, this._insertionPoint.nextS ibling); 237 this._contentElement.insertBefore(item.element, this._insertionPoint.nextS ibling);
238 else 238 else
239 this._contentElement.insertBefore(item.element, this._insertionPoint); 239 this._contentElement.insertBefore(item.element, this._insertionPoint);
240 this._hideSeparatorDupes(); 240 this._hideSeparatorDupes();
241 } 241 }
242 242
243 appendSeparator() { 243 appendSeparator() {
244 this.appendToolbarItem(new UI.ToolbarSeparator()); 244 this.appendToolbarItem(new UI.ToolbarSeparator());
245 } 245 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 super(); 368 super();
369 this.element = element; 369 this.element = element;
370 this.element.classList.add('toolbar-item'); 370 this.element.classList.add('toolbar-item');
371 this._visible = true; 371 this._visible = true;
372 this._enabled = true; 372 this._enabled = true;
373 this.element.addEventListener('mouseenter', this._mouseEnter.bind(this), fal se); 373 this.element.addEventListener('mouseenter', this._mouseEnter.bind(this), fal se);
374 this.element.addEventListener('mouseleave', this._mouseLeave.bind(this), fal se); 374 this.element.addEventListener('mouseleave', this._mouseLeave.bind(this), fal se);
375 } 375 }
376 376
377 /** 377 /**
378 * @param {string} title 378 * @param {!Element|string} title
379 */ 379 */
380 setTitle(title) { 380 setTitle(title) {
381 if (this._title === title) 381 if (this._title === title)
382 return; 382 return;
383 this._title = title; 383 this._title = title;
384 UI.Tooltip.install(this.element, title); 384 UI.Tooltip.install(this.element, title);
385 } 385 }
386 386
387 _mouseEnter() { 387 _mouseEnter() {
388 this.element.classList.add('hover'); 388 this.element.classList.add('hover');
389 } 389 }
390 390
391 _mouseLeave() { 391 _mouseLeave() {
392 this.element.classList.remove('hover'); 392 this.element.classList.remove('hover');
393 } 393 }
394 394
395 /** 395 /**
396 * @param {boolean} value 396 * @param {boolean} value
397 */ 397 */
398 setEnabled(value) { 398 setEnabled(value) {
399 if (this._enabled === value) 399 if (this._enabled === value)
400 return; 400 return;
401 this._enabled = value; 401 this._enabled = value;
402 this._applyEnabledState(); 402 this._applyEnabledState(this._enabled && (!this._toolbar || this._toolbar._e nabled));
403 }
404
405 _applyEnabledState() {
406 this.element.disabled = !this._enabled || (this._toolbar && !this._toolbar._ enabled);
407 } 403 }
408 404
409 /** 405 /**
406 * @param {boolean} enabled
407 */
408 _applyEnabledState(enabled) {
409 this.element.disabled = !enabled;
410 }
411
412 /**
410 * @return {boolean} x 413 * @return {boolean} x
411 */ 414 */
412 visible() { 415 visible() {
413 return this._visible; 416 return this._visible;
414 } 417 }
415 418
416 /** 419 /**
417 * @param {boolean} x 420 * @param {boolean} x
418 */ 421 */
419 setVisible(x) { 422 setVisible(x) {
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 option.text = label; 829 option.text = label;
827 if (title) 830 if (title)
828 option.title = title; 831 option.title = title;
829 if (typeof value !== 'undefined') 832 if (typeof value !== 'undefined')
830 option.value = value; 833 option.value = value;
831 return option; 834 return option;
832 } 835 }
833 836
834 /** 837 /**
835 * @override 838 * @override
839 * @param {boolean} enabled
836 */ 840 */
837 _applyEnabledState() { 841 _applyEnabledState(enabled) {
838 this._selectElement.disabled = !this._enabled || (this._toolbar && !this._to olbar._enabled); 842 super._applyEnabledState(enabled);
843 this._selectElement.disabled = !enabled;
839 } 844 }
840 845
841 /** 846 /**
842 * @param {!Element} option 847 * @param {!Element} option
843 */ 848 */
844 removeOption(option) { 849 removeOption(option) {
845 this._selectElement.removeChild(option); 850 this._selectElement.removeChild(option);
846 } 851 }
847 852
848 removeOptions() { 853 removeOptions() {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 checked() { 920 checked() {
916 return this.inputElement.checked; 921 return this.inputElement.checked;
917 } 922 }
918 923
919 /** 924 /**
920 * @param {boolean} value 925 * @param {boolean} value
921 */ 926 */
922 setChecked(value) { 927 setChecked(value) {
923 this.inputElement.checked = value; 928 this.inputElement.checked = value;
924 } 929 }
930
931 /**
932 * @override
933 * @param {boolean} enabled
934 */
935 _applyEnabledState(enabled) {
936 super._applyEnabledState(enabled);
937 this.inputElement.disabled = !enabled;
938 }
925 }; 939 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698