Title: [97975] trunk
Revision
97975
Author
[email protected]
Date
2011-10-20 07:22:46 -0700 (Thu, 20 Oct 2011)

Log Message

Web Inspector: Advanced search results should keep working after pretty print toggled.
https://bugs.webkit.org/show_bug.cgi?id=70347

Reviewed by Pavel Feldman.

Source/WebCore:

* inspector/front-end/AdvancedSearchController.js:
(WebInspector.SearchScope.prototype.createSearchResultsPane):
(WebInspector.FileBasedSearchResultsPane.prototype.createAnchor):
(WebInspector.FileBasedSearchResultsPane.prototype.addSearchResult):
(WebInspector.FileBasedSearchResultsPane.prototype._regexMatchRanges):
(WebInspector.FileBasedSearchResultsPane.prototype._createContentSpan):
* inspector/front-end/BreakpointManager.js:
(WebInspector.BreakpointManager.prototype._materializeBreakpoint):
* inspector/front-end/CompilerSourceMapping.js:
(WebInspector.CompilerSourceMapping.prototype.sourceLocationToCompiledLocation):
* inspector/front-end/DebuggerPresentationModel.js:
(WebInspector.DebuggerPresentationModel.prototype.createLinkifier):
(WebInspector.DebuggerPresentationModel.prototype.continueToLine):
(WebInspector.DebuggerPresentationModel.LinkifierFormatter):
(WebInspector.DebuggerPresentationModel.LinkifierFormatter.prototype.formatRawSourceCodeAnchor):
(WebInspector.DebuggerPresentationModel.DefaultLinkifierFormatter):
(WebInspector.DebuggerPresentationModel.DefaultLinkifierFormatter.prototype.formatRawSourceCodeAnchor):
(WebInspector.DebuggerPresentationModel.Linkifier):
(WebInspector.DebuggerPresentationModel.Linkifier.prototype.linkifyLocation):
(WebInspector.DebuggerPresentationModel.Linkifier.prototype.linkifyResource):
(WebInspector.DebuggerPresentationModel.Linkifier.prototype.linkifyRawSourceCode):
(WebInspector.DebuggerPresentationModel.Linkifier.prototype._updateAnchor):
* inspector/front-end/RawSourceCode.js:
(WebInspector.RawSourceCode.SourceMapping.prototype.uiLocationToRawLocation):
(WebInspector.RawSourceCode.PlainSourceMapping.prototype.uiLocationToRawLocation):
(WebInspector.RawSourceCode.FormattedSourceMapping.prototype.uiLocationToRawLocation):
(WebInspector.RawSourceCode.CompilerSourceMapping.prototype.uiLocationToRawLocation):
* inspector/front-end/ScriptsSearchScope.js:
(WebInspector.ScriptsSearchResultsPane):
(WebInspector.ScriptsSearchResultsPane.prototype.createAnchor):
(WebInspector.ScriptsSearchResultsPane.LinkifierFormatter):
(WebInspector.ScriptsSearchResultsPane.LinkifierFormatter.prototype.formatRawSourceCodeAnchor):
* inspector/front-end/inspector.html:

LayoutTests:

* inspector/debugger/raw-source-code.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (97974 => 97975)


--- trunk/LayoutTests/ChangeLog	2011-10-20 14:13:43 UTC (rev 97974)
+++ trunk/LayoutTests/ChangeLog	2011-10-20 14:22:46 UTC (rev 97975)
@@ -1,3 +1,12 @@
+2011-10-20  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Advanced search results should keep working after pretty print toggled.
+        https://bugs.webkit.org/show_bug.cgi?id=70347
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/debugger/raw-source-code.html:
+
 2011-10-20  Leandro Pereira  <[email protected]>
 
         Unreviewed. Add EFL baselines for dom, editing, fonts, mathml, media, printing, scrollbars and security.

Modified: trunk/LayoutTests/inspector/debugger/raw-source-code.html (97974 => 97975)


--- trunk/LayoutTests/inspector/debugger/raw-source-code.html	2011-10-20 14:13:43 UTC (rev 97974)
+++ trunk/LayoutTests/inspector/debugger/raw-source-code.html	2011-10-20 14:22:46 UTC (rev 97975)
@@ -112,7 +112,7 @@
             InspectorTest.assertEquals(true, uiSourceCode.isContentScript);
             InspectorTest.assertEquals(rawSourceCode, uiSourceCode.rawSourceCode);
             checkUILocation(uiSourceCode, 0, 5, sourceMapping.rawLocationToUILocation(createRawLocation(0, 5)));
-            checkRawLocation(script, 10, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 10));
+            checkRawLocation(script, 10, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 10, 0));
             uiSourceCode.requestContent(didRequestContent);
 
             function didRequestContent(mimeType, content)
@@ -178,8 +178,8 @@
                 rawSourceCode.addScript(script2);
                 rawSourceCode.forceUpdateSourceMapping();
                 checkUILocation(uiSourceCode, 1, 20, sourceMapping.rawLocationToUILocation(createRawLocation(1, 20)));
-                checkRawLocation(script1, 1, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 1));
-                checkRawLocation(script2, 6, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 6));
+                checkRawLocation(script1, 1, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 1, 0));
+                checkRawLocation(script2, 6, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 6, 0));
 
                 next();
             }
@@ -264,7 +264,7 @@
             InspectorTest.assertEquals(1, sourceMapping.uiSourceCodeList().length);
             var uiSourceCode = sourceMapping.uiSourceCodeList()[0];
             checkUILocation(uiSourceCode, 1, 2, sourceMapping.rawLocationToUILocation(createRawLocation(1, 2)));
-            checkRawLocation(script, 2, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 2));
+            checkRawLocation(script, 2, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 2, 0));
             uiSourceCode.requestContent(didRequestContent);
 
             function didRequestContent(mimeType, content)
@@ -283,7 +283,7 @@
                 InspectorTest.assertEquals(1, sourceMapping.uiSourceCodeList().length);
                 var uiSourceCode = sourceMapping.uiSourceCodeList()[0];
                 checkUILocation(uiSourceCode, 2, 4, sourceMapping.rawLocationToUILocation(createRawLocation(1, 2)));
-                checkRawLocation(script, 1, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 2));
+                checkRawLocation(script, 1, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 2, 0));
                 uiSourceCode.requestContent(didRequestFormattedContent);
             }
 
@@ -302,7 +302,7 @@
                 InspectorTest.assertEquals(1, sourceMapping.uiSourceCodeList().length);
                 var uiSourceCode = sourceMapping.uiSourceCodeList()[0];
                 checkUILocation(uiSourceCode, 1, 2, sourceMapping.rawLocationToUILocation(createRawLocation(1, 2)));
-                checkRawLocation(script, 2, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 2));
+                checkRawLocation(script, 2, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 2, 0));
                 uiSourceCode.requestContent(didRequestNotFormattedContent);
             }
 
@@ -332,7 +332,7 @@
                 InspectorTest.assertEquals(1, sourceMapping.uiSourceCodeList().length);
                 var uiSourceCode = sourceMapping.uiSourceCodeList()[0];
                 checkUILocation(uiSourceCode, 2, 4, sourceMapping.rawLocationToUILocation(createRawLocation(1, 2)));
-                checkRawLocation(script, 1, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 2));
+                checkRawLocation(script, 1, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 2, 0));
                 next();
             }
         },
@@ -381,8 +381,8 @@
                     uiSourceCodeByURL[uiSourceCodeList[i].url] = uiSourceCodeList[i];
                 checkUILocation(uiSourceCodeByURL["source1.js"], 2, 4, sourceMapping.rawLocationToUILocation(createRawLocation(1, 2)));
                 checkUILocation(uiSourceCodeByURL["source2.js"], 10, 40, sourceMapping.rawLocationToUILocation(createRawLocation(15, 20)));
-                checkRawLocation(script, 1, 0, sourceMapping.uiLocationToRawLocation(uiSourceCodeByURL["source1.js"], 2));
-                checkRawLocation(script, 15, 0, sourceMapping.uiLocationToRawLocation(uiSourceCodeByURL["source2.js"], 10));
+                checkRawLocation(script, 1, 0, sourceMapping.uiLocationToRawLocation(uiSourceCodeByURL["source1.js"], 2, 0));
+                checkRawLocation(script, 15, 0, sourceMapping.uiLocationToRawLocation(uiSourceCodeByURL["source2.js"], 10, 0));
 
                 uiSourceCodeList[0].requestContent(didRequestContent1);
             }

Modified: trunk/Source/WebCore/ChangeLog (97974 => 97975)


--- trunk/Source/WebCore/ChangeLog	2011-10-20 14:13:43 UTC (rev 97974)
+++ trunk/Source/WebCore/ChangeLog	2011-10-20 14:22:46 UTC (rev 97975)
@@ -1,3 +1,44 @@
+2011-10-20  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Advanced search results should keep working after pretty print toggled.
+        https://bugs.webkit.org/show_bug.cgi?id=70347
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/front-end/AdvancedSearchController.js:
+        (WebInspector.SearchScope.prototype.createSearchResultsPane):
+        (WebInspector.FileBasedSearchResultsPane.prototype.createAnchor):
+        (WebInspector.FileBasedSearchResultsPane.prototype.addSearchResult):
+        (WebInspector.FileBasedSearchResultsPane.prototype._regexMatchRanges):
+        (WebInspector.FileBasedSearchResultsPane.prototype._createContentSpan):
+        * inspector/front-end/BreakpointManager.js:
+        (WebInspector.BreakpointManager.prototype._materializeBreakpoint):
+        * inspector/front-end/CompilerSourceMapping.js:
+        (WebInspector.CompilerSourceMapping.prototype.sourceLocationToCompiledLocation):
+        * inspector/front-end/DebuggerPresentationModel.js:
+        (WebInspector.DebuggerPresentationModel.prototype.createLinkifier):
+        (WebInspector.DebuggerPresentationModel.prototype.continueToLine):
+        (WebInspector.DebuggerPresentationModel.LinkifierFormatter):
+        (WebInspector.DebuggerPresentationModel.LinkifierFormatter.prototype.formatRawSourceCodeAnchor):
+        (WebInspector.DebuggerPresentationModel.DefaultLinkifierFormatter):
+        (WebInspector.DebuggerPresentationModel.DefaultLinkifierFormatter.prototype.formatRawSourceCodeAnchor):
+        (WebInspector.DebuggerPresentationModel.Linkifier):
+        (WebInspector.DebuggerPresentationModel.Linkifier.prototype.linkifyLocation):
+        (WebInspector.DebuggerPresentationModel.Linkifier.prototype.linkifyResource):
+        (WebInspector.DebuggerPresentationModel.Linkifier.prototype.linkifyRawSourceCode):
+        (WebInspector.DebuggerPresentationModel.Linkifier.prototype._updateAnchor):
+        * inspector/front-end/RawSourceCode.js:
+        (WebInspector.RawSourceCode.SourceMapping.prototype.uiLocationToRawLocation):
+        (WebInspector.RawSourceCode.PlainSourceMapping.prototype.uiLocationToRawLocation):
+        (WebInspector.RawSourceCode.FormattedSourceMapping.prototype.uiLocationToRawLocation):
+        (WebInspector.RawSourceCode.CompilerSourceMapping.prototype.uiLocationToRawLocation):
+        * inspector/front-end/ScriptsSearchScope.js:
+        (WebInspector.ScriptsSearchResultsPane):
+        (WebInspector.ScriptsSearchResultsPane.prototype.createAnchor):
+        (WebInspector.ScriptsSearchResultsPane.LinkifierFormatter):
+        (WebInspector.ScriptsSearchResultsPane.LinkifierFormatter.prototype.formatRawSourceCodeAnchor):
+        * inspector/front-end/inspector.html:
+
 2011-10-20  Kenneth Rohde Christiansen  <[email protected]>
 
         m_client in DeviceMotionController can never be 0, so no need to check for it

Modified: trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js (97974 => 97975)


--- trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js	2011-10-20 14:13:43 UTC (rev 97974)
+++ trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js	2011-10-20 14:22:46 UTC (rev 97975)
@@ -296,9 +296,10 @@
     stopSearch: function() { },
     
     /**
+     * @param {WebInspector.SearchConfig} searchConfig
      * @return WebInspector.SearchResultsPane}
      */
-    createSearchResultsPane: function() { }
+    createSearchResultsPane: function(searchConfig) { }
 }
 
 /**
@@ -349,9 +350,10 @@
     /**
      * @param {Object} file
      * @param {number} lineNumber
+     * @param {number} columnNumber
      * @return {Element}
      */
-    createAnchor: function(file, lineNumber) { },
+    createAnchor: function(file, lineNumber, columnNumber) { },
     
     /**
      * @param {Object} file
@@ -372,11 +374,13 @@
         // Expand first file with matches only.
         var fileTreeElement = this._addFileTreeElement(fileName, searchMatches.length, this._searchResults.length === 1);
         
-        var regexObject = createSearchRegex(this._searchConfig.query, !this._searchConfig.ignoreCase, this._searchConfig.isRegex);
+        var regex = createSearchRegex(this._searchConfig.query, !this._searchConfig.ignoreCase, this._searchConfig.isRegex);
         for (var i = 0; i < searchMatches.length; i++) {
             var lineNumber = searchMatches[i].lineNumber;
+            var lineContent = searchMatches[i].lineContent;
+            var matchRanges = this._regexMatchRanges(lineContent, regex);
             
-            var anchor = this.createAnchor(file, lineNumber);
+            var anchor = this.createAnchor(file, lineNumber, matchRanges[0].offset);
             
             var numberString = numberToStringWithSpacesPadding(lineNumber + 1, 4);
             var lineNumberSpan = document.createElement("span");
@@ -385,7 +389,7 @@
             lineNumberSpan.textContent = numberString;
             anchor.appendChild(lineNumberSpan);
             
-            var contentSpan = this._createContentSpan(searchMatches[i].lineContent, regexObject);
+            var contentSpan = this._createContentSpan(lineContent, matchRanges);
             anchor.appendChild(contentSpan);
             
             var searchMatchElement = new TreeElement("", null, false);
@@ -429,24 +433,31 @@
 
     /**
      * @param {string} lineContent
-     * @param {RegExp} regexObject
+     * @param {RegExp} regex
+     * @return {Array.<Object>}
      */
-    _createContentSpan: function(lineContent, regexObject)
+    _regexMatchRanges: function(lineContent, regex)
     {
+        regex.lastIndex = 0;
+        var match;
+        var offset = 0;
+        var matchRanges = [];
+        while (match = regex.exec(lineContent))
+            matchRanges.push({ offset: match.index, length: match[0].length });
+        
+        return matchRanges;
+    },
+    
+    /**
+     * @param {string} lineContent
+     * @param {Array.<Object>} matchRanges
+     */
+    _createContentSpan: function(lineContent, matchRanges)
+    {
         var contentSpan = document.createElement("span");
         contentSpan.className = "search-match-content";
         contentSpan.textContent = lineContent;
-        
-        regexObject.lastIndex = 0;
-        var match = regexObject.exec(lineContent);
-        var offset = 0;
-        var matchRanges = [];
-        while (match) {
-            matchRanges.push({ offset: match.index, length: match[0].length });
-            match = regexObject.exec(lineContent);
-        }
         highlightRangesWithStyleClass(contentSpan, matchRanges, "highlighted-match");
-        
         return contentSpan;
     }
 }

Modified: trunk/Source/WebCore/inspector/front-end/BreakpointManager.js (97974 => 97975)


--- trunk/Source/WebCore/inspector/front-end/BreakpointManager.js	2011-10-20 14:13:43 UTC (rev 97974)
+++ trunk/Source/WebCore/inspector/front-end/BreakpointManager.js	2011-10-20 14:22:46 UTC (rev 97975)
@@ -127,7 +127,7 @@
             return;
 
         breakpoint._materialized = true;
-        var rawLocation = sourceMapping.uiLocationToRawLocation(uiSourceCode, breakpoint.lineNumber);
+        var rawLocation = sourceMapping.uiLocationToRawLocation(uiSourceCode, breakpoint.lineNumber, 0);
         this._setBreakpointInDebugger(breakpoint, rawLocation);
     },
 

Modified: trunk/Source/WebCore/inspector/front-end/CompilerSourceMapping.js (97974 => 97975)


--- trunk/Source/WebCore/inspector/front-end/CompilerSourceMapping.js	2011-10-20 14:13:43 UTC (rev 97974)
+++ trunk/Source/WebCore/inspector/front-end/CompilerSourceMapping.js	2011-10-20 14:22:46 UTC (rev 97975)
@@ -46,10 +46,9 @@
     /**
      * @param {string} sourceURL
      * @param {number} lineNumber
-     * @param {number} columnNumber
      * @return {Object}
      */
-    sourceLocationToCompiledLocation: function(sourceURL, lineNumber, columnNumber) { },
+    sourceLocationToCompiledLocation: function(sourceURL, lineNumber) { },
 
     /**
      * @return {Array.<string>}

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


--- trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js	2011-10-20 14:13:43 UTC (rev 97974)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js	2011-10-20 14:22:46 UTC (rev 97975)
@@ -68,9 +68,12 @@
 }
 
 WebInspector.DebuggerPresentationModel.prototype = {
-    createLinkifier: function()
+    /**
+     * @param {WebInspector.DebuggerPresentationModel.LinkifierFormatter=} formatter
+     */
+    createLinkifier: function(formatter)
     {
-        return new WebInspector.DebuggerPresentationModel.Linkifier(this);
+        return new WebInspector.DebuggerPresentationModel.Linkifier(this, formatter);
     },
 
     /**
@@ -362,7 +365,7 @@
     continueToLine: function(uiSourceCode, lineNumber)
     {
         // FIXME: use RawSourceCode.uiLocationToRawLocation.
-        var rawLocation = uiSourceCode.rawSourceCode.sourceMapping.uiLocationToRawLocation(uiSourceCode, lineNumber);
+        var rawLocation = uiSourceCode.rawSourceCode.sourceMapping.uiLocationToRawLocation(uiSourceCode, lineNumber, 0);
         WebInspector.debuggerModel.continueToLocation(rawLocation);
     },
 
@@ -768,12 +771,59 @@
 }
 
 /**
+ * @interface
+ */
+WebInspector.DebuggerPresentationModel.LinkifierFormatter = function()
+{
+}
+
+WebInspector.DebuggerPresentationModel.LinkifierFormatter.prototype = {
+    /**
+     * @param {WebInspector.RawSourceCode} rawSourceCode
+     * @param {Element} anchor
+     */
+    formatRawSourceCodeAnchor: function(rawSourceCode, anchor) { },
+}
+
+/**
  * @constructor
+ * @implements {WebInspector.DebuggerPresentationModel.LinkifierFormatter}
+ * @param {number=} maxLength
+ */
+WebInspector.DebuggerPresentationModel.DefaultLinkifierFormatter = function(maxLength)
+{
+    this._maxLength = maxLength;
+}
+
+WebInspector.DebuggerPresentationModel.DefaultLinkifierFormatter.prototype = {
+    /**
+     * @param {WebInspector.RawSourceCode} rawSourceCode
+     * @param {Element} anchor
+     */
+    formatRawSourceCodeAnchor: function(rawSourceCode, anchor)
+    {
+        var uiLocation = rawSourceCode.sourceMapping.rawLocationToUILocation(anchor.rawLocation);
+
+        anchor.textContent = WebInspector.formatLinkText(uiLocation.uiSourceCode.url, uiLocation.lineNumber);
+            
+        var text = WebInspector.formatLinkText(uiLocation.uiSourceCode.url, uiLocation.lineNumber);
+        if (this._maxLength)
+            text = text.trimMiddle(this._maxLength);
+        anchor.textContent = text;
+    }
+}
+
+WebInspector.DebuggerPresentationModel.DefaultLinkifierFormatter.prototype.__proto__ = WebInspector.DebuggerPresentationModel.LinkifierFormatter.prototype;
+
+/**
+ * @constructor
  * @param {WebInspector.DebuggerPresentationModel} model
+ * @param {WebInspector.DebuggerPresentationModel.LinkifierFormatter=} formatter
  */
-WebInspector.DebuggerPresentationModel.Linkifier = function(model)
+WebInspector.DebuggerPresentationModel.Linkifier = function(model, formatter)
 {
     this._model = model;
+    this._formatter = formatter || new WebInspector.DebuggerPresentationModel.DefaultLinkifierFormatter();
     this._anchorsForRawSourceCode = {};
 }
 
@@ -786,17 +836,38 @@
      */
     linkifyLocation: function(sourceURL, lineNumber, columnNumber, classes)
     {
+        var rawSourceCode = this._model._rawSourceCodeForScriptWithURL(sourceURL);
+        if (!rawSourceCode)
+            return this.linkifyResource(sourceURL, lineNumber, classes);
+        
+        return this.linkifyRawSourceCode(rawSourceCode, lineNumber, columnNumber, classes);
+    },
+
+    /**
+     * @param {string} sourceURL
+     * @param {number=} lineNumber
+     * @param {string=} classes
+     */
+    linkifyResource: function(sourceURL, lineNumber, classes)
+    {
         var linkText = WebInspector.formatLinkText(sourceURL, lineNumber);
         var anchor = WebInspector.linkifyURLAsNode(sourceURL, linkText, classes, false);
+        anchor.setAttribute("preferred_panel", "resources");
+        anchor.setAttribute("line_number", lineNumber);
+        return anchor;
+    },
+
+    /**
+     * @param {WebInspector.RawSourceCode} rawSourceCode
+     * @param {number=} lineNumber
+     * @param {number=} columnNumber
+     * @param {string=} classes
+     */
+    linkifyRawSourceCode: function(rawSourceCode, lineNumber, columnNumber, classes)
+    {
+        var anchor = WebInspector.linkifyURLAsNode(rawSourceCode.url, "", classes, false);
         anchor.rawLocation = { lineNumber: lineNumber, columnNumber: columnNumber };
 
-        var rawSourceCode = this._model._rawSourceCodeForScriptWithURL(sourceURL);
-        if (!rawSourceCode) {
-            anchor.setAttribute("preferred_panel", "resources");
-            anchor.setAttribute("line_number", lineNumber);
-            return anchor;
-        }
-
         var anchors = this._anchorsForRawSourceCode[rawSourceCode.id];
         if (!anchors) {
             anchors = [];
@@ -837,10 +908,11 @@
     _updateAnchor: function(rawSourceCode, anchor)
     {
         var uiLocation = rawSourceCode.sourceMapping.rawLocationToUILocation(anchor.rawLocation);
-        anchor.textContent = WebInspector.formatLinkText(uiLocation.uiSourceCode.url, uiLocation.lineNumber);
         anchor.setAttribute("preferred_panel", "scripts");
         anchor.uiSourceCode = uiLocation.uiSourceCode;
         anchor.lineNumber = uiLocation.lineNumber;
+        
+        this._formatter.formatRawSourceCodeAnchor(rawSourceCode, anchor);
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/RawSourceCode.js (97974 => 97975)


--- trunk/Source/WebCore/inspector/front-end/RawSourceCode.js	2011-10-20 14:13:43 UTC (rev 97974)
+++ trunk/Source/WebCore/inspector/front-end/RawSourceCode.js	2011-10-20 14:22:46 UTC (rev 97975)
@@ -266,9 +266,10 @@
     /**
      * @param {WebInspector.UISourceCode} uiSourceCode
      * @param {number} lineNumber
+     * @param {number} columnNumber
      * @return {DebuggerAgent.Location}
      */
-    uiLocationToRawLocation: function(uiSourceCode, lineNumber) { }
+    uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) { }
 }
 
 /**
@@ -296,12 +297,13 @@
     /**
      * @param {WebInspector.UISourceCode} uiSourceCode
      * @param {number} lineNumber
+     * @param {number} columnNumber
      * @return {DebuggerAgent.Location}
      */
-    uiLocationToRawLocation: function(uiSourceCode, lineNumber)
+    uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber)
     {
         console.assert(uiSourceCode === this._uiSourceCodeList[0]);
-        var rawLocation = { lineNumber: lineNumber, columnNumber: 0 };
+        var rawLocation = { lineNumber: lineNumber, columnNumber: columnNumber };
         rawLocation.scriptId = this._rawSourceCode._scriptForRawLocation(rawLocation.lineNumber, rawLocation.columnNumber).scriptId;
         return /** @type {DebuggerAgent.Location} */ rawLocation;
     },
@@ -342,12 +344,13 @@
     /**
      * @param {WebInspector.UISourceCode} uiSourceCode
      * @param {number} lineNumber
+     * @param {number} columnNumber
      * @return {DebuggerAgent.Location}
      */
-    uiLocationToRawLocation: function(uiSourceCode, lineNumber)
+    uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber)
     {
         console.assert(uiSourceCode === this._uiSourceCodeList[0]);
-        var rawLocation = this._mapping.formattedToOriginal({ lineNumber: lineNumber, columnNumber: 0 });
+        var rawLocation = this._mapping.formattedToOriginal({ lineNumber: lineNumber, columnNumber: columnNumber });
         rawLocation.scriptId = this._rawSourceCode._scriptForRawLocation(rawLocation.lineNumber, rawLocation.columnNumber).scriptId;
         return rawLocation;
     },
@@ -392,11 +395,12 @@
     /**
      * @param {WebInspector.UISourceCode} uiSourceCode
      * @param {number} lineNumber
+     * @param {number} columnNumber
      * @return {DebuggerAgent.Location}
      */
-    uiLocationToRawLocation: function(uiSourceCode, lineNumber)
+    uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber)
     {
-        var rawLocation = this._mapping.sourceLocationToCompiledLocation(uiSourceCode.url, lineNumber, 0);
+        var rawLocation = this._mapping.sourceLocationToCompiledLocation(uiSourceCode.url, lineNumber);
         rawLocation.scriptId = this._rawSourceCode._scriptForRawLocation(rawLocation.lineNumber, rawLocation.columnNumber).scriptId;
         return /** @type {DebuggerAgent.Location} */ rawLocation;
     },

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsSearchScope.js (97974 => 97975)


--- trunk/Source/WebCore/inspector/front-end/ScriptsSearchScope.js	2011-10-20 14:13:43 UTC (rev 97974)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsSearchScope.js	2011-10-20 14:22:46 UTC (rev 97975)
@@ -125,23 +125,24 @@
 WebInspector.ScriptsSearchResultsPane = function(searchConfig)
 {
     WebInspector.FileBasedSearchResultsPane.call(this, searchConfig)
+
+    this._linkifier = WebInspector.debuggerPresentationModel.createLinkifier(new WebInspector.ScriptsSearchResultsPane.LinkifierFormatter());
 }
 
 WebInspector.ScriptsSearchResultsPane.prototype = {
     /**
      * @param {Object} file
      * @param {number} lineNumber
+     * @param {number} columnNumber
      */
-    createAnchor: function(file, lineNumber)
+    createAnchor: function(file, lineNumber, columnNumber)
     {
+        
         var uiSourceCode = file;
-        
-        var anchor = WebInspector.linkifyURLAsNode(uiSourceCode.url, "");
-        anchor.setAttribute("preferred_panel", "scripts");
-        anchor.uiSourceCode = uiSourceCode;
-        anchor.lineNumber = lineNumber;
+        var rawSourceCode = uiSourceCode.rawSourceCode;
+        var rawLocation = rawSourceCode.sourceMapping.uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber);
+        var anchor = this._linkifier.linkifyRawSourceCode(uiSourceCode.rawSourceCode, rawLocation.lineNumber, rawLocation.columnNumber);
         anchor.removeChildren();
-        
         return anchor;
     },
     
@@ -157,3 +158,24 @@
 }
 
 WebInspector.ScriptsSearchResultsPane.prototype.__proto__ = WebInspector.FileBasedSearchResultsPane.prototype;
+
+/**
+ * @constructor
+ * @implements {WebInspector.DebuggerPresentationModel.LinkifierFormatter}
+ */
+WebInspector.ScriptsSearchResultsPane.LinkifierFormatter = function()
+{
+}
+
+WebInspector.ScriptsSearchResultsPane.LinkifierFormatter.prototype = {
+    /**
+     * @param {WebInspector.RawSourceCode} rawSourceCode
+     * @param {Element} anchor
+     */
+    formatRawSourceCodeAnchor: function(rawSourceCode, anchor)
+    {
+        // Empty because we don't want to ever update anchor contents after creation.
+    }
+}
+
+WebInspector.ScriptsSearchResultsPane.LinkifierFormatter.prototype.__proto__ = WebInspector.DebuggerPresentationModel.LinkifierFormatter.prototype;

Modified: trunk/Source/WebCore/inspector/front-end/inspector.html (97974 => 97975)


--- trunk/Source/WebCore/inspector/front-end/inspector.html	2011-10-20 14:13:43 UTC (rev 97974)
+++ trunk/Source/WebCore/inspector/front-end/inspector.html	2011-10-20 14:22:46 UTC (rev 97975)
@@ -116,7 +116,6 @@
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
-    <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
@@ -170,6 +169,7 @@
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
+    <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to