Changeset 240763 in webkit
- Timestamp:
- Jan 30, 2019 10:52:35 PM (5 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r240741 r240763 1 2019-01-30 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Memory Timeline View should be responsive / resizable 4 https://bugs.webkit.org/show_bug.cgi?id=153758 5 <rdar://problem/24444320> 6 7 Reviewed by Joseph Pecoraro. 8 9 Leverage the SVG `viewBox` (which was misspelled) to scale the graphs when the width of the 10 container changes. The `viewBox` used is equal to the total amount of time that is visible. 11 12 Make `WI.LineChart` (and its container classes) into subclasses of `WI.View` to leverage the 13 existing layout system. 14 15 Prevent any work from being done when resizing, as this is now handled by CSS/SVG. 16 17 * UserInterface/Views/LineChart.js: 18 (WI.LineChart): 19 (WI.LineChart.prototype.set size): 20 (WI.LineChart.prototype.addPoint): 21 (WI.LineChart.prototype.clear): 22 (WI.LineChart.prototype.layout): 23 (WI.LineChart.prototype.get element): Deleted. 24 (WI.LineChart.prototype.get points): Deleted. 25 (WI.LineChart.prototype.needsLayout): Deleted. 26 (WI.LineChart.prototype.updateLayout): Deleted. 27 28 * UserInterface/Views/CPUUsageView.js: 29 (WI.CPUUsageView): 30 (WI.CPUUsageView.prototype.clear): 31 (WI.CPUUsageView.prototype.updateChart): Added. 32 (WI.CPUUsageView.prototype.get element): Deleted. 33 (WI.CPUUsageView.prototype.layoutWithDataPoints): Deleted. 34 * UserInterface/Views/CPUUsageView.css: 35 (.cpu-usage-view): 36 (.cpu-usage-view > .details): 37 (.cpu-usage-view > .graph, .cpu-usage-view > .graph > .line-chart, .cpu-usage-view > .graph > .line-chart > svg): Added. 38 (.cpu-usage-view > .graph): Deleted. 39 40 * UserInterface/Views/CPUTimelineView.js: 41 (WI.CPUTimelineView): 42 (WI.CPUTimelineView.prototype.layout): 43 (WI.CPUTimelineView.prototype.layout.layoutView): 44 (WI.CPUTimelineView.prototype.layout.layoutView.xScale): 45 (WI.CPUTimelineView.prototype.layout.layoutView.yScale): 46 * UserInterface/Views/CPUTimelineView.css: 47 (body .timeline-view.cpu): Added. 48 (.timeline-view.cpu > .content): 49 (.timeline-view.cpu): Deleted. 50 51 * UserInterface/Views/MemoryCategoryView.js: 52 (WI.MemoryCategoryView): 53 (WI.MemoryCategoryView.prototype.clear): 54 (WI.MemoryCategoryView.prototype.updateChart): Added. 55 (WI.MemoryCategoryView.prototype.get element): Deleted. 56 (WI.MemoryCategoryView.prototype.layoutWithDataPoints): Deleted. 57 * UserInterface/Views/MemoryCategoryView.css: 58 (.memory-category-view): 59 (.memory-category-view > .details): 60 (.memory-category-view > .graph, .memory-category-view > .graph > .line-chart, .memory-category-view > .graph > .line-chart > svg): Added. 61 (.memory-category-view > .graph): Deleted. 62 63 * UserInterface/Views/MemoryTimelineView.js: 64 (WI.MemoryTimelineView.prototype.layout): 65 (WI.MemoryTimelineView.prototype.layout.layoutCategoryView): 66 (WI.MemoryTimelineView.prototype.layout.layoutCategoryView.xScale): 67 (WI.MemoryTimelineView.prototype.layout.layoutCategoryView.yScale): 68 (WI.MemoryTimelineView.prototype._initializeCategoryViews): 69 (WI.MemoryTimelineView.prototype._initializeCategoryViews.appendLegendRow): 70 * UserInterface/Views/MemoryTimelineView.css: 71 (.timeline-view.memory > .content > .overview): 72 (.timeline-view.memory > .content > .overview > .divider): 73 (.timeline-view.memory > .content > .overview .total-usage, .timeline-view.memory > .content > .overview .max-percentage, .timeline-view.memory > .content > .overview .legend .size): Added. 74 (.timeline-view.memory .legend): 75 (.timeline-view.memory .legend .row): Added. 76 (.timeline-view.memory .legend .row + .row): Added. 77 (.timeline-view.memory .legend .swatch): Addd. 78 (.timeline-view.memory .legend .swatch.javascript): Addd. 79 (.timeline-view.memory .legend .swatch.images): Addd. 80 (.timeline-view.memory .legend .swatch.layers): Addd. 81 (.timeline-view.memory .legend .swatch.page): Addd. 82 (.timeline-view.memory .legend .swatch.current): Addd. 83 (.timeline-view.memory > .content): Deleted. 84 (.timeline-view.memory > .content > .overview .total-usage, .timeline-view.memory > .content > .overview .max-percentage): 85 (body[dir=ltr] .timeline-view.memory .legend): Deleted. 86 (body[dir=rtl] .timeline-view.memory .legend): Deleted. 87 (.timeline-view.memory .legend > .row): Deleted. 88 (.timeline-view.memory .legend > .row > .swatch): Deleted. 89 (body[dir=ltr] .timeline-view.memory .legend > .row > .swatch): Deleted. 90 (body[dir=rtl] .timeline-view.memory .legend > .row > .swatch): Deleted. 91 (.timeline-view.memory .legend > .row > p): Deleted. 92 (body[dir=ltr] .timeline-view.memory .legend > .row > :matches(.label, .size)): Deleted. 93 (body[dir=rtl] .timeline-view.memory .legend > .row > :matches(.label, .size)): Deleted. 94 (.timeline-view.memory .legend > .row > .label): Deleted. 95 (.timeline-view.memory .legend > .row > .size): Deleted. 96 (.timeline-view.memory .legend > .row > .swatch.javascript): Deleted. 97 (.timeline-view.memory .legend > .row > .swatch.images): Deleted. 98 (.timeline-view.memory .legend > .row > .swatch.layers): Deleted. 99 (.timeline-view.memory .legend > .row > .swatch.page): Deleted. 100 (.timeline-view.memory .legend > .row > .swatch.current): Deleted. 101 1 102 2019-01-30 Nikita Vasilyev <nvasilyev@apple.com> 2 103 -
trunk/Source/WebInspectorUI/UserInterface/Views/CPUTimelineView.css
r240457 r240763 24 24 */ 25 25 26 .timeline-view.cpu {26 body .timeline-view.cpu { 27 27 overflow: scroll; 28 28 } 29 29 30 30 .timeline-view.cpu > .content { 31 width: 970px; 32 margin: 10px auto; 31 margin-top: 10px; 33 32 } 34 33 -
trunk/Source/WebInspectorUI/UserInterface/Views/CPUTimelineView.js
r240457 r240763 54 54 55 55 this._cpuUsageView = new WI.CPUUsageView; 56 this.addSubview(this._cpuUsageView); 56 57 this._detailsContainerElement.appendChild(this._cpuUsageView.element); 57 58 … … 94 95 layout() 95 96 { 97 if (this.layoutReason === WI.View.LayoutReason.Resize) 98 return; 99 96 100 // Always update timeline ruler. 97 101 this._timelineRuler.zeroTime = this.zeroTime; … … 99 103 this._timelineRuler.endTime = this.endTime; 100 104 105 const cpuUsageViewHeight = 75; // Keep this in sync with .cpu-usage-view 106 101 107 let graphStartTime = this.startTime; 102 108 let graphEndTime = this.endTime; 109 let secondsPerPixel = this._timelineRuler.secondsPerPixel; 103 110 let visibleEndTime = Math.min(this.endTime, this.currentTime); 104 111 … … 116 123 // FIXME: Left chart. 117 124 // FIXME: Right chart. 118 119 // FIXME: <https://webkit.org/b/153758> Web Inspector: Memory / CPU Timeline Views should be responsive / resizable120 const cpuUsageViewWidth = 800;121 const cpuUsageViewHeight = 150;122 123 let secondsPerPixel = (graphEndTime - graphStartTime) / cpuUsageViewWidth;124 125 125 126 let dataPoints = []; … … 165 166 return (time - graphStartTime) / secondsPerPixel; 166 167 } 167 function yScale(size) { 168 return cpuUsageViewHeight - (((size - graphMin) / graphMax) * cpuUsageViewHeight); 168 169 let size = new WI.Size(xScale(graphEndTime), cpuUsageViewHeight); 170 171 function yScale(value) { 172 return size.height - (((value - graphMin) / graphMax) * size.height); 169 173 } 170 174 171 view. layoutWithDataPoints(dataPoints, visibleEndTime, min, max, average, xScale, yScale);175 view.updateChart(dataPoints, size, visibleEndTime, min, max, average, xScale, yScale); 172 176 } 173 177 -
trunk/Source/WebInspectorUI/UserInterface/Views/CPUUsageView.css
r240518 r240763 26 26 .cpu-usage-view { 27 27 display: flex; 28 width: 100%; 29 height: 76px; /* Keep this in sync with cpuUsageViewHeight + 1 (for border-bottom) */ 28 30 border-bottom: 1px solid var(--border-color); 29 31 } 30 32 31 33 .cpu-usage-view > .details { 34 flex-shrink: 0; 32 35 width: 150px; 33 36 padding-top: 10px; … … 48 51 } 49 52 50 .cpu-usage-view > .graph {51 position: relative;52 bottom: -3px;53 }54 55 53 body[dir=rtl] .cpu-usage-view > .graph { 56 54 transform: scaleX(-1); 57 55 } 56 57 .cpu-usage-view > .graph, 58 .cpu-usage-view > .graph > .line-chart, 59 .cpu-usage-view > .graph > .line-chart > svg { 60 width: 100%; 61 height: 100%; 62 } -
trunk/Source/WebInspectorUI/UserInterface/Views/CPUUsageView.js
r240457 r240763 24 24 */ 25 25 26 WI.CPUUsageView = class CPUUsageView 26 WI.CPUUsageView = class CPUUsageView extends WI.View 27 27 { 28 28 constructor() 29 29 { 30 this._element = document.createElement("div"); 31 this._element.classList.add("cpu-usage-view"); 30 super(); 32 31 33 this._detailsElement = this._element.appendChild(document.createElement("div")); 32 this.element.classList.add("cpu-usage-view"); 33 34 this._detailsElement = this.element.appendChild(document.createElement("div")); 34 35 this._detailsElement.classList.add("details"); 35 36 36 this._detailsAverageElement = this._detailsElement.appendChild(document.createElement("span")); 37 this._detailsAverageElement = this._detailsElement.appendChild(document.createElement("span")); 37 38 this._detailsElement.appendChild(document.createElement("br")); 38 39 this._detailsMaxElement = this._detailsElement.appendChild(document.createElement("span")); … … 41 42 this._updateDetails(NaN, NaN); 42 43 43 this._graphElement = this. _element.appendChild(document.createElement("div"));44 this._graphElement = this.element.appendChild(document.createElement("div")); 44 45 this._graphElement.classList.add("graph"); 45 46 46 // FIXME: <https://webkit.org/b/153758> Web Inspector: Memory / CPU Timeline Views should be responsive / resizable 47 let size = new WI.Size(800, 150); 48 this._chart = new WI.LineChart(size); 47 this._chart = new WI.LineChart; 48 this.addSubview(this._chart); 49 49 this._graphElement.appendChild(this._chart.element); 50 50 } 51 51 52 52 // Public 53 54 get element() { return this._element; }55 53 56 54 clear() … … 62 60 63 61 this._chart.clear(); 64 this._chart.needsLayout();65 62 } 66 63 67 layoutWithDataPoints(dataPoints, lastTime, minSize, maxSize, averageSize, xScale, yScale)64 updateChart(dataPoints, size, visibleEndTime, min, max, average, xScale, yScale) 68 65 { 69 console.assert(minSize >= 0); 70 console.assert(maxSize >= 0); 71 console.assert(minSize <= maxSize); 66 console.assert(size instanceof WI.Size); 67 console.assert(min >= 0); 68 console.assert(max >= 0); 69 console.assert(min <= max); 70 console.assert(min <= average && average <= max); 72 71 73 this._updateDetails(minSize, maxSize, averageSize); 72 this._updateDetails(min, max, average); 73 74 74 this._chart.clear(); 75 this._chart.size = size; 76 this._chart.needsLayout(); 75 77 76 78 if (!dataPoints.length) … … 78 80 79 81 // Ensure an empty graph is empty. 80 if (!max Size)82 if (!max) 81 83 return; 82 84 … … 95 97 // Extend the last data point to the end time. 96 98 let lastDataPoint = dataPoints.lastValue; 97 let lastX = Math.floor(xScale( lastTime));99 let lastX = Math.floor(xScale(visibleEndTime)); 98 100 let lastY = yScale(lastDataPoint.size); 99 101 this._chart.addPoint(lastX, lastY); 100 101 this._chart.updateLayout();102 102 } 103 103 -
trunk/Source/WebInspectorUI/UserInterface/Views/LineChart.js
r220119 r240763 34 34 // 35 35 // <div class="line-chart"> 36 // <svg width="800" height="75" view box="0 0 800 75">36 // <svg width="800" height="75" viewBox="0 0 800 75"> 37 37 // <path d="..."/> 38 38 // </svg> 39 39 // </div> 40 40 41 WI.LineChart = class LineChart 41 WI.LineChart = class LineChart extends WI.View 42 42 { 43 constructor( size)43 constructor() 44 44 { 45 this._element = document.createElement("div"); 46 this._element.classList.add("line-chart"); 45 super(); 47 46 48 this._chartElement = this._element.appendChild(createSVGElement("svg")); 47 this.element.classList.add("line-chart"); 48 49 this._chartElement = this.element.appendChild(createSVGElement("svg")); 50 this._chartElement.setAttribute("preserveAspectRatio", "none"); 51 49 52 this._pathElement = this._chartElement.appendChild(createSVGElement("path")); 50 53 51 54 this._points = []; 52 this. size = size;55 this._size = null; 53 56 } 54 57 55 58 // Public 56 57 get element() { return this._element; }58 get points() { return this._points; }59 59 60 60 get size() … … 65 65 set size(size) 66 66 { 67 if (this._size && this._size.equals(size)) 68 return; 69 67 70 this._size = size; 68 71 69 this._chartElement.setAttribute(" width", size.width);70 this._chartElement.setAttribute("height", size.height); 71 this. _chartElement.setAttribute("viewbox", `0 0 ${size.width} ${size.height}`);72 this._chartElement.setAttribute("viewBox", `0 0 ${size.width} ${size.height}`); 73 74 this.needsLayout(); 72 75 } 73 76 … … 82 85 } 83 86 84 needsLayout() 87 // Protected 88 89 layout() 85 90 { 86 if (this. _scheduledLayoutUpdateIdentifier)91 if (this.layoutReason === WI.View.LayoutReason.Resize) 87 92 return; 88 93 89 this._scheduledLayoutUpdateIdentifier = requestAnimationFrame(this.updateLayout.bind(this)); 90 } 91 92 updateLayout() 93 { 94 if (this._scheduledLayoutUpdateIdentifier) { 95 cancelAnimationFrame(this._scheduledLayoutUpdateIdentifier); 96 this._scheduledLayoutUpdateIdentifier = undefined; 97 } 94 if (!this._size) 95 return; 98 96 99 97 let pathComponents = []; -
trunk/Source/WebInspectorUI/UserInterface/Views/MemoryCategoryView.css
r240518 r240763 26 26 .memory-category-view { 27 27 display: flex; 28 width: 100%; 29 height: 76px; /* Keep this in sync with memoryCategoryViewHeight + 1 (for border-bottom) */ 28 30 border-bottom: 1px solid var(--border-color); 29 31 } 30 32 31 33 .memory-category-view > .details { 34 flex-shrink: 0; 32 35 width: 150px; 33 36 padding-top: 10px; … … 52 55 } 53 56 54 .memory-category-view > .graph {55 position: relative;56 bottom: -3px;57 }58 57 59 58 body[dir=rtl] .memory-category-view > .graph { 60 59 transform: scaleX(-1); 61 60 } 61 62 .memory-category-view > .graph, 63 .memory-category-view > .graph > .line-chart, 64 .memory-category-view > .graph > .line-chart > svg { 65 width: 100%; 66 height: 100%; 67 } -
trunk/Source/WebInspectorUI/UserInterface/Views/MemoryCategoryView.js
r240457 r240763 24 24 */ 25 25 26 WI.MemoryCategoryView = class MemoryCategoryView 26 WI.MemoryCategoryView = class MemoryCategoryView extends WI.View 27 27 { 28 28 constructor(category, displayName) … … 30 30 console.assert(typeof category === "string"); 31 31 32 super(); 33 32 34 this._category = category; 33 35 34 this._element = document.createElement("div"); 35 this._element.classList.add("memory-category-view", category); 36 this.element.classList.add("memory-category-view", category); 36 37 37 this._detailsElement = this. _element.appendChild(document.createElement("div"));38 this._detailsElement = this.element.appendChild(document.createElement("div")); 38 39 this._detailsElement.classList.add("details"); 39 40 … … 47 48 this._updateDetails(NaN, NaN); 48 49 49 this._graphElement = this. _element.appendChild(document.createElement("div"));50 this._graphElement = this.element.appendChild(document.createElement("div")); 50 51 this._graphElement.classList.add("graph"); 51 52 52 // FIXME: <https://webkit.org/b/153758> Web Inspector: Memory / CPU Timeline Views should be responsive / resizable 53 let size = new WI.Size(800, 75); 54 this._chart = new WI.LineChart(size); 53 this._chart = new WI.LineChart; 54 this.addSubview(this._chart); 55 55 this._graphElement.appendChild(this._chart.element); 56 56 } … … 58 58 // Public 59 59 60 get element() { return this._element; }61 60 get category() { return this._category; } 62 61 … … 68 67 69 68 this._chart.clear(); 70 this._chart.needsLayout();71 69 } 72 70 73 layoutWithDataPoints(dataPoints, lastTime, minSize, maxSize, xScale, yScale)71 updateChart(dataPoints, size, visibleEndTime, min, max, xScale, yScale) 74 72 { 75 console.assert(minSize >= 0); 76 console.assert(maxSize >= 0); 77 console.assert(minSize <= maxSize); 73 console.assert(size instanceof WI.Size); 74 console.assert(min >= 0); 75 console.assert(max >= 0); 76 console.assert(min <= max); 78 77 79 this._updateDetails(minSize, maxSize); 78 this._updateDetails(min, max); 79 80 80 this._chart.clear(); 81 this._chart.size = size; 82 this._chart.needsLayout(); 81 83 82 84 if (!dataPoints.length) … … 84 86 85 87 // Ensure an empty graph is empty. 86 if (!max Size)88 if (!max) 87 89 return; 88 90 … … 101 103 // Extend the last data point to the end time. 102 104 let lastDataPoint = dataPoints.lastValue; 103 let lastX = Math.floor(xScale( lastTime));105 let lastX = Math.floor(xScale(visibleEndTime)); 104 106 let lastY = yScale(lastDataPoint.size); 105 107 this._chart.addPoint(lastX, lastY); 106 107 this._chart.updateLayout();108 108 } 109 109 -
trunk/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineView.css
r240518 r240763 28 28 } 29 29 30 .timeline-view.memory > .content {31 width: 970px;32 margin: 10px auto;33 }34 35 30 .timeline-view.memory > .content > .overview { 36 padding -bottom: 10px;31 padding: 10px; 37 32 margin-bottom: 10px; 38 33 border-bottom: 1px solid var(--border-color); … … 91 86 92 87 .timeline-view.memory > .content > .overview > .divider { 93 margin-left: 10px; 94 margin-right: 10px; 88 margin: 0 5px; 95 89 96 90 --memory-timeline-view-overview-divider-border-end: 1px solid var(--border-color); … … 106 100 107 101 .timeline-view.memory > .content > .overview .total-usage, 108 .timeline-view.memory > .content > .overview .max-percentage { 102 .timeline-view.memory > .content > .overview .max-percentage, 103 .timeline-view.memory > .content > .overview .legend .size { 109 104 margin: auto; 110 105 color: var(--text-color-secondary); … … 112 107 113 108 .timeline-view.memory .legend { 109 -webkit-padding-start: 20px; 114 110 text-align: start; 115 116 --memory-timeline-view-legent-padding-start: 20px;117 111 } 118 112 119 body[dir=ltr] .timeline-view.memory .legend{120 padding-left: var(--memory-timeline-view-legent-padding-start);113 .timeline-view.memory .legend .row { 114 display: flex; 121 115 } 122 116 123 body[dir=rtl] .timeline-view.memory .legend{124 padding-right: var(--memory-timeline-view-legent-padding-start);117 .timeline-view.memory .legend .row + .row { 118 margin-top: 4px; 125 119 } 126 120 127 .timeline-view.memory .legend > .row { 128 position: relative; 129 width: 100px; 130 height: 27px; 131 132 --memory-timeline-view-legend-row-offset-start: 20px; 121 .timeline-view.memory .legend .swatch { 122 width: 1em; 123 height: 1em; 124 margin-top: 1px; 125 -webkit-margin-end: 8px; 133 126 } 134 127 135 .timeline-view.memory .legend > .row > .swatch { 136 position: absolute; 137 top: 1px; 138 width: 1em; 139 height: 1em; 140 } 141 142 body[dir=ltr] .timeline-view.memory .legend > .row > .swatch { 143 left: 0; 144 } 145 146 body[dir=rtl] .timeline-view.memory .legend > .row > .swatch { 147 right: 0; 148 } 149 150 .timeline-view.memory .legend > .row > p { 151 margin: 0; 152 } 153 154 body[dir=ltr] .timeline-view.memory .legend > .row > :matches(.label, .size) { 155 left: var(--memory-timeline-view-legend-row-offset-start); 156 } 157 158 body[dir=rtl] .timeline-view.memory .legend > .row > :matches(.label, .size) { 159 right: var(--memory-timeline-view-legend-row-offset-start); 160 } 161 162 .timeline-view.memory .legend > .row > .label { 163 position: absolute; 164 top: 0; 165 } 166 167 .timeline-view.memory .legend > .row > .size { 168 position: absolute; 169 top: 12px; 170 color: var(--text-color-secondary); 171 } 172 173 .timeline-view.memory .legend > .row > .swatch.javascript { 128 .timeline-view.memory .legend .swatch.javascript { 174 129 border: 1px solid var(--memory-javascript-stroke-color); 175 130 background: var(--memory-javascript-fill-color); 176 131 } 177 132 178 .timeline-view.memory .legend > .row >.swatch.images {133 .timeline-view.memory .legend .swatch.images { 179 134 border: 1px solid var(--memory-images-stroke-color); 180 135 background: var(--memory-images-fill-color); 181 136 } 182 137 183 .timeline-view.memory .legend > .row >.swatch.layers {138 .timeline-view.memory .legend .swatch.layers { 184 139 border: 1px solid var(--memory-layers-stroke-color); 185 140 background: var(--memory-layers-fill-color); 186 141 } 187 142 188 .timeline-view.memory .legend > .row >.swatch.page {143 .timeline-view.memory .legend .swatch.page { 189 144 border: 1px solid var(--memory-page-stroke-color); 190 145 background: var(--memory-page-fill-color); 191 146 } 192 147 148 .timeline-view.memory .legend .swatch.current { 149 border: 1px solid var(--memory-max-comparison-stroke-color); 150 background: var(--memory-max-comparison-fill-color); 151 } 193 152 194 153 .timeline-view.memory .circle-chart > svg > path.javascript, … … 216 175 } 217 176 218 .timeline-view.memory .legend > .row > .swatch.current {219 border: 1px solid var(--memory-max-comparison-stroke-color);220 background: var(--memory-max-comparison-fill-color);221 }222 223 177 .timeline-view.memory .circle-chart > svg > path.current { 224 178 stroke: var(--memory-max-comparison-stroke-color); -
trunk/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineView.js
r240457 r240763 159 159 layout() 160 160 { 161 if (this.layoutReason === WI.View.LayoutReason.Resize) 162 return; 163 161 164 // Always update timeline ruler. 162 165 this._timelineRuler.zeroTime = this.zeroTime; … … 167 170 return; 168 171 172 const memoryCategoryViewHeight = 75; // Keep this in sync with .memory-category-view 173 169 174 let graphStartTime = this.startTime; 170 175 let graphEndTime = this.endTime; 176 let secondsPerPixel = this._timelineRuler.secondsPerPixel; 171 177 let visibleEndTime = Math.min(this.endTime, this.currentTime); 172 178 … … 195 201 this._updateMaxComparisonLegend(lastRecord.totalSize); 196 202 197 // FIXME: <https://webkit.org/b/153758> Web Inspector: Memory / CPU Timeline Views should be responsive / resizable198 const categoryViewWidth = 800;199 const categoryViewHeight = 75;200 201 let secondsPerPixel = (graphEndTime - graphStartTime) / categoryViewWidth;202 203 203 let categoryDataMap = {}; 204 204 for (let categoryView of this._categoryViews) … … 236 236 visibleEndTime = discontinuities[0].startTime; 237 237 238 function layoutCategoryView(categoryView, categoryData) { 239 let {dataPoints, min, max} = categoryData; 240 238 function layoutCategoryView(categoryView, {dataPoints, min, max}) { 241 239 if (min === Infinity) 242 240 min = 0; … … 251 249 return (time - graphStartTime) / secondsPerPixel; 252 250 } 253 function yScale(size) { 254 return categoryViewHeight - (((size - graphMin) / graphMax) * categoryViewHeight); 251 252 let size = new WI.Size(xScale(graphEndTime), memoryCategoryViewHeight); 253 254 function yScale(value) { 255 return size.height - (((value - graphMin) / graphMax) * size.height); 255 256 } 256 257 257 categoryView. layoutWithDataPoints(dataPoints, visibleEndTime, min, max, xScale, yScale);258 categoryView.updateChart(dataPoints, size, visibleEndTime, min, max, xScale, yScale); 258 259 } 259 260 … … 350 351 let rowElement = legendElement.appendChild(document.createElement("div")); 351 352 rowElement.classList.add("row"); 353 352 354 let swatchElement = rowElement.appendChild(document.createElement("div")); 353 355 swatchElement.classList.add("swatch", swatchClass); 354 let labelElement = rowElement.appendChild(document.createElement("p")); 356 357 let valueContainer = rowElement.appendChild(document.createElement("div")); 358 valueContainer.classList.add("value"); 359 360 let labelElement = valueContainer.appendChild(document.createElement("div")); 355 361 labelElement.classList.add("label"); 356 362 labelElement.textContent = label; 357 let sizeElement = rowElement.appendChild(document.createElement("p")); 363 364 let sizeElement = valueContainer.appendChild(document.createElement("div")); 358 365 sizeElement.classList.add("size"); 359 366 … … 370 377 let categoryView = new WI.MemoryCategoryView(type, WI.MemoryTimelineView.displayNameForCategory(type)); 371 378 this._categoryViews.push(categoryView); 379 this.addSubview(categoryView); 372 380 if (!lastCategoryViewElement) 373 381 this._detailsContainerElement.appendChild(categoryView.element);
Note: See TracChangeset
for help on using the changeset viewer.