Title: [92598] trunk/Source/WebCore
Revision
92598
Author
[email protected]
Date
2011-08-08 08:50:36 -0700 (Mon, 08 Aug 2011)

Log Message

Web Inspector: refactor links creation.
https://bugs.webkit.org/show_bug.cgi?id=65612

Reviewed by Pavel Feldman.

No new tests - it is refactoring, modified code covered by script-formatter.html test.

* inspector/front-end/ConsoleView.js:
(WebInspector.ConsoleMessage.prototype._formatMessage):
(WebInspector.ConsoleMessage.prototype._linkifyLocation):
(WebInspector.ConsoleMessage.prototype._linkifyCallFrame):
(WebInspector.ConsoleMessage.prototype._populateStackTraceTreeElement):
* inspector/front-end/DebuggerPresentationModel.js:
(WebInspector.DebuggerPresentationModel):
(WebInspector.DebuggerPresentationModel.prototype.addSourceMappingListener):
(WebInspector.DebuggerPresentationModel.prototype.removeSourceMappingListener):
(WebInspector.DebuggerPresentationModel.prototype.linkifyLocation.updateAnchor.didGetLocation):
(WebInspector.DebuggerPresentationModel.prototype.linkifyLocation.updateAnchor):
(WebInspector.DebuggerPresentationModel.prototype.linkifyLocation):
(WebInspector.DebuggerPresentationModel.prototype.setFormatSourceFiles):
(WebInspector.DebuggerPresentationModel.prototype._sourceFileForScript):
(WebInspector.DebuggerPresentationModel.prototype._debuggerReset):
* inspector/front-end/EventListenersSidebarPane.js:
* inspector/front-end/NetworkPanel.js:
(WebInspector.NetworkDataGridNode.prototype._refreshInitiatorCell):
* inspector/front-end/Panel.js:
* inspector/front-end/ProfileDataGridTree.js:
(WebInspector.ProfileDataGridNode.prototype.createCell):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._folderAndDisplayNameForScriptURL):
* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylePropertiesSection.linkifyUncopyable):
(WebInspector.StylePropertiesSection):
* inspector/front-end/TimelinePanel.js:
(WebInspector.TimelinePanel.FormattedRecord.prototype._getRecordDetails):
(WebInspector.TimelinePanel.FormattedRecord.prototype._linkifyLocation):
(WebInspector.TimelinePanel.FormattedRecord.prototype._linkifyCallFrame):
(WebInspector.TimelinePanel.PopupContentHelper.prototype._appendLinkRow):
(WebInspector.TimelinePanel.PopupContentHelper.prototype._appendStackTrace):
* inspector/front-end/inspector.js:
(WebInspector._showSettingsScreen):
(WebInspector.formatLinkText):
(WebInspector.linkifyResourceAsNode):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (92597 => 92598)


--- trunk/Source/WebCore/ChangeLog	2011-08-08 15:34:50 UTC (rev 92597)
+++ trunk/Source/WebCore/ChangeLog	2011-08-08 15:50:36 UTC (rev 92598)
@@ -1,3 +1,49 @@
+2011-08-08  Pavel Podivilov  <[email protected]>
+
+        Web Inspector: refactor links creation.
+        https://bugs.webkit.org/show_bug.cgi?id=65612
+
+        Reviewed by Pavel Feldman.
+
+        No new tests - it is refactoring, modified code covered by script-formatter.html test.
+
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleMessage.prototype._formatMessage):
+        (WebInspector.ConsoleMessage.prototype._linkifyLocation):
+        (WebInspector.ConsoleMessage.prototype._linkifyCallFrame):
+        (WebInspector.ConsoleMessage.prototype._populateStackTraceTreeElement):
+        * inspector/front-end/DebuggerPresentationModel.js:
+        (WebInspector.DebuggerPresentationModel):
+        (WebInspector.DebuggerPresentationModel.prototype.addSourceMappingListener):
+        (WebInspector.DebuggerPresentationModel.prototype.removeSourceMappingListener):
+        (WebInspector.DebuggerPresentationModel.prototype.linkifyLocation.updateAnchor.didGetLocation):
+        (WebInspector.DebuggerPresentationModel.prototype.linkifyLocation.updateAnchor):
+        (WebInspector.DebuggerPresentationModel.prototype.linkifyLocation):
+        (WebInspector.DebuggerPresentationModel.prototype.setFormatSourceFiles):
+        (WebInspector.DebuggerPresentationModel.prototype._sourceFileForScript):
+        (WebInspector.DebuggerPresentationModel.prototype._debuggerReset):
+        * inspector/front-end/EventListenersSidebarPane.js:
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkDataGridNode.prototype._refreshInitiatorCell):
+        * inspector/front-end/Panel.js:
+        * inspector/front-end/ProfileDataGridTree.js:
+        (WebInspector.ProfileDataGridNode.prototype.createCell):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype._folderAndDisplayNameForScriptURL):
+        * inspector/front-end/StylesSidebarPane.js:
+        (WebInspector.StylePropertiesSection.linkifyUncopyable):
+        (WebInspector.StylePropertiesSection):
+        * inspector/front-end/TimelinePanel.js:
+        (WebInspector.TimelinePanel.FormattedRecord.prototype._getRecordDetails):
+        (WebInspector.TimelinePanel.FormattedRecord.prototype._linkifyLocation):
+        (WebInspector.TimelinePanel.FormattedRecord.prototype._linkifyCallFrame):
+        (WebInspector.TimelinePanel.PopupContentHelper.prototype._appendLinkRow):
+        (WebInspector.TimelinePanel.PopupContentHelper.prototype._appendStackTrace):
+        * inspector/front-end/inspector.js:
+        (WebInspector._showSettingsScreen):
+        (WebInspector.formatLinkText):
+        (WebInspector.linkifyResourceAsNode):
+
 2011-08-08  Andrew Wason  <[email protected]>
 
         [Qt] Implement WebGL antialiasing (part 3)

Modified: trunk/Source/WebCore/inspector/front-end/ConsoleView.js (92597 => 92598)


--- trunk/Source/WebCore/inspector/front-end/ConsoleView.js	2011-08-08 15:34:50 UTC (rev 92597)
+++ trunk/Source/WebCore/inspector/front-end/ConsoleView.js	2011-08-08 15:50:36 UTC (rev 92598)
@@ -740,7 +740,7 @@
         // Prevent infinite expansion of cross-referencing arrays.
         return this._format(output, output.subtype && output.subtype === "array");
     },
-    
+
     get scrollLeft()
     {
         return this.messagesElement.scrollLeft;
@@ -844,10 +844,10 @@
         this._formattedMessage.className = "console-message-text source-code";
 
         if (this._stackTrace && this._stackTrace.length && this._stackTrace[0].url) {
-            var urlElement = WebInspector.linkifyCallFrameAsNode(this._stackTrace[0], "console-message-url");
+            var urlElement = this._linkifyCallFrame(this._stackTrace[0]);
             this._formattedMessage.appendChild(urlElement);
         } else if (this.url && this.url !== "undefined") {
-            var urlElement = WebInspector.linkifyResourceAsNode(this.url, "scripts", this.line, "console-message-url");
+            var urlElement = this._linkifyLocation(this.url, this.line, 0);
             this._formattedMessage.appendChild(urlElement);
         }
 
@@ -880,6 +880,19 @@
         this.message = this._formattedMessage.textContent;
     },
 
+    _linkifyLocation: function(url, lineNumber, columnNumber)
+    {
+        // FIXME(62725): stack trace line/column numbers are one-based.
+        lineNumber = lineNumber ? lineNumber - 1 : undefined;
+        columnNumber = columnNumber ? columnNumber - 1 : 0;
+        return WebInspector.debuggerPresentationModel.linkifyLocation(url, lineNumber, columnNumber, "console-message-url");
+    },
+
+    _linkifyCallFrame: function(callFrame)
+    {
+        return this._linkifyLocation(callFrame.url, callFrame.lineNumber, callFrame.columnNumber);
+    },
+
     isErrorOrWarning: function()
     {
         return (this.level === WebInspector.ConsoleMessage.MessageLevel.Warning || this.level === WebInspector.ConsoleMessage.MessageLevel.Error);
@@ -1044,7 +1057,7 @@
             content.appendChild(messageTextElement);
 
             if (frame.url) {
-                var urlElement = WebInspector.linkifyCallFrameAsNode(frame, "console-message-url");
+                var urlElement = this._linkifyCallFrame(frame);
                 content.appendChild(urlElement);
             }
 

Modified: trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js (92597 => 92598)


--- trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js	2011-08-08 15:34:50 UTC (rev 92597)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js	2011-08-08 15:50:36 UTC (rev 92598)
@@ -34,7 +34,8 @@
     this._formatter = new WebInspector.ScriptFormatter();
     this._sourceFiles = {};
     this._messages = [];
-    this._anchors = [];
+    // FIXME: move this to RawSourceCode when it's not re-created in pretty-print mode.
+    this._sourceMappingListeners = [];
     this._breakpointsByDebuggerId = {};
     this._breakpointsWithoutSourceFile = {};
 
@@ -119,20 +120,42 @@
         this._sourceFiles[sourceFileId].requestContent(callback);
     },
 
-    registerAnchor: function(sourceURL, scriptId, lineNumber, columnNumber, updateHandler)
+    addSourceMappingListener: function(sourceURL, sourceId, listener)
     {
-        var anchor = { sourceURL: sourceURL, scriptId: scriptId, lineNumber: lineNumber, columnNumber: columnNumber, updateHandler: updateHandler };
-        this._anchors.push(anchor);
-        this._updateAnchor(anchor);
+        this._sourceMappingListeners.push(listener);
     },
 
-    _updateAnchor: function(anchor)
+    removeSourceMappingListener: function(sourceURL, sourceId, listener)
     {
-        var sourceFile = this._sourceFileForScript(anchor.sourceURL, anchor.scriptId);
-        if (!sourceFile)
-            return;
+        // FIXME: implement this.
+    },
 
-        this._scriptLocationToUILocation(anchor.sourceURL, anchor.scriptId, anchor.lineNumber, anchor.columnNumber, anchor.updateHandler);
+    linkifyLocation: function(sourceURL, lineNumber, columnNumber, classes)
+    {
+        var linkText = WebInspector.formatLinkText(sourceURL, lineNumber);
+        var anchor = WebInspector.linkifyURLAsNode(sourceURL, linkText, classes, false);
+
+        var sourceFile = this._sourceFileForScript(sourceURL);
+        if (!sourceFile) {
+            anchor.setAttribute("preferred_panel", "resources");
+            anchor.setAttribute("line_number", lineNumber);
+            return anchor;
+        }
+
+        function updateAnchor()
+        {
+            function didGetLocation(sourceFileId, lineNumber)
+            {
+                anchor.textContent = WebInspector.formatLinkText(sourceFile.url, lineNumber);
+                anchor.setAttribute("preferred_panel", "scripts");
+                anchor.setAttribute("source_file_id", sourceFileId);
+                anchor.setAttribute("line_number", lineNumber);
+            }
+            this._scriptLocationToUILocation(sourceURL, null, lineNumber, columnNumber, didGetLocation.bind(this));
+        }
+        updateAnchor.call(this);
+        this.addSourceMappingListener(sourceURL, null, updateAnchor.bind(this));
+        return anchor;
     },
 
     _parsedScriptSource: function(event)
@@ -281,8 +304,9 @@
         for (var i = 0; i < messages.length; ++i)
             this._addConsoleMessage(messages[i]);
 
-        for (var i = 0; i < this._anchors.length; ++i)
-            this._updateAnchor(this._anchors[i]);
+        // FIXME: move this to RawSourceCode.
+        for (var i = 0; i < this._sourceMappingListeners.length; ++i)
+            this._sourceMappingListeners[i]();
 
         if (WebInspector.debuggerModel.callFrames)
             this._debuggerPaused();
@@ -616,8 +640,12 @@
 
     _sourceFileForScript: function(sourceURL, scriptId)
     {
-        if (!sourceURL)
-            sourceURL = WebInspector.debuggerModel.scriptForSourceID(scriptId).sourceURL;
+        if (!sourceURL) {
+            var script = WebInspector.debuggerModel.scriptForSourceID(scriptId);
+            if (!script)
+                return;
+            sourceURL = script.sourceURL;
+        }
         return this._sourceFiles[this._createSourceFileId(sourceURL, scriptId)];
     },
 
@@ -658,7 +686,7 @@
     _debuggerReset: function()
     {
         this._reset();
-        this._anchors = [];
+        this._sourceMappingListeners = [];
         this._presentationCallFrames = [];
         this._selectedCallFrameIndex = 0;
     }

Modified: trunk/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js (92597 => 92598)


--- trunk/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js	2011-08-08 15:34:50 UTC (rev 92597)
+++ trunk/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js	2011-08-08 15:50:36 UTC (rev 92598)
@@ -236,7 +236,12 @@
         // Requires that Function.toString() return at least the function's signature.
         if (this.eventListener.location) {
             this.subtitleElement.removeChildren();
-            this.subtitleElement.appendChild(WebInspector.linkifyResourceAsNode(this.eventListener.location.scriptId, "scripts", this.eventListener.location.lineNumber));
+            // FIXME(62725): eventListener.location should be a debugger Location.
+            var url = ""
+            var lineNumber = this.eventListener.location.lineNumber - 1;
+            var columnNumber = 0;
+            var urlElement = WebInspector.debuggerPresentationModel.linkifyLocation(url, lineNumber, columnNumber);
+            this.subtitleElement.appendChild(urlElement);
         } else {
             var match = this.eventListener.handlerBody.match(/function ([^\(]+?)\(/);
             if (match)

Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (92597 => 92598)


--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2011-08-08 15:34:50 UTC (rev 92597)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2011-08-08 15:50:36 UTC (rev 92598)
@@ -1977,11 +1977,12 @@
                     return;
                 }
                 this._initiatorCell.title = topFrame.url + ":" + topFrame.lineNumber;
-                this._initiatorCell.appendChild(WebInspector.linkifyResourceAsNode(topFrame.url, "scripts", topFrame.lineNumber));
+                var urlElement = WebInspector.debuggerPresentationModel.linkifyLocation(topFrame.url, topFrame.lineNumber - 1, 0);
+                this._initiatorCell.appendChild(urlElement);
                 this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Script"));
             } else { // initiator.type === "parser"
                 this._initiatorCell.title = initiator.url + ":" + initiator.lineNumber;
-                this._initiatorCell.appendChild(WebInspector.linkifyResourceAsNode(initiator.url, "resources", initiator.lineNumber));
+                this._initiatorCell.appendChild(WebInspector.linkifyResourceAsNode(initiator.url, initiator.lineNumber - 1));
                 this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Parser"));
             }
         }

Modified: trunk/Source/WebCore/inspector/front-end/Panel.js (92597 => 92598)


--- trunk/Source/WebCore/inspector/front-end/Panel.js	2011-08-08 15:34:50 UTC (rev 92597)
+++ trunk/Source/WebCore/inspector/front-end/Panel.js	2011-08-08 15:50:36 UTC (rev 92598)
@@ -395,24 +395,6 @@
             visibleView.resize();
     },
 
-    createAnchor: function(url, lineNumber, columnNumber, classes, tooltipText)
-    {
-        var linkText = this.formatAnchorText(url, lineNumber);
-        var anchor = WebInspector.linkifyURLAsNode(url, linkText, classes, false, tooltipText);
-        anchor.setAttribute("preferred_panel", "resources");
-        if (lineNumber !== undefined)
-            anchor.setAttribute("line_number", lineNumber);
-        return anchor;
-    },
-
-    formatAnchorText: function(url, lineNumber)
-    {
-        var text = WebInspector.displayNameForURL(url);
-        if (lineNumber !== undefined)
-            text += ":" + (lineNumber + 1);
-        return text;
-    },
-
     canShowAnchorLocation: function(anchor)
     {
         return false;

Modified: trunk/Source/WebCore/inspector/front-end/ProfileDataGridTree.js (92597 => 92598)


--- trunk/Source/WebCore/inspector/front-end/ProfileDataGridTree.js	2011-08-08 15:34:50 UTC (rev 92597)
+++ trunk/Source/WebCore/inspector/front-end/ProfileDataGridTree.js	2011-08-08 15:50:36 UTC (rev 92598)
@@ -96,10 +96,9 @@
             cell.addStyleClass("highlight");
 
         if (this.profileNode.url) {
-            var lineNumber;
-            if (this.profileNode.lineNumber > 0)
-                lineNumber = this.profileNode.lineNumber;
-            var urlElement = WebInspector.linkifyResourceAsNode(this.profileNode.url, "scripts", lineNumber, "profile-node-file");
+            // FIXME(62725): profileNode should reference a debugger location.
+            var lineNumber = this.profileNode.lineNumber ? this.profileNode.lineNumber - 1 : 0;
+            var urlElement = WebInspector.debuggerPresentationModel.linkifyLocation(this.profileNode.url, lineNumber, 0, "profile-node-file");
             cell.insertBefore(urlElement, cell.firstChild);
         }
 

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (92597 => 92598)


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-08-08 15:34:50 UTC (rev 92597)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-08-08 15:50:36 UTC (rev 92598)
@@ -28,7 +28,7 @@
 {
     WebInspector.Panel.call(this, "scripts");
 
-    this._presentationModel = new WebInspector.DebuggerPresentationModel();
+    this._presentationModel = WebInspector.debuggerPresentationModel;
 
     this.registerShortcuts();
 
@@ -324,7 +324,7 @@
 
         if (folderName.length > 80)
             folderName = "\u2026" + folderName.substring(folderName.length - 80);
- 
+
         return { folderName: folderName, displayName: displayName};
     },
 
@@ -545,14 +545,6 @@
             x.show(this.viewsContainerElement);
     },
 
-    createAnchor: function(url, lineNumber, columnNumber, classes, tooltipText)
-    {
-        var anchor = WebInspector.Panel.prototype.createAnchor.call(this, url, lineNumber, columnNumber, classes, tooltipText);
-        if (lineNumber !== undefined)
-            this._presentationModel.registerAnchor(url, null, lineNumber, columnNumber, this._updateAnchor.bind(this, anchor));
-        return anchor;
-    },
-
     canShowAnchorLocation: function(anchor)
     {
         return this._debuggerEnabled && this._presentationModel.sourceFileForScriptURL(anchor.href);
@@ -563,17 +555,6 @@
         this._showSourceLine(anchor.getAttribute("source_file_id"), parseInt(anchor.getAttribute("line_number")));
     },
 
-    _updateAnchor: function(anchor, sourceFileId, lineNumber)
-    {
-        var sourceFile = this._presentationModel.sourceFile(sourceFileId);
-        var url = "" || WebInspector.UIString("(program)");
-        anchor.textContent = this.formatAnchorText(url, lineNumber)
-        // Used for showing anchor location.
-        anchor.setAttribute("preferred_panel", "scripts");
-        anchor.setAttribute("source_file_id", sourceFileId);
-        anchor.setAttribute("line_number", lineNumber);
-    },
-
     _showSourceLine: function(sourceFileId, lineNumber)
     {
         var sourceFrame = this._showSourceFrameAndAddToHistory(sourceFileId);

Modified: trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js (92597 => 92598)


--- trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2011-08-08 15:34:50 UTC (rev 92597)
+++ trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2011-08-08 15:50:36 UTC (rev 92598)
@@ -836,7 +836,7 @@
 
     function linkifyUncopyable(url, line)
     {
-        var link = WebInspector.linkifyResourceAsNode(url, "resources", line + 1);
+        var link = WebInspector.linkifyResourceAsNode(url, line);
         return link;
     }
 

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePanel.js (92597 => 92598)


--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2011-08-08 15:34:50 UTC (rev 92597)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2011-08-08 15:50:36 UTC (rev 92598)
@@ -356,7 +356,7 @@
         this.toggleFilterButton.element.title = this._calculator._showShortEvents ? this._hideShortRecordsTitleText : this._showShortRecordsTitleText;
         this._scheduleRefresh(true);
     },
-    
+
     _garbageCollectButtonClicked: function()
     {
         ProfilerAgent.collectGarbage();
@@ -1115,21 +1115,21 @@
             case WebInspector.TimelineAgent.RecordType.GCEvent:
                 return WebInspector.UIString("%s collected", Number.bytesToString(this.data.usedHeapSizeDelta));
             case WebInspector.TimelineAgent.RecordType.TimerFire:
-                return this.scriptName ? WebInspector.linkifyResourceAsNode(this.scriptName, "scripts", this.scriptLine, "", "") : this.data.timerId;
+                return this.scriptName ? this._linkifyLocation(this.scriptName, this.scriptLine, 0) : this.data.timerId;
             case WebInspector.TimelineAgent.RecordType.FunctionCall:
-                return this.scriptName ? WebInspector.linkifyResourceAsNode(this.scriptName, "scripts", this.scriptLine, "", "") : null;
+                return this.scriptName ? this._linkifyLocation(this.scriptName, this.scriptLine, 0) : null;
             case WebInspector.TimelineAgent.RecordType.EventDispatch:
                 return this.data ? this.data.type : null;
             case WebInspector.TimelineAgent.RecordType.Paint:
                 return this.data.width + "\u2009\u00d7\u2009" + this.data.height;
             case WebInspector.TimelineAgent.RecordType.TimerInstall:
             case WebInspector.TimelineAgent.RecordType.TimerRemove:
-                return this.stackTrace ? WebInspector.linkifyCallFrameAsNode(this.stackTrace[0], "") : this.data.timerId;
+                return this.stackTrace ? this._linkifyCallFrame(this.stackTrace[0]) : this.data.timerId;
             case WebInspector.TimelineAgent.RecordType.ParseHTML:
             case WebInspector.TimelineAgent.RecordType.RecalculateStyles:
-                return this.stackTrace ? WebInspector.linkifyCallFrameAsNode(this.stackTrace[0], "") : null;
+                return this.stackTrace ? this._linkifyCallFrame(this.stackTrace[0]) : null;
             case WebInspector.TimelineAgent.RecordType.EvaluateScript:
-                return this.url ? WebInspector.linkifyResourceAsNode(this.url, "scripts", this.data.lineNumber, "", "") : null;
+                return this.url ? this._linkifyLocation(this.url, this.data.lineNumber, 0) : null;
             case WebInspector.TimelineAgent.RecordType.XHRReadyStateChange:
             case WebInspector.TimelineAgent.RecordType.XHRLoad:
             case WebInspector.TimelineAgent.RecordType.ScheduleResourceRequest:
@@ -1145,6 +1145,19 @@
         }
     },
 
+    _linkifyLocation: function(url, lineNumber, columnNumber)
+    {
+        // FIXME(62725): stack trace line/column numbers are one-based.
+        lineNumber = lineNumber ? lineNumber - 1 : lineNumber;
+        columnNumber = columnNumber ? columnNumber - 1 : 0;
+        return WebInspector.debuggerPresentationModel.linkifyLocation(url, lineNumber, columnNumber, "timeline-details");
+    },
+
+    _linkifyCallFrame: function(callFrame)
+    {
+        return this._linkifyLocation(callFrame.url, callFrame.lineNumber, callFrame.columnNumber);
+    },
+
     _calculateAggregatedStats: function(categories)
     {
         this._aggregatedStats = {};
@@ -1212,7 +1225,7 @@
 
     _appendLinkRow: function(title, scriptName, scriptLine)
     {
-        var link = WebInspector.linkifyResourceAsNode(scriptName, "scripts", scriptLine, "timeline-details");
+        var link = WebInspector.TimelinePanel.FormattedRecord.prototype._linkifyLocation(scriptName, scriptLine, 0, "timeline-details");
         this._appendElementRow(title, link);
     },
 
@@ -1227,7 +1240,8 @@
             row.appendChild(this._createCell(stackFrame.functionName ? stackFrame.functionName : WebInspector.UIString("(anonymous function)"), "timeline-function-name"));
             row.appendChild(this._createCell(" @ "));
             var linkCell = document.createElement("td");
-            linkCell.appendChild(WebInspector.linkifyCallFrameAsNode(stackFrame, "timeline-details"));
+            var urlElement = WebInspector.TimelinePanel.FormattedRecord.prototype._linkifyCallFrame(stackFrame);
+            linkCell.appendChild(urlElement);
             row.appendChild(linkCell);
             framesTable.appendChild(row);
         }

Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (92597 => 92598)


--- trunk/Source/WebCore/inspector/front-end/inspector.js	2011-08-08 15:34:50 UTC (rev 92597)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js	2011-08-08 15:50:36 UTC (rev 92598)
@@ -240,7 +240,7 @@
             this._settingsButton.toggled = false;
             delete this._settingsScreen;
         }
-        
+
         if (!this._settingsScreen) {
             this._settingsScreen = new WebInspector.SettingsScreen();
             this._settingsScreen.show(onhide.bind(this));
@@ -519,6 +519,7 @@
 
     this.cssModel = new WebInspector.CSSStyleModel();
     this.debuggerModel = new WebInspector.DebuggerModel();
+    this.debuggerPresentationModel = new WebInspector.DebuggerPresentationModel();
 
     this.searchController = new WebInspector.SearchController();
     this.domBreakpointsSidebarPane = new WebInspector.DOMBreakpointsSidebarPane();
@@ -1322,19 +1323,21 @@
     return WebInspector.linkifyURLAsNode(url, linkText, classes, isExternal, tooltipText).outerHTML;
 }
 
-WebInspector.linkifyResourceAsNode = function(url, preferredPanel, oneBasedLineNumber, classes, tooltipText)
+WebInspector.formatLinkText = function(url, lineNumber)
 {
-    preferredPanel = preferredPanel || "scripts";
-    // FIXME(62725): stack trace line/column numbers are one-based.
-    var lineNumber = oneBasedLineNumber ? oneBasedLineNumber - 1 : undefined;
-    return this.panels[preferredPanel].createAnchor(url, lineNumber, 0, classes, tooltipText);
+    var text = WebInspector.displayNameForURL(url);
+    if (lineNumber !== undefined)
+        text += ":" + (lineNumber + 1);
+    return text;
 }
 
-WebInspector.linkifyCallFrameAsNode = function(callFrame, classes, tooltipText)
+WebInspector.linkifyResourceAsNode = function(url, lineNumber, classes, tooltipText)
 {
-    // FIXME(62725): stack trace line/column numbers are one-based.
-    var columnNumber = callFrame.columnNumber ? callFrame.columnNumber - 1 : 0;
-    return this.panels.scripts.createAnchor(callFrame.url, callFrame.lineNumber - 1, columnNumber, classes, tooltipText);
+    var linkText = this.formatLinkText(url, lineNumber);
+    var anchor = this.linkifyURLAsNode(url, linkText, classes, false, tooltipText);
+    anchor.setAttribute("preferred_panel", "resources");
+    anchor.setAttribute("line_number", lineNumber);
+    return anchor;
 }
 
 WebInspector.resourceURLForRelatedNode = function(node, url)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to