Changeset 143324 in webkit
- Timestamp:
- Feb 19, 2013 6:29:47 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r143323 r143324 1 2013-02-19 Andrey Adaikin <aandrey@chromium.org> 2 3 Web Inspector: [Canvas] UI: tweak replay control buttons behavior 4 https://bugs.webkit.org/show_bug.cgi?id=110207 5 6 Reviewed by Pavel Feldman. 7 8 Testing control buttons behavior. 9 10 * inspector/profiler/canvas2d/canvas-replay-log-grid-expected.txt: 11 * inspector/profiler/canvas2d/canvas-replay-log-grid.html: 12 1 13 2013-02-19 Sheriff Bot <webkit.review.bot@gmail.com> 2 14 -
trunk/LayoutTests/inspector/profiler/canvas2d/canvas-replay-log-grid-expected.txt
r143237 r143324 2 2 3 3 Bug 109592 4 5 Total frames: 2 6 Total draw call groups: 5 7 Total calls: 30 8 Total grid nodes: 37 9 10 Testing ReplayFirstStepClick 11 Testing ReplayNextStepClick 12 Testing ReplayPreviousStepClick 13 Testing ReplayNextDrawingCallClick starting on a frame node 14 Testing ReplayPreviousDrawingCallClick starting on a frame node 15 Testing ReplayNextDrawingCallClick starting on a draw call group 16 Testing ReplayPreviousDrawingCallClick starting on a call node 17 Testing ReplayNextDrawingCallClick starting on a call node 4 18 5 19 | Frame #1 | | | -
trunk/LayoutTests/inspector/profiler/canvas2d/canvas-replay-log-grid.html
r143237 r143324 49 49 profilesPanel.toggleRecordButton(); 50 50 51 var traceLogId;52 51 var profileHeader; 52 var profileView; 53 var dataGrid; 54 53 55 function didStartCapturingFrame(profilesPanel, frameId, error, traceLogId) 54 56 { 55 57 profileHeader = profilesPanel.getProfiles(WebInspector.CanvasProfileType.TypeId)[0]; 56 traceLogId = profileHeader.traceLogId();57 58 profilesPanel.showProfile(profileHeader); 58 59 InspectorTest.addSniffer(profileHeader, "_updateCapturingStatus", didReceiveFirstFrame); … … 69 70 function didSecondFrameCalls() 70 71 { 71 InspectorTest.addSniffer(profileHeader, "_updateCapturingStatus", didReceiveSecondFrame); 72 profileView = profilesPanel.visibleView; 73 dataGrid = profileView._logGrid; 74 InspectorTest.addSniffer(CanvasAgent, "replayTraceLog", onReplayTraceLog); 72 75 profilesPanel.toggleRecordButton(); 73 76 } 74 function didReceiveSecondFrame() 75 { 76 if (profileHeader._alive) { 77 InspectorTest.addSniffer(profileHeader, "_updateCapturingStatus", didReceiveSecondFrame); 78 return; 79 } 80 81 var profileView = profilesPanel.visibleView; 82 var dataGrid = profileView._logGrid; 83 dataGrid.rootNode().expandRecursively(); 84 77 function onReplayTraceLog(traceLogId, index) 78 { 79 testControlButtons(); 80 81 InspectorTest.addResult(""); 85 82 dumpTableData(dataGrid.element); 86 83 InspectorTest.completeTest(); 87 84 } 85 86 87 function testControlButtons() 88 { 89 var rootNode = dataGrid.rootNode(); 90 var frameNodes = []; 91 var drawCallGroups = []; 92 var nodes = []; 93 var allNodesFlat = []; 94 95 frameNodes = frameNodes.concat(rootNode.children); 96 frameNodes.forEach(function(frameNode) { 97 drawCallGroups = drawCallGroups.concat(frameNode.children); 98 }); 99 drawCallGroups.forEach(function(drawCallGroup) { 100 nodes = nodes.concat(drawCallGroup.children); 101 }); 102 for (var node = rootNode; node; node = node.traverseNextNode(false)) { 103 if (node !== rootNode) 104 allNodesFlat.push(node); 105 } 106 allNodesFlat.forEach(function(node) { 107 node.toString = function() 108 { 109 return "Node{" + this.element.textContent + "}"; 110 } 111 }); 112 113 InspectorTest.addResult(""); 114 InspectorTest.addResult("Total frames: " + frameNodes.length); 115 InspectorTest.addResult("Total draw call groups: " + drawCallGroups.length); 116 InspectorTest.addResult("Total calls: " + nodes.length); 117 InspectorTest.addResult("Total grid nodes: " + allNodesFlat.length); 118 InspectorTest.addResult(""); 119 120 InspectorTest.assertEquals(frameNodes.peekLast(), dataGrid.selectedNode, "Expected last frame node before testing control buttons"); 121 122 InspectorTest.addResult("Testing ReplayFirstStepClick"); 123 profileView._onReplayFirstStepClick(); 124 InspectorTest.assertEquals(frameNodes[0], dataGrid.selectedNode); 125 126 InspectorTest.addResult("Testing ReplayNextStepClick"); 127 for (var i = 1; i < allNodesFlat.length + 5; ++i) { 128 profileView._onReplayStepClick(true); 129 InspectorTest.assertEquals(allNodesFlat[i] || allNodesFlat.peekLast(), dataGrid.selectedNode, "error on index " + i); 130 } 131 132 InspectorTest.addResult("Testing ReplayPreviousStepClick"); 133 for (var i = allNodesFlat.length - 2; i >= -5; --i) { 134 profileView._onReplayStepClick(false); 135 InspectorTest.assertEquals(allNodesFlat[i] || allNodesFlat[0], dataGrid.selectedNode, "error on index " + i); 136 } 137 138 InspectorTest.addResult("Testing ReplayNextDrawingCallClick starting on a frame node"); 139 for (var i = 1; i < frameNodes.length + 5; ++i) { 140 profileView._onReplayDrawingCallClick(true); 141 InspectorTest.assertEquals(frameNodes[i] || frameNodes.peekLast(), dataGrid.selectedNode, "error on index " + i); 142 } 143 144 InspectorTest.addResult("Testing ReplayPreviousDrawingCallClick starting on a frame node"); 145 for (var i = frameNodes.length - 2; i >= -5; --i) { 146 profileView._onReplayDrawingCallClick(false); 147 InspectorTest.assertEquals(frameNodes[i] || frameNodes[0], dataGrid.selectedNode, "error on index " + i); 148 } 149 150 profileView._onReplayStepClick(true); 151 InspectorTest.assertEquals(drawCallGroups[0], dataGrid.selectedNode, "Expected to move to the first draw call group"); 152 153 InspectorTest.addResult("Testing ReplayNextDrawingCallClick starting on a draw call group"); 154 var expected = [drawCallGroups[1], frameNodes[1]]; 155 for (var i = 0; i < expected.length + 5; ++i) { 156 profileView._onReplayDrawingCallClick(true); 157 InspectorTest.assertEquals(expected[i] || expected.peekLast(), dataGrid.selectedNode, "error on index " + i); 158 } 159 160 profileView._onReplayLastStepClick(); 161 InspectorTest.assertEquals(allNodesFlat.peekLast(), dataGrid.selectedNode, "Expected to move to the last call"); 162 163 InspectorTest.addResult("Testing ReplayPreviousDrawingCallClick starting on a call node"); 164 var expected = [frameNodes[0], frameNodes[1], drawCallGroups[2], drawCallGroups[3], drawCallGroups[4]]; 165 for (var i = expected.length - 1; i >= -5; --i) { 166 profileView._onReplayDrawingCallClick(false); 167 InspectorTest.assertEquals(expected[i] || expected[0], dataGrid.selectedNode, "error on index " + i); 168 } 169 170 nodes[15].revealAndSelect(); 171 InspectorTest.assertEquals(nodes[15], dataGrid.selectedNode, "Expected to select node #20"); 172 173 InspectorTest.addResult("Testing ReplayNextDrawingCallClick starting on a call node"); 174 var expected = [drawCallGroups[3], drawCallGroups[4]]; 175 for (var i = 0; i < expected.length + 5; ++i) { 176 profileView._onReplayDrawingCallClick(true); 177 InspectorTest.assertEquals(expected[i] || expected.peekLast(), dataGrid.selectedNode, "error on index " + i); 178 } 179 } 180 88 181 function dumpTableData(tableElement) 89 182 { … … 104 197 textCols[index] = text; 105 198 } 106 textRows.push(textCols); 199 if (textCols.length) 200 textRows.push(textCols); 107 201 } 108 202 … … 124 218 line += alignText(textRows[i][j], textWidths[j]); 125 219 } 126 if (line) 127 line += "|"; 220 line += "|"; 128 221 InspectorTest.addResult(line); 129 222 } -
trunk/Source/WebCore/ChangeLog
r143322 r143324 1 2013-02-19 Andrey Adaikin <aandrey@chromium.org> 2 3 Web Inspector: [Canvas] UI: tweak replay control buttons behavior 4 https://bugs.webkit.org/show_bug.cgi?id=110207 5 6 Reviewed by Pavel Feldman. 7 8 New behavior for control buttons in the Canvas profiler. 9 - The NextCall button (~StepInto) on a node group should expand it and move into its first child (instead of expanding and moving into the next node group) 10 - The NextDrawCall button (~StepOver) should move to a next node that has children (instead of just iterating call group nodes, ignoring frame nodes). 11 - The ReplayLast button should select the last expanded node (instead of always selecting last frame group node). 12 13 * inspector/front-end/CanvasProfileView.js: 14 (WebInspector.CanvasProfileView.prototype._onReplayStepClick): 15 (WebInspector.CanvasProfileView.prototype._onReplayDrawingCallClick): 16 (WebInspector.CanvasProfileView.prototype._onReplayLastStepClick): 17 1 18 2013-02-19 Andrei Bucur <abucur@adobe.com> 2 19 -
trunk/Source/WebCore/inspector/front-end/CanvasProfileView.js
r143237 r143324 182 182 _onReplayStepClick: function(forward) 183 183 { 184 var index = this._selectedCallIndex();185 if ( index === -1)186 return; 187 var nextNode = this._logGridNodes[forward ? index + 1 : index - 1] || this._logGridNodes[index];188 nextNode.revealAndSelect();184 var selectedNode = this._logGrid.selectedNode; 185 if (!selectedNode) 186 return; 187 var nextNode = forward ? selectedNode.traverseNextNode(false) : selectedNode.traversePreviousNode(false); 188 (nextNode || selectedNode).revealAndSelect(); 189 189 }, 190 190 … … 194 194 _onReplayDrawingCallClick: function(forward) 195 195 { 196 var index = this._selectedDrawCallGroupIndex(); 197 if (index === -1) 198 return; 199 var nextNode = this._drawCallGroups[forward ? index + 1 : index - 1] || this._drawCallGroups[index]; 200 nextNode.revealAndSelect(); 196 var selectedNode = this._logGrid.selectedNode; 197 if (!selectedNode) 198 return; 199 var nextNode = selectedNode; 200 while (nextNode) { 201 var sibling = forward ? nextNode.nextSibling : nextNode.previousSibling; 202 if (sibling) { 203 nextNode = sibling; 204 if (nextNode.hasChildren) 205 break; 206 } else { 207 nextNode = nextNode.parent; 208 if (!forward) 209 break; 210 } 211 } 212 (nextNode || selectedNode).revealAndSelect(); 201 213 }, 202 214 … … 211 223 { 212 224 var lastNode = this._logGrid.rootNode().children.peekLast(); 213 if (lastNode) 214 lastNode.revealAndSelect(); 225 if (!lastNode) 226 return; 227 while (lastNode.expanded) { 228 var lastChild = lastNode.children.peekLast(); 229 if (!lastChild) 230 break; 231 lastNode = lastChild; 232 } 233 lastNode.revealAndSelect(); 215 234 }, 216 235
Note: See TracChangeset
for help on using the changeset viewer.