Bug 132090

Summary: Web Inspector: CSS autofill suggests properties instead of values when values are needed
Product: WebKit Reporter: Jonathan Wells <jonowells>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, graouts, joepeck, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix: Updated to CSS mode handling to fix autocomplete, other issues none

Description Jonathan Wells 2014-04-23 16:34:39 PDT
In the styles sidebar, property names are suggested in place of values. For instance, 'display: b' should suggest 'block' but instead 'background' and other possible property names appear.
Comment 1 Radar WebKit Bug Importer 2014-04-23 16:35:55 PDT
<rdar://problem/16706366>
Comment 2 Jonathan Wells 2014-04-24 14:50:14 PDT
Created attachment 230108 [details]
[PATCH] Proposed Fix: Updated to CSS mode handling to fix autocomplete, other issues
Comment 3 Joseph Pecoraro 2014-04-24 14:59:30 PDT
Comment on attachment 230108 [details]
[PATCH] Proposed Fix: Updated to CSS mode handling to fix autocomplete, other issues

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

r=me

> Source/WebInspectorUI/ChangeLog:13
> +        data structure. All references to state.stack are obscelete. Many

Typo: obscelete

> Source/WebInspectorUI/ChangeLog:884
> -        Add missing semicolon.        
> +        Add missing semicolon.

I wonder if commit queue will allow a patch that fixes this trailing whitespace. Maybe it will, maybe it won't.

> Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js:398
> +        if (!state.stack || !state.stack.length || state.stack.lastValue === "@media{")

These only fix the exception, but I assume they don't make CSS pretty printing work?
Comment 4 Jonathan Wells 2014-04-24 15:20:37 PDT
That's right, this just fixes the exception.  See https://bugs.webkit.org/show_bug.cgi?id=132149
Comment 5 Jonathan Wells 2014-04-24 15:22:17 PDT
Good question re: the whitespace. I meant to remove that and did so incorrectly. That should be done in a separate patch probably.
Comment 6 WebKit Commit Bot 2014-04-24 15:29:44 PDT
Comment on attachment 230108 [details]
[PATCH] Proposed Fix: Updated to CSS mode handling to fix autocomplete, other issues

Clearing flags on attachment: 230108

Committed r167779: <http://trac.webkit.org/changeset/167779>
Comment 7 WebKit Commit Bot 2014-04-24 15:29:47 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Timothy Hatcher 2014-04-24 17:01:13 PDT
Comment on attachment 230108 [details]
[PATCH] Proposed Fix: Updated to CSS mode handling to fix autocomplete, other issues

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

> Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js:523
> +        if (!mainToken.state || !mainToken.state.state || !mainToken.state.state === "block")
>              return [];

This is not right. The while loop later looks for "prop", but this returns early if there is no "block" state. This needs to do a similar contains check up the state stack for "block".

As-is only proper name completions will work, property value completions will not work. But maybe you intended to fix this in the other bug.
Comment 9 Jonathan Wells 2014-04-24 17:34:26 PDT
Yes, this was just a quick fix to avoid total breakage of the inspector. Plan to rework in https://bugs.webkit.org/show_bug.cgi?id=132149