Changeset 139614 in webkit
- Timestamp:
- Jan 14, 2013 7:37:40 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r139611 r139614 1 2013-01-14 Andrey Adaikin <aandrey@chromium.org> 2 3 Web Inspector: [Canvas] UI: add control buttons for doing the replay steps 4 https://bugs.webkit.org/show_bug.cgi?id=106788 5 6 Reviewed by Pavel Feldman. 7 8 Adding UI control buttons for doing the Canvas replay steps. 9 Drive-by: fixed a bug in DataGrid (found by the JSCompiler). 10 11 * inspector/front-end/CanvasProfileView.js: 12 (WebInspector.CanvasProfileView): 13 (WebInspector.CanvasProfileView.prototype._createControlButton): 14 (WebInspector.CanvasProfileView.prototype._onReplayStepClick): 15 (WebInspector.CanvasProfileView.prototype._onReplayFirstStepClick): 16 (WebInspector.CanvasProfileView.prototype._onReplayLastStepClick): 17 (WebInspector.CanvasProfileView.prototype._enableWaitIcon): 18 (WebInspector.CanvasProfileView.prototype._replayTraceLog.didReplayTraceLog): 19 (WebInspector.CanvasProfileView.prototype._replayTraceLog): 20 (WebInspector.CanvasProfileView.prototype._didReceiveTraceLog): 21 (WebInspector.CanvasProfileType.prototype._updateDecorationElement): 22 * inspector/front-end/DOMExtension.js: 23 (Element.prototype.enableStyleClass): 24 * inspector/front-end/DataGrid.js: 25 (WebInspector.DataGrid.prototype.setRootNode): 26 (WebInspector.DataGrid.prototype._startEditingColumnOfDataGridNode): 27 (WebInspector.DataGrid.prototype.moveToNextIfNeeded): 28 (WebInspector.DataGrid.prototype._editingCommitted): 29 (WebInspector.DataGridNode): 30 * inspector/front-end/canvasProfiler.css: 31 (.canvas-replay-image): 32 (.canvas-replay-image.wait): 33 (.canvas-replay-controls): 34 (.canvas-replay-log): 35 (.canvas-control-button): 36 (.canvas-control-button:active): 37 (.canvas-control-button:disabled): 38 (.canvas-control-button img): 39 (.canvas-replay-first-step img): 40 (.canvas-replay-next-step img): 41 (.canvas-replay-prev-step img): 42 (.canvas-replay-last-step img): 43 1 44 2013-01-14 Tommy Widenflycht <tommyw@google.com> 2 45 -
trunk/Source/WebCore/English.lproj/localizedStrings.js
r139408 r139614 778 778 localizedStrings["Capturing\u2026"] = "Capturing\u2026"; 779 779 localizedStrings["There is an uninstrumented canvas on the page. Reload the page to instrument it."] = "There is an uninstrumented canvas on the page. Reload the page to instrument it."; 780 localizedStrings["First call."] = "First call."; 781 localizedStrings["Previous call."] = "Previous call."; 782 localizedStrings["Next call."] = "Next call."; 783 localizedStrings["Last call."] = "Last call."; 780 784 localizedStrings["Reload"] = "Reload"; 781 785 localizedStrings["Binary File"] = "Binary File"; -
trunk/Source/WebCore/inspector/front-end/CanvasProfileView.js
r139408 r139614 44 44 this._splitView = new WebInspector.SplitView(false, "canvasProfileViewSplitLocation", 300); 45 45 46 var replayImageContainer = this._splitView.firstElement(); 47 replayImageContainer.id = "canvas-replay-image-container"; 48 this._replayImageElement = replayImageContainer.createChild("image", "canvas-replay-image"); 49 this._debugInfoElement = replayImageContainer.createChild("div"); 50 51 var replayInfoContainer = this._splitView.secondElement(); 52 var controlsContainer = replayInfoContainer.createChild("div", "canvas-replay-controls"); 53 var logGridContainer = replayInfoContainer.createChild("div", "canvas-replay-log"); 54 55 this._createControlButton(controlsContainer, "canvas-replay-first-step", WebInspector.UIString("First call."), this._onReplayFirstStepClick.bind(this)); 56 this._createControlButton(controlsContainer, "canvas-replay-prev-step", WebInspector.UIString("Previous call."), this._onReplayStepClick.bind(this, false)); 57 this._createControlButton(controlsContainer, "canvas-replay-next-step", WebInspector.UIString("Next call."), this._onReplayStepClick.bind(this, true)); 58 this._createControlButton(controlsContainer, "canvas-replay-last-step", WebInspector.UIString("Last call."), this._onReplayLastStepClick.bind(this)); 59 46 60 var columns = { 0: {}, 1: {}, 2: {} }; 47 61 columns[0].title = "#"; … … 57 71 this._logGrid = new WebInspector.DataGrid(columns); 58 72 this._logGrid.element.addStyleClass("fill"); 59 this._logGrid.show( this._splitView.secondElement());73 this._logGrid.show(logGridContainer); 60 74 this._logGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._replayTraceLog.bind(this)); 61 62 var replayImageContainer = this._splitView.firstElement();63 replayImageContainer.id = "canvas-replay-image-container";64 65 this._replayImageElement = document.createElement("image");66 this._replayImageElement.id = "canvas-replay-image";67 68 replayImageContainer.appendChild(this._replayImageElement);69 this._debugInfoElement = document.createElement("div");70 replayImageContainer.appendChild(this._debugInfoElement);71 75 72 76 this._splitView.show(this.element); … … 103 107 104 108 /** 109 * @param {Element} parent 110 * @param {string} className 111 * @param {string} title 112 * @param {function(this:WebInspector.CanvasProfileView)} clickCallback 113 */ 114 _createControlButton: function(parent, className, title, clickCallback) 115 { 116 var button = parent.createChild("button", "canvas-control-button"); 117 button.addStyleClass(className); 118 button.title = title; 119 button.createChild("img"); 120 button.addEventListener("click", clickCallback, false); 121 }, 122 123 /** 124 * @param {boolean} forward 125 */ 126 _onReplayStepClick: function(forward) 127 { 128 var selectedNode = this._logGrid.selectedNode; 129 if (!selectedNode) 130 return; 131 var nextNode = forward ? selectedNode.traverseNextNode(false) : selectedNode.traversePreviousNode(false); 132 if (nextNode) 133 nextNode.revealAndSelect(); 134 else 135 selectedNode.reveal(); 136 }, 137 138 _onReplayFirstStepClick: function() 139 { 140 var rootNode = this._logGrid.rootNode(); 141 var children = rootNode && rootNode.children; 142 var firstNode = children && children[0]; 143 if (firstNode) 144 firstNode.revealAndSelect(); 145 }, 146 147 _onReplayLastStepClick: function() 148 { 149 var rootNode = this._logGrid.rootNode(); 150 var children = rootNode && rootNode.children; 151 var lastNode = children && children[children.length - 1]; 152 if (lastNode) 153 lastNode.revealAndSelect(); 154 }, 155 156 /** 105 157 * @param {boolean} enable 106 158 */ … … 109 161 function showWaitIcon() 110 162 { 111 this._replayImageElement. className = "wait";163 this._replayImageElement.addStyleClass("wait"); 112 164 this._debugInfoElement.textContent = ""; 113 165 delete this._showWaitIconTimer; … … 121 173 delete this._showWaitIconTimer; 122 174 } 123 this._replayImageElement. className = enable ? "wait" : "";175 this._replayImageElement.enableStyleClass("wait", enable); 124 176 this._debugInfoElement.textContent = ""; 125 177 } … … 134 186 function didReplayTraceLog(error, dataURL) 135 187 { 188 if (callNode !== this._logGrid.selectedNode) 189 return; 136 190 this._enableWaitIcon(false); 137 191 if (error) … … 154 208 this._logGrid.rootNode().appendChild(this._createCallNode(i, calls[i])); 155 209 var lastNode = this._logGrid.rootNode().children[calls.length - 1]; 156 if (lastNode) { 157 lastNode.reveal(); 158 lastNode.select(); 159 } 160 }, 161 210 if (lastNode) 211 lastNode.revealAndSelect(); 212 }, 213 214 /** 215 * @param {number} index 216 * @param {Object} call 217 */ 162 218 _createCallNode: function(index, call) 163 219 { … … 295 351 function callback(error, result) 296 352 { 297 var showWarning = (!error && result); 298 if (showWarning) 299 this._decorationElement.removeStyleClass("hidden"); 300 else 301 this._decorationElement.addStyleClass("hidden"); 353 var hideWarning = (error || !result); 354 this._decorationElement.enableStyleClass("hidden", hideWarning); 302 355 } 303 356 CanvasAgent.hasUninstrumentedCanvases(callback.bind(this)); -
trunk/Source/WebCore/inspector/front-end/DOMExtension.js
r138532 r139614 145 145 } 146 146 147 /** 148 * @param {string} className 149 */ 147 150 Element.prototype.removeStyleClass = function(className) 148 151 { … … 157 160 } 158 161 162 /** 163 * @param {string} className 164 */ 159 165 Element.prototype.addStyleClass = function(className) 160 166 { … … 162 168 } 163 169 170 /** 171 * @param {string} className 172 * @return {boolean} 173 */ 164 174 Element.prototype.hasStyleClass = function(className) 165 175 { 166 176 return this.classList.contains(className); 177 } 178 179 /** 180 * @param {string} className 181 * @param {*} enable 182 */ 183 Element.prototype.enableStyleClass = function(className, enable) 184 { 185 if (enable) 186 this.addStyleClass(className); 187 else 188 this.removeStyleClass(className); 167 189 } 168 190 -
trunk/Source/WebCore/inspector/front-end/DataGrid.js
r139452 r139614 234 234 235 235 WebInspector.DataGrid.prototype = { 236 /** 237 * @param {!WebInspector.DataGridNode} rootNode 238 */ 236 239 setRootNode: function(rootNode) 237 240 { … … 241 244 this._rootNode._isRoot = false; 242 245 } 246 /** @type {!WebInspector.DataGridNode} */ 243 247 this._rootNode = rootNode; 244 248 rootNode._isRoot = true; … … 249 253 }, 250 254 255 /** 256 * @return {!WebInspector.DataGridNode} 257 */ 251 258 rootNode: function() 252 259 { … … 282 289 { 283 290 this._editing = true; 291 /** @type {WebInspector.DataGridNode} */ 284 292 this._editingNode = node; 285 293 this._editingNode.select(); … … 359 367 360 368 var lastEditableColumn = this._nextEditableColumn(this._columnsArray.length, true); 361 var nextDataGridNode = currentEditingNode.traversePreviousNode(true, null,true);369 var nextDataGridNode = currentEditingNode.traversePreviousNode(true, true); 362 370 if (nextDataGridNode) 363 371 return this._startEditingColumnOfDataGridNode(nextDataGridNode, lastEditableColumn); … … 1051 1059 this._data = data || {}; 1052 1060 this.hasChildren = hasChildren || false; 1061 /** @type {!Array.<WebInspector.DataGridNode>} */ 1053 1062 this.children = []; 1054 1063 this.dataGrid = null; 1055 1064 this.parent = null; 1065 /** @type {WebInspector.DataGridNode} */ 1056 1066 this.previousSibling = null; 1067 /** @type {WebInspector.DataGridNode} */ 1057 1068 this.nextSibling = null; 1058 1069 this.disclosureToggleWidth = 10; … … 1060 1071 1061 1072 WebInspector.DataGridNode.prototype = { 1073 /** @type {boolean} */ 1062 1074 selectable: true, 1063 1075 1076 /** @type {boolean} */ 1064 1077 _isRoot: false, 1065 1078 … … 1540 1553 }, 1541 1554 1555 /** 1556 * @param {boolean} skipHidden 1557 * @param {WebInspector.DataGridNode=} stayWithin 1558 * @param {boolean=} dontPopulate 1559 * @param {Object=} info 1560 * @return {WebInspector.DataGridNode} 1561 */ 1542 1562 traverseNextNode: function(skipHidden, stayWithin, dontPopulate, info) 1543 1563 { … … 1575 1595 }, 1576 1596 1597 /** 1598 * @param {boolean} skipHidden 1599 * @param {boolean=} dontPopulate 1600 * @return {WebInspector.DataGridNode} 1601 */ 1577 1602 traversePreviousNode: function(skipHidden, dontPopulate) 1578 1603 { -
trunk/Source/WebCore/inspector/front-end/canvasProfiler.css
r134405 r139614 46 46 } 47 47 48 #canvas-replay-image {48 .canvas-replay-image { 49 49 zoom: 100; 50 50 height: auto; … … 56 56 } 57 57 58 #canvas-replay-image.wait {58 .canvas-replay-image.wait { 59 59 content: url(Images/spinnerActiveSelected.gif); 60 60 zoom: inherit; … … 64 64 margin: -16px 0 0 -16px; 65 65 } 66 67 .canvas-replay-controls { 68 position: absolute; 69 top: 0; 70 left: 0; 71 right: 0; 72 height: 26px; 73 border: 1px solid #aaa; 74 background-image: -webkit-linear-gradient(rgb(243,243,243), rgb(235,235,235)); 75 } 76 77 .canvas-replay-log { 78 position: absolute; 79 top: 24px; 80 left: 0; 81 right: 0; 82 bottom: 0; 83 } 84 85 .canvas-control-button { 86 display: inline-block; 87 position: relative; 88 width: 32px; 89 height: 24px; 90 padding: 0; 91 margin-left: -1px; 92 vertical-align: top; 93 background-color: transparent; 94 border: 0 transparent none; 95 border-left: 1px solid rgb(202, 202, 202); 96 border-right: 1px solid rgb(202, 202, 202); 97 } 98 99 .canvas-control-button:active { 100 background-color: rgb(163,163,163); 101 border-left: 1px solid rgb(120, 120, 120); 102 border-right: 1px solid rgb(120, 120, 120); 103 } 104 105 .canvas-control-button:disabled { 106 opacity: 0.5; 107 } 108 109 .canvas-control-button img { 110 margin-top: 1px; 111 } 112 113 .canvas-replay-first-step img { 114 content: url(Images/debuggerContinue.png); 115 -webkit-transform: rotate(180deg); 116 } 117 .canvas-replay-next-step img { 118 content: url(Images/debuggerStepInto.png); 119 } 120 .canvas-replay-prev-step img { 121 content: url(Images/debuggerStepOut.png); 122 } 123 .canvas-replay-last-step img { 124 content: url(Images/debuggerContinue.png); 125 }
Note: See TracChangeset
for help on using the changeset viewer.