| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 3089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3100 valueElement.normalize(); | 3100 valueElement.normalize(); |
| 3101 return valueElement; | 3101 return valueElement; |
| 3102 }, | 3102 }, |
| 3103 | 3103 |
| 3104 /** | 3104 /** |
| 3105 * @param {string} url | 3105 * @param {string} url |
| 3106 * @return {!Node} | 3106 * @return {!Node} |
| 3107 */ | 3107 */ |
| 3108 _processURL: function(url) | 3108 _processURL: function(url) |
| 3109 { | 3109 { |
| 3110 var hrefUrl = url; | 3110 var isQuoted = /^'.*'$/.test(url) || /^".*"$/.test(url); |
| 3111 var match = hrefUrl.match(/['"]?([^'"]+)/); | 3111 if (isQuoted) |
| 3112 if (match) | 3112 url = url.substring(1, url.length - 1); |
| 3113 hrefUrl = match[1]; | |
| 3114 var container = createDocumentFragment(); | 3113 var container = createDocumentFragment(); |
| 3115 container.createTextChild("url("); | 3114 container.createTextChild("url("); |
| 3115 var hrefUrl = null; |
| 3116 if (this._rule && this._rule.resourceURL()) | 3116 if (this._rule && this._rule.resourceURL()) |
| 3117 hrefUrl = WebInspector.ParsedURL.completeURL(this._rule.resourceURL(
), hrefUrl); | 3117 hrefUrl = WebInspector.ParsedURL.completeURL(this._rule.resourceURL(
), url); |
| 3118 else if (this._node) | 3118 else if (this._node) |
| 3119 hrefUrl = this._node.resolveURL(hrefUrl); | 3119 hrefUrl = this._node.resolveURL(url); |
| 3120 var hasResource = hrefUrl && !!WebInspector.resourceForURL(hrefUrl); | 3120 var hasResource = hrefUrl && !!WebInspector.resourceForURL(hrefUrl); |
| 3121 // FIXME: WebInspector.linkifyURLAsNode() should really use baseURI. | 3121 // FIXME: WebInspector.linkifyURLAsNode() should really use baseURI. |
| 3122 container.appendChild(WebInspector.linkifyURLAsNode(hrefUrl || url, url,
undefined, !hasResource)); | 3122 container.appendChild(WebInspector.linkifyURLAsNode(hrefUrl || url, url,
undefined, !hasResource)); |
| 3123 container.createTextChild(")"); | 3123 container.createTextChild(")"); |
| 3124 return container; | 3124 return container; |
| 3125 } | 3125 } |
| 3126 } | 3126 } |
| 3127 | 3127 |
| 3128 | 3128 |
| 3129 /** | 3129 /** |
| 3130 * @return {!WebInspector.ToolbarItem} | 3130 * @return {!WebInspector.ToolbarItem} |
| 3131 */ | 3131 */ |
| 3132 WebInspector.StylesSidebarPane.createAddNewRuleButton = function(stylesSidebarPa
ne) | 3132 WebInspector.StylesSidebarPane.createAddNewRuleButton = function(stylesSidebarPa
ne) |
| 3133 { | 3133 { |
| 3134 var button = new WebInspector.ToolbarButton(WebInspector.UIString("New Style
Rule"), "add-toolbar-item"); | 3134 var button = new WebInspector.ToolbarButton(WebInspector.UIString("New Style
Rule"), "add-toolbar-item"); |
| 3135 button.addEventListener("click", stylesSidebarPane._createNewRuleInViaInspec
torStyleSheet, stylesSidebarPane); | 3135 button.addEventListener("click", stylesSidebarPane._createNewRuleInViaInspec
torStyleSheet, stylesSidebarPane); |
| 3136 button.element.createChild("div", "long-click-glyph toolbar-button-theme"); | 3136 button.element.createChild("div", "long-click-glyph toolbar-button-theme"); |
| 3137 new WebInspector.LongClickController(button.element, stylesSidebarPane._onAd
dButtonLongClick.bind(stylesSidebarPane)); | 3137 new WebInspector.LongClickController(button.element, stylesSidebarPane._onAd
dButtonLongClick.bind(stylesSidebarPane)); |
| 3138 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, onNodeCha
nged); | 3138 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, onNodeCha
nged); |
| 3139 onNodeChanged(); | 3139 onNodeChanged(); |
| 3140 return button; | 3140 return button; |
| 3141 | 3141 |
| 3142 function onNodeChanged() | 3142 function onNodeChanged() |
| 3143 { | 3143 { |
| 3144 var node = WebInspector.context.flavor(WebInspector.DOMNode); | 3144 var node = WebInspector.context.flavor(WebInspector.DOMNode); |
| 3145 button.setEnabled(!!node); | 3145 button.setEnabled(!!node); |
| 3146 } | 3146 } |
| 3147 } | 3147 } |
| OLD | NEW |