[webkit-dev] lineNumber() and textPosition() methods in HTMLDocumentParser

Adam Barth abarth at webkit.org
Tue Jul 3 23:42:07 PDT 2012


They can probably be combined.  It's done this way because there are
other subclasses of DocumentParser besides HTMLDocumentParser.  I'm
not sure it's a big deal either way.

Adam


On Tue, Jul 3, 2012 at 9:28 PM, KwangYul Seo <skyul at company100.net> wrote:
> Hi.
>
> I have a question regarding HTMLDocumentParser. I found that lineNumber()
> retrives the line number from m_tokenizer while textPosition() retrieves the
> line number from m_input.current(). I wonder why HTMLDocumentParser keeps
> two copies of line number. ASSERT(m_tokenizer->lineNumber() == line) in
> HTMLDocumentParser::textPosition() implies that these two line numbers are
> usually the same.
>
> OrdinalNumber HTMLDocumentParser::lineNumber() const
> {
>     return m_tokenizer->lineNumber();
> }
>
> TextPosition HTMLDocumentParser::textPosition() const
> {
>     const SegmentedString& currentString = m_input.current();
>     OrdinalNumber line = currentString.currentLine();
>     OrdinalNumber column = currentString.currentColumn();
>     ASSERT(m_tokenizer->lineNumber() == line);
>
>     return TextPosition(line, column);
> }
>
> Regards,
> Kwang Yul Seo
>
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>


More information about the webkit-dev mailing list