Bug 21268 - CSS file line numbers should be displayed on styles pane
Summary: CSS file line numbers should be displayed on styles pane
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Enhancement
Assignee: Nobody
URL:
Keywords: InRadar
: 21324 27362 (view as bug list)
Depends on: 36414
Blocks:
  Show dependency treegraph
 
Reported: 2008-09-30 22:17 PDT by Henry Jalonen
Modified: 2010-03-23 00:52 PDT (History)
10 users (show)

See Also:


Attachments
Example of CSS Line numbers implementation [screenshot] (61 bytes, text/plain)
2009-11-24 11:36 PST, jasonevers
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Henry Jalonen 2008-09-30 22:17:25 PDT
This useful feature is present in Firebug and missing from WebKit inspector, which I'm really missing.
Comment 1 Timothy Hatcher 2008-10-01 20:05:46 PDT
<rdar://problem/6116072>
Comment 2 Timothy Hatcher 2008-10-03 00:23:59 PDT
*** Bug 21324 has been marked as a duplicate of this bug. ***
Comment 3 Timothy Hatcher 2009-07-17 07:18:15 PDT
*** Bug 27362 has been marked as a duplicate of this bug. ***
Comment 4 jasonevers 2009-11-24 11:34:09 PST
I also would love this to be implemented. +5
Comment 5 jasonevers 2009-11-24 11:36:47 PST
Created attachment 43793 [details]
Example of CSS Line numbers implementation [screenshot]
Comment 6 jasonevers 2009-11-24 11:37:43 PST
Comment on attachment 43793 [details]
Example of CSS Line numbers implementation [screenshot]

http://img.skitch.com/20091124-rxtwi85rw2um1xiw88ft4be5r8.jpg
Comment 7 Timothy Hatcher 2009-11-24 12:19:05 PST
Out style is file:line.

So: imac.css:144
Comment 8 jasonevers 2009-11-24 12:32:24 PST
That format sounds spectacular.
Comment 9 Joseph Pecoraro 2010-01-18 18:58:45 PST
It seems this is a very common request. So I looked things over.
A few thoughts out loud:

  1. The Web Inspector currently gets all its style info
     through public DOM methods. As far as I know, everything
     is available, up to the filename (taken from the href)
     of the Stylesheet. Line numbers however aren't available.
     
     Would exposing them through the DOM, say in an IDL like
     CSSStyleRule be taboo? I'd like to know the process on
     creating non-standard, but public properties.

  2. Grammar Changes. Currently whitespace is breezed over:
  
      - css/tokenizer.flex has
      
>         [ \t\r\n\f]+            {yyTok = WHITESPACE; return yyTok;}

      - css/CSSGrammar.y has
  
>         %token WHITESPACE SGML_CD

      - css/CSSParser.cpp in CSSParser::lex(void* yylvalWithoutType)

>         switch (token()) {
>         case WHITESPACE:
>         case SGML_CD:
>         case INCLUDES:
>         case DASHMATCH:
>             break;
  
    If we were to quickly add this, we could just have a counter,
    and increment the counter in the lexer however many newlines
    we see in the WHITESPACE (and SGML_CD?) tokens. I have a
    feeling that would probably have an impact performance.
    (Reparsing a string that was already parsed into a token).
    
    An alternative would be breaking WHITESPACE up in the
    tokenizer/grammar. Counting newlines there, and ignoring
    other whitespace as usual. This would (hopefully) ensure the
    text is parsed just once, keeping the performance about
    the same.
    
    Assuming a developer were to try out these approaches, are
    there tools for testing the performance of the CSS parser?
    I noticed some recent work on the JavaScript grammar had
    some tooling for just testing parsing:
    https://bugs.webkit.org/show_bug.cgi?id=32722#c17
Comment 10 Ron Domingue 2010-01-19 10:50:52 PST
Line numbering provides an efficient way to identify adjustments and errors in CSS.
Comment 11 Pavel Feldman 2010-03-23 00:52:49 PDT
Fixed as a part of 36414