RESOLVED FIXED 162758
Web Inspector: Shift clicking on named color value only shows its hex form
https://bugs.webkit.org/show_bug.cgi?id=162758
Summary Web Inspector: Shift clicking on named color value only shows its hex form
Nikita Vasilyev
Reported 2016-09-29 15:27:01 PDT
Created attachment 290253 [details] [Animated GIF] Bug Steps: 1. Inspect any element on this page. 2. Add "color: brown" inline style. 3. Click twice while holding Shift on the brown square. Expected: Shift clicking should cycle through all possible color formats (i.e. RGB, HSL, hex). Actual: Only hex and named color values are shown. Also, the following assertion failed: [Error] Assertion Failed _inlineSwatchValueChanged (CSSStyleDeclarationTextEditor.js:1333) dispatch (Object.js:170) dispatchEventToListeners (Object.js:177) _updateSwatch (InlineSwatch.js:123) _swatchElementClicked (InlineSwatch.js:137) _swatchElementClicked
Attachments
[Animated GIF] Bug (24.39 KB, image/gif)
2016-09-29 15:27 PDT, Nikita Vasilyev
no flags
Patch (3.84 KB, patch)
2016-09-29 17:18 PDT, Devin Rousso
no flags
Archive of layout-test-results from ews101 for mac-yosemite (1.13 MB, application/zip)
2016-09-29 17:58 PDT, Build Bot
no flags
Archive of layout-test-results from ews114 for mac-yosemite (1.54 MB, application/zip)
2016-09-29 18:21 PDT, Build Bot
no flags
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (1.27 MB, application/zip)
2016-09-29 18:22 PDT, Build Bot
no flags
Patch (6.44 KB, patch)
2016-10-01 23:54 PDT, Devin Rousso
no flags
Patch (8.77 KB, patch)
2016-10-06 20:45 PDT, Devin Rousso
no flags
Archive of layout-test-results from ews101 for mac-yosemite (881.58 KB, application/zip)
2016-10-06 21:43 PDT, Build Bot
no flags
Archive of layout-test-results from ews106 for mac-yosemite-wk2 (1.07 MB, application/zip)
2016-10-06 21:47 PDT, Build Bot
no flags
Archive of layout-test-results from ews117 for mac-yosemite (1.75 MB, application/zip)
2016-10-06 21:52 PDT, Build Bot
no flags
Patch (7.93 KB, patch)
2016-10-23 22:49 PDT, Devin Rousso
no flags
Radar WebKit Bug Importer
Comment 1 2016-09-29 15:27:33 PDT
Devin Rousso
Comment 2 2016-09-29 17:18:33 PDT
Build Bot
Comment 3 2016-09-29 17:58:12 PDT
Comment on attachment 290269 [details] Patch Attachment 290269 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2171570 New failing tests: inspector/model/color.html
Build Bot
Comment 4 2016-09-29 17:58:15 PDT
Created attachment 290273 [details] Archive of layout-test-results from ews101 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 5 2016-09-29 18:21:05 PDT
Comment on attachment 290269 [details] Patch Attachment 290269 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/2171647 New failing tests: inspector/model/color.html
Build Bot
Comment 6 2016-09-29 18:21:07 PDT
Created attachment 290278 [details] Archive of layout-test-results from ews114 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews114 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 7 2016-09-29 18:22:26 PDT
Comment on attachment 290269 [details] Patch Attachment 290269 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/2171671 New failing tests: inspector/model/color.html
Build Bot
Comment 8 2016-09-29 18:22:29 PDT
Created attachment 290279 [details] Archive of layout-test-results from ews107 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Joseph Pecoraro
Comment 9 2016-09-29 21:33:43 PDT
Comment on attachment 290269 [details] Patch r- need to update the color test.
Devin Rousso
Comment 10 2016-10-01 23:54:46 PDT
Matt Baker
Comment 11 2016-10-03 15:11:07 PDT
Comment on attachment 290465 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=290465&action=review > Source/WebInspectorUI/ChangeLog:18 > + If the alpha is not 1, it will not show formats with non-alpha values. This is true when cycling through formats with shift+click, but not when using the context menu: 1. Inspect element, add style rule "color: orange" 2. Right click swatch, select "Format: Hex" => Rule changes to "color: #ffa500" 3. Right click swatch => "Format: Hex with Alpha" is an option
Devin Rousso
Comment 12 2016-10-03 20:31:13 PDT
Comment on attachment 290465 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=290465&action=review >> Source/WebInspectorUI/ChangeLog:18 >> + If the alpha is not 1, it will not show formats with non-alpha values. > > This is true when cycling through formats with shift+click, but not when using the context menu: > > 1. Inspect element, add style rule "color: orange" > 2. Right click swatch, select "Format: Hex" > => Rule changes to "color: #ffa500" > 3. Right click swatch > => "Format: Hex with Alpha" is an option I actually think that this should stay as it is. My view is that Shift+Click cycles through the different formats of the color, but only the ones that are truly necessary (it would be annoying for the user to have to click past RGB and RGBA in order to get to HSL). The context menu, however, is more direct and lets the user pick exactly which format they want (albeit going for an alpha format on a color that doesn't have an alpha is a bit more tedious). I see them serving two different purposes: Shift+Click: what does this color value look like in each format? Right-Click: I need to edit this color in HSL because I don't know how to modify HEX as easily
Matt Baker
Comment 13 2016-10-04 11:19:22 PDT
Comment on attachment 290465 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=290465&action=review >>> Source/WebInspectorUI/ChangeLog:18 >>> + If the alpha is not 1, it will not show formats with non-alpha values. >> >> This is true when cycling through formats with shift+click, but not when using the context menu: >> >> 1. Inspect element, add style rule "color: orange" >> 2. Right click swatch, select "Format: Hex" >> => Rule changes to "color: #ffa500" >> 3. Right click swatch >> => "Format: Hex with Alpha" is an option > > I actually think that this should stay as it is. My view is that Shift+Click cycles through the different formats of the color, but only the ones that are truly necessary (it would be annoying for the user to have to click past RGB and RGBA in order to get to HSL). The context menu, however, is more direct and lets the user pick exactly which format they want (albeit going for an alpha format on a color that doesn't have an alpha is a bit more tedious). I see them serving two different purposes: > > Shift+Click: what does this color value look like in each format? > Right-Click: I need to edit this color in HSL because I don't know how to modify HEX as easily Works for me! Please update the change log so it's clear that this is by design.
Matt Baker
Comment 14 2016-10-04 11:25:43 PDT
Comment on attachment 290465 [details] Patch r-, for the following issue with alpha value decimal places: 1. Inspect element, add style rule "color: hsla(0, 100%, 100%, 0.5)" 2. Right-click, select "Format: Hex with Alpha" => Value changes to "#ff000080" 3. Right-click, select "Format: HSLA" => Value changes to "hsla(0, 100%, 50%, 0.5019607843137255);"
Devin Rousso
Comment 15 2016-10-06 20:45:50 PDT
Build Bot
Comment 16 2016-10-06 21:43:56 PDT
Comment on attachment 290887 [details] Patch Attachment 290887 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2235268 New failing tests: inspector/model/color.html
Build Bot
Comment 17 2016-10-06 21:43:59 PDT
Created attachment 290890 [details] Archive of layout-test-results from ews101 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 18 2016-10-06 21:47:22 PDT
Comment on attachment 290887 [details] Patch Attachment 290887 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/2235286 New failing tests: inspector/model/color.html
Build Bot
Comment 19 2016-10-06 21:47:25 PDT
Created attachment 290891 [details] Archive of layout-test-results from ews106 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Build Bot
Comment 20 2016-10-06 21:52:24 PDT
Comment on attachment 290887 [details] Patch Attachment 290887 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/2235283 New failing tests: inspector/model/color.html
Build Bot
Comment 21 2016-10-06 21:52:27 PDT
Created attachment 290893 [details] Archive of layout-test-results from ews117 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews117 Port: mac-yosemite Platform: Mac OS X 10.10.5
Devin Rousso
Comment 22 2016-10-23 22:49:59 PDT
Nikita Vasilyev
Comment 23 2016-10-26 16:37:04 PDT
Shift-Clicking on "brown" cycles through the color schemes (RGB, HSL, hex, etc.) but it never goes back to the original value, "brown". Somehow "color: red" works as expected. Why is that?
Nikita Vasilyev
Comment 24 2016-10-26 17:00:56 PDT
Comment on attachment 292583 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=292583&action=review > Source/WebInspectorUI/UserInterface/Models/Color.js:485 > + rgba = rgba.map((value) => value.maxDecimals(2)); Nit: would be nice to mention in the changelog that now we round numbers up to 2 decimal points.
Timothy Hatcher
Comment 25 2016-10-31 16:00:00 PDT
Comment on attachment 292583 [details] Patch r+ Assuming the thing Nikita mentions is not a bug.
Devin Rousso
Comment 26 2016-11-14 23:11:19 PST
(In reply to comment #23) > Shift-Clicking on "brown" cycles through the color schemes (RGB, HSL, hex, > etc.) but it never goes back to the original value, "brown". > > Somehow "color: red" works as expected. > > Why is that? So it looks like this is actually a problem. When we display a Color in a HSL or RGB format, rounding the values will prevent any future color swatches from knowing the original color. This is a problem because AFAICT, we regenerate all InlineSwatch elements each time the content changes, meaning that each new swatch gets its value from the text and not the original value. Not sure how to fix this, but I'll think about it and figure something out.
Nikita Vasilyev
Comment 27 2016-11-17 11:36:57 PST
(In reply to comment #26) > (In reply to comment #23) > > Shift-Clicking on "brown" cycles through the color schemes (RGB, HSL, hex, > > etc.) but it never goes back to the original value, "brown". > > > > Somehow "color: red" works as expected. > > > > Why is that? > > So it looks like this is actually a problem. When we display a Color in a > HSL or RGB format, rounding the values will prevent any future color > swatches from knowing the original color. This is a problem because AFAICT, > we regenerate all InlineSwatch elements each time the content changes, > meaning that each new swatch gets its value from the text and not the > original value. Not sure how to fix this, but I'll think about it and > figure something out. Since this patch is already an improvement from what we had, I'm fine with landing it and fixing the rounding issue separately.
WebKit Commit Bot
Comment 28 2016-11-17 12:25:30 PST
Comment on attachment 292583 [details] Patch Clearing flags on attachment: 292583 Committed r208857: <http://trac.webkit.org/changeset/208857>
WebKit Commit Bot
Comment 29 2016-11-17 12:25:36 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.