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 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1948 */ | 1948 */ |
1949 _processColor: function(text) | 1949 _processColor: function(text) |
1950 { | 1950 { |
1951 // We can be called with valid non-color values of |text| (like 'none' f
rom border style) | 1951 // We can be called with valid non-color values of |text| (like 'none' f
rom border style) |
1952 var color = WebInspector.Color.parse(text); | 1952 var color = WebInspector.Color.parse(text); |
1953 if (!color) | 1953 if (!color) |
1954 return createTextNode(text); | 1954 return createTextNode(text); |
1955 | 1955 |
1956 if (!this._editable()) { | 1956 if (!this._editable()) { |
1957 var swatch = WebInspector.ColorSwatch.create(); | 1957 var swatch = WebInspector.ColorSwatch.create(); |
1958 swatch.setColorText(text); | 1958 swatch.setColor(color); |
1959 return swatch; | 1959 return swatch; |
1960 } | 1960 } |
1961 | 1961 |
1962 var swatchPopoverHelper = this._parentPane._swatchPopoverHelper; | 1962 var swatchPopoverHelper = this._parentPane._swatchPopoverHelper; |
1963 var swatch = WebInspector.ColorSwatch.create(); | 1963 var swatch = WebInspector.ColorSwatch.create(); |
1964 swatch.setColorText(text); | 1964 swatch.setColor(color); |
1965 swatch.setFormat(WebInspector.Color.detectColorFormat(swatch.color())); | 1965 swatch.setFormat(WebInspector.Color.detectColorFormat(swatch.color())); |
1966 var swatchIcon = new WebInspector.ColorSwatchPopoverIcon(this, swatchPop
overHelper, swatch); | 1966 var swatchIcon = new WebInspector.ColorSwatchPopoverIcon(this, swatchPop
overHelper, swatch); |
1967 | 1967 |
1968 /** | 1968 /** |
1969 * @param {?Array<string>} backgroundColors | 1969 * @param {?Array<string>} backgroundColors |
1970 */ | 1970 */ |
1971 function computedCallback(backgroundColors) | 1971 function computedCallback(backgroundColors) |
1972 { | 1972 { |
1973 // TODO(aboxhall): distinguish between !backgroundColors (no text) a
nd | 1973 // TODO(aboxhall): distinguish between !backgroundColors (no text) a
nd |
1974 // !backgroundColors.length (no computed bg color) | 1974 // !backgroundColors.length (no computed bg color) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2041 return createTextNode(propertyValue); | 2041 return createTextNode(propertyValue); |
2042 var container = createDocumentFragment(); | 2042 var container = createDocumentFragment(); |
2043 var swatchPopoverHelper = this._parentPane._swatchPopoverHelper; | 2043 var swatchPopoverHelper = this._parentPane._swatchPopoverHelper; |
2044 for (var i = 0; i < shadows.length; i++) { | 2044 for (var i = 0; i < shadows.length; i++) { |
2045 if (i !== 0) | 2045 if (i !== 0) |
2046 container.appendChild(createTextNode(", ")); // Add back commas
and spaces between each shadow. | 2046 container.appendChild(createTextNode(", ")); // Add back commas
and spaces between each shadow. |
2047 // TODO(flandy): editing the property value should use the original
value with all spaces. | 2047 // TODO(flandy): editing the property value should use the original
value with all spaces. |
2048 var cssShadowSwatch = WebInspector.CSSShadowSwatch.create(); | 2048 var cssShadowSwatch = WebInspector.CSSShadowSwatch.create(); |
2049 cssShadowSwatch.setCSSShadow(shadows[i]); | 2049 cssShadowSwatch.setCSSShadow(shadows[i]); |
2050 new WebInspector.ShadowSwatchPopoverHelper(this, swatchPopoverHelper
, cssShadowSwatch); | 2050 new WebInspector.ShadowSwatchPopoverHelper(this, swatchPopoverHelper
, cssShadowSwatch); |
2051 if (cssShadowSwatch.colorSwatch()) | 2051 var colorSwatch = cssShadowSwatch.colorSwatch(); |
2052 var colorSwatchIcon = new WebInspector.ColorSwatchPopoverIcon(th
is, swatchPopoverHelper, cssShadowSwatch.colorSwatch()); | 2052 if (colorSwatch) |
| 2053 new WebInspector.ColorSwatchPopoverIcon(this, swatchPopoverHelpe
r, colorSwatch); |
2053 container.appendChild(cssShadowSwatch); | 2054 container.appendChild(cssShadowSwatch); |
2054 } | 2055 } |
2055 return container; | 2056 return container; |
2056 }, | 2057 }, |
2057 | 2058 |
2058 _updateState: function() | 2059 _updateState: function() |
2059 { | 2060 { |
2060 if (!this.listItemElement) | 2061 if (!this.listItemElement) |
2061 return; | 2062 return; |
2062 | 2063 |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3152 | 3153 |
3153 /** | 3154 /** |
3154 * @override | 3155 * @override |
3155 * @return {!WebInspector.ToolbarItem} | 3156 * @return {!WebInspector.ToolbarItem} |
3156 */ | 3157 */ |
3157 item: function() | 3158 item: function() |
3158 { | 3159 { |
3159 return this._button; | 3160 return this._button; |
3160 } | 3161 } |
3161 } | 3162 } |
OLD | NEW |