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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js

Issue 2827843002: [Devtools] Network waterfall and grid rows feed bg color from same place (Closed)
Patch Set: changes Created 3 years, 8 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
5 * Copyright (C) 2009 Joseph Pecoraro 5 * Copyright (C) 2009 Joseph Pecoraro
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
(...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 * @param {string} text 1862 * @param {string} text
1863 * @param {!UI.ThemeSupport.ColorUsage} colorUsage 1863 * @param {!UI.ThemeSupport.ColorUsage} colorUsage
1864 * @return {string} 1864 * @return {string}
1865 */ 1865 */
1866 patchColor(text, colorUsage) { 1866 patchColor(text, colorUsage) {
1867 var color = Common.Color.parse(text); 1867 var color = Common.Color.parse(text);
1868 if (!color) 1868 if (!color)
1869 return text; 1869 return text;
1870 1870
1871 var hsla = color.hsla(); 1871 var hsla = color.hsla();
1872 this._patchHSLA(hsla, colorUsage); 1872 this.patchHSLA(hsla, colorUsage);
1873 var rgba = []; 1873 var rgba = [];
1874 Common.Color.hsl2rgb(hsla, rgba); 1874 Common.Color.hsl2rgb(hsla, rgba);
1875 var outColor = new Common.Color(rgba, color.format()); 1875 var outColor = new Common.Color(rgba, color.format());
1876 var outText = outColor.asString(null); 1876 var outText = outColor.asString(null);
1877 if (!outText) 1877 if (!outText)
1878 outText = outColor.asString(outColor.hasAlpha() ? Common.Color.Format.RGBA : Common.Color.Format.RGB); 1878 outText = outColor.asString(outColor.hasAlpha() ? Common.Color.Format.RGBA : Common.Color.Format.RGB);
1879 return outText || text; 1879 return outText || text;
1880 } 1880 }
1881 1881
1882 /** 1882 /**
1883 * @param {!Array<number>} hsla 1883 * @param {!Array<number>} hsla
1884 * @param {!UI.ThemeSupport.ColorUsage} colorUsage 1884 * @param {!UI.ThemeSupport.ColorUsage} colorUsage
1885 */ 1885 */
1886 _patchHSLA(hsla, colorUsage) { 1886 patchHSLA(hsla, colorUsage) {
pfeldman 2017/04/19 19:52:03 I see what you did here. Don't!
allada 2017/04/19 23:38:46 Done.
1887 var hue = hsla[0]; 1887 var hue = hsla[0];
1888 var sat = hsla[1]; 1888 var sat = hsla[1];
1889 var lit = hsla[2]; 1889 var lit = hsla[2];
1890 var alpha = hsla[3]; 1890 var alpha = hsla[3];
1891 1891
1892 switch (this._themeName) { 1892 switch (this._themeName) {
1893 case 'dark': 1893 case 'dark':
1894 if (colorUsage & UI.ThemeSupport.ColorUsage.Selection) 1894 if (colorUsage & UI.ThemeSupport.ColorUsage.Selection)
1895 hue = (hue + 0.5) % 1; 1895 hue = (hue + 0.5) % 1;
1896 var minCap = colorUsage & UI.ThemeSupport.ColorUsage.Background ? 0.14 : 0; 1896 var minCap = colorUsage & UI.ThemeSupport.ColorUsage.Background ? 0.14 : 0;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
2063 */ 2063 */
2064 constructor(message, okCallback, cancelCallback) { 2064 constructor(message, okCallback, cancelCallback) {
2065 super(true); 2065 super(true);
2066 this.registerRequiredCSS('ui/confirmDialog.css'); 2066 this.registerRequiredCSS('ui/confirmDialog.css');
2067 this.contentElement.createChild('div', 'message').createChild('span').textCo ntent = message; 2067 this.contentElement.createChild('div', 'message').createChild('span').textCo ntent = message;
2068 var buttonsBar = this.contentElement.createChild('div', 'button'); 2068 var buttonsBar = this.contentElement.createChild('div', 'button');
2069 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Ok'), okCallback )); 2069 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Ok'), okCallback ));
2070 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Cancel'), cancel Callback)); 2070 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Cancel'), cancel Callback));
2071 } 2071 }
2072 }; 2072 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698