Bug 183951

Summary: Web Inspector: Styles: don't show checkboxes for invalid properties
Product: WebKit Reporter: Nikita Vasilyev <nvasilyev>
Component: Web InspectorAssignee: Nikita Vasilyev <nvasilyev>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, inspector-bugzilla-changes, mattbaker, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
[Animated GIF] With patch applied none

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.