| 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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 var groups = this._rawTimelineData.groups || []; | 966 var groups = this._rawTimelineData.groups || []; |
| 967 this._visibleLevelOffsets = new Uint32Array(levelCount + 1); | 967 this._visibleLevelOffsets = new Uint32Array(levelCount + 1); |
| 968 this._visibleLevels = new Uint16Array(levelCount); | 968 this._visibleLevels = new Uint16Array(levelCount); |
| 969 this._groupOffsets = new Uint32Array(groups.length + 1); | 969 this._groupOffsets = new Uint32Array(groups.length + 1); |
| 970 | 970 |
| 971 var groupIndex = -1; | 971 var groupIndex = -1; |
| 972 var currentOffset = UI.FlameChart.DividersBarHeight; | 972 var currentOffset = UI.FlameChart.DividersBarHeight; |
| 973 var visible = true; | 973 var visible = true; |
| 974 /** @type !Array<{nestingLevel: number, visible: boolean}> */ | 974 /** @type !Array<{nestingLevel: number, visible: boolean}> */ |
| 975 var groupStack = [{nestingLevel: -1, visible: true}]; | 975 var groupStack = [{nestingLevel: -1, visible: true}]; |
| 976 for (var level = 0; level < levelCount; ++level) { | 976 var lastGroupLevel = Math.max(levelCount, groups.peekLast().startLevel + 1); |
| 977 for (var level = 0; level < lastGroupLevel; ++level) { |
| 977 while (groupIndex < groups.length - 1 && level === groups[groupIndex + 1].
startLevel) { | 978 while (groupIndex < groups.length - 1 && level === groups[groupIndex + 1].
startLevel) { |
| 978 ++groupIndex; | 979 ++groupIndex; |
| 979 var style = groups[groupIndex].style; | 980 var style = groups[groupIndex].style; |
| 980 var nextLevel = true; | 981 var nextLevel = true; |
| 981 while (groupStack.peekLast().nestingLevel >= style.nestingLevel) { | 982 while (groupStack.peekLast().nestingLevel >= style.nestingLevel) { |
| 982 groupStack.pop(); | 983 groupStack.pop(); |
| 983 nextLevel = false; | 984 nextLevel = false; |
| 984 } | 985 } |
| 985 var thisGroupIsVisible = | 986 var thisGroupIsVisible = |
| 986 groupIndex >= 0 && this._isGroupCollapsible(groupIndex) ? groups[gro
upIndex].expanded : true; | 987 groupIndex >= 0 && this._isGroupCollapsible(groupIndex) ? groups[gro
upIndex].expanded : true; |
| 987 var parentGroupIsVisible = groupStack.peekLast().visible; | 988 var parentGroupIsVisible = groupStack.peekLast().visible; |
| 988 visible = thisGroupIsVisible && parentGroupIsVisible; | 989 visible = thisGroupIsVisible && parentGroupIsVisible; |
| 989 groupStack.push({nestingLevel: style.nestingLevel, visible: visible}); | 990 groupStack.push({nestingLevel: style.nestingLevel, visible: visible}); |
| 990 if (parentGroupIsVisible) | 991 if (parentGroupIsVisible) |
| 991 currentOffset += nextLevel ? 0 : style.padding; | 992 currentOffset += nextLevel ? 0 : style.padding; |
| 992 this._groupOffsets[groupIndex] = currentOffset; | 993 this._groupOffsets[groupIndex] = currentOffset; |
| 993 if (parentGroupIsVisible && !style.shareHeaderLine) | 994 if (parentGroupIsVisible && !style.shareHeaderLine) |
| 994 currentOffset += style.height; | 995 currentOffset += style.height; |
| 995 } | 996 } |
| 996 var isFirstOnLevel = groupIndex >= 0 && level === groups[groupIndex].start
Level; | 997 var isFirstOnLevel = groupIndex >= 0 && level === groups[groupIndex].start
Level; |
| 997 var thisLevelIsVisible = visible || isFirstOnLevel && groups[groupIndex].s
tyle.useFirstLineForOverview; | 998 var thisLevelIsVisible = visible || isFirstOnLevel && groups[groupIndex].s
tyle.useFirstLineForOverview; |
| 998 this._visibleLevels[level] = thisLevelIsVisible; | 999 if (level < levelCount) { |
| 999 this._visibleLevelOffsets[level] = currentOffset; | 1000 this._visibleLevels[level] = thisLevelIsVisible; |
| 1001 this._visibleLevelOffsets[level] = currentOffset; |
| 1002 } |
| 1000 if (thisLevelIsVisible || (parentGroupIsVisible && style.shareHeaderLine &
& isFirstOnLevel)) | 1003 if (thisLevelIsVisible || (parentGroupIsVisible && style.shareHeaderLine &
& isFirstOnLevel)) |
| 1001 currentOffset += this._barHeight; | 1004 currentOffset += this._barHeight; |
| 1002 } | 1005 } |
| 1003 if (groupIndex >= 0) | 1006 if (groupIndex >= 0) |
| 1004 this._groupOffsets[groupIndex + 1] = currentOffset; | 1007 this._groupOffsets[groupIndex + 1] = currentOffset; |
| 1005 this._visibleLevelOffsets[level] = currentOffset; | 1008 this._visibleLevelOffsets[level] = currentOffset; |
| 1006 } | 1009 } |
| 1007 | 1010 |
| 1008 /** | 1011 /** |
| 1009 * @param {number} index | 1012 * @param {number} index |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 } | 1495 } |
| 1493 | 1496 |
| 1494 /** | 1497 /** |
| 1495 * @override | 1498 * @override |
| 1496 * @return {number} | 1499 * @return {number} |
| 1497 */ | 1500 */ |
| 1498 boundarySpan() { | 1501 boundarySpan() { |
| 1499 return this._maximumBoundaries - this._minimumBoundaries; | 1502 return this._maximumBoundaries - this._minimumBoundaries; |
| 1500 } | 1503 } |
| 1501 }; | 1504 }; |
| OLD | NEW |