| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 * @return {number} | 1107 * @return {number} |
| 1108 */ | 1108 */ |
| 1109 _coordinatesToGroupIndex: function(x, y) | 1109 _coordinatesToGroupIndex: function(x, y) |
| 1110 { | 1110 { |
| 1111 if (x < 0 || y < 0) | 1111 if (x < 0 || y < 0) |
| 1112 return -1; | 1112 return -1; |
| 1113 y += this._scrollTop; | 1113 y += this._scrollTop; |
| 1114 var groups = this._rawTimelineData.groups || []; | 1114 var groups = this._rawTimelineData.groups || []; |
| 1115 var group = this._groupOffsets.upperBound(y) - 1; | 1115 var group = this._groupOffsets.upperBound(y) - 1; |
| 1116 | 1116 |
| 1117 if (group >= 0 && y - this._groupOffsets[group] < groups[group].style.he
ight) | 1117 if (group >= 0 && group < groups.length && y - this._groupOffsets[group]
< groups[group].style.height) |
| 1118 return group; | 1118 return group; |
| 1119 return -1; | 1119 return -1; |
| 1120 }, | 1120 }, |
| 1121 | 1121 |
| 1122 /** | 1122 /** |
| 1123 * @param {number} x | 1123 * @param {number} x |
| 1124 * @return {number} | 1124 * @return {number} |
| 1125 */ | 1125 */ |
| 1126 _markerIndexAtPosition: function(x) | 1126 _markerIndexAtPosition: function(x) |
| 1127 { | 1127 { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 * @param {number} height | 1326 * @param {number} height |
| 1327 */ | 1327 */ |
| 1328 _drawGroupHeaders: function(width, height) | 1328 _drawGroupHeaders: function(width, height) |
| 1329 { | 1329 { |
| 1330 var context = this._canvas.getContext("2d"); | 1330 var context = this._canvas.getContext("2d"); |
| 1331 var top = this._scrollTop; | 1331 var top = this._scrollTop; |
| 1332 var ratio = window.devicePixelRatio; | 1332 var ratio = window.devicePixelRatio; |
| 1333 var barHeight = this._barHeight; | 1333 var barHeight = this._barHeight; |
| 1334 var textBaseHeight = barHeight - this._dataProvider.textBaseline(); | 1334 var textBaseHeight = barHeight - this._dataProvider.textBaseline(); |
| 1335 var groups = this._rawTimelineData.groups || []; | 1335 var groups = this._rawTimelineData.groups || []; |
| 1336 if (!groups.length) |
| 1337 return; |
| 1338 |
| 1336 var groupOffsets = this._groupOffsets; | 1339 var groupOffsets = this._groupOffsets; |
| 1337 var lastGroupOffset = Array.prototype.peekLast.call(groupOffsets); | 1340 var lastGroupOffset = Array.prototype.peekLast.call(groupOffsets); |
| 1338 | |
| 1339 var firstVisibleGroup = Math.max(groupOffsets.upperBound(top) - 1, 0); | 1341 var firstVisibleGroup = Math.max(groupOffsets.upperBound(top) - 1, 0); |
| 1340 | 1342 |
| 1341 context.save(); | 1343 context.save(); |
| 1342 context.scale(ratio, ratio); | 1344 context.scale(ratio, ratio); |
| 1343 context.translate(0, -top); | 1345 context.translate(0, -top); |
| 1344 | 1346 |
| 1345 context.fillStyle = "#eee"; | 1347 context.fillStyle = "#eee"; |
| 1346 forEachGroup((offset, index, group) => { | 1348 forEachGroup((offset, index, group) => { |
| 1347 var paddingHeight = group.style.padding; | 1349 var paddingHeight = group.style.padding; |
| 1348 if (paddingHeight < 5) | 1350 if (paddingHeight < 5) |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1965 this.update(); | 1967 this.update(); |
| 1966 }, | 1968 }, |
| 1967 | 1969 |
| 1968 _enabled: function() | 1970 _enabled: function() |
| 1969 { | 1971 { |
| 1970 return this._rawTimelineDataLength !== 0; | 1972 return this._rawTimelineDataLength !== 0; |
| 1971 }, | 1973 }, |
| 1972 | 1974 |
| 1973 __proto__: WebInspector.HBox.prototype | 1975 __proto__: WebInspector.HBox.prototype |
| 1974 } | 1976 } |
| OLD | NEW |