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

Side by Side Diff: third_party/polymer/v1_0/components-chromium/paper-slider/paper-slider-extracted.js

Issue 1862213002: Roll third_party/polymer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove obsolete appearance_browsertest.js, result of a previous bad merge. Created 4 years, 8 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 Polymer({ 1 Polymer({
2 is: 'paper-slider', 2 is: 'paper-slider',
3 3
4 behaviors: [ 4 behaviors: [
5 Polymer.IronA11yKeysBehavior, 5 Polymer.IronA11yKeysBehavior,
6 Polymer.IronFormElementBehavior, 6 Polymer.IronFormElementBehavior,
7 Polymer.PaperInkyFocusBehavior, 7 Polymer.PaperInkyFocusBehavior,
8 Polymer.IronRangeBehavior 8 Polymer.IronRangeBehavior
9 ], 9 ],
10 10
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 if (prevRatio === this.ratio) { 271 if (prevRatio === this.ratio) {
272 this._setTransiting(false); 272 this._setTransiting(false);
273 } 273 }
274 274
275 this.async(function() { 275 this.async(function() {
276 this.fire('change'); 276 this.fire('change');
277 }); 277 });
278 278
279 // cancel selection 279 // cancel selection
280 event.preventDefault(); 280 event.preventDefault();
281
282 // set the focus manually because we will called prevent default
283 this.focus();
281 }, 284 },
282 285
283 _knobTransitionEnd: function(event) { 286 _knobTransitionEnd: function(event) {
284 if (event.target === this.$.sliderKnob) { 287 if (event.target === this.$.sliderKnob) {
285 this._setTransiting(false); 288 this._setTransiting(false);
286 } 289 }
287 }, 290 },
288 291
289 _maxMarkersChanged: function(maxMarkers) { 292 _maxMarkersChanged: function(maxMarkers) {
290 if (!this.snaps) { 293 if (!this.snaps) {
291 this._setMarkers([]); 294 this._setMarkers([]);
292 } 295 }
293 var steps = Math.floor((this.max - this.min) / this.step); 296 var steps = Math.round((this.max - this.min) / this.step);
294 if (steps > maxMarkers) { 297 if (steps > maxMarkers) {
295 steps = maxMarkers; 298 steps = maxMarkers;
296 } 299 }
297 this._setMarkers(new Array(steps)); 300 this._setMarkers(new Array(steps));
298 }, 301 },
299 302
300 _mergeClasses: function(classes) { 303 _mergeClasses: function(classes) {
301 return Object.keys(classes).filter( 304 return Object.keys(classes).filter(
302 function(className) { 305 function(className) {
303 return classes[className]; 306 return classes[className];
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 // Hide the ripple when user is not interacting with keyboard. 360 // Hide the ripple when user is not interacting with keyboard.
358 // This behavior is different from other ripple-y controls, but is 361 // This behavior is different from other ripple-y controls, but is
359 // according to spec: https://www.google.com/design/spec/components/slider s.html 362 // according to spec: https://www.google.com/design/spec/components/slider s.html
360 _focusedChanged: function(receivedFocusFromKeyboard) { 363 _focusedChanged: function(receivedFocusFromKeyboard) {
361 if (receivedFocusFromKeyboard) { 364 if (receivedFocusFromKeyboard) {
362 this.ensureRipple(); 365 this.ensureRipple();
363 } 366 }
364 if (this.hasRipple()) { 367 if (this.hasRipple()) {
365 // note, ripple must be un-hidden prior to setting `holdDown` 368 // note, ripple must be un-hidden prior to setting `holdDown`
366 if (receivedFocusFromKeyboard) { 369 if (receivedFocusFromKeyboard) {
367 this._ripple.removeAttribute('hidden'); 370 this._ripple.style.display = '';
368 } else { 371 } else {
369 this._ripple.setAttribute('hidden', ''); 372 this._ripple.style.display = 'none';
370 } 373 }
371 this._ripple.holdDown = receivedFocusFromKeyboard; 374 this._ripple.holdDown = receivedFocusFromKeyboard;
372 } 375 }
373 } 376 }
374 }); 377 });
375 378
376 /** 379 /**
377 * Fired when the slider's value changes. 380 * Fired when the slider's value changes.
378 * 381 *
379 * @event value-change 382 * @event value-change
380 */ 383 */
381 384
382 /** 385 /**
383 * Fired when the slider's immediateValue changes. 386 * Fired when the slider's immediateValue changes.
384 * 387 *
385 * @event immediate-value-change 388 * @event immediate-value-change
386 */ 389 */
387 390
388 /** 391 /**
389 * Fired when the slider's value changes due to user interaction. 392 * Fired when the slider's value changes due to user interaction.
390 * 393 *
391 * Changes to the slider's value due to changes in an underlying 394 * Changes to the slider's value due to changes in an underlying
392 * bound variable will not trigger this event. 395 * bound variable will not trigger this event.
393 * 396 *
394 * @event change 397 * @event change
395 */ 398 */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698