Bug 183951 - Web Inspector: Styles: don't show checkboxes for invalid properties
Summary: Web Inspector: Styles: don't show checkboxes for invalid properties
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nikita Vasilyev
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-03-23 14:36 PDT by Nikita Vasilyev
Modified: 2018-03-23 18:26 PDT (History)
4 users (show)

See Also:


Attachments
Patch (1.85 KB, patch)
2018-03-23 14:42 PDT, Nikita Vasilyev
no flags Details | Formatted Diff | Diff
[Animated GIF] With patch applied (80.22 KB, image/gif)
2018-03-23 14:46 PDT, Nikita Vasilyev
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Vasilyev 2018-03-23 14:36:47 PDT
Currently, unchecking an invalid property unexpectedly removes the property.

Steps:
1. Open http://nv.github.io/webkit-inspector-bugs/styles-redesign/tests/invalid.html
2. Inspect <body>
3. Click on the checkbox for `color: blah;` or `invalid-name: blah;`

Expected:
Invalid property disables the same way as a valid property.

Actual:
Property gets removed.

<rdar://problem/36797202>

---

Fixing this would require non-trivial CSS parser changes on the backend.

The backend has a heuristic to distinguish commented out properties, such as 

    /* font-size: 11px */

from other comments, such as 

    /* make this red */

The CSS parser isn't smart enough to distinguish an invalid CSS property, such as `color: blah`, from a comment that isn't a CSS property at all.

As a workaround, I suggest to hide checkboxes for invalid properties. This is exactly what Chrome does.
Comment 1 Radar WebKit Bug Importer 2018-03-23 14:37:09 PDT
<rdar://problem/38807602>
Comment 2 Nikita Vasilyev 2018-03-23 14:42:55 PDT
Created attachment 336424 [details]
Patch
Comment 3 Nikita Vasilyev 2018-03-23 14:46:11 PDT
Created attachment 336425 [details]
[Animated GIF] With patch applied
Comment 4 Matt Baker 2018-03-23 18:00:33 PDT
Comment on attachment 336424 [details]
Patch

r=me
Comment 5 WebKit Commit Bot 2018-03-23 18:26:10 PDT
Comment on attachment 336424 [details]
Patch

Clearing flags on attachment: 336424

Committed r229941: <https://trac.webkit.org/changeset/229941>
Comment 6 WebKit Commit Bot 2018-03-23 18:26:11 PDT
All reviewed patches have been landed.  Closing bug.