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

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

Issue 2655393003: DevTools: Introduce ARIAUtils (Closed)
Patch Set: Use namespace instead of class 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
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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 * @param {string} title 596 * @param {string} title
597 * @param {string=} glyph 597 * @param {string=} glyph
598 * @param {string=} toggledGlyph 598 * @param {string=} toggledGlyph
599 */ 599 */
600 constructor(title, glyph, toggledGlyph) { 600 constructor(title, glyph, toggledGlyph) {
601 super(title, glyph, ''); 601 super(title, glyph, '');
602 this._toggled = false; 602 this._toggled = false;
603 this._untoggledGlyph = glyph; 603 this._untoggledGlyph = glyph;
604 this._toggledGlyph = toggledGlyph; 604 this._toggledGlyph = toggledGlyph;
605 this.element.classList.add('toolbar-state-off'); 605 this.element.classList.add('toolbar-state-off');
606 UI.ARIAUtils.setPressed(this.element, false);
606 } 607 }
607 608
608 /** 609 /**
609 * @return {boolean} 610 * @return {boolean}
610 */ 611 */
611 toggled() { 612 toggled() {
612 return this._toggled; 613 return this._toggled;
613 } 614 }
614 615
615 /** 616 /**
616 * @param {boolean} toggled 617 * @param {boolean} toggled
617 */ 618 */
618 setToggled(toggled) { 619 setToggled(toggled) {
619 if (this._toggled === toggled) 620 if (this._toggled === toggled)
620 return; 621 return;
621 this._toggled = toggled; 622 this._toggled = toggled;
622 this.element.classList.toggle('toolbar-state-on', toggled); 623 this.element.classList.toggle('toolbar-state-on', toggled);
623 this.element.classList.toggle('toolbar-state-off', !toggled); 624 this.element.classList.toggle('toolbar-state-off', !toggled);
625 UI.ARIAUtils.setPressed(this.element, toggled);
624 if (this._toggledGlyph && this._untoggledGlyph) 626 if (this._toggledGlyph && this._untoggledGlyph)
625 this.setGlyph(toggled ? this._toggledGlyph : this._untoggledGlyph); 627 this.setGlyph(toggled ? this._toggledGlyph : this._untoggledGlyph);
626 } 628 }
627 629
628 /** 630 /**
629 * @param {boolean} withRedColor 631 * @param {boolean} withRedColor
630 */ 632 */
631 setDefaultWithRedColor(withRedColor) { 633 setDefaultWithRedColor(withRedColor) {
632 this.element.classList.toggle('toolbar-default-with-red-color', withRedColor ); 634 this.element.classList.toggle('toolbar-default-with-red-color', withRedColor );
633 } 635 }
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 932
931 /** 933 /**
932 * @override 934 * @override
933 * @param {boolean} enabled 935 * @param {boolean} enabled
934 */ 936 */
935 _applyEnabledState(enabled) { 937 _applyEnabledState(enabled) {
936 super._applyEnabledState(enabled); 938 super._applyEnabledState(enabled);
937 this.inputElement.disabled = !enabled; 939 this.inputElement.disabled = !enabled;
938 } 940 }
939 }; 941 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698