| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 offsets.push(time); | 90 offsets.push(time); |
| 91 } | 91 } |
| 92 | 92 |
| 93 return {offsets: offsets, precision: Math.max(0, -Math.floor(Math.log(gridSl
iceTime * 1.01) / Math.LN10))}; | 93 return {offsets: offsets, precision: Math.max(0, -Math.floor(Math.log(gridSl
iceTime * 1.01) / Math.LN10))}; |
| 94 } | 94 } |
| 95 | 95 |
| 96 /** | 96 /** |
| 97 * @param {!CanvasRenderingContext2D} context | 97 * @param {!CanvasRenderingContext2D} context |
| 98 * @param {!UI.TimelineGrid.Calculator} calculator | 98 * @param {!UI.TimelineGrid.Calculator} calculator |
| 99 * @param {number} paddingTop | 99 * @param {number} paddingTop |
| 100 * @param {number} headerHeight |
| 100 * @param {number=} freeZoneAtLeft | 101 * @param {number=} freeZoneAtLeft |
| 101 */ | 102 */ |
| 102 static drawCanvasGrid(context, calculator, paddingTop, freeZoneAtLeft) { | 103 static drawCanvasGrid(context, calculator, paddingTop, headerHeight, freeZoneA
tLeft) { |
| 103 context.save(); | 104 context.save(); |
| 104 var ratio = window.devicePixelRatio; | 105 var ratio = window.devicePixelRatio; |
| 105 context.scale(ratio, ratio); | 106 context.scale(ratio, ratio); |
| 106 var width = context.canvas.width / window.devicePixelRatio; | 107 var width = context.canvas.width / window.devicePixelRatio; |
| 107 var height = context.canvas.height / window.devicePixelRatio; | 108 var height = context.canvas.height / window.devicePixelRatio; |
| 108 var dividersData = UI.TimelineGrid.calculateDividerOffsets(calculator); | 109 var dividersData = UI.TimelineGrid.calculateDividerOffsets(calculator); |
| 109 var dividerOffsets = dividersData.offsets; | 110 var dividerOffsets = dividersData.offsets; |
| 110 var precision = dividersData.precision; | 111 var precision = dividersData.precision; |
| 111 | 112 |
| 112 context.fillStyle = 'rgba(255, 255, 255, 0.5)'; | 113 context.fillStyle = UI.themeSupport.patchColor('rgba(255, 255, 255, 0.5)', U
I.ThemeSupport.ColorUsage.Background); |
| 113 context.fillRect(0, 0, width, 15); | 114 context.fillRect(0, 0, width, headerHeight); |
| 114 | 115 |
| 115 context.fillStyle = '#333'; | 116 context.fillStyle = UI.themeSupport.patchColor('#333', UI.ThemeSupport.Color
Usage.Foreground); |
| 116 context.strokeStyle = 'rgba(0, 0, 0, 0.1)'; | 117 context.strokeStyle = UI.themeSupport.patchColor('rgba(0, 0, 0, 0.1)', UI.Th
emeSupport.ColorUsage.Foreground); |
| 117 context.textBaseline = 'hanging'; | 118 context.textBaseline = 'hanging'; |
| 118 context.font = '11px ' + Host.fontFamily(); | 119 context.font = '11px ' + Host.fontFamily(); |
| 119 context.lineWidth = 1; | 120 context.lineWidth = 1; |
| 120 | 121 |
| 121 context.translate(0.5, 0.5); | 122 context.translate(0.5, 0.5); |
| 122 const paddingRight = 4; | 123 const paddingRight = 4; |
| 123 freeZoneAtLeft = freeZoneAtLeft || 0; | 124 freeZoneAtLeft = freeZoneAtLeft || 0; |
| 124 for (var i = 0; i < dividerOffsets.length; ++i) { | 125 for (var i = 0; i < dividerOffsets.length; ++i) { |
| 125 var time = dividerOffsets[i]; | 126 var time = dividerOffsets[i]; |
| 126 var position = calculator.computePosition(time); | 127 var position = calculator.computePosition(time); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 | 283 |
| 283 /** @return {number} */ | 284 /** @return {number} */ |
| 284 zeroTime() {}, | 285 zeroTime() {}, |
| 285 | 286 |
| 286 /** @return {number} */ | 287 /** @return {number} */ |
| 287 maximumBoundary() {}, | 288 maximumBoundary() {}, |
| 288 | 289 |
| 289 /** @return {number} */ | 290 /** @return {number} */ |
| 290 boundarySpan() {} | 291 boundarySpan() {} |
| 291 }; | 292 }; |
| OLD | NEW |