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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 this.element.appendChild(this._gridHeaderElement); | 45 this.element.appendChild(this._gridHeaderElement); |
46 } | 46 } |
47 | 47 |
48 /** | 48 /** |
49 * @param {!WebInspector.TimelineGrid.Calculator} calculator | 49 * @param {!WebInspector.TimelineGrid.Calculator} calculator |
50 * @param {number=} freeZoneAtLeft | 50 * @param {number=} freeZoneAtLeft |
51 * @return {!{offsets: !Array.<number>, precision: number}} | 51 * @return {!{offsets: !Array.<number>, precision: number}} |
52 */ | 52 */ |
53 WebInspector.TimelineGrid.calculateDividerOffsets = function(calculator, freeZon
eAtLeft) | 53 WebInspector.TimelineGrid.calculateDividerOffsets = function(calculator, freeZon
eAtLeft) |
54 { | 54 { |
| 55 // TODO(allada) Remove this code out when timeline canvas experiment is over
. |
55 /** @const */ var minGridSlicePx = 64; // minimal distance between grid line
s. | 56 /** @const */ var minGridSlicePx = 64; // minimal distance between grid line
s. |
56 | 57 |
57 var clientWidth = calculator.computePosition(calculator.maximumBoundary()); | 58 var clientWidth = calculator.computePosition(calculator.maximumBoundary()); |
58 var dividersCount = clientWidth / minGridSlicePx; | 59 var dividersCount = clientWidth / minGridSlicePx; |
59 var gridSliceTime = calculator.boundarySpan() / dividersCount; | 60 var gridSliceTime = calculator.boundarySpan() / dividersCount; |
60 var pixelsPerTime = clientWidth / calculator.boundarySpan(); | 61 var pixelsPerTime = clientWidth / calculator.boundarySpan(); |
61 | 62 |
62 // Align gridSliceTime to a nearest round value. | 63 // Align gridSliceTime to a nearest round value. |
63 // We allow spans that fit into the formula: span = (1|2|5)x10^n, | 64 // We allow spans that fit into the formula: span = (1|2|5)x10^n, |
64 // e.g.: ... .1 .2 .5 1 2 5 10 20 50 ... | 65 // e.g.: ... .1 .2 .5 1 2 5 10 20 50 ... |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 308 |
308 /** @return {number} */ | 309 /** @return {number} */ |
309 zeroTime: function() { }, | 310 zeroTime: function() { }, |
310 | 311 |
311 /** @return {number} */ | 312 /** @return {number} */ |
312 maximumBoundary: function() { }, | 313 maximumBoundary: function() { }, |
313 | 314 |
314 /** @return {number} */ | 315 /** @return {number} */ |
315 boundarySpan: function() { } | 316 boundarySpan: function() { } |
316 } | 317 } |
OLD | NEW |