Bug 39984

Summary: HTML5 parser does not track line numbers
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: New BugsAssignee: Eric Seidel (no email) <eric>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, commit-queue, tonyg
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: OS X 10.5   
Bug Depends on:    
Bug Blocks: 39259    
Attachments:
Description Flags
Patch
none
Patch for landing none

Eric Seidel (no email)
Reported 2010-06-01 00:34:16 PDT
HTML5 parser does not track line numbers
Attachments
Patch (32.41 KB, patch)
2010-06-01 00:51 PDT, Eric Seidel (no email)
no flags
Patch for landing (32.44 KB, patch)
2010-06-01 22:41 PDT, Eric Seidel (no email)
no flags
Eric Seidel (no email)
Comment 1 2010-06-01 00:51:17 PDT
Eric Seidel (no email)
Comment 2 2010-06-01 00:52:35 PDT
This fixes 268 (57%) of the 467 remaining failing tests. :)
Adam Barth
Comment 3 2010-06-01 09:45:30 PDT
Please add these to the tracking bug when you file them. :)
Adam Barth
Comment 4 2010-06-01 09:50:57 PDT
Comment on attachment 57523 [details] Patch Minor nits. Thanks for fixing hundreds of tests. :) WebCore/html/HTML5TreeBuilder.cpp:43 + static const int uninitializedLineNumberValue = -1; There was a thread on webkit-dev recently about whether we prefer s_ as a prefix for values like this. I'm not sure what the outcome was, but you might want to check to be sure. WebCore/html/HTML5TreeBuilder.h:81 + int m_lastScriptElementStartLine; // FIXME: Hack for <script> support on top of the old parser. Maybe a struct to hold these related values? WebCore/html/HTML5TreeBuilder.h:84 + int m_scriptToProcessStartLine; // Starting line number of the script tag needing processing. Especially because the struct recurs here. WebCore/html/HTML5Lexer.cpp:242 + source.advance(m_lineNumber); On cases like this, we want to call "advancePastNonnewline" because its faster. The conditional above proves that we can't change the line number here. WebCore/html/HTML5Lexer.cpp:252 + source.advance(m_lineNumber); Ditto.
Eric Seidel (no email)
Comment 5 2010-06-01 22:35:26 PDT
(In reply to comment #4) > There was a thread on webkit-dev recently about whether we prefer s_ as a prefix for values like this. I'm not sure what the outcome was, but you might want to check to be sure. I sent a reply to the list just now. For now I believe the global statics have no prefix. > WebCore/html/HTML5TreeBuilder.h:81 > + int m_lastScriptElementStartLine; // FIXME: Hack for <script> support on top of the old parser. > Maybe a struct to hold these related values? They variables have different meanings in the two cases, which is why I haven't used a struct until now. I'll consider it in the future, though not for this change. :) > WebCore/html/HTML5Lexer.cpp:242 > + source.advance(m_lineNumber); > On cases like this, we want to call "advancePastNonnewline" because its faster. The conditional above proves that we can't change the line number here. Yup. Will fix.
Eric Seidel (no email)
Comment 6 2010-06-01 22:41:32 PDT
Created attachment 57621 [details] Patch for landing
WebKit Commit Bot
Comment 7 2010-06-02 03:08:01 PDT
Comment on attachment 57621 [details] Patch for landing Clearing flags on attachment: 57621 Committed r60553: <http://trac.webkit.org/changeset/60553>
WebKit Commit Bot
Comment 8 2010-06-02 03:08:08 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.