OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2016 The Chromium Authors. All rights reserved. | 3 Copyright 2016 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/base/event.html"> | 8 <link rel="import" href="/tracing/base/event.html"> |
| 9 <link rel="import" href="/tracing/base/math/range.html"> |
9 <link rel="import" href="/tracing/base/raf.html"> | 10 <link rel="import" href="/tracing/base/raf.html"> |
10 <link rel="import" href="/tracing/base/range.html"> | |
11 | 11 |
12 <dom-module id='tr-v-ui-scalar-context-controller'> | 12 <dom-module id='tr-v-ui-scalar-context-controller'> |
13 <template></template> | 13 <template></template> |
14 </dom-module> | 14 </dom-module> |
15 | 15 |
16 <!-- | 16 <!-- |
17 @fileoverview Polymer element for controlling common context across scalar | 17 @fileoverview Polymer element for controlling common context across scalar |
18 spans. To facilitate multiple separate contexts (e.g. a separate context for | 18 spans. To facilitate multiple separate contexts (e.g. a separate context for |
19 each table column), each scalar span has to specify which "context group" | 19 each table column), each scalar span has to specify which "context group" |
20 it belongs to: | 20 it belongs to: |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 getContext: function(group) { | 106 getContext: function(group) { |
107 return this.groupToContext_.get(group); | 107 return this.groupToContext_.get(group); |
108 }, | 108 }, |
109 | 109 |
110 onScalarSpanAdded: function(group, span) { | 110 onScalarSpanAdded: function(group, span) { |
111 let context = this.groupToContext_.get(group); | 111 let context = this.groupToContext_.get(group); |
112 if (context === undefined) { | 112 if (context === undefined) { |
113 context = { | 113 context = { |
114 spans: new Set(), | 114 spans: new Set(), |
115 range: new tr.b.Range() | 115 range: new tr.b.math.Range() |
116 }; | 116 }; |
117 this.groupToContext_.set(group, context); | 117 this.groupToContext_.set(group, context); |
118 } | 118 } |
119 if (context.spans.has(span)) | 119 if (context.spans.has(span)) |
120 throw new Error('Scalar span already registered with group: ' + group); | 120 throw new Error('Scalar span already registered with group: ' + group); |
121 context.spans.add(span); | 121 context.spans.add(span); |
122 this._markGroupDirtyAndScheduleUpdate(group); | 122 this._markGroupDirtyAndScheduleUpdate(group); |
123 }, | 123 }, |
124 | 124 |
125 onScalarSpanRemoved: function(group, span) { | 125 onScalarSpanRemoved: function(group, span) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 while (Polymer.dom(node).parentNode) | 187 while (Polymer.dom(node).parentNode) |
188 node = Polymer.dom(node).parentNode; | 188 node = Polymer.dom(node).parentNode; |
189 return node.host; | 189 return node.host; |
190 } | 190 } |
191 | 191 |
192 return { | 192 return { |
193 getScalarContextControllerForElement, | 193 getScalarContextControllerForElement, |
194 }; | 194 }; |
195 }); | 195 }); |
196 </script> | 196 </script> |
OLD | NEW |