Title: [254726] trunk/Source/WebInspectorUI
- Revision
- 254726
- Author
- [email protected]
- Date
- 2020-01-16 17:08:21 -0800 (Thu, 16 Jan 2020)
Log Message
REGRESSION(r251487): Web Inspector: selected color in color picker has wrong lightness
https://bugs.webkit.org/show_bug.cgi?id=206202
Reviewed by Devin Rousso.
Currently, tintedColor setter has two code paths:
- rgb2hsv convertion if the color is defined using color(...) syntax.
- HSL to HSV convertion for any other color.
The latter was defined in the view, was untested, and incorrect.
This patch uses WI.Color.rgb2hsv convertion for all colors. This method is
already covered by tests.
* UserInterface/Views/ColorSquare.js:
(WI.ColorSquare.prototype.set tintedColor):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (254725 => 254726)
--- trunk/Source/WebInspectorUI/ChangeLog 2020-01-17 00:55:15 UTC (rev 254725)
+++ trunk/Source/WebInspectorUI/ChangeLog 2020-01-17 01:08:21 UTC (rev 254726)
@@ -1,3 +1,21 @@
+2020-01-16 Nikita Vasilyev <[email protected]>
+
+ REGRESSION(r251487): Web Inspector: selected color in color picker has wrong lightness
+ https://bugs.webkit.org/show_bug.cgi?id=206202
+
+ Reviewed by Devin Rousso.
+
+ Currently, tintedColor setter has two code paths:
+ - rgb2hsv convertion if the color is defined using color(...) syntax.
+ - HSL to HSV convertion for any other color.
+
+ The latter was defined in the view, was untested, and incorrect.
+ This patch uses WI.Color.rgb2hsv convertion for all colors. This method is
+ already covered by tests.
+
+ * UserInterface/Views/ColorSquare.js:
+ (WI.ColorSquare.prototype.set tintedColor):
+
2020-01-16 David Kilzer <[email protected]>
Enable -Wconditional-uninitialized in WebInspectorUI, WebKitLegacy, WebKit projects
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ColorSquare.js (254725 => 254726)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ColorSquare.js 2020-01-17 00:55:15 UTC (rev 254725)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ColorSquare.js 2020-01-17 01:08:21 UTC (rev 254726)
@@ -106,29 +106,14 @@
this._gamut = tintedColor.gamut;
- if (tintedColor.format === WI.Color.Format.ColorFunction) {
- // CSS color function only supports RGB. It doesn't support HSL.
- let hsv = WI.Color.rgb2hsv(...tintedColor.normalizedRGB);
- let x = hsv[1] / 100 * this._dimension;
- let y = (1 - (hsv[2] / 100)) * this._dimension;
- this._setCrosshairPosition(new WI.Point(x, y));
- if (this._gamut === WI.Color.Gamut.DisplayP3)
- this._drawSRGBOutline();
- } else {
- let hsl = tintedColor.hsl;
- let saturation = Number.constrain(hsl[1], 0, 100);
- let x = saturation / 100 * this._dimension;
+ let [hue, saturation, value] = WI.Color.rgb2hsv(...tintedColor.normalizedRGB);
+ let x = saturation / 100 * this._dimension;
+ let y = (1 - (value / 100)) * this._dimension;
- let lightness = hsl[2];
+ if (this._gamut === WI.Color.Gamut.DisplayP3)
+ this._drawSRGBOutline();
- // The color picker is HSV-based. (HSV is also known as HSB.)
- // Derive lightness by using HSV to HSL equation.
- let y = 2 * lightness / (200 - saturation);
- y = -1 * (y - 1) * this._dimension;
-
- this._setCrosshairPosition(new WI.Point(x, y));
- }
-
+ this._setCrosshairPosition(new WI.Point(x, y));
this._updateBaseColor();
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes