Changeset 184045 in webkit
- Timestamp:
- May 10, 2015, 5:23:07 AM (11 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 2 added
- 12 edited
-
ChangeLog (modified) (1 diff)
-
UserInterface/Base/Main.js (modified) (4 diffs)
-
UserInterface/Controllers/TimelineManager.js (modified) (1 diff)
-
UserInterface/Main.html (modified) (2 diffs)
-
UserInterface/Models/CallFrame.js (modified) (1 diff)
-
UserInterface/Views/CallFrameTreeElement.js (modified) (2 diffs)
-
UserInterface/Views/CallFrameView.css (added)
-
UserInterface/Views/CallFrameView.js (added)
-
UserInterface/Views/ConsoleMessageView.css (modified) (2 diffs)
-
UserInterface/Views/ConsoleMessageView.js (modified) (1 diff)
-
UserInterface/Views/DebuggerDashboardView.js (modified) (1 diff)
-
UserInterface/Views/Main.css (modified) (1 diff)
-
UserInterface/Views/ProfileNodeTreeElement.js (modified) (2 diffs)
-
UserInterface/Views/TimelineDataGridNode.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r184000 r184045 1 2015-05-10 Nikita Vasilyev <nvasilyev@apple.com> 2 3 Web Inspector: In the console, show function name next to the source link 4 https://bugs.webkit.org/show_bug.cgi?id=144372 5 6 Introduce CallFrameView to display counsole message source links. It looks like this: 7 8 [f] functionName - filename.js:42 9 10 Reviewed by Timothy Hatcher. 11 12 * UserInterface/Base/Main.js: 13 (WebInspector.createSourceCodeLocationLink): 14 (WebInspector.linkifyLocation): 15 (.showSourceCodeLocation): 16 (WebInspector.linkifyElement): 17 Abstract this out as it's used in WebInspector.CallFrameView and WebInspector.createSourceCodeLocationLink. 18 19 (WebInspector.sourceCodeForURL): 20 Move this code from Timeline to Main.js as it's used by Console too. 21 22 (WebInspector.linkifyURLAsNode): 23 Remove tooltipText argument as it is never used. 24 25 * UserInterface/Controllers/TimelineManager.js: 26 (WebInspector.TimelineManager.prototype._callFramesFromPayload): 27 * UserInterface/Main.html: 28 * UserInterface/Models/CallFrame.js: 29 (WebInspector.CallFrame.fromPayload): 30 Abstract this out as it's used in WebInspector.TimelineManager.prototype._callFramesFromPayload and 31 WebInspector.ConsoleMessageView._appendLocationLink. 32 33 (WebInspector.CallFrame): 34 * UserInterface/Views/CallFrameTreeElement.js: 35 (WebInspector.CallFrameTreeElement): 36 Move it to WebInspector.CallFrameView.iconForCallFrame. 37 38 * UserInterface/Views/CallFrameView.css: Added. 39 (.call-frame): 40 (.call-frame .icon): 41 (.call-frame .titles): 42 (.call-frame .title): 43 (.call-frame .source-link): 44 (.call-frame .title + .subtitle > .source-link): 45 (.call-frame .subtitle .source-link): 46 (.call-frame:focus .subtitle .source-link): 47 (.call-frame .subtitle:empty): 48 (.call-frame .subtitle): 49 (.call-frame .colon): 50 (.call-frame .title + .subtitle::before): 51 * UserInterface/Views/CallFrameView.js: Added. 52 (WebInspector.CallFrameView): 53 (WebInspector.CallFrameView.iconClassNameForCallFrame): 54 * UserInterface/Views/ConsoleMessageView.css: 55 (.console-message .console-message-location): 56 (.console-message .call-frame): 57 (.console-message .go-to-link): 58 (.console-message .go-to-link:focus): 59 (.console-message .console-message-url::before): 60 (.console-saved-variable): Deleted. 61 * UserInterface/Views/ConsoleMessageView.js: 62 (WebInspector.ConsoleMessageView.prototype._appendLocationLink): 63 * UserInterface/Views/DebuggerDashboardView.js: 64 * UserInterface/Views/Main.css: 65 (.hidden): Deleted. 66 * UserInterface/Views/ProfileNodeTreeElement.js: 67 (WebInspector.ProfileNodeTreeElement): 68 * UserInterface/Views/TimelineDataGridNode.js: 69 (WebInspector.TimelineDataGridNode.prototype.createCellContent): 70 1 71 2015-05-08 Tobias Reiss <tobi+webkit@basecode.de> 2 72 -
trunk/Source/WebInspectorUI/UserInterface/Base/Main.js
r183907 r184045 1740 1740 return null; 1741 1741 1742 function showSourceCodeLocation(event)1743 {1744 event.stopPropagation();1745 event.preventDefault();1746 1747 if (event.metaKey)1748 this.showOriginalUnformattedSourceCodeLocation(sourceCodeLocation);1749 else1750 this.showSourceCodeLocation(sourceCodeLocation);1751 }1752 1753 1742 var linkElement = document.createElement("a"); 1754 1743 linkElement.className = "go-to-link"; 1755 linkElement.addEventListener("click", showSourceCodeLocation.bind(this));1744 WebInspector.linkifyElement(linkElement, sourceCodeLocation); 1756 1745 sourceCodeLocation.populateLiveDisplayLocationTooltip(linkElement); 1757 1746 … … 1769 1758 WebInspector.linkifyLocation = function(url, lineNumber, columnNumber, className) 1770 1759 { 1771 var sourceCode = WebInspector.frameResourceManager.resourceForURL(url); 1772 if (!sourceCode) { 1773 sourceCode = WebInspector.debuggerManager.scriptsForURL(url)[0]; 1774 if (sourceCode) 1775 sourceCode = sourceCode.resource || sourceCode; 1776 } 1760 var sourceCode = WebInspector.sourceCodeForURL(url); 1777 1761 1778 1762 if (!sourceCode) { … … 1793 1777 }; 1794 1778 1795 WebInspector.linkifyURLAsNode = function(url, linkText, classes, tooltipText) 1779 WebInspector.linkifyElement = function(linkElement, sourceCodeLocation) { 1780 console.assert(sourceCodeLocation); 1781 1782 function showSourceCodeLocation(event) 1783 { 1784 event.stopPropagation(); 1785 event.preventDefault(); 1786 1787 if (event.metaKey) 1788 this.showOriginalUnformattedSourceCodeLocation(sourceCodeLocation); 1789 else 1790 this.showSourceCodeLocation(sourceCodeLocation); 1791 } 1792 1793 linkElement.addEventListener("click", showSourceCodeLocation.bind(this)); 1794 }; 1795 1796 WebInspector.sourceCodeForURL = function(url) { 1797 var sourceCode = WebInspector.frameResourceManager.resourceForURL(url); 1798 if (!sourceCode) { 1799 sourceCode = WebInspector.debuggerManager.scriptsForURL(url)[0]; 1800 if (sourceCode) 1801 sourceCode = sourceCode.resource || sourceCode; 1802 } 1803 return sourceCode || null; 1804 }; 1805 1806 WebInspector.linkifyURLAsNode = function(url, linkText, classes) 1796 1807 { 1797 1808 if (!linkText) … … 1803 1814 a.href = url; 1804 1815 a.className = classes; 1805 1806 if (tooltipText === undefined)1807 a.title = url;1808 else if (typeof tooltipText !== "string" || tooltipText.length)1809 a.title = tooltipText;1810 1816 1811 1817 a.textContent = linkText; -
trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js
r183764 r184045 452 452 return null; 453 453 454 function createCallFrame(payload) 455 { 456 var url = payload.url; 457 var nativeCode = false; 458 459 if (url === "[native code]") { 460 nativeCode = true; 461 url = null; 462 } 463 464 var sourceCode = WebInspector.frameResourceManager.resourceForURL(url); 465 if (!sourceCode) 466 sourceCode = WebInspector.debuggerManager.scriptsForURL(url)[0]; 467 468 // The lineNumber is 1-based, but we expect 0-based. 469 var lineNumber = payload.lineNumber - 1; 470 471 var sourceCodeLocation = sourceCode ? sourceCode.createLazySourceCodeLocation(lineNumber, payload.columnNumber) : null; 472 var functionName = payload.functionName !== "global code" ? payload.functionName : null; 473 474 return new WebInspector.CallFrame(null, sourceCodeLocation, functionName, null, null, nativeCode); 475 } 476 477 return payload.map(createCallFrame); 454 return payload.map(WebInspector.CallFrame.fromPayload); 478 455 } 479 456 -
trunk/Source/WebInspectorUI/UserInterface/Main.html
r183721 r184045 43 43 <link rel="stylesheet" href="Views/CSSStyleDetailsSidebarPanel.css"> 44 44 <link rel="stylesheet" href="Views/CallFrameIcons.css"> 45 <link rel="stylesheet" href="Views/CallFrameView.css"> 45 46 <link rel="stylesheet" href="Views/ChartDetailsSectionRow.css"> 46 47 <link rel="stylesheet" href="Views/ClusterContentView.css"> … … 378 379 <script src="Views/CSSStyleDetailsSidebarPanel.js"></script> 379 380 <script src="Views/CallFrameTreeElement.js"></script> 381 <script src="Views/CallFrameView.js"></script> 380 382 <script src="Views/ChartDetailsSectionRow.js"></script> 381 383 <script src="Views/ClusterContentView.js"></script> -
trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js
r182094 r184045 100 100 this._scopeChain[i].object.deprecatedGetAllProperties(propertiesCollected); 101 101 } 102 103 // Static 104 105 static fromPayload(payload) 106 { 107 console.assert(payload); 108 109 var url = payload.url; 110 var nativeCode = false; 111 112 if (url === "[native code]") { 113 nativeCode = true; 114 url = null; 115 } 116 117 var sourceCode = WebInspector.frameResourceManager.resourceForURL(url); 118 if (!sourceCode) 119 sourceCode = WebInspector.debuggerManager.scriptsForURL(url)[0]; 120 121 // The lineNumber is 1-based, but we expect 0-based. 122 var lineNumber = payload.lineNumber - 1; 123 124 var sourceCodeLocation = sourceCode ? sourceCode.createLazySourceCodeLocation(lineNumber, payload.columnNumber) : null; 125 var functionName = payload.functionName !== "global code" ? payload.functionName : null; 126 127 return new WebInspector.CallFrame(null, sourceCodeLocation, functionName, null, null, nativeCode); 128 } 102 129 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/CallFrameTreeElement.js
r182042 r184045 30 30 console.assert(callFrame instanceof WebInspector.CallFrame); 31 31 32 var className = WebInspector.CallFrameTreeElement.FunctionIconStyleClassName; 33 if (callFrame.nativeCode) 34 className = WebInspector.CallFrameTreeElement.NativeIconStyleClassName; 35 36 // This is more than likely an event listener function with an "on" prefix and it is 37 // as long or longer than the shortest event listener name -- "oncut". 38 if (callFrame.functionName && callFrame.functionName.startsWith("on") && callFrame.functionName.length >= 5) 39 className = WebInspector.CallFrameTreeElement.EventListenerIconStyleClassName; 40 32 var className = WebInspector.CallFrameView.iconClassNameForCallFrame(callFrame); 41 33 var title = callFrame.functionName || WebInspector.UIString("(anonymous function)"); 42 34 … … 79 71 } 80 72 }; 81 82 WebInspector.CallFrameTreeElement.FunctionIconStyleClassName = "function-icon";83 WebInspector.CallFrameTreeElement.EventListenerIconStyleClassName = "event-listener-icon";84 WebInspector.CallFrameTreeElement.NativeIconStyleClassName = "native-icon"; -
trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.css
r183668 r184045 202 202 } 203 203 204 .console-message-url {205 float: right;206 margin-left: 4px;207 font-weight: normal;208 }209 210 204 .console-saved-variable { 211 205 font-style: normal; … … 223 217 margin-left: 1px; 224 218 } 219 220 .console-message .console-message-location { 221 float: right; 222 font-weight: normal; 223 } 224 225 .console-message .call-frame { 226 -webkit-user-select: text; 227 height: 1.2em; 228 } 229 230 .console-message .go-to-link { 231 color: hsla(0, 0%, 0%, 0.6); 232 text-decoration: none; 233 } 234 235 .console-message .go-to-link:hover, 236 .console-message .go-to-link:focus { 237 color: hsl(210, 100%, 40%); 238 } 239 240 .console-message .console-message-url::before { 241 content: ' '; 242 } -
trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js
r183659 r184045 288 288 289 289 var firstNonNativeCallFrame = this._firstNonNativeCallFrame(); 290 291 var callFrame; 290 292 if (firstNonNativeCallFrame) { 291 var urlElement = this._linkifyCallFrame(firstNonNativeCallFrame);292 this._element.appendChild(urlElement);293 // JavaScript errors and console.* methods. 294 callFrame = WebInspector.CallFrame.fromPayload(firstNonNativeCallFrame); 293 295 } else if (this._message.url && !this._shouldHideURL(this._message.url)) { 294 var urlElement = this._linkifyLocation(this._message.url, this._message.line, this._message.column); 295 this._element.appendChild(urlElement); 296 } 296 // CSS warnings have no stack traces. 297 callFrame = WebInspector.CallFrame.fromPayload({ 298 url: this._message.url, 299 lineNumber: this._message.line, 300 columnNumber: this._message.column 301 }); 302 } 303 304 if (!callFrame) 305 return; 306 307 var locationElement = new WebInspector.CallFrameView(callFrame); 308 locationElement.classList.add("console-message-location"); 309 this._element.appendChild(locationElement); 297 310 } 298 311 -
trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerDashboardView.js
r183579 r184045 101 101 }; 102 102 103 WebInspector.DebuggerDashboardView.FunctionIconStyleClassName = WebInspector.CallFrame TreeElement.FunctionIconStyleClassName;104 WebInspector.DebuggerDashboardView.EventListenerIconStyleClassName = WebInspector.CallFrame TreeElement.EventListenerIconStyleClassName;103 WebInspector.DebuggerDashboardView.FunctionIconStyleClassName = WebInspector.CallFrameView.FunctionIconStyleClassName; 104 WebInspector.DebuggerDashboardView.EventListenerIconStyleClassName = WebInspector.CallFrameView.EventListenerIconStyleClassName; 105 105 106 106 WebInspector.DebuggerDashboardView.IconStyleClassName = "icon"; -
trunk/Source/WebInspectorUI/UserInterface/Views/Main.css
r183579 r184045 270 270 } 271 271 272 .display-location {273 font-style: italic !important;274 }275 276 272 .hidden { 277 273 display: none !important; -
trunk/Source/WebInspectorUI/UserInterface/Views/ProfileNodeTreeElement.js
r182042 r184045 57 57 switch (profileNode.type) { 58 58 case WebInspector.ProfileNode.Type.Function: 59 className = WebInspector.CallFrame TreeElement.FunctionIconStyleClassName;59 className = WebInspector.CallFrameView.FunctionIconStyleClassName; 60 60 if (!sourceCodeLocation) 61 className = WebInspector.CallFrame TreeElement.NativeIconStyleClassName;61 className = WebInspector.CallFrameView.NativeIconStyleClassName; 62 62 break; 63 63 case WebInspector.ProfileNode.Type.Program: … … 71 71 // as long or longer than the shortest event listener name -- "oncut". 72 72 if (profileNode.functionName && profileNode.functionName.startsWith("on") && profileNode.functionName.length >= 5) 73 className = WebInspector.CallFrame TreeElement.EventListenerIconStyleClassName;73 className = WebInspector.CallFrameView.EventListenerIconStyleClassName; 74 74 75 75 var hasChildren = !!profileNode.childNodes.length; -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNode.js
r181769 r184045 151 151 } 152 152 153 cell.classList.add(WebInspector.CallFrame TreeElement.FunctionIconStyleClassName);153 cell.classList.add(WebInspector.CallFrameView.FunctionIconStyleClassName); 154 154 155 155 var fragment = document.createDocumentFragment(); … … 186 186 } else { 187 187 // Show the function name and icon. 188 cell.classList.add(WebInspector.CallFrame TreeElement.FunctionIconStyleClassName);188 cell.classList.add(WebInspector.CallFrameView.FunctionIconStyleClassName); 189 189 190 190 fragment.appendChild(document.createTextNode(functionName));
Note:
See TracChangeset
for help on using the changeset viewer.