| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {HTMLSpanElement} | 7 * @extends {HTMLSpanElement} |
| 8 */ | 8 */ |
| 9 WebInspector.ColorSwatch = function() | 9 WebInspector.ColorSwatch = function() |
| 10 { | 10 { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 * @return {!Element} | 72 * @return {!Element} |
| 73 */ | 73 */ |
| 74 iconElement: function() | 74 iconElement: function() |
| 75 { | 75 { |
| 76 return this._iconElement; | 76 return this._iconElement; |
| 77 }, | 77 }, |
| 78 | 78 |
| 79 createdCallback: function() | 79 createdCallback: function() |
| 80 { | 80 { |
| 81 var root = this.createShadowRoot(); | 81 var root = this.createShadowRoot(); |
| 82 root.appendChild(WebInspector.View.createStyleElement("ui/colorSwatch.cs
s")); | 82 root.appendChild(WebInspector.Widget.createStyleElement("ui/colorSwatch.
css")); |
| 83 | 83 |
| 84 this._iconElement = root.createChild("span", "color-swatch"); | 84 this._iconElement = root.createChild("span", "color-swatch"); |
| 85 this._iconElement.title = WebInspector.UIString("Shift-click to change c
olor format."); | 85 this._iconElement.title = WebInspector.UIString("Shift-click to change c
olor format."); |
| 86 this._swatchInner = this._iconElement.createChild("span", "color-swatch-
inner"); | 86 this._swatchInner = this._iconElement.createChild("span", "color-swatch-
inner"); |
| 87 this._swatchInner.addEventListener("dblclick", consumeEvent, false); | 87 this._swatchInner.addEventListener("dblclick", consumeEvent, false); |
| 88 this._swatchInner.addEventListener("mousedown", consumeEvent, false); | 88 this._swatchInner.addEventListener("mousedown", consumeEvent, false); |
| 89 this._swatchInner.addEventListener("click", this._handleClick.bind(this)
, true); | 89 this._swatchInner.addEventListener("click", this._handleClick.bind(this)
, true); |
| 90 | 90 |
| 91 root.createChild("content"); | 91 root.createChild("content"); |
| 92 this._colorValueElement = this.createChild("span"); | 92 this._colorValueElement = this.createChild("span"); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 case cf.Nickname: | 150 case cf.Nickname: |
| 151 if (!color.hasAlpha()) | 151 if (!color.hasAlpha()) |
| 152 return color.canBeShortHex() ? cf.ShortHEX : cf.HEX; | 152 return color.canBeShortHex() ? cf.ShortHEX : cf.HEX; |
| 153 else | 153 else |
| 154 return cf.Original; | 154 return cf.Original; |
| 155 | 155 |
| 156 default: | 156 default: |
| 157 return cf.RGBA; | 157 return cf.RGBA; |
| 158 } | 158 } |
| 159 } | 159 } |
| OLD | NEW |