[Webkit-unassigned] [Bug 141692] Web Inspector: Styles sidebar editing with incomplete property looks poor in UI

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 10 11:11:30 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=141692

--- Comment #15 from Joseph Pecoraro <joepeck at webkit.org> ---
> I see the logic here, but because we are using a CSS tokenizer we should
> take advantage of it.

In case we do go down the parser route:

There is a tool I use to see CodeMirror's tokenizer / parser output. Open up Source/WebInspectorUI/Tools/PrettyPrinting/index.html in your browser and play around with it.

Switch the language to CSS, and write some code and you can see what CodeMirror's tokenizer/parser state looks like.

For instance:

    div {
        /* comment */
        color;
        color: red;
    }

Outputs:

    Token: 'tag'         Stack: 'undefined'     Current: 'div'
    Token: null          Stack: 'undefined'     Current: ' '
    Token: null          Stack: 'rule'          Current: '{'
    Token: null          Stack: 'rule'          Current: '  '
    Token: 'comment'     Stack: 'rule'          Current: '/* comment */'
    Token: null          Stack: 'rule'          Current: '  '
    Token: 'property'    Stack: 'rule'          Current: 'color'
    Token: null          Stack: 'rule'          Current: ';'
    Token: null          Stack: 'rule'          Current: '  '
    Token: 'property'    Stack: 'rule'          Current: 'color'
    Token: 'operator'    Stack: 'propertyValue' Current: ':'
    Token: null          Stack: 'propertyValue' Current: ' '
    Token: 'keyword'     Stack: 'propertyValue' Current: 'red'
    Token: null          Stack: 'rule'          Current: ';'
    Token: null          Stack: 'undefined'     Current: '}'

So it seems like using CodeMirror's CSS mode you should be able to detect comments and "property;" and "property: value" patterns rather easily without direct string searching.

As for the cost, I have a feeling it is not very costly because CodeMirror is already parsing so that we can get syntax highlighting.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150310/7f9743b8/attachment-0002.html>


More information about the webkit-unassigned mailing list