| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright 2015 The Chromium Authors. All rights reserved. | 3 Copyright 2015 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 | 7 |
| 8 <link rel="import" href="/tracing/ui/base/deep_utils.html"> | 8 <link rel="import" href="/tracing/ui/base/deep_utils.html"> |
| 9 <link rel="import" href="/tracing/ui/base/polymer_utils.html"> | 9 <link rel="import" href="/tracing/ui/base/polymer_utils.html"> |
| 10 <link rel="import" href="/tracing/value/numeric.html"> | 10 <link rel="import" href="/tracing/value/numeric.html"> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 if (config.total) | 39 if (config.total) |
| 40 span.percentage = numericValue / config.total; | 40 span.percentage = numericValue / config.total; |
| 41 | 41 |
| 42 if (config.rightAlign) | 42 if (config.rightAlign) |
| 43 span.rightAlign = true; | 43 span.rightAlign = true; |
| 44 | 44 |
| 45 return span; | 45 return span; |
| 46 } | 46 } |
| 47 | 47 |
| 48 tr.v.Unit.addEventListener('display-mode-changed', function(e) { | |
| 49 | |
| 50 // Can't do this subclass dependency, and subclasses | |
| 51 // have been eliminated, so querySelectorAll works | |
| 52 | |
| 53 var scalarSpans = document.querySelectorAll('tr-v-ui-scalar-span'); | |
| 54 for (var i = 0; i < scalarSpans.length; i++) | |
| 55 scalarSpans[i].updateContent_(); | |
| 56 | |
| 57 // var scalarSpanTagName = 'tr-v-ui-scalar-span'; | |
| 58 // var subclassNames = tr.ui.b.getPolymerElementsThatSubclass( | |
| 59 // scalarSpanTagName); | |
| 60 // subclassNames.push(scalarSpanTagName); | |
| 61 // var isSubclass = {}; | |
| 62 // subclassNames.forEach(function(n) { | |
| 63 // isSubclass[n.toUpperCase()] = true; | |
| 64 // }); | |
| 65 | |
| 66 // var m = tr.b.findDeepElementsMatchingPredicate( | |
| 67 // document.body, | |
| 68 // function(el) { | |
| 69 // return isSubclass[el.tagName]; | |
| 70 // }); | |
| 71 // m.forEach(function(el) { | |
| 72 // el.updateContent_(); | |
| 73 // }); | |
| 74 }); | |
| 75 | |
| 76 return { | 48 return { |
| 77 createScalarSpan: createScalarSpan | 49 createScalarSpan: createScalarSpan |
| 78 }; | 50 }; |
| 79 }); | 51 }); |
| 80 </script> | 52 </script> |
| 81 | 53 |
| 82 <dom-module id='tr-v-ui-scalar-span'> | 54 <dom-module id='tr-v-ui-scalar-span'> |
| 83 <template> | 55 <template> |
| 84 <style> | 56 <style> |
| 85 :host { | 57 :host { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 is: 'tr-v-ui-scalar-span', | 91 is: 'tr-v-ui-scalar-span', |
| 120 | 92 |
| 121 ready: function() { | 93 ready: function() { |
| 122 this.value_ = undefined; | 94 this.value_ = undefined; |
| 123 this.unit_ = undefined; | 95 this.unit_ = undefined; |
| 124 | 96 |
| 125 this.warning_ = undefined; | 97 this.warning_ = undefined; |
| 126 this.percentage_ = undefined; | 98 this.percentage_ = undefined; |
| 127 }, | 99 }, |
| 128 | 100 |
| 101 attached: function() { |
| 102 tr.v.Unit.addEventListener( |
| 103 'display-mode-changed', this.updateContent_.bind(this)); |
| 104 }, |
| 105 |
| 106 detached: function() { |
| 107 tr.v.Unit.removeEventListener( |
| 108 'display-mode-changed', this.updateContent_.bind(this)); |
| 109 }, |
| 110 |
| 129 set contentTextDecoration(deco) { | 111 set contentTextDecoration(deco) { |
| 130 this.$.content.style.textDecoration = deco; | 112 this.$.content.style.textDecoration = deco; |
| 131 }, | 113 }, |
| 132 | 114 |
| 133 get value() { | 115 get value() { |
| 134 return this.value_; | 116 return this.value_; |
| 135 }, | 117 }, |
| 136 | 118 |
| 137 set value(value) { | 119 set value(value) { |
| 138 if (value instanceof tr.v.ScalarNumeric) { | 120 if (value instanceof tr.v.ScalarNumeric) { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 246 |
| 265 set duration(duration) { | 247 set duration(duration) { |
| 266 if (duration instanceof tr.b.u.TimeDuration) { | 248 if (duration instanceof tr.b.u.TimeDuration) { |
| 267 this.value = duration; | 249 this.value = duration; |
| 268 return; | 250 return; |
| 269 } | 251 } |
| 270 this.setValueAndUnit(duration, tr.b.u.Units.timeDurationInMs); | 252 this.setValueAndUnit(duration, tr.b.u.Units.timeDurationInMs); |
| 271 } | 253 } |
| 272 }); | 254 }); |
| 273 </script> | 255 </script> |
| OLD | NEW |