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 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2058 if (!this._styleRule.editable()) { | 2058 if (!this._styleRule.editable()) { |
2059 var swatch = WebInspector.ColorSwatch.create(); | 2059 var swatch = WebInspector.ColorSwatch.create(); |
2060 swatch.setColorText(text); | 2060 swatch.setColorText(text); |
2061 return swatch; | 2061 return swatch; |
2062 } | 2062 } |
2063 | 2063 |
2064 var stylesPopoverHelper = this._parentPane._stylesPopoverHelper; | 2064 var stylesPopoverHelper = this._parentPane._stylesPopoverHelper; |
2065 var swatchIcon = new WebInspector.ColorSwatchPopoverIcon(this, stylesPop
overHelper, text); | 2065 var swatchIcon = new WebInspector.ColorSwatchPopoverIcon(this, stylesPop
overHelper, text); |
2066 | 2066 |
2067 /** | 2067 /** |
2068 * @param {?WebInspector.CSSStyleDeclaration} styles | 2068 * @param {?Map.<string, string>} styles |
2069 */ | 2069 */ |
2070 function computedCallback(styles) | 2070 function computedCallback(styles) |
2071 { | 2071 { |
2072 if (!styles) | 2072 if (!styles) |
2073 return; | 2073 return; |
2074 var bgColorText = styles.getPropertyValue("background-color") || ""; | 2074 var bgColorText = styles.get("background-color") || ""; |
2075 var bgColor = WebInspector.Color.parse(bgColorText); | 2075 var bgColor = WebInspector.Color.parse(bgColorText); |
2076 // TODO(aboxhall): for background color with alpha, compute the actu
al | 2076 // TODO(aboxhall): for background color with alpha, compute the actu
al |
2077 // visible background color (blended with content underneath). | 2077 // visible background color (blended with content underneath). |
2078 if (bgColor && !bgColor.hasAlpha()) | 2078 if (bgColor && !bgColor.hasAlpha()) |
2079 swatchIcon.setContrastColor(bgColor); | 2079 swatchIcon.setContrastColor(bgColor); |
2080 } | 2080 } |
2081 | 2081 |
2082 if (this.property.name === "color" && this._parentPane.cssModel() && thi
s.node()) { | 2082 if (this.property.name === "color" && this._parentPane.cssModel() && thi
s.node()) { |
2083 var cssModel = this._parentPane.cssModel(); | 2083 var cssModel = this._parentPane.cssModel(); |
2084 cssModel.computedStylePromise(this.node().id).then(computedCallback)
; | 2084 cssModel.computedStylePromise(this.node().id).then(computedCallback)
; |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3250 | 3250 |
3251 /** | 3251 /** |
3252 * @override | 3252 * @override |
3253 * @return {?WebInspector.ToolbarItem} | 3253 * @return {?WebInspector.ToolbarItem} |
3254 */ | 3254 */ |
3255 item: function() | 3255 item: function() |
3256 { | 3256 { |
3257 return this._button; | 3257 return this._button; |
3258 } | 3258 } |
3259 } | 3259 } |
OLD | NEW |