[Cronet] Delay StartNetLog and StopNetLog until native request context is initialized
[chromium-blink-merge.git] / third_party / polymer / components-chromium / core-range / core-range-extracted.js
blob5650bfdf95b7a268428da9fe51648a677fe11bd8
3 Polymer('core-range', {
5 /**
6 * The number that represents the current value.
8 * @attribute value
9 * @type number
10 * @default 0
12 value: 0,
14 /**
15 * The number that indicates the minimum value of the range.
17 * @attribute min
18 * @type number
19 * @default 0
21 min: 0,
23 /**
24 * The number that indicates the maximum value of the range.
26 * @attribute max
27 * @type number
28 * @default 100
30 max: 100,
32 /**
33 * Specifies the value granularity of the range's value.
35 * @attribute step
36 * @type number
37 * @default 1
39 step: 1,
41 /**
42 * Returns the ratio of the value.
44 * @attribute ratio
45 * @type number
46 * @default 0
48 ratio: 0,
50 observe: {
51 'value min max step': 'update'
54 calcRatio: function(value) {
55 return (this.clampValue(value) - this.min) / (this.max - this.min);
58 clampValue: function(value) {
59 return Math.min(this.max, Math.max(this.min, this.calcStep(value)));
62 calcStep: function(value) {
63 return this.step ? (Math.round(value / this.step) / (1 / this.step)) : value;
66 validateValue: function() {
67 var v = this.clampValue(this.value);
68 this.value = this.oldValue = isNaN(v) ? this.oldValue : v;
69 return this.value !== v;
72 update: function() {
73 this.validateValue();
74 this.ratio = this.calcRatio(this.value) * 100;
77 });