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

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

Issue 2655393003: DevTools: Introduce ARIAUtils (Closed)
Patch Set: setAccessibleName in InspectorView 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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 * @param {string} title 600 * @param {string} title
601 * @param {string=} glyph 601 * @param {string=} glyph
602 * @param {string=} toggledGlyph 602 * @param {string=} toggledGlyph
603 */ 603 */
604 constructor(title, glyph, toggledGlyph) { 604 constructor(title, glyph, toggledGlyph) {
605 super(title, glyph, ''); 605 super(title, glyph, '');
606 this._toggled = false; 606 this._toggled = false;
607 this._untoggledGlyph = glyph; 607 this._untoggledGlyph = glyph;
608 this._toggledGlyph = toggledGlyph; 608 this._toggledGlyph = toggledGlyph;
609 this.element.classList.add('toolbar-state-off'); 609 this.element.classList.add('toolbar-state-off');
610 UI.ARIAUtils.setPressed(this.element, false);
610 } 611 }
611 612
612 /** 613 /**
613 * @return {boolean} 614 * @return {boolean}
614 */ 615 */
615 toggled() { 616 toggled() {
616 return this._toggled; 617 return this._toggled;
617 } 618 }
618 619
619 /** 620 /**
620 * @param {boolean} toggled 621 * @param {boolean} toggled
621 */ 622 */
622 setToggled(toggled) { 623 setToggled(toggled) {
623 if (this._toggled === toggled) 624 if (this._toggled === toggled)
624 return; 625 return;
625 this._toggled = toggled; 626 this._toggled = toggled;
626 this.element.classList.toggle('toolbar-state-on', toggled); 627 this.element.classList.toggle('toolbar-state-on', toggled);
627 this.element.classList.toggle('toolbar-state-off', !toggled); 628 this.element.classList.toggle('toolbar-state-off', !toggled);
629 UI.ARIAUtils.setPressed(this.element, toggled);
628 if (this._toggledGlyph && this._untoggledGlyph) 630 if (this._toggledGlyph && this._untoggledGlyph)
629 this.setGlyph(toggled ? this._toggledGlyph : this._untoggledGlyph); 631 this.setGlyph(toggled ? this._toggledGlyph : this._untoggledGlyph);
630 } 632 }
631 633
632 /** 634 /**
633 * @param {boolean} withRedColor 635 * @param {boolean} withRedColor
634 */ 636 */
635 setDefaultWithRedColor(withRedColor) { 637 setDefaultWithRedColor(withRedColor) {
636 this.element.classList.toggle('toolbar-default-with-red-color', withRedColor ); 638 this.element.classList.toggle('toolbar-default-with-red-color', withRedColor );
637 } 639 }
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 998
997 /** 999 /**
998 * @override 1000 * @override
999 * @param {boolean} enabled 1001 * @param {boolean} enabled
1000 */ 1002 */
1001 _applyEnabledState(enabled) { 1003 _applyEnabledState(enabled) {
1002 super._applyEnabledState(enabled); 1004 super._applyEnabledState(enabled);
1003 this.inputElement.disabled = !enabled; 1005 this.inputElement.disabled = !enabled;
1004 } 1006 }
1005 }; 1007 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698