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 {WebInspector.Object} | 7 * @extends {WebInspector.Object} |
8 */ | 8 */ |
9 WebInspector.StylesPopoverHelper = function() | 9 WebInspector.StylesPopoverHelper = function() |
10 { | 10 { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 { | 156 { |
157 return this._element; | 157 return this._element; |
158 }, | 158 }, |
159 | 159 |
160 /** | 160 /** |
161 * @param {string} text | 161 * @param {string} text |
162 */ | 162 */ |
163 _createDOM: function(text) | 163 _createDOM: function(text) |
164 { | 164 { |
165 this._element = createElement("nobr"); | 165 this._element = createElement("nobr"); |
166 WebInspector.Tooltip.install(this._element, WebInspector.UIString("Open
cubic bezier editor")); | 166 this._element.title = WebInspector.UIString("Open cubic bezier editor"); |
167 | 167 |
168 this._iconElement = this._element.createSVGChild("svg", "popover-icon be
zier-icon"); | 168 this._iconElement = this._element.createSVGChild("svg", "popover-icon be
zier-icon"); |
169 this._iconElement.setAttribute("height", 10); | 169 this._iconElement.setAttribute("height", 10); |
170 this._iconElement.setAttribute("width", 10); | 170 this._iconElement.setAttribute("width", 10); |
171 this._iconElement.addEventListener("click", this._iconClick.bind(this),
false); | 171 this._iconElement.addEventListener("click", this._iconClick.bind(this),
false); |
172 var g = this._iconElement.createSVGChild("g"); | 172 var g = this._iconElement.createSVGChild("g"); |
173 var path = g.createSVGChild("path"); | 173 var path = g.createSVGChild("path"); |
174 path.setAttribute("d", "M2,8 C2,3 8,7 8,2"); | 174 path.setAttribute("d", "M2,8 C2,3 8,7 8,2"); |
175 | 175 |
176 this._bezierValueElement = this._element.createChild("span"); | 176 this._bezierValueElement = this._element.createChild("span"); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 */ | 230 */ |
231 WebInspector.ColorSwatchPopoverIcon = function(treeElement, stylesPopoverHelper,
colorText) | 231 WebInspector.ColorSwatchPopoverIcon = function(treeElement, stylesPopoverHelper,
colorText) |
232 { | 232 { |
233 this._treeElement = treeElement; | 233 this._treeElement = treeElement; |
234 this._stylesPopoverHelper = stylesPopoverHelper; | 234 this._stylesPopoverHelper = stylesPopoverHelper; |
235 | 235 |
236 this._swatch = WebInspector.ColorSwatch.create(); | 236 this._swatch = WebInspector.ColorSwatch.create(); |
237 this._swatch.setColorText(colorText); | 237 this._swatch.setColorText(colorText); |
238 this._swatch.setFormat(WebInspector.ColorSwatchPopoverIcon._colorFormat(this
._swatch.color())); | 238 this._swatch.setFormat(WebInspector.ColorSwatchPopoverIcon._colorFormat(this
._swatch.color())); |
239 var shiftClickMessage = WebInspector.UIString("Shift + Click to change color
format."); | 239 var shiftClickMessage = WebInspector.UIString("Shift + Click to change color
format."); |
240 WebInspector.Tooltip.install(this._swatch.iconElement(), WebInspector.UIStri
ng("Open color picker. %s", shiftClickMessage)); | 240 this._swatch.iconElement().title = WebInspector.UIString("Open color picker.
%s", shiftClickMessage); |
241 this._swatch.iconElement().addEventListener("click", this._iconClick.bind(th
is)); | 241 this._swatch.iconElement().addEventListener("click", this._iconClick.bind(th
is)); |
242 this._contrastColor = null; | 242 this._contrastColor = null; |
243 | 243 |
244 this._boundSpectrumChanged = this._spectrumChanged.bind(this); | 244 this._boundSpectrumChanged = this._spectrumChanged.bind(this); |
245 } | 245 } |
246 | 246 |
247 /** | 247 /** |
248 * @param {!WebInspector.Color} color | 248 * @param {!WebInspector.Color} color |
249 * @return {!WebInspector.Color.Format} | 249 * @return {!WebInspector.Color.Format} |
250 */ | 250 */ |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 { | 339 { |
340 this._spectrum.removeEventListener(WebInspector.Spectrum.Events.ColorCha
nged, this._boundSpectrumChanged); | 340 this._spectrum.removeEventListener(WebInspector.Spectrum.Events.ColorCha
nged, this._boundSpectrumChanged); |
341 delete this._spectrum; | 341 delete this._spectrum; |
342 | 342 |
343 var propertyText = commitEdit ? this._treeElement.renderedPropertyText()
: this._originalPropertyText; | 343 var propertyText = commitEdit ? this._treeElement.renderedPropertyText()
: this._originalPropertyText; |
344 this._treeElement.applyStyleText(propertyText, true); | 344 this._treeElement.applyStyleText(propertyText, true); |
345 this._treeElement.parentPane().setEditingStyle(false); | 345 this._treeElement.parentPane().setEditingStyle(false); |
346 delete this._originalPropertyText; | 346 delete this._originalPropertyText; |
347 } | 347 } |
348 } | 348 } |
OLD | NEW |