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

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

Issue 1986053004: Devtools Color: Basic support for #RRGGBBAA and #RGBA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 {HTMLSpanElement} 7 * @extends {HTMLSpanElement}
8 */ 8 */
9 WebInspector.ColorSwatch = function() 9 WebInspector.ColorSwatch = function()
10 { 10 {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return !color.hasAlpha() ? cf.RGB : cf.RGBA; 128 return !color.hasAlpha() ? cf.RGB : cf.RGBA;
129 129
130 case cf.RGB: 130 case cf.RGB:
131 case cf.RGBA: 131 case cf.RGBA:
132 return !color.hasAlpha() ? cf.HSL : cf.HSLA; 132 return !color.hasAlpha() ? cf.HSL : cf.HSLA;
133 133
134 case cf.HSL: 134 case cf.HSL:
135 case cf.HSLA: 135 case cf.HSLA:
136 if (color.nickname()) 136 if (color.nickname())
137 return cf.Nickname; 137 return cf.Nickname;
138 if (!color.hasAlpha()) 138 if (!color.hasAlpha())
dgozman 2016/05/20 00:55:15 I think this whole if should be just detectHEXForm
samli 2016/05/20 01:58:02 Done.
139 return color.canBeShortHex() ? cf.ShortHEX : cf.HEX; 139 return color.detectHEXFormat() ? cf.ShortHEX : cf.HEX;
140 else 140 else
141 return cf.Original; 141 return cf.Original;
142 142
143 case cf.ShortHEX: 143 case cf.ShortHEX:
144 return cf.HEX; 144 return cf.HEX;
145 145
146 case cf.HEX: 146 case cf.HEX:
147 return cf.Original; 147 return cf.Original;
148 148
149 case cf.Nickname: 149 case cf.Nickname:
150 if (!color.hasAlpha()) 150 if (!color.hasAlpha())
dgozman 2016/05/20 00:55:15 Ditto.
samli 2016/05/20 01:58:02 Done.
151 return color.canBeShortHex() ? cf.ShortHEX : cf.HEX; 151 return color.detectHEXFormat() ? cf.ShortHEX : cf.HEX;
152 else 152 else
153 return cf.Original; 153 return cf.Original;
154 154
155 default: 155 default:
156 return cf.RGBA; 156 return cf.RGBA;
157 } 157 }
158 } 158 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698