diff options
Diffstat (limited to 'WebCore/inspector/front-end/StylesSidebarPane.js')
-rw-r--r-- | WebCore/inspector/front-end/StylesSidebarPane.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/WebCore/inspector/front-end/StylesSidebarPane.js b/WebCore/inspector/front-end/StylesSidebarPane.js index db72486..5399953 100644 --- a/WebCore/inspector/front-end/StylesSidebarPane.js +++ b/WebCore/inspector/front-end/StylesSidebarPane.js @@ -1202,6 +1202,8 @@ WebInspector.StylePropertyTreeElement.prototype = { this.valueElement = valueElement; if (value) { + var self = this; + function processValue(regex, processor, nextProcessor, valueText) { var container = document.createDocumentFragment(); @@ -1225,10 +1227,19 @@ WebInspector.StylePropertyTreeElement.prototype = { function linkifyURL(url) { + var hrefUrl = url; + var match = hrefUrl.match(/['"]?([^'"]+)/); + if (match) + hrefUrl = match[1]; var container = document.createDocumentFragment(); container.appendChild(document.createTextNode("url(")); - var hasResource = !!WebInspector.resourceForURL(url); - container.appendChild(WebInspector.linkifyURLAsNode(url, url, null, hasResource)); + if (self._styleRule.sourceURL) + hrefUrl = WebInspector.completeURL(self._styleRule.sourceURL, hrefUrl); + else if (WebInspector.panels.elements.focusedDOMNode) + hrefUrl = WebInspector.resourceURLForRelatedNode(WebInspector.panels.elements.focusedDOMNode, hrefUrl); + var hasResource = !!WebInspector.resourceForURL(hrefUrl); + // FIXME: WebInspector.linkifyURLAsNode() should really use baseURI. + container.appendChild(WebInspector.linkifyURLAsNode(hrefUrl, url, null, hasResource)); container.appendChild(document.createTextNode(")")); return container; } @@ -1330,7 +1341,7 @@ WebInspector.StylePropertyTreeElement.prototype = { var colorRegex = /((?:rgb|hsl)a?\([^)]+\)|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3}|\b\w+\b(?!-))/g; var colorProcessor = processValue.bind(window, colorRegex, processColor, null); - valueElement.appendChild(processValue(/url\(([^)]+)\)/g, linkifyURL, colorProcessor, value)); + valueElement.appendChild(processValue(/url\(\s*([^)\s]+)\s*\)/g, linkifyURL, colorProcessor, value)); } this.listItemElement.removeChildren(); |