OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | 3 Copyright (c) 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/base/guid.html"> | 8 <link rel="import" href="/tracing/base/guid.html"> |
9 <link rel="import" href="/tracing/model/event_set.html"> | 9 <link rel="import" href="/tracing/model/event_set.html"> |
10 <link rel="import" href="/tracing/model/selection_state.html"> | 10 <link rel="import" href="/tracing/model/selection_state.html"> |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 if (this.selection_.contains(e)) | 159 if (this.selection_.contains(e)) |
160 score++; | 160 score++; |
161 if (this.analysisLinkHoveredEvents_.contains(e)) | 161 if (this.analysisLinkHoveredEvents_.contains(e)) |
162 score++; | 162 score++; |
163 e.selectionState = SelectionState.getFromBrighteningLevel(score); | 163 e.selectionState = SelectionState.getFromBrighteningLevel(score); |
164 }, this); | 164 }, this); |
165 return; | 165 return; |
166 } | 166 } |
167 | 167 |
168 var brightenedEvents = this.brightenedEvents_; | 168 var brightenedEvents = this.brightenedEvents_; |
169 model.iterateAllEvents(function(e) { | 169 for (var e of model.getDescendantEvents()) { |
170 var score; | 170 var score; |
171 if (brightenedEvents.contains(e)) { | 171 if (brightenedEvents.contains(e)) { |
172 score = 0; | 172 score = 0; |
173 if (this.selection_.contains(e)) | 173 if (this.selection_.contains(e)) |
174 score++; | 174 score++; |
175 if (this.analysisLinkHoveredEvents_.contains(e)) | 175 if (this.analysisLinkHoveredEvents_.contains(e)) |
176 score++; | 176 score++; |
177 e.selectionState = SelectionState.getFromBrighteningLevel(score); | 177 e.selectionState = SelectionState.getFromBrighteningLevel(score); |
178 } else { | 178 } else { |
179 score = 0; | 179 score = 0; |
180 if (this.findMatches_.contains(e)) | 180 if (this.findMatches_.contains(e)) |
181 score++; | 181 score++; |
182 if (this.analysisViewRelatedEvents_.contains(e)) | 182 if (this.analysisViewRelatedEvents_.contains(e)) |
183 score++; | 183 score++; |
184 e.selectionState = SelectionState.getFromDimmingLevel(score); | 184 e.selectionState = SelectionState.getFromDimmingLevel(score); |
185 } | 185 } |
186 }.bind(this)); | 186 } |
187 }, | 187 }, |
188 | 188 |
189 transferModelOwnershipToClone: function(that) { | 189 transferModelOwnershipToClone: function(that) { |
190 if (!this.appliedToModel_) | 190 if (!this.appliedToModel_) |
191 throw new Error('Not applied'); | 191 throw new Error('Not applied'); |
192 // Assumes this.equals(that). | 192 // Assumes this.equals(that). |
193 that.appliedToModel_ = this.appliedToModel_; | 193 that.appliedToModel_ = this.appliedToModel_; |
194 this.appliedToModel_ = undefined; | 194 this.appliedToModel_ = undefined; |
195 }, | 195 }, |
196 | 196 |
197 unapplyFromModelSelectionState: function() { | 197 unapplyFromModelSelectionState: function() { |
198 if (!this.appliedToModel_) | 198 if (!this.appliedToModel_) |
199 throw new Error('Not applied'); | 199 throw new Error('Not applied'); |
200 var model = this.appliedToModel_; | 200 var model = this.appliedToModel_; |
201 this.appliedToModel_ = undefined; | 201 this.appliedToModel_ = undefined; |
202 | 202 |
203 if (!this.causesDimming_) { | 203 if (!this.causesDimming_) { |
204 this.brightenedEvents_.forEach(function(e) { | 204 for (var e of this.brightenedEvents_) |
205 e.selectionState = SelectionState.NONE; | 205 e.selectionState = SelectionState.NONE; |
206 }); | |
207 return; | 206 return; |
208 } | 207 } |
209 | 208 |
210 model.iterateAllEvents(function(e) { | 209 for (var e of model.getDescendantEvents()) |
211 e.selectionState = SelectionState.NONE; | 210 e.selectionState = SelectionState.NONE; |
212 }); | |
213 } | 211 } |
214 }; | 212 }; |
215 | 213 |
216 return { | 214 return { |
217 BrushingState: BrushingState | 215 BrushingState: BrushingState |
218 }; | 216 }; |
219 }); | 217 }); |
220 </script> | 218 </script> |
OLD | NEW |