OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> | 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> |
4 * Copyright (C) 2009 Google Inc. All rights reserved. | 4 * Copyright (C) 2009 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 15 matching lines...) Expand all Loading... |
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 */ | 33 */ |
34 WebInspector.TimelineGrid = function() | 34 WebInspector.TimelineGrid = function() |
35 { | 35 { |
36 this.element = document.createElement("div"); | 36 this.element = createElement("div"); |
37 | 37 |
38 this._dividersElement = this.element.createChild("div", "resources-dividers"
); | 38 this._dividersElement = this.element.createChild("div", "resources-dividers"
); |
39 | 39 |
40 this._gridHeaderElement = document.createElement("div"); | 40 this._gridHeaderElement = createElement("div"); |
41 this._gridHeaderElement.id = "timeline-grid-header"; | 41 this._gridHeaderElement.id = "timeline-grid-header"; |
42 this._eventDividersElement = this._gridHeaderElement.createChild("div", "res
ources-event-dividers"); | 42 this._eventDividersElement = this._gridHeaderElement.createChild("div", "res
ources-event-dividers"); |
43 this._dividersLabelBarElement = this._gridHeaderElement.createChild("div", "
resources-dividers-label-bar"); | 43 this._dividersLabelBarElement = this._gridHeaderElement.createChild("div", "
resources-dividers-label-bar"); |
44 this.element.appendChild(this._gridHeaderElement); | 44 this.element.appendChild(this._gridHeaderElement); |
45 | 45 |
46 this._leftCurtainElement = this.element.createChild("div", "timeline-cpu-cur
tain-left"); | 46 this._leftCurtainElement = this.element.createChild("div", "timeline-cpu-cur
tain-left"); |
47 this._rightCurtainElement = this.element.createChild("div", "timeline-cpu-cu
rtain-right"); | 47 this._rightCurtainElement = this.element.createChild("div", "timeline-cpu-cu
rtain-right"); |
48 } | 48 } |
49 | 49 |
50 /** | 50 /** |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 192 |
193 // Reuse divider elements and labels. | 193 // Reuse divider elements and labels. |
194 var divider = /** @type {?Element} */ (this._dividersElement.firstChild)
; | 194 var divider = /** @type {?Element} */ (this._dividersElement.firstChild)
; |
195 var dividerLabelBar = /** @type {?Element} */ (this._dividersLabelBarEle
ment.firstChild); | 195 var dividerLabelBar = /** @type {?Element} */ (this._dividersLabelBarEle
ment.firstChild); |
196 | 196 |
197 const minWidthForTitle = 60; | 197 const minWidthForTitle = 60; |
198 var lastPosition = 0; | 198 var lastPosition = 0; |
199 var lastTime = 0; | 199 var lastTime = 0; |
200 for (var i = 0; i < dividerOffsets.length; ++i) { | 200 for (var i = 0; i < dividerOffsets.length; ++i) { |
201 if (!divider) { | 201 if (!divider) { |
202 divider = document.createElement("div"); | 202 divider = createElement("div"); |
203 divider.className = "resources-divider"; | 203 divider.className = "resources-divider"; |
204 this._dividersElement.appendChild(divider); | 204 this._dividersElement.appendChild(divider); |
205 | 205 |
206 dividerLabelBar = document.createElement("div"); | 206 dividerLabelBar = createElement("div"); |
207 dividerLabelBar.className = "resources-divider"; | 207 dividerLabelBar.className = "resources-divider"; |
208 var label = document.createElement("div"); | 208 var label = createElement("div"); |
209 label.className = "resources-divider-label"; | 209 label.className = "resources-divider-label"; |
210 dividerLabelBar._labelElement = label; | 210 dividerLabelBar._labelElement = label; |
211 dividerLabelBar.appendChild(label); | 211 dividerLabelBar.appendChild(label); |
212 this._dividersLabelBarElement.appendChild(dividerLabelBar); | 212 this._dividersLabelBarElement.appendChild(dividerLabelBar); |
213 } | 213 } |
214 | 214 |
215 var time = dividerOffsets[i]; | 215 var time = dividerOffsets[i]; |
216 var position = calculator.computePosition(time); | 216 var position = calculator.computePosition(time); |
217 if (position - lastPosition > minWidthForTitle) | 217 if (position - lastPosition > minWidthForTitle) |
218 dividerLabelBar._labelElement.textContent = printDeltas ? calcul
ator.formatTime(time - lastTime) : calculator.formatTime(time, precision); | 218 dividerLabelBar._labelElement.textContent = printDeltas ? calcul
ator.formatTime(time - lastTime) : calculator.formatTime(time, precision); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 344 |
345 /** @return {number} */ | 345 /** @return {number} */ |
346 zeroTime: function() { }, | 346 zeroTime: function() { }, |
347 | 347 |
348 /** @return {number} */ | 348 /** @return {number} */ |
349 maximumBoundary: function() { }, | 349 maximumBoundary: function() { }, |
350 | 350 |
351 /** @return {number} */ | 351 /** @return {number} */ |
352 boundarySpan: function() { } | 352 boundarySpan: function() { } |
353 } | 353 } |
OLD | NEW |