Title: [255024] branches/safari-609-branch/Source/WebInspectorUI
Revision
255024
Author
[email protected]
Date
2020-01-23 13:44:21 -0800 (Thu, 23 Jan 2020)

Log Message

Cherry-pick r254726. rdar://problem/58816338

    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):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254726 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-609-branch/Source/WebInspectorUI/ChangeLog (255023 => 255024)


--- branches/safari-609-branch/Source/WebInspectorUI/ChangeLog	2020-01-23 21:44:18 UTC (rev 255023)
+++ branches/safari-609-branch/Source/WebInspectorUI/ChangeLog	2020-01-23 21:44:21 UTC (rev 255024)
@@ -1,5 +1,46 @@
 2020-01-23  Russell Epstein  <[email protected]>
 
+        Cherry-pick r254726. rdar://problem/58816338
+
+    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):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254726 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-23  Russell Epstein  <[email protected]>
+
         Cherry-pick r254633. rdar://problem/58816370
 
     Web Inspector: collapsing a virtualized folder in a `WI.TreeOutline` doesn't updated the DOM

Modified: branches/safari-609-branch/Source/WebInspectorUI/UserInterface/Views/ColorSquare.js (255023 => 255024)


--- branches/safari-609-branch/Source/WebInspectorUI/UserInterface/Views/ColorSquare.js	2020-01-23 21:44:18 UTC (rev 255023)
+++ branches/safari-609-branch/Source/WebInspectorUI/UserInterface/Views/ColorSquare.js	2020-01-23 21:44:21 UTC (rev 255024)
@@ -104,29 +104,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

Reply via email to