RESOLVED FIXED 45649
Move adjustLexerState to the HTMLTokenizer
https://bugs.webkit.org/show_bug.cgi?id=45649
Summary Move adjustLexerState to the HTMLTokenizer
Adam Barth
Reported 2010-09-13 03:23:40 PDT
Move adjustLexerState to the HTMLTokenizer
Attachments
Patch (7.94 KB, patch)
2010-09-13 03:25 PDT, Adam Barth
no flags
Patch (7.87 KB, patch)
2010-09-13 11:53 PDT, Adam Barth
no flags
Patch for landing (11.95 KB, patch)
2010-09-13 12:29 PDT, Adam Barth
no flags
Adam Barth
Comment 1 2010-09-13 03:25:54 PDT
Eric Seidel (no email)
Comment 2 2010-09-13 10:05:06 PDT
Comment on attachment 67391 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=67391&action=prettypatch Seems we could remove includes of TreeBuilder.h now, no? > WebCore/html/parser/HTMLTokenizer.h:142 > + // Updates the tokenizer's state according to the given tag name. This is > + // an approxmation of how the tree builder would update the tokenizer's > + // state. This method is useful for approximating HTML tokenization. To > + // get exactly the correct tokenization, you need the real tree builder. > + void updateState(const AtomicString& tagName, Frame*); If this is an approximation, can we name it to say such? approximateStateForTag or something?
Adam Barth
Comment 3 2010-09-13 11:53:31 PDT
Darin Adler
Comment 4 2010-09-13 12:01:14 PDT
Comment on attachment 67446 [details] Patch > + // Updates the tokenizer's state according to the given tag name. This is > + // an approxmation of how the tree builder would update the tokenizer's > + // state. This method is useful for approximating HTML tokenization. To > + // get exactly the correct tokenization, you need the real tree builder. Typo "approxmation" Two spaces after periods. I am uncomfortable with the use of the verb "approximate" here. First, it’s easy to confuse the verb with the adjective. And if this was an adjectival form then it would have a return value. Your comment uses the verb "update" and I think that should be in the function name. Maybe updateStateForFakeElement? Or something else like that? Probably not because the element is not fake. Another problem with "approximate" is that it doesn’t say what’s wrong. To decide if it’s OK to use the function you need to know how far off “correct” it is, not just that it’s not perfect. It’s not enough to say that it’s not 100% correct; that’s enough to get someone off the hook in a court of law or mathematical proof but is not so great for high-quality software development. commit-queue- to give you a chance to consider my comments
Adam Barth
Comment 5 2010-09-13 12:05:41 PDT
> Your comment uses the verb "update" and I think that should be in the function name. Maybe updateStateForFakeElement? Or something else like that? Probably not because the element is not fake. :) I originally called it "updateState" but Eric asked me to change it. > Another problem with "approximate" is that it doesn’t say what’s wrong. To decide if it’s OK to use the function you need to know how far off “correct” it is, not just that it’s not perfect. It’s not enough to say that it’s not 100% correct; that’s enough to get someone off the hook in a court of law or mathematical proof but is not so great for high-quality software development. We might eventually need something fancier here where we run the tree builder in a side-effect free way. The main thing this function doesn't understand is foreign content. I'll add more detail to the comment.
Adam Barth
Comment 6 2010-09-13 12:29:07 PDT
Created attachment 67454 [details] Patch for landing
WebKit Commit Bot
Comment 7 2010-09-14 07:26:07 PDT
Comment on attachment 67454 [details] Patch for landing Clearing flags on attachment: 67454 Committed r67467: <http://trac.webkit.org/changeset/67467>
WebKit Commit Bot
Comment 8 2010-09-14 07:26:12 PDT
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 9 2010-09-14 09:14:14 PDT
Note You need to log in before you can comment on or make changes to this bug.