Title: [123768] trunk/Source/WebCore
Revision
123768
Author
pfeld...@chromium.org
Date
2012-07-26 10:25:00 -0700 (Thu, 26 Jul 2012)

Log Message

Web Inspector: SASS source mapping straw man (behind experiment)
https://bugs.webkit.org/show_bug.cgi?id=92265

Reviewed by Vsevolod Vlasov.

This change introduces SASS mapping support (behind the experiment).

* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* inspector/compile-front-end.py:
* inspector/front-end/CSSStyleModel.js:
(WebInspector.CSSStyleModel):
(WebInspector.CSSStyleModel.prototype.resourceBinding):
(WebInspector.CSSStyleModel.prototype.setSourceMapping):
(WebInspector.CSSStyleModel.prototype.resetSourceMappings):
(WebInspector.CSSStyleModel.prototype._rawLocationToUILocation):
(WebInspector.CSSLocation):
(WebInspector.CSSRule):
(WebInspector.CSSRule.prototype.get isRegular):
(WebInspector.CSSRule.prototype.uiLocation):
* inspector/front-end/ContentProviders.js:
(WebInspector.StaticContentProvider.prototype.contentType):
* inspector/front-end/SASSSourceMapping.js: Added.
(WebInspector.SASSSourceMapping):
(WebInspector.SASSSourceMapping.prototype._populate):
(WebInspector.SASSSourceMapping.prototype._resourceAdded.didRequestContent):
(WebInspector.SASSSourceMapping.prototype._resourceAdded):
(rawLocationToUILocation):
(uiLocationToRawLocation):
(uiSourceCodes):
(reset):
(WebInspector.SASSSource):
(WebInspector.SASSSource.prototype.isEditable):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._createSourceFrame):
* inspector/front-end/Settings.js:
(WebInspector.ExperimentsSettings):
* inspector/front-end/StylesPanel.js:
(WebInspector.StylesUISourceCodeProvider):
(WebInspector.StylesUISourceCodeProvider.prototype.rawLocationToUILocation):
(WebInspector.StylesUISourceCodeProvider.prototype.uiLocationToRawLocation):
(WebInspector.StylesUISourceCodeProvider.prototype._resourceAdded):
(WebInspector.StylesUISourceCodeProvider.prototype.reset):
* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylePropertyTreeElement.prototype):
* inspector/front-end/UISourceCode.js:
(WebInspector.UILocation.prototype.uiLocationToRawLocation):
(WebInspector.UILocation.prototype.url):
* inspector/front-end/Workspace.js:
(WebInspector.Workspace):
* inspector/front-end/inspector.html:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (123767 => 123768)


--- trunk/Source/WebCore/ChangeLog	2012-07-26 17:23:20 UTC (rev 123767)
+++ trunk/Source/WebCore/ChangeLog	2012-07-26 17:25:00 UTC (rev 123768)
@@ -1,3 +1,80 @@
+2012-07-25  Pavel Feldman  <pfeld...@chromium.org>
+
+        Web Inspector: SASS source mapping straw man (behind experiment)
+        https://bugs.webkit.org/show_bug.cgi?id=92265
+
+        Reviewed by Vsevolod Vlasov.
+
+        This change introduces SASS mapping support (behind the experiment).
+
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/compile-front-end.py:
+        * inspector/front-end/CSSStyleModel.js:
+        (WebInspector.CSSStyleModel):
+        (WebInspector.CSSStyleModel.prototype.resourceBinding):
+        (WebInspector.CSSStyleModel.prototype.setSourceMapping):
+        (WebInspector.CSSStyleModel.prototype.resetSourceMappings):
+        (WebInspector.CSSStyleModel.prototype._rawLocationToUILocation):
+        (WebInspector.CSSLocation):
+        (WebInspector.CSSRule):
+        (WebInspector.CSSRule.prototype.get isRegular):
+        (WebInspector.CSSRule.prototype.uiLocation):
+        * inspector/front-end/ContentProviders.js:
+        (WebInspector.StaticContentProvider.prototype.contentType):
+        * inspector/front-end/SASSSourceMapping.js: Added.
+        (WebInspector.SASSSourceMapping):
+        (WebInspector.SASSSourceMapping.prototype._populate):
+        (WebInspector.SASSSourceMapping.prototype._resourceAdded.didRequestContent):
+        (WebInspector.SASSSourceMapping.prototype._resourceAdded):
+        (rawLocationToUILocation):
+        (uiLocationToRawLocation):
+        (uiSourceCodes):
+        (reset):
+        (WebInspector.SASSSource):
+        (WebInspector.SASSSource.prototype.isEditable):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype._createSourceFrame):
+        * inspector/front-end/Settings.js:
+        (WebInspector.ExperimentsSettings):
+        * inspector/front-end/StylesPanel.js:
+        (WebInspector.StylesUISourceCodeProvider):
+        (WebInspector.StylesUISourceCodeProvider.prototype.rawLocationToUILocation):
+        (WebInspector.StylesUISourceCodeProvider.prototype.uiLocationToRawLocation):
+        (WebInspector.StylesUISourceCodeProvider.prototype._resourceAdded):
+        (WebInspector.StylesUISourceCodeProvider.prototype.reset):
+        * inspector/front-end/StylesSidebarPane.js:
+        (WebInspector.StylePropertyTreeElement.prototype):
+        * inspector/front-end/UISourceCode.js:
+        (WebInspector.UILocation.prototype.uiLocationToRawLocation):
+        (WebInspector.UILocation.prototype.url):
+        * inspector/front-end/Workspace.js:
+        (WebInspector.Workspace):
+        * inspector/front-end/inspector.html:
+
+2012-07-26  Vsevolod Vlasov  <vse...@chromium.org>
+
+        Unreviewed r123761 follow-up, inspector closure compilation fix.
+
+        * inspector/front-end/Script.js:
+        (WebInspector.Script.Location.prototype.uiLocation):
+        * inspector/front-end/ScriptSnippetModel.js:
+
+2012-07-26  Patrick Gansterer  <par...@webkit.org>
+
+        Cleanup GraphicsContext::(getWindowsContext|releaseWindowsContext)
+        https://bugs.webkit.org/show_bug.cgi?id=92113
+
+        Reviewed by Simon Hausmann.
+
+        Cleanup the definition of the two methods across different ports and
+        replace the calls to them with LocalWindowsContext where possible.
+
+        * platform/graphics/GraphicsContext.h:
+        (GraphicsContext):
+        * platform/win/ScrollbarThemeWin.cpp:
+        (WebCore::ScrollbarThemeWin::paintThumb):
+
 2012-07-27 Chris Fleizach <cfleiz...@apple.com>
 
         WebKit should expose @title as label (AXTitle or AXDescription) sometimes instead of AXHelp, according to the ARIA text alt computation

Modified: trunk/Source/WebCore/WebCore.gypi (123767 => 123768)


--- trunk/Source/WebCore/WebCore.gypi	2012-07-26 17:23:20 UTC (rev 123767)
+++ trunk/Source/WebCore/WebCore.gypi	2012-07-26 17:25:00 UTC (rev 123768)
@@ -6345,6 +6345,7 @@
             'inspector/front-end/ResourceWebSocketFrameView.js',
             'inspector/front-end/ResourcesPanel.js',
             'inspector/front-end/RevisionHistoryView.js',
+            'inspector/front-end/SASSSourceMapping.js',
             'inspector/front-end/ScopeChainSidebarPane.js',
             'inspector/front-end/Script.js',
             'inspector/front-end/ScriptFormatter.js',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (123767 => 123768)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-07-26 17:23:20 UTC (rev 123767)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-07-26 17:25:00 UTC (rev 123768)
@@ -75738,6 +75738,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\inspector\front-end\SASSSourceMapping.js"
+					>
+				</File>
+				<File
 					RelativePath="..\inspector\front-end\ScopeChainSidebarPane.js"
 					>
 				</File>

Modified: trunk/Source/WebCore/inspector/compile-front-end.py (123767 => 123768)


--- trunk/Source/WebCore/inspector/compile-front-end.py	2012-07-26 17:23:20 UTC (rev 123767)
+++ trunk/Source/WebCore/inspector/compile-front-end.py	2012-07-26 17:25:00 UTC (rev 123768)
@@ -87,6 +87,7 @@
             "Linkifier.js",
             "NetworkLog.js",
             "Placard.js",
+            "SASSSourceMapping.js",
             "Script.js",
             "ScriptFormatter.js",
             "ScriptSnippetModel.js",

Modified: trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js (123767 => 123768)


--- trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js	2012-07-26 17:23:20 UTC (rev 123767)
+++ trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js	2012-07-26 17:25:00 UTC (rev 123768)
@@ -35,6 +35,7 @@
 WebInspector.CSSStyleModel = function()
 {
     this._pendingCommandsMajorState = [];
+    this._sourceMappings = {};
     WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoRequested, this._undoRedoRequested, this);
     WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoCompleted, this._undoRedoCompleted, this);
     this._resourceBinding = new WebInspector.CSSStyleModelResourceBinding(this);
@@ -388,6 +389,30 @@
     resourceBinding: function()
     {
         return this._resourceBinding;
+    },
+
+    /**
+     * @param {string} url
+     * @param {WebInspector.SourceMapping} sourceMapping
+     */
+    setSourceMapping: function(url, sourceMapping)
+    {
+        this._sourceMappings[url] = sourceMapping;
+    },
+
+    resetSourceMappings: function()
+    {
+        this._sourceMappings = {};
+    },
+
+    /**
+     * @param {WebInspector.CSSLocation} rawLocation
+     * @return {?WebInspector.UILocation}
+     */
+    _rawLocationToUILocation: function(rawLocation)
+    {
+        var sourceMapping = this._sourceMappings[rawLocation.url];
+        return sourceMapping ? sourceMapping.rawLocationToUILocation(rawLocation) : null;
     }
 }
 
@@ -395,6 +420,18 @@
 
 /**
  * @constructor
+ * @implements {WebInspector.RawLocation}
+ * @param {string} url
+ * @param {number} lineNumber
+ */
+WebInspector.CSSLocation = function(url, lineNumber)
+{
+    this.url = ""
+    this.lineNumber = lineNumber;
+}
+
+/**
+ * @constructor
  * @param {CSSAgent.CSSStyle} payload
  */
 WebInspector.CSSStyleDeclaration = function(payload)
@@ -617,6 +654,8 @@
     this.selectorText = payload.selectorText;
     this.sourceLine = payload.sourceLine;
     this.sourceURL = payload.sourceURL;
+    if (payload.sourceURL)
+        this._rawLocation = new WebInspector.CSSLocation(payload.sourceURL, payload.sourceLine);
     this.origin = payload.origin;
     this.style = WebInspector.CSSStyleDeclaration.parsePayload(payload.style);
     this.style.parentRule = this;
@@ -653,6 +692,16 @@
     get isRegular()
     {
         return this.origin === "regular";
+    },
+
+    /**
+     * @return {?WebInspector.UILocation}
+     */
+    uiLocation: function()
+    {
+        if (!this._rawLocation)
+            return null;
+        return WebInspector.cssModel._rawLocationToUILocation(this._rawLocation);
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/ContentProviders.js (123767 => 123768)


--- trunk/Source/WebCore/inspector/front-end/ContentProviders.js	2012-07-26 17:23:20 UTC (rev 123767)
+++ trunk/Source/WebCore/inspector/front-end/ContentProviders.js	2012-07-26 17:25:00 UTC (rev 123768)
@@ -263,7 +263,7 @@
      */
     contentType: function()
     {
-        return WebInspector.resourceTypes.Script;
+        return this._contentType;
     },
 
     /**

Added: trunk/Source/WebCore/inspector/front-end/SASSSourceMapping.js (0 => 123768)


--- trunk/Source/WebCore/inspector/front-end/SASSSourceMapping.js	                        (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/SASSSourceMapping.js	2012-07-26 17:25:00 UTC (rev 123768)
@@ -0,0 +1,173 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @constructor
+ * @extends {WebInspector.Object}
+ * @implements {WebInspector.SourceMapping}
+ * @implements {WebInspector.UISourceCodeProvider}
+ */
+WebInspector.SASSSourceMapping = function()
+{
+    /**
+     * @type {Array.<WebInspector.UISourceCode>}
+     */
+    this._uiSourceCodes = [];
+    this._uiSourceCodeForURL = {};
+    this._uiLocations = {};
+    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this);
+}
+
+WebInspector.SASSSourceMapping.prototype = {
+    _populate: function()
+    {
+        function populateFrame(frame)
+        {
+            for (var i = 0; i < frame.childFrames.length; ++i)
+                populateFrame.call(this, frame.childFrames[i]);
+
+            var resources = frame.resources();
+            for (var i = 0; i < resources.length; ++i)
+                this._resourceAdded({data:resources[i]});
+        }
+
+        populateFrame.call(this, WebInspector.resourceTreeModel.mainFrame);
+    },
+
+    /**
+     * @param {WebInspector.Event} event
+     */
+    _resourceAdded: function(event)
+    {
+        var resource = /** @type {WebInspector.Resource} */ event.data;
+        if (resource.type !== WebInspector.resourceTypes.Stylesheet)
+            return;
+
+        /**
+         * @param {?string} content
+         * @param {boolean} contentEncoded
+         * @param {string} mimeType
+         */
+        function didRequestContent(content, contentEncoded, mimeType)
+        {
+            if (!content)
+                return;
+            var lines = content.split(/\r?\n/);
+            var regex = /@media\s\-sass\-debug\-info{filename{font-family:([^}]+)}line{font-family:\\[0]+([^}]*)}}/i;
+            for (var lineNumber = 0; lineNumber < lines.length; ++lineNumber) {
+                var match = regex.exec(lines[lineNumber]);
+                if (!match)
+                    continue;
+                var url = "" "$1");
+                var uiSourceCode = this._uiSourceCodeForURL[url];
+                if (!uiSourceCode) {
+                    uiSourceCode = new WebInspector.SASSSource(url);
+                    this._uiSourceCodeForURL[url] = uiSourceCode;
+                    this._uiSourceCodes.push(uiSourceCode);
+                    this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, uiSourceCode);
+                    WebInspector.cssModel.setSourceMapping(resource.url, this);
+                }
+                var line = parseInt(decodeURI(match[2].replace(/(..)/g, "%$1")), 10) - 1;
+                var rawLocationString = resource.url + ":" + (lineNumber + 1);
+                this._uiLocations[rawLocationString] = new WebInspector.UILocation(uiSourceCode, line, 0);
+            }
+        }
+        resource.requestContent(didRequestContent.bind(this));
+    },
+
+    /**
+     * @param {WebInspector.RawLocation} rawLocation
+     * @return {WebInspector.UILocation}
+     */
+    rawLocationToUILocation: function(rawLocation)
+    {
+        var location = /** @type WebInspector.CSSLocation */ rawLocation;
+        var uiLocation = this._uiLocations[location.url + ":" + location.lineNumber];
+        if (!uiLocation) {
+            var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(location.url);
+            uiLocation = new WebInspector.UILocation(uiSourceCode, location.lineNumber, 0);
+        }
+        return uiLocation;
+    },
+
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {number} lineNumber
+     * @param {number} columnNumber
+     * @return {WebInspector.RawLocation}
+     */
+    uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber)
+    {
+        // FIXME: Implement this when ui -> raw mapping has clients.
+        return new WebInspector.CSSLocation(uiSourceCode.contentURL() || "", lineNumber);
+    },
+
+    /**
+     * @return {Array.<WebInspector.UISourceCode>}
+     */
+    uiSourceCodes: function()
+    {
+        return this._uiSourceCodes;
+    },
+
+    reset: function()
+    {
+        this._uiSourceCodes = [];
+        this._uiSourceCodeForURL = {};
+        this._uiLocations = {};
+        this._populate();
+    }
+}
+
+WebInspector.SASSSourceMapping.prototype.__proto__ = WebInspector.Object.prototype;
+
+/**
+ * @constructor
+ * @extends {WebInspector.UISourceCode}
+ * @param {string} sassURL
+ */
+WebInspector.SASSSource = function(sassURL)
+{
+    var content = InspectorFrontendHost.loadResourceSynchronously(sassURL);
+    var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Stylesheet, content);
+    WebInspector.UISourceCode.call(this, sassURL, null, contentProvider);
+}
+
+WebInspector.SASSSource.prototype = {
+    /**
+     * @return {boolean}
+     */
+    isEditable: function()
+    {
+        return true;
+    }
+}
+
+WebInspector.SASSSource.prototype.__proto__ = WebInspector.UISourceCode.prototype;
Property changes on: trunk/Source/WebCore/inspector/front-end/SASSSourceMapping.js
___________________________________________________________________

Added: svn:eol-style

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


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2012-07-26 17:23:20 UTC (rev 123767)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2012-07-26 17:25:00 UTC (rev 123768)
@@ -469,7 +469,6 @@
                 sourceFrame = new WebInspector._javascript_SourceFrame(this, _javascript_Source);
         } else
             sourceFrame = new WebInspector.UISourceCodeFrame(uiSourceCode);
-
         this._sourceFramesByUISourceCode.put(uiSourceCode, sourceFrame);
         return sourceFrame;
     },

Modified: trunk/Source/WebCore/inspector/front-end/Settings.js (123767 => 123768)


--- trunk/Source/WebCore/inspector/front-end/Settings.js	2012-07-26 17:23:20 UTC (rev 123767)
+++ trunk/Source/WebCore/inspector/front-end/Settings.js	2012-07-26 17:25:00 UTC (rev 123768)
@@ -190,6 +190,7 @@
     this.fileSystemInspection = this._createExperiment("fileSystemInspection", "FileSystem inspection");
     this.mainThreadMonitoring = this._createExperiment("mainThreadMonitoring", "Show CPU activity in Timeline");
     this.geolocationOverride = this._createExperiment("geolocationOverride", "Override Device Geolocation");
+    this.sass = this._createExperiment("sass", "Support for SASS");
 
     this._cleanUpSetting();
 }

Modified: trunk/Source/WebCore/inspector/front-end/StylesPanel.js (123767 => 123768)


--- trunk/Source/WebCore/inspector/front-end/StylesPanel.js	2012-07-26 17:23:20 UTC (rev 123767)
+++ trunk/Source/WebCore/inspector/front-end/StylesPanel.js	2012-07-26 17:25:00 UTC (rev 123768)
@@ -30,6 +30,7 @@
  * @constructor
  * @extends {WebInspector.Object}
  * @implements {WebInspector.UISourceCodeProvider}
+ * @implements {WebInspector.SourceMapping}
  */
 WebInspector.StylesUISourceCodeProvider = function()
 {
@@ -37,6 +38,7 @@
      * @type {Array.<WebInspector.UISourceCode>}
      */
     this._uiSourceCodes = [];
+    this._uiSourceCodeForURL = {};
     WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this);
 }
 
@@ -49,6 +51,28 @@
         return this._uiSourceCodes;
     },
 
+    /**
+     * @param {WebInspector.RawLocation} rawLocation
+     * @return {WebInspector.UILocation}
+     */
+    rawLocationToUILocation: function(rawLocation)
+    {
+        var location = /** @type WebInspector.CSSLocation */ rawLocation;
+        var uiSourceCode = this._uiSourceCodeForURL[location.url];
+        return new WebInspector.UILocation(uiSourceCode, location.lineNumber, 0);
+    },
+
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {number} lineNumber
+     * @param {number} columnNumber
+     * @return {WebInspector.RawLocation}
+     */
+    uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber)
+    {
+        return new WebInspector.CSSLocation(uiSourceCode.contentURL() || "", lineNumber);
+    },
+
     _populate: function()
     {
         function populateFrame(frame)
@@ -64,19 +88,26 @@
         populateFrame.call(this, WebInspector.resourceTreeModel.mainFrame);
     },
 
+    /**
+     * @param {WebInspector.Event} event
+     */
     _resourceAdded: function(event)
     {
-        var resource = event.data;
+        var resource = /** @type {WebInspector.Resource} */ event.data;
         if (resource.type !== WebInspector.resourceTypes.Stylesheet)
             return;
         var uiSourceCode = new WebInspector.StyleSource(resource);
         this._uiSourceCodes.push(uiSourceCode);
+        this._uiSourceCodeForURL[resource.url] = uiSourceCode;
+        WebInspector.cssModel.setSourceMapping(resource.url, this);
         this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, uiSourceCode);
     },
 
     reset: function()
     {
         this._uiSourceCodes = [];
+        this._uiSourceCodeForURL = {};
+        WebInspector.cssModel.resetSourceMappings();
         this._populate();
     }
 }

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


--- trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2012-07-26 17:23:20 UTC (rev 123767)
+++ trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2012-07-26 17:25:00 UTC (rev 123768)
@@ -1180,6 +1180,10 @@
 
     _createRuleOriginNode: function()
     {
+        /**
+         * @param {string} url
+         * @param {number} line
+         */
         function linkifyUncopyable(url, line)
         {
             var link = WebInspector.linkifyResourceAsNode(url, line, "", url + ":" + (line + 1));
@@ -1190,8 +1194,13 @@
             return link;
         }
 
-        if (this.styleRule.sourceURL)
-            return linkifyUncopyable(this.styleRule.sourceURL, this.rule.sourceLine);
+        if (this.styleRule.sourceURL) {
+            var uiLocation = this.rule.uiLocation();
+            if (uiLocation)
+                return linkifyUncopyable(uiLocation.url(), uiLocation.lineNumber);
+            else
+                return linkifyUncopyable(this.styleRule.sourceURL, this.rule.sourceLine);
+        }
 
         if (!this.rule)
             return document.createTextNode("");

Modified: trunk/Source/WebCore/inspector/front-end/UISourceCode.js (123767 => 123768)


--- trunk/Source/WebCore/inspector/front-end/UISourceCode.js	2012-07-26 17:23:20 UTC (rev 123767)
+++ trunk/Source/WebCore/inspector/front-end/UISourceCode.js	2012-07-26 17:25:00 UTC (rev 123768)
@@ -511,6 +511,14 @@
     uiLocationToRawLocation: function()
     {
         return this.uiSourceCode.uiLocationToRawLocation(this.lineNumber, this.columnNumber);
+    },
+
+    /**
+     * @return {?string}
+     */
+    url: function()
+    {
+        return this.uiSourceCode.contentURL();
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/WebKit.qrc (123767 => 123768)


--- trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2012-07-26 17:23:20 UTC (rev 123767)
+++ trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2012-07-26 17:25:00 UTC (rev 123768)
@@ -133,6 +133,7 @@
     <file>ResourceWebSocketFrameView.js</file>
     <file>ResourcesPanel.js</file>
     <file>RevisionHistoryView.js</file>
+    <file>SASSSourceMapping.js</file>
     <file>ScopeChainSidebarPane.js</file>
     <file>Script.js</file>
     <file>ScriptFormatter.js</file>

Modified: trunk/Source/WebCore/inspector/front-end/Workspace.js (123767 => 123768)


--- trunk/Source/WebCore/inspector/front-end/Workspace.js	2012-07-26 17:23:20 UTC (rev 123767)
+++ trunk/Source/WebCore/inspector/front-end/Workspace.js	2012-07-26 17:25:00 UTC (rev 123768)
@@ -123,10 +123,12 @@
 WebInspector.Workspace = function()
 {
     var scriptMapping = new WebInspector.DebuggerScriptMapping();
-    var providers = scriptMapping.uiSourceCodeProviders();
-    providers = providers.concat(new WebInspector.StylesUISourceCodeProvider());
+    var styleProviders = [new WebInspector.StylesUISourceCodeProvider()];
+    if (WebInspector.experimentsSettings.sass.isEnabled())
+        styleProviders.push(new WebInspector.SASSSourceMapping());
+    var providers = scriptMapping.uiSourceCodeProviders().concat(styleProviders);
     WebInspector.CompositeUISourceCodeProvider.call(this, providers);
-    
+
     new WebInspector.PresentationConsoleMessageHelper(this);
     
     WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._reset, this);

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


--- trunk/Source/WebCore/inspector/front-end/inspector.html	2012-07-26 17:23:20 UTC (rev 123767)
+++ trunk/Source/WebCore/inspector/front-end/inspector.html	2012-07-26 17:25:00 UTC (rev 123768)
@@ -197,6 +197,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
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to