Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js |
| index da94dcc7ded3ed81af9008d31ac1751125d0717a..9219bd50e1cbd0104cb4cf0a455396545fff2292 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js |
| @@ -2018,6 +2018,32 @@ WebInspector.StylePropertyTreeElement.prototype = { |
| return new WebInspector.BezierPopoverIcon(this, swatchPopoverHelper, text).element(); |
| }, |
| + /** |
| + * @param {string} propertyValue |
| + * @param {string} propertyName |
| + * @return {!Node} |
| + */ |
| + _processShadow: function(propertyValue, propertyName) |
| + { |
| + var shadows; |
| + if (propertyName === "box-shadow") |
| + shadows = WebInspector.CSSShadowModel.parseBoxShadow(propertyValue); |
| + else |
| + shadows = WebInspector.CSSShadowModel.parseTextShadow(propertyValue); |
| + if (!shadows.length || !this._editable()) |
|
dgozman
2016/08/23 17:40:56
Let's not even parse if value is not editable.
flandy
2016/08/23 19:27:15
Done.
|
| + return createTextNode(propertyValue); |
| + var container = createDocumentFragment(); |
| + var swatchPopoverHelper = this._parentPane._swatchPopoverHelper; |
| + for (var i = 0; i < shadows.length; i++) { |
| + if (i !== 0) |
| + container.appendChild(createTextNode(", ")); // Add back commas and spaces between each shadow. |
|
dgozman
2016/08/23 17:40:57
This removes original formatting. Do we do this ev
flandy
2016/08/23 19:27:15
Andrey says it is okay right now.
dgozman
2016/08/23 19:29:47
Let's have a TODO then.
|
| + var cssShadowSwatch = WebInspector.CSSShadowSwatch.create(); |
| + cssShadowSwatch.setCSSShadow(shadows[i]); |
| + container.appendChild(cssShadowSwatch); |
| + } |
| + return container; |
| + }, |
| + |
| _updateState: function() |
| { |
| if (!this.listItemElement) |
| @@ -2181,6 +2207,7 @@ WebInspector.StylePropertyTreeElement.prototype = { |
| if (this.property.parsedOk) { |
| propertyRenderer.setColorHandler(this._processColor.bind(this)); |
| propertyRenderer.setBezierHandler(this._processBezier.bind(this)); |
| + propertyRenderer.setShadowHandler(this._processShadow.bind(this)); |
| } |
| this.listItemElement.removeChildren(); |
| @@ -2992,6 +3019,14 @@ WebInspector.StylesSidebarPropertyRenderer.prototype = { |
| }, |
| /** |
| + * @param {function(string, string):!Node} handler |
| + */ |
| + setShadowHandler: function(handler) |
| + { |
| + this._shadowHandler = handler; |
| + }, |
| + |
| + /** |
| * @return {!Element} |
| */ |
| renderName: function() |
| @@ -3013,6 +3048,13 @@ WebInspector.StylesSidebarPropertyRenderer.prototype = { |
| if (!this._propertyValue) |
| return valueElement; |
| + if (this._shadowHandler && (this._propertyName === "box-shadow" || this._propertyName === "text-shadow") |
|
dgozman
2016/08/23 17:40:57
Are there any -webkit aliases we should support as
flandy
2016/08/23 19:27:14
Yes, thanks. There is -webkit-box-shadow but not -
|
| + && !WebInspector.CSSMetadata.VariableRegex.test(this._propertyValue) && Runtime.experiments.isEnabled("shadowEditor")) { |
| + valueElement.appendChild(this._shadowHandler(this._propertyValue, this._propertyName)); |
| + valueElement.normalize(); |
| + return valueElement; |
| + } |
| + |
| var regexes = [WebInspector.CSSMetadata.VariableRegex, WebInspector.CSSMetadata.URLRegex]; |
| var processors = [createTextNode, this._processURL.bind(this)]; |
| if (this._bezierHandler && WebInspector.cssMetadata().isBezierAwareProperty(this._propertyName)) { |