Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: Source/devtools/front_end/elements/StylesPopoverHelper.js

Issue 1181773007: Devtools: Add tooltip title for bezier icon (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 */ 162 */
163 _createDOM: function(text) 163 _createDOM: function(text)
164 { 164 {
165 this._element = createElement("nobr"); 165 this._element = createElement("nobr");
166 166
167 this._iconElement = this._element.createSVGChild("svg", "popover-icon be zier-icon"); 167 this._iconElement = this._element.createSVGChild("svg", "popover-icon be zier-icon");
168 this._iconElement.setAttribute("height", 10); 168 this._iconElement.setAttribute("height", 10);
169 this._iconElement.setAttribute("width", 10); 169 this._iconElement.setAttribute("width", 10);
170 this._iconElement.addEventListener("click", this._iconClick.bind(this), false); 170 this._iconElement.addEventListener("click", this._iconClick.bind(this), false);
171 var g = this._iconElement.createSVGChild("g"); 171 var g = this._iconElement.createSVGChild("g");
172 var title = g.createSVGChild("title");
173 title.textContent = WebInspector.UIString("Click to open a cubic bezier editor.");
172 var path = g.createSVGChild("path"); 174 var path = g.createSVGChild("path");
173 path.setAttribute("d", "M2,8 C2,3 8,7 8,2"); 175 path.setAttribute("d", "M2,8 C2,3 8,7 8,2");
174 176
175 this._bezierValueElement = this._element.createChild("span"); 177 this._bezierValueElement = this._element.createChild("span");
176 this._bezierValueElement.textContent = text; 178 this._bezierValueElement.textContent = text;
177 }, 179 },
178 180
179 /** 181 /**
180 * @param {!Event} event 182 * @param {!Event} event
181 */ 183 */
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 delete this._originalPropertyText; 222 delete this._originalPropertyText;
221 } 223 }
222 } 224 }
223 225
224 /** 226 /**
225 * @constructor 227 * @constructor
226 * @param {!WebInspector.StylePropertyTreeElement} treeElement 228 * @param {!WebInspector.StylePropertyTreeElement} treeElement
227 * @param {!WebInspector.StylesPopoverHelper} stylesPopoverHelper 229 * @param {!WebInspector.StylesPopoverHelper} stylesPopoverHelper
228 * @param {string} colorText 230 * @param {string} colorText
229 */ 231 */
230 WebInspector.ColowSwatchPopoverIcon = function(treeElement, stylesPopoverHelper, colorText) 232 WebInspector.ColorSwatchPopoverIcon = function(treeElement, stylesPopoverHelper, colorText)
231 { 233 {
232 this._treeElement = treeElement; 234 this._treeElement = treeElement;
233 this._stylesPopoverHelper = stylesPopoverHelper; 235 this._stylesPopoverHelper = stylesPopoverHelper;
234 236
235 this._swatch = WebInspector.ColorSwatch.create(); 237 this._swatch = WebInspector.ColorSwatch.create();
236 this._swatch.setColorText(colorText); 238 this._swatch.setColorText(colorText);
237 this._swatch.setFormat(WebInspector.ColowSwatchPopoverIcon._colorFormat(this ._swatch.color())); 239 this._swatch.setFormat(WebInspector.ColorSwatchPopoverIcon._colorFormat(this ._swatch.color()));
238 var shiftClickMessage = WebInspector.UIString("Shift-click to change color f ormat."); 240 var shiftClickMessage = WebInspector.UIString("Shift-click to change color f ormat.");
239 this._swatch.iconElement().title = String.sprintf("%s\n%s", WebInspector.UIS tring("Click to open a colorpicker."), shiftClickMessage); 241 this._swatch.iconElement().title = String.sprintf("%s\n%s", WebInspector.UIS tring("Click to open a colorpicker."), shiftClickMessage);
240 this._swatch.iconElement().addEventListener("click", this._iconClick.bind(th is)); 242 this._swatch.iconElement().addEventListener("click", this._iconClick.bind(th is));
241 243
242 this._boundSpectrumChanged = this._spectrumChanged.bind(this); 244 this._boundSpectrumChanged = this._spectrumChanged.bind(this);
243 } 245 }
244 246
245 /** 247 /**
246 * @param {!WebInspector.Color} color 248 * @param {!WebInspector.Color} color
247 * @return {!WebInspector.Color.Format} 249 * @return {!WebInspector.Color.Format}
248 */ 250 */
249 WebInspector.ColowSwatchPopoverIcon._colorFormat = function(color) 251 WebInspector.ColorSwatchPopoverIcon._colorFormat = function(color)
250 { 252 {
251 const cf = WebInspector.Color.Format; 253 const cf = WebInspector.Color.Format;
252 var format; 254 var format;
253 var formatSetting = WebInspector.moduleSetting("colorFormat").get(); 255 var formatSetting = WebInspector.moduleSetting("colorFormat").get();
254 if (formatSetting === cf.Original) 256 if (formatSetting === cf.Original)
255 format = cf.Original; 257 format = cf.Original;
256 else if (formatSetting === cf.RGB) 258 else if (formatSetting === cf.RGB)
257 format = (color.hasAlpha() ? cf.RGBA : cf.RGB); 259 format = (color.hasAlpha() ? cf.RGBA : cf.RGB);
258 else if (formatSetting === cf.HSL) 260 else if (formatSetting === cf.HSL)
259 format = (color.hasAlpha() ? cf.HSLA : cf.HSL); 261 format = (color.hasAlpha() ? cf.HSLA : cf.HSL);
260 else if (!color.hasAlpha()) 262 else if (!color.hasAlpha())
261 format = (color.canBeShortHex() ? cf.ShortHEX : cf.HEX); 263 format = (color.canBeShortHex() ? cf.ShortHEX : cf.HEX);
262 else 264 else
263 format = cf.RGBA; 265 format = cf.RGBA;
264 266
265 return format; 267 return format;
266 } 268 }
267 269
268 WebInspector.ColowSwatchPopoverIcon.prototype = { 270 WebInspector.ColorSwatchPopoverIcon.prototype = {
269 /** 271 /**
270 * @return {!Element} 272 * @return {!Element}
271 */ 273 */
272 element: function() 274 element: function()
273 { 275 {
274 return this._swatch; 276 return this._swatch;
275 }, 277 },
276 278
277 /** 279 /**
278 * @param {!Event} event 280 * @param {!Event} event
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 { 318 {
317 this._spectrum.removeEventListener(WebInspector.Spectrum.Events.ColorCha nged, this._boundSpectrumChanged); 319 this._spectrum.removeEventListener(WebInspector.Spectrum.Events.ColorCha nged, this._boundSpectrumChanged);
318 delete this._spectrum; 320 delete this._spectrum;
319 321
320 var propertyText = commitEdit ? this._treeElement.renderedPropertyText() : this._originalPropertyText; 322 var propertyText = commitEdit ? this._treeElement.renderedPropertyText() : this._originalPropertyText;
321 this._treeElement.applyStyleText(propertyText, true); 323 this._treeElement.applyStyleText(propertyText, true);
322 this._treeElement.parentPane().setEditingStyle(false); 324 this._treeElement.parentPane().setEditingStyle(false);
323 delete this._originalPropertyText; 325 delete this._originalPropertyText;
324 } 326 }
325 } 327 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698