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

KwangYul Seo skyul at company100.net
Tue Jul 3 21:28:33 PDT 2012


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);

Kwang Yul Seo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20120704/80890006/attachment.html>

More information about the webkit-dev mailing list