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

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

Issue 1401633002: Update Polymer from 1.1.4 -> 1.1.5 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dzhioev@ review Created 5 years, 2 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 Polymer.IronButtonState 3 * @polymerBehavior Polymer.IronButtonState
6 */ 4 */
7 Polymer.IronButtonStateImpl = { 5 Polymer.IronButtonStateImpl = {
8 6
9 properties: { 7 properties: {
10 8
11 /** 9 /**
12 * If true, the user is currently holding down the button. 10 * If true, the user is currently holding down the button.
13 */ 11 */
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 102
105 // to emulate native checkbox, (de-)activations from a user interaction fire 103 // to emulate native checkbox, (de-)activations from a user interaction fire
106 // 'change' events 104 // 'change' events
107 _userActivate: function(active) { 105 _userActivate: function(active) {
108 if (this.active !== active) { 106 if (this.active !== active) {
109 this.active = active; 107 this.active = active;
110 this.fire('change'); 108 this.fire('change');
111 } 109 }
112 }, 110 },
113 111
114 _eventSourceIsPrimaryInput: function(event) {
115 event = event.detail.sourceEvent || event;
116
117 // Always true for non-mouse events....
118 if (!this._mouseEventRe.test(event.type)) {
119 return true;
120 }
121
122 // http://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
123 if ('buttons' in event) {
124 return event.buttons === 1;
125 }
126
127 // http://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/which
128 if (typeof event.which === 'number') {
129 return event.which < 2;
130 }
131
132 // http://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
133 return event.button < 1;
134 },
135
136 _downHandler: function(event) { 112 _downHandler: function(event) {
137 if (!this._eventSourceIsPrimaryInput(event)) {
138 return;
139 }
140
141 this._setPointerDown(true); 113 this._setPointerDown(true);
142 this._setPressed(true); 114 this._setPressed(true);
143 this._setReceivedFocusFromKeyboard(false); 115 this._setReceivedFocusFromKeyboard(false);
144 }, 116 },
145 117
146 _upHandler: function() { 118 _upHandler: function() {
147 this._setPointerDown(false); 119 this._setPointerDown(false);
148 this._setPressed(false); 120 this._setPressed(false);
149 }, 121 },
150 122
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 this._buttonStateChanged(); // abstract 179 this._buttonStateChanged(); // abstract
208 } 180 }
209 } 181 }
210 182
211 }; 183 };
212 184
213 /** @polymerBehavior */ 185 /** @polymerBehavior */
214 Polymer.IronButtonState = [ 186 Polymer.IronButtonState = [
215 Polymer.IronA11yKeysBehavior, 187 Polymer.IronA11yKeysBehavior,
216 Polymer.IronButtonStateImpl 188 Polymer.IronButtonStateImpl
217 ]; 189 ];
218
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698