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

Side by Side Diff: third_party/polymer/v1_0/components-chromium/iron-behaviors/iron-control-state-extracted.js

Issue 1287713002: [MD settings] merge polymer 1.0.11; hack for settings checkbox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
3 /**
4 * @demo demo/index.html 2 * @demo demo/index.html
5 * @polymerBehavior 3 * @polymerBehavior
6 */ 4 */
7 Polymer.IronControlState = { 5 Polymer.IronControlState = {
8 6
9 properties: { 7 properties: {
10 8
11 /** 9 /**
12 * If true, the element currently has focus. 10 * If true, the element currently has focus.
13 */ 11 */
(...skipping 27 matching lines...) Expand all
41 } 39 }
42 } 40 }
43 41
44 }, 42 },
45 43
46 observers: [ 44 observers: [
47 '_changedControlState(focused, disabled)' 45 '_changedControlState(focused, disabled)'
48 ], 46 ],
49 47
50 ready: function() { 48 ready: function() {
51 // TODO(sjmiles): ensure read-only property is valued so the compound
52 // observer will fire
53 if (this.focused === undefined) {
54 this._setFocused(false);
55 }
56 this.addEventListener('focus', this._boundFocusBlurHandler, true); 49 this.addEventListener('focus', this._boundFocusBlurHandler, true);
57 this.addEventListener('blur', this._boundFocusBlurHandler, true); 50 this.addEventListener('blur', this._boundFocusBlurHandler, true);
58 }, 51 },
59 52
60 _focusBlurHandler: function(event) { 53 _focusBlurHandler: function(event) {
61 var target = event.path ? event.path[0] : event.target; 54 var target = event.path ? event.path[0] : event.target;
62 if (target === this) { 55 if (target === this) {
63 var focused = event.type === 'focus'; 56 var focused = event.type === 'focus';
64 this._setFocused(focused); 57 this._setFocused(focused);
65 } else if (!this.shadowRoot) { 58 } else if (!this.shadowRoot) {
66 event.stopPropagation();
67 this.fire(event.type, {sourceEvent: event}, { 59 this.fire(event.type, {sourceEvent: event}, {
68 node: this, 60 node: this,
69 bubbles: event.bubbles, 61 bubbles: event.bubbles,
70 cancelable: event.cancelable 62 cancelable: event.cancelable
71 }); 63 });
72 } 64 }
73 }, 65 },
74 66
75 _disabledChanged: function(disabled, old) { 67 _disabledChanged: function(disabled, old) {
76 this.setAttribute('aria-disabled', disabled ? 'true' : 'false'); 68 this.setAttribute('aria-disabled', disabled ? 'true' : 'false');
77 this.style.pointerEvents = disabled ? 'none' : ''; 69 this.style.pointerEvents = disabled ? 'none' : '';
78 if (disabled) { 70 if (disabled) {
79 this._oldTabIndex = this.tabIndex; 71 this._oldTabIndex = this.tabIndex;
80 this.focused = false; 72 this.focused = false;
81 this.tabIndex = -1; 73 this.tabIndex = -1;
82 } else if (this._oldTabIndex !== undefined) { 74 } else if (this._oldTabIndex !== undefined) {
83 this.tabIndex = this._oldTabIndex; 75 this.tabIndex = this._oldTabIndex;
84 } 76 }
85 }, 77 },
86 78
87 _changedControlState: function() { 79 _changedControlState: function() {
88 // _controlStateChanged is abstract, follow-on behaviors may implement it 80 // _controlStateChanged is abstract, follow-on behaviors may implement it
89 if (this._controlStateChanged) { 81 if (this._controlStateChanged) {
90 this._controlStateChanged(); 82 this._controlStateChanged();
91 } 83 }
92 } 84 }
93 85
94 }; 86 };
95
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698