Title: [255286] branches/safari-610.1.1-branch/Source/WebInspectorUI
Revision
255286
Author
[email protected]
Date
2020-01-28 13:49:11 -0800 (Tue, 28 Jan 2020)

Log Message

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

    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-610.1.1-branch/Source/WebInspectorUI/ChangeLog (255285 => 255286)


--- branches/safari-610.1.1-branch/Source/WebInspectorUI/ChangeLog	2020-01-28 21:49:09 UTC (rev 255285)
+++ branches/safari-610.1.1-branch/Source/WebInspectorUI/ChangeLog	2020-01-28 21:49:11 UTC (rev 255286)
@@ -1,5 +1,46 @@
 2020-01-28  Russell Epstein  <[email protected]>
 
+        Cherry-pick r254726. rdar://problem/58548071
+
+    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-28  Russell Epstein  <[email protected]>
+
         Cherry-pick r254485. rdar://problem/58409880
 
     Web Inspector: "Enable Local Override" and "Delete Local Override" are displayed twice in the contextual menu

Modified: branches/safari-610.1.1-branch/Source/WebInspectorUI/UserInterface/Views/ColorSquare.js (255285 => 255286)


--- branches/safari-610.1.1-branch/Source/WebInspectorUI/UserInterface/Views/ColorSquare.js	2020-01-28 21:49:09 UTC (rev 255285)
+++ branches/safari-610.1.1-branch/Source/WebInspectorUI/UserInterface/Views/ColorSquare.js	2020-01-28 21:49:11 UTC (rev 255286)
@@ -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

Reply via email to