Bug 206202

Summary: REGRESSION(r251487): Web Inspector: selected color in color picker has wrong lightness
Product: WebKit Reporter: Nikita Vasilyev <nvasilyev>
Component: Web InspectorAssignee: Nikita Vasilyev <nvasilyev>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, hi, inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
[Image] Bug
none
Patch
none
Patch
hi: review+
Patch none

Description Nikita Vasilyev 2020-01-13 15:47:19 PST
Created attachment 387581 [details]
[Image] Bug

ColorSquare shows the wrong color selected.
Comment 1 Nikita Vasilyev 2020-01-13 15:57:53 PST
Created attachment 387582 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2020-01-13 15:58:14 PST
<rdar://problem/58548071>
Comment 3 Nikita Vasilyev 2020-01-13 16:00:45 PST
Created attachment 387584 [details]
Patch

Retitled.
Comment 4 Devin Rousso 2020-01-16 16:36:27 PST
Comment on attachment 387584 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=387584&action=review

r=me

> Source/WebInspectorUI/UserInterface/Views/ColorSquare.js:109
> +        let hsv = WI.Color.rgb2hsv(...tintedColor.normalizedRGB);

NIT: we can destructure this for better code clarity:
```
    let [hue, saturation] = WI.Color.rgb2hsv(...tintedColor.normalizedRGB);
    let x = hue / 100 * this._dimension;
    let y = (1 - (saturation / 100)) * this._dimension;
```

> Source/WebInspectorUI/UserInterface/Views/ColorSquare.js:112
> +        this._setCrosshairPosition(new WI.Point(x, y));

This is called again below.  Please remove it, or add a comment explaining why it has to be called twice.
Comment 5 Nikita Vasilyev 2020-01-16 16:45:21 PST
Comment on attachment 387584 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=387584&action=review

>> Source/WebInspectorUI/UserInterface/Views/ColorSquare.js:109
>> +        let hsv = WI.Color.rgb2hsv(...tintedColor.normalizedRGB);
> 
> NIT: we can destructure this for better code clarity:
> ```
>     let [hue, saturation] = WI.Color.rgb2hsv(...tintedColor.normalizedRGB);
>     let x = hue / 100 * this._dimension;
>     let y = (1 - (saturation / 100)) * this._dimension;
> ```

I'm not using the 1st array's item, hue.

>> Source/WebInspectorUI/UserInterface/Views/ColorSquare.js:112
>> +        this._setCrosshairPosition(new WI.Point(x, y));
> 
> This is called again below.  Please remove it, or add a comment explaining why it has to be called twice.

This was a mistake. Thanks!
Comment 6 Nikita Vasilyev 2020-01-16 16:48:08 PST
Created attachment 387987 [details]
Patch
Comment 7 WebKit Commit Bot 2020-01-16 17:08:26 PST
Comment on attachment 387987 [details]
Patch

Clearing flags on attachment: 387987

Committed r254726: <https://trac.webkit.org/changeset/254726>
Comment 8 WebKit Commit Bot 2020-01-16 17:08:28 PST
All reviewed patches have been landed.  Closing bug.