mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bug 483015 - Expose line numbers for <style> and <script> in the HTML5 parser
This commit is contained in:
parent
2a38c0ddfc
commit
f93baf7cb6
@ -372,6 +372,8 @@ nsHtml5Parser::Parse(const nsAString& aSourceBuffer,
|
||||
|
||||
// XXX stop speculative script thread here
|
||||
|
||||
PRInt32 lineNumberSave = mTokenizer->getLineNumber();
|
||||
|
||||
// Maintain a reference to ourselves so we don't go away
|
||||
// till we're completely done.
|
||||
// XXX is this still necessary? -- hsivonen
|
||||
@ -442,6 +444,7 @@ nsHtml5Parser::Parse(const nsAString& aSourceBuffer,
|
||||
}
|
||||
// Scripting semantics require a forced tree builder flush here
|
||||
mTreeBuilder->Flush();
|
||||
mTokenizer->setLineNumber(lineNumberSave);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -154,10 +154,10 @@ nsHtml5Tokenizer::contentModelElementToArray()
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsHtml5Tokenizer::getLineNumber()
|
||||
void
|
||||
nsHtml5Tokenizer::setLineNumber(PRInt32 line)
|
||||
{
|
||||
return line;
|
||||
this->line = line;
|
||||
}
|
||||
|
||||
nsHtml5HtmlAttributes*
|
||||
@ -400,7 +400,7 @@ nsHtml5Tokenizer::start()
|
||||
longStrBuf = jArray<PRUnichar,PRInt32>(1024);
|
||||
longStrBufLen = 0;
|
||||
stateSave = NS_HTML5TOKENIZER_DATA;
|
||||
line = -1;
|
||||
line = 1;
|
||||
lastCR = PR_FALSE;
|
||||
tokenHandler->startTokenization(this);
|
||||
index = 0;
|
||||
|
@ -173,7 +173,12 @@ class nsHtml5Tokenizer
|
||||
private:
|
||||
void contentModelElementToArray();
|
||||
public:
|
||||
PRInt32 getLineNumber();
|
||||
void setLineNumber(PRInt32 line);
|
||||
inline PRInt32 getLineNumber()
|
||||
{
|
||||
return line;
|
||||
}
|
||||
|
||||
nsHtml5HtmlAttributes* emptyAttributes();
|
||||
private:
|
||||
void clearStrBufAndAppendCurrentC(PRUnichar c);
|
||||
|
Loading…
Reference in New Issue
Block a user