зеркало из https://github.com/mozilla/gecko-dev.git
Bug 482921 part 14 - Address review comments. r=Olli.Pettay.
This commit is contained in:
Родитель
f4d82459e5
Коммит
c718393931
|
@ -868,6 +868,8 @@ public abstract class TreeBuilder<T> implements TokenHandler,
|
||||||
*/
|
*/
|
||||||
public final void characters(@Const @NoLength char[] buf, int start, int length)
|
public final void characters(@Const @NoLength char[] buf, int start, int length)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
|
// Note: Can't attach error messages to EOF in C++ yet
|
||||||
|
|
||||||
// CPPONLY: if (tokenizer.isViewingXmlSource()) {
|
// CPPONLY: if (tokenizer.isViewingXmlSource()) {
|
||||||
// CPPONLY: return;
|
// CPPONLY: return;
|
||||||
// CPPONLY: }
|
// CPPONLY: }
|
||||||
|
@ -1271,6 +1273,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
|
||||||
|
|
||||||
public final void eof() throws SAXException {
|
public final void eof() throws SAXException {
|
||||||
flushCharacters();
|
flushCharacters();
|
||||||
|
// Note: Can't attach error messages to EOF in C++ yet
|
||||||
eofloop: for (;;) {
|
eofloop: for (;;) {
|
||||||
if (isInForeign()) {
|
if (isInForeign()) {
|
||||||
// [NOCPP[
|
// [NOCPP[
|
||||||
|
|
|
@ -205,10 +205,10 @@ nsHtml5Highlighter::Transition(PRInt32 aState, bool aReconsume, PRInt32 aPos)
|
||||||
case NS_HTML5TOKENIZER_TAG_NAME:
|
case NS_HTML5TOKENIZER_TAG_NAME:
|
||||||
switch (aState) {
|
switch (aState) {
|
||||||
case NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME:
|
case NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME:
|
||||||
EndInline(); // NS_HTML5TOKENIZER_TAG_NAME
|
EndSpanOrA(); // NS_HTML5TOKENIZER_TAG_NAME
|
||||||
break;
|
break;
|
||||||
case NS_HTML5TOKENIZER_SELF_CLOSING_START_TAG:
|
case NS_HTML5TOKENIZER_SELF_CLOSING_START_TAG:
|
||||||
EndInline(); // NS_HTML5TOKENIZER_TAG_NAME
|
EndSpanOrA(); // NS_HTML5TOKENIZER_TAG_NAME
|
||||||
StartSpan(); // for highlighting the slash
|
StartSpan(); // for highlighting the slash
|
||||||
mSlash = CurrentNode();
|
mSlash = CurrentNode();
|
||||||
break;
|
break;
|
||||||
|
@ -235,10 +235,10 @@ nsHtml5Highlighter::Transition(PRInt32 aState, bool aReconsume, PRInt32 aPos)
|
||||||
switch (aState) {
|
switch (aState) {
|
||||||
case NS_HTML5TOKENIZER_AFTER_ATTRIBUTE_NAME:
|
case NS_HTML5TOKENIZER_AFTER_ATTRIBUTE_NAME:
|
||||||
case NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_VALUE:
|
case NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_VALUE:
|
||||||
EndInline(); // NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME
|
EndSpanOrA(); // NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME
|
||||||
break;
|
break;
|
||||||
case NS_HTML5TOKENIZER_SELF_CLOSING_START_TAG:
|
case NS_HTML5TOKENIZER_SELF_CLOSING_START_TAG:
|
||||||
EndInline(); // NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME
|
EndSpanOrA(); // NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME
|
||||||
StartSpan(); // for highlighting the slash
|
StartSpan(); // for highlighting the slash
|
||||||
mSlash = CurrentNode();
|
mSlash = CurrentNode();
|
||||||
break;
|
break;
|
||||||
|
@ -266,7 +266,7 @@ nsHtml5Highlighter::Transition(PRInt32 aState, bool aReconsume, PRInt32 aPos)
|
||||||
case NS_HTML5TOKENIZER_ATTRIBUTE_VALUE_SINGLE_QUOTED:
|
case NS_HTML5TOKENIZER_ATTRIBUTE_VALUE_SINGLE_QUOTED:
|
||||||
switch (aState) {
|
switch (aState) {
|
||||||
case NS_HTML5TOKENIZER_AFTER_ATTRIBUTE_VALUE_QUOTED:
|
case NS_HTML5TOKENIZER_AFTER_ATTRIBUTE_VALUE_QUOTED:
|
||||||
EndInline();
|
EndSpanOrA();
|
||||||
break;
|
break;
|
||||||
case NS_HTML5TOKENIZER_CONSUME_CHARACTER_REFERENCE:
|
case NS_HTML5TOKENIZER_CONSUME_CHARACTER_REFERENCE:
|
||||||
StartSpan();
|
StartSpan();
|
||||||
|
@ -292,7 +292,7 @@ nsHtml5Highlighter::Transition(PRInt32 aState, bool aReconsume, PRInt32 aPos)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NS_HTML5TOKENIZER_SELF_CLOSING_START_TAG:
|
case NS_HTML5TOKENIZER_SELF_CLOSING_START_TAG:
|
||||||
EndInline(); // end the slash highlight
|
EndSpanOrA(); // end the slash highlight
|
||||||
switch (aState) {
|
switch (aState) {
|
||||||
case NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME:
|
case NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME:
|
||||||
break;
|
break;
|
||||||
|
@ -304,7 +304,7 @@ nsHtml5Highlighter::Transition(PRInt32 aState, bool aReconsume, PRInt32 aPos)
|
||||||
case NS_HTML5TOKENIZER_ATTRIBUTE_VALUE_UNQUOTED:
|
case NS_HTML5TOKENIZER_ATTRIBUTE_VALUE_UNQUOTED:
|
||||||
switch (aState) {
|
switch (aState) {
|
||||||
case NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME:
|
case NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME:
|
||||||
EndInline();
|
EndSpanOrA();
|
||||||
break;
|
break;
|
||||||
case NS_HTML5TOKENIZER_CONSUME_CHARACTER_REFERENCE:
|
case NS_HTML5TOKENIZER_CONSUME_CHARACTER_REFERENCE:
|
||||||
StartSpan();
|
StartSpan();
|
||||||
|
@ -353,14 +353,14 @@ nsHtml5Highlighter::Transition(PRInt32 aState, bool aReconsume, PRInt32 aPos)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NS_HTML5TOKENIZER_CONSUME_CHARACTER_REFERENCE:
|
case NS_HTML5TOKENIZER_CONSUME_CHARACTER_REFERENCE:
|
||||||
EndInline(); // the span for the ampersand
|
EndSpanOrA(); // the span for the ampersand
|
||||||
switch (aState) {
|
switch (aState) {
|
||||||
case NS_HTML5TOKENIZER_CONSUME_NCR:
|
case NS_HTML5TOKENIZER_CONSUME_NCR:
|
||||||
case NS_HTML5TOKENIZER_CHARACTER_REFERENCE_HILO_LOOKUP:
|
case NS_HTML5TOKENIZER_CHARACTER_REFERENCE_HILO_LOOKUP:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// not actually a character reference
|
// not actually a character reference
|
||||||
EndInline();
|
EndSpanOrA();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -369,13 +369,13 @@ nsHtml5Highlighter::Transition(PRInt32 aState, bool aReconsume, PRInt32 aPos)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// not actually a character reference
|
// not actually a character reference
|
||||||
EndInline();
|
EndSpanOrA();
|
||||||
break;
|
break;
|
||||||
case NS_HTML5TOKENIZER_CHARACTER_REFERENCE_TAIL:
|
case NS_HTML5TOKENIZER_CHARACTER_REFERENCE_TAIL:
|
||||||
if (!aReconsume) {
|
if (!aReconsume) {
|
||||||
FlushCurrent();
|
FlushCurrent();
|
||||||
}
|
}
|
||||||
EndInline();
|
EndSpanOrA();
|
||||||
break;
|
break;
|
||||||
case NS_HTML5TOKENIZER_DECIMAL_NRC_LOOP:
|
case NS_HTML5TOKENIZER_DECIMAL_NRC_LOOP:
|
||||||
case NS_HTML5TOKENIZER_HEX_NCR_LOOP:
|
case NS_HTML5TOKENIZER_HEX_NCR_LOOP:
|
||||||
|
@ -388,7 +388,7 @@ nsHtml5Highlighter::Transition(PRInt32 aState, bool aReconsume, PRInt32 aPos)
|
||||||
AddClass(sEntity);
|
AddClass(sEntity);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
EndInline();
|
EndSpanOrA();
|
||||||
break;
|
break;
|
||||||
case NS_HTML5TOKENIZER_CLOSE_TAG_OPEN:
|
case NS_HTML5TOKENIZER_CLOSE_TAG_OPEN:
|
||||||
switch (aState) {
|
switch (aState) {
|
||||||
|
@ -406,18 +406,18 @@ nsHtml5Highlighter::Transition(PRInt32 aState, bool aReconsume, PRInt32 aPos)
|
||||||
StartSpan(); // don't know if it is "end-tag" yet :-(
|
StartSpan(); // don't know if it is "end-tag" yet :-(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
EndInline();
|
EndSpanOrA();
|
||||||
StartCharacters();
|
StartCharacters();
|
||||||
break;
|
break;
|
||||||
case NS_HTML5TOKENIZER_NON_DATA_END_TAG_NAME:
|
case NS_HTML5TOKENIZER_NON_DATA_END_TAG_NAME:
|
||||||
switch (aState) {
|
switch (aState) {
|
||||||
case NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME:
|
case NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME:
|
||||||
AddClass(sEndTag);
|
AddClass(sEndTag);
|
||||||
EndInline();
|
EndSpanOrA();
|
||||||
break;
|
break;
|
||||||
case NS_HTML5TOKENIZER_SELF_CLOSING_START_TAG:
|
case NS_HTML5TOKENIZER_SELF_CLOSING_START_TAG:
|
||||||
AddClass(sEndTag);
|
AddClass(sEndTag);
|
||||||
EndInline();
|
EndSpanOrA();
|
||||||
StartSpan(); // for highlighting the slash
|
StartSpan(); // for highlighting the slash
|
||||||
mSlash = CurrentNode();
|
mSlash = CurrentNode();
|
||||||
break;
|
break;
|
||||||
|
@ -557,7 +557,7 @@ nsHtml5Highlighter::StartSpan(const PRUnichar* aClass)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Highlighter::EndInline()
|
nsHtml5Highlighter::EndSpanOrA()
|
||||||
{
|
{
|
||||||
FlushChars();
|
FlushChars();
|
||||||
Pop();
|
Pop();
|
||||||
|
@ -596,10 +596,10 @@ void
|
||||||
nsHtml5Highlighter::FinishTag()
|
nsHtml5Highlighter::FinishTag()
|
||||||
{
|
{
|
||||||
while (mInlinesOpen > 1) {
|
while (mInlinesOpen > 1) {
|
||||||
EndInline();
|
EndSpanOrA();
|
||||||
}
|
}
|
||||||
FlushCurrent(); // >
|
FlushCurrent(); // >
|
||||||
EndInline(); // DATA
|
EndSpanOrA(); // DATA
|
||||||
NS_ASSERTION(!mInlinesOpen, "mInlinesOpen got out of sync!");
|
NS_ASSERTION(!mInlinesOpen, "mInlinesOpen got out of sync!");
|
||||||
StartCharacters();
|
StartCharacters();
|
||||||
}
|
}
|
||||||
|
@ -685,14 +685,14 @@ void
|
||||||
nsHtml5Highlighter::MaybeLinkifyAttributeValue(nsHtml5AttributeName* aName,
|
nsHtml5Highlighter::MaybeLinkifyAttributeValue(nsHtml5AttributeName* aName,
|
||||||
nsString* aValue)
|
nsString* aValue)
|
||||||
{
|
{
|
||||||
if (!(nsHtml5AttributeName::ATTR_HREF == aName
|
if (!(nsHtml5AttributeName::ATTR_HREF == aName ||
|
||||||
|| nsHtml5AttributeName::ATTR_SRC == aName
|
nsHtml5AttributeName::ATTR_SRC == aName ||
|
||||||
|| nsHtml5AttributeName::ATTR_ACTION == aName
|
nsHtml5AttributeName::ATTR_ACTION == aName ||
|
||||||
|| nsHtml5AttributeName::ATTR_CITE == aName
|
nsHtml5AttributeName::ATTR_CITE == aName ||
|
||||||
|| nsHtml5AttributeName::ATTR_BACKGROUND == aName
|
nsHtml5AttributeName::ATTR_BACKGROUND == aName ||
|
||||||
|| nsHtml5AttributeName::ATTR_LONGDESC == aName
|
nsHtml5AttributeName::ATTR_LONGDESC == aName ||
|
||||||
|| nsHtml5AttributeName::ATTR_XLINK_HREF == aName
|
nsHtml5AttributeName::ATTR_XLINK_HREF == aName ||
|
||||||
|| nsHtml5AttributeName::ATTR_DEFINITIONURL == aName)) {
|
nsHtml5AttributeName::ATTR_DEFINITIONURL == aName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AddViewSourceHref(*aValue);
|
AddViewSourceHref(*aValue);
|
||||||
|
|
|
@ -192,9 +192,9 @@ class nsHtml5Highlighter
|
||||||
void StartSpan(const PRUnichar* aClass);
|
void StartSpan(const PRUnichar* aClass);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End the current <span> or <a>.
|
* End the current <span> or <a> in the highlighter output.
|
||||||
*/
|
*/
|
||||||
void EndInline();
|
void EndSpanOrA();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a wrapper around a run of characters.
|
* Starts a wrapper around a run of characters.
|
||||||
|
@ -222,8 +222,10 @@ class nsHtml5Highlighter
|
||||||
void FlushCurrent();
|
void FlushCurrent();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finishes a source tag being highlighted by closing the open <span> and
|
* Finishes highlighting a tag in the input data by closing the open
|
||||||
* <a> elements.
|
* <span> and <a> elements in the highlighter output and then starts
|
||||||
|
* another <span> for potentially highlighting characters potentially
|
||||||
|
* appearing next.
|
||||||
*/
|
*/
|
||||||
void FinishTag();
|
void FinishTag();
|
||||||
|
|
||||||
|
@ -238,6 +240,9 @@ class nsHtml5Highlighter
|
||||||
/**
|
/**
|
||||||
* Allocates a handle for an element.
|
* Allocates a handle for an element.
|
||||||
*
|
*
|
||||||
|
* See the documentation for nsHtml5TreeBuilder::AllocateContentHandle()
|
||||||
|
* in nsHtml5TreeBuilderHSupplement.h.
|
||||||
|
*
|
||||||
* @return the handle
|
* @return the handle
|
||||||
*/
|
*/
|
||||||
nsIContent** AllocateContentHandle();
|
nsIContent** AllocateContentHandle();
|
||||||
|
|
|
@ -516,6 +516,14 @@ nsHtml5StreamParser::FinalizeSniffing(const PRUint8* aFromSegment, // can be nul
|
||||||
XML_SetUserData(ud.mExpat, static_cast<void*>(&ud));
|
XML_SetUserData(ud.mExpat, static_cast<void*>(&ud));
|
||||||
|
|
||||||
XML_Status status = XML_STATUS_OK;
|
XML_Status status = XML_STATUS_OK;
|
||||||
|
|
||||||
|
// aFromSegment points to the data obtained from the current network
|
||||||
|
// event. mSniffingBuffer (if it exists) contains the data obtained before
|
||||||
|
// the current event. Thus, mSniffingLenth bytes of mSniffingBuffer
|
||||||
|
// followed by aCountToSniffingLimit bytes from aFromSegment are the
|
||||||
|
// first 1024 bytes of the file (or the file as a whole if the file is
|
||||||
|
// 1024 bytes long or shorter). Thus, we parse both buffers, but if the
|
||||||
|
// first call succeeds already, we skip parsing the second buffer.
|
||||||
if (mSniffingBuffer) {
|
if (mSniffingBuffer) {
|
||||||
status = XML_Parse(ud.mExpat,
|
status = XML_Parse(ud.mExpat,
|
||||||
reinterpret_cast<const char*>(mSniffingBuffer.get()),
|
reinterpret_cast<const char*>(mSniffingBuffer.get()),
|
||||||
|
@ -682,8 +690,8 @@ nsHtml5StreamParser::SniffStreamBytes(const PRUint8* aFromSegment,
|
||||||
PRUint32 countToSniffingLimit =
|
PRUint32 countToSniffingLimit =
|
||||||
NS_HTML5_STREAM_PARSER_SNIFFING_BUFFER_SIZE - mSniffingLength;
|
NS_HTML5_STREAM_PARSER_SNIFFING_BUFFER_SIZE - mSniffingLength;
|
||||||
if (mMode == NORMAL || mMode == VIEW_SOURCE_HTML) {
|
if (mMode == NORMAL || mMode == VIEW_SOURCE_HTML) {
|
||||||
nsHtml5ByteReadable readable(aFromSegment, aFromSegment
|
nsHtml5ByteReadable readable(aFromSegment, aFromSegment +
|
||||||
+ countToSniffingLimit);
|
countToSniffingLimit);
|
||||||
mMetaScanner->sniff(&readable, getter_AddRefs(mUnicodeDecoder), mCharset);
|
mMetaScanner->sniff(&readable, getter_AddRefs(mUnicodeDecoder), mCharset);
|
||||||
if (mUnicodeDecoder) {
|
if (mUnicodeDecoder) {
|
||||||
mUnicodeDecoder->SetInputErrorBehavior(
|
mUnicodeDecoder->SetInputErrorBehavior(
|
||||||
|
|
|
@ -496,7 +496,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
state = P::transition(mViewSource, NS_HTML5TOKENIZER_PROCESSING_INSTRUCTION, reconsume, pos);
|
state = P::transition(mViewSource, NS_HTML5TOKENIZER_PROCESSING_INSTRUCTION, reconsume, pos);
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errProcessingInstruction();
|
errProcessingInstruction();
|
||||||
}
|
}
|
||||||
clearLongStrBufAndAppend(c);
|
clearLongStrBufAndAppend(c);
|
||||||
|
@ -504,7 +504,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
case '>': {
|
case '>': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errLtGt();
|
errLtGt();
|
||||||
}
|
}
|
||||||
tokenHandler->characters(nsHtml5Tokenizer::LT_GT, 0, 2);
|
tokenHandler->characters(nsHtml5Tokenizer::LT_GT, 0, 2);
|
||||||
|
@ -513,7 +513,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errBadCharAfterLt(c);
|
errBadCharAfterLt(c);
|
||||||
}
|
}
|
||||||
tokenHandler->characters(nsHtml5Tokenizer::LT_GT, 0, 1);
|
tokenHandler->characters(nsHtml5Tokenizer::LT_GT, 0, 1);
|
||||||
|
@ -617,7 +617,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
case '\'':
|
case '\'':
|
||||||
case '<':
|
case '<':
|
||||||
case '=': {
|
case '=': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errBadCharBeforeAttributeNameOrNull(c);
|
errBadCharBeforeAttributeNameOrNull(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -682,7 +682,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
case '\"':
|
case '\"':
|
||||||
case '\'':
|
case '\'':
|
||||||
case '<': {
|
case '<': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errQuoteOrLtInAttributeNameOrNull(c);
|
errQuoteOrLtInAttributeNameOrNull(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -734,7 +734,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
case '>': {
|
case '>': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errAttributeValueMissing();
|
errAttributeValueMissing();
|
||||||
}
|
}
|
||||||
addAttributeWithoutValue();
|
addAttributeWithoutValue();
|
||||||
|
@ -750,7 +750,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
case '<':
|
case '<':
|
||||||
case '=':
|
case '=':
|
||||||
case '`': {
|
case '`': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errLtOrEqualsOrGraveInUnquotedAttributeOrNull(c);
|
errLtOrEqualsOrGraveInUnquotedAttributeOrNull(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -839,7 +839,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNoSpaceBetweenAttributes();
|
errNoSpaceBetweenAttributes();
|
||||||
}
|
}
|
||||||
state = P::transition(mViewSource, NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME, reconsume, pos);
|
state = P::transition(mViewSource, NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME, reconsume, pos);
|
||||||
|
@ -864,7 +864,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errSlashNotFollowedByGt();
|
errSlashNotFollowedByGt();
|
||||||
}
|
}
|
||||||
state = P::transition(mViewSource, NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME, reconsume, pos);
|
state = P::transition(mViewSource, NS_HTML5TOKENIZER_BEFORE_ATTRIBUTE_NAME, reconsume, pos);
|
||||||
|
@ -923,7 +923,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
case '\'':
|
case '\'':
|
||||||
case '=':
|
case '=':
|
||||||
case '`': {
|
case '`': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errUnquotedAttributeValOrNull(c);
|
errUnquotedAttributeValOrNull(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -977,7 +977,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
case '\"':
|
case '\"':
|
||||||
case '\'':
|
case '\'':
|
||||||
case '<': {
|
case '<': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errQuoteOrLtInAttributeNameOrNull(c);
|
errQuoteOrLtInAttributeNameOrNull(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1021,7 +1021,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errBogusComment();
|
errBogusComment();
|
||||||
}
|
}
|
||||||
clearLongStrBuf();
|
clearLongStrBuf();
|
||||||
|
@ -1049,7 +1049,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_BREAK(markupdeclarationhyphenloop);
|
NS_HTML5_BREAK(markupdeclarationhyphenloop);
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errBogusComment();
|
errBogusComment();
|
||||||
}
|
}
|
||||||
state = P::transition(mViewSource, NS_HTML5TOKENIZER_BOGUS_COMMENT, reconsume, pos);
|
state = P::transition(mViewSource, NS_HTML5TOKENIZER_BOGUS_COMMENT, reconsume, pos);
|
||||||
|
@ -1073,7 +1073,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
case '>': {
|
case '>': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errPrematureEndOfComment();
|
errPrematureEndOfComment();
|
||||||
}
|
}
|
||||||
emitComment(0, pos);
|
emitComment(0, pos);
|
||||||
|
@ -1194,7 +1194,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
case '!': {
|
case '!': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errHyphenHyphenBang();
|
errHyphenHyphenBang();
|
||||||
}
|
}
|
||||||
appendLongStrBuf(c);
|
appendLongStrBuf(c);
|
||||||
|
@ -1261,7 +1261,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
case '>': {
|
case '>': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errPrematureEndOfComment();
|
errPrematureEndOfComment();
|
||||||
}
|
}
|
||||||
emitComment(1, pos);
|
emitComment(1, pos);
|
||||||
|
@ -1298,7 +1298,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
if (c == nsHtml5Tokenizer::CDATA_LSQB[index]) {
|
if (c == nsHtml5Tokenizer::CDATA_LSQB[index]) {
|
||||||
appendLongStrBuf(c);
|
appendLongStrBuf(c);
|
||||||
} else {
|
} else {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errBogusComment();
|
errBogusComment();
|
||||||
}
|
}
|
||||||
state = P::transition(mViewSource, NS_HTML5TOKENIZER_BOGUS_COMMENT, reconsume, pos);
|
state = P::transition(mViewSource, NS_HTML5TOKENIZER_BOGUS_COMMENT, reconsume, pos);
|
||||||
|
@ -1474,7 +1474,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
} else if (c >= 'A' && c <= 'Z') {
|
} else if (c >= 'A' && c <= 'Z') {
|
||||||
firstCharKey = c - 'A';
|
firstCharKey = c - 'A';
|
||||||
} else {
|
} else {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNoNamedCharacterMatch();
|
errNoNamedCharacterMatch();
|
||||||
}
|
}
|
||||||
emitOrAppendStrBuf(returnState);
|
emitOrAppendStrBuf(returnState);
|
||||||
|
@ -1507,7 +1507,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hilo) {
|
if (!hilo) {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNoNamedCharacterMatch();
|
errNoNamedCharacterMatch();
|
||||||
}
|
}
|
||||||
emitOrAppendStrBuf(returnState);
|
emitOrAppendStrBuf(returnState);
|
||||||
|
@ -1578,7 +1578,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
}
|
}
|
||||||
outer_end: ;
|
outer_end: ;
|
||||||
if (candidate == -1) {
|
if (candidate == -1) {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNoNamedCharacterMatch();
|
errNoNamedCharacterMatch();
|
||||||
}
|
}
|
||||||
emitOrAppendStrBuf(returnState);
|
emitOrAppendStrBuf(returnState);
|
||||||
|
@ -1599,7 +1599,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
ch = strBuf[strBufMark];
|
ch = strBuf[strBufMark];
|
||||||
}
|
}
|
||||||
if (ch == '=' || (ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) {
|
if (ch == '=' || (ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNoNamedCharacterMatch();
|
errNoNamedCharacterMatch();
|
||||||
}
|
}
|
||||||
appendStrBufToLongStrBuf();
|
appendStrBufToLongStrBuf();
|
||||||
|
@ -1609,11 +1609,11 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((returnState & NS_HTML5TOKENIZER_DATA_AND_RCDATA_MASK)) {
|
if ((returnState & NS_HTML5TOKENIZER_DATA_AND_RCDATA_MASK)) {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errUnescapedAmpersandInterpretedAsCharacterReference();
|
errUnescapedAmpersandInterpretedAsCharacterReference();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNotSemicolonTerminated();
|
errNotSemicolonTerminated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1690,7 +1690,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
state = P::transition(mViewSource, NS_HTML5TOKENIZER_HANDLE_NCR_VALUE, reconsume, pos);
|
state = P::transition(mViewSource, NS_HTML5TOKENIZER_HANDLE_NCR_VALUE, reconsume, pos);
|
||||||
NS_HTML5_BREAK(decimalloop);
|
NS_HTML5_BREAK(decimalloop);
|
||||||
} else {
|
} else {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNoDigitsInNCR();
|
errNoDigitsInNCR();
|
||||||
}
|
}
|
||||||
appendStrBuf(';');
|
appendStrBuf(';');
|
||||||
|
@ -1703,7 +1703,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!seenDigits) {
|
if (!seenDigits) {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNoDigitsInNCR();
|
errNoDigitsInNCR();
|
||||||
}
|
}
|
||||||
emitOrAppendStrBuf(returnState);
|
emitOrAppendStrBuf(returnState);
|
||||||
|
@ -1714,7 +1714,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
reconsume = true;
|
reconsume = true;
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
} else {
|
} else {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errCharRefLacksSemicolon();
|
errCharRefLacksSemicolon();
|
||||||
}
|
}
|
||||||
if (!(returnState & NS_HTML5TOKENIZER_DATA_AND_RCDATA_MASK)) {
|
if (!(returnState & NS_HTML5TOKENIZER_DATA_AND_RCDATA_MASK)) {
|
||||||
|
@ -1766,7 +1766,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
state = P::transition(mViewSource, NS_HTML5TOKENIZER_HANDLE_NCR_VALUE, reconsume, pos);
|
state = P::transition(mViewSource, NS_HTML5TOKENIZER_HANDLE_NCR_VALUE, reconsume, pos);
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
} else {
|
} else {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNoDigitsInNCR();
|
errNoDigitsInNCR();
|
||||||
}
|
}
|
||||||
appendStrBuf(';');
|
appendStrBuf(';');
|
||||||
|
@ -1779,7 +1779,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!seenDigits) {
|
if (!seenDigits) {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNoDigitsInNCR();
|
errNoDigitsInNCR();
|
||||||
}
|
}
|
||||||
emitOrAppendStrBuf(returnState);
|
emitOrAppendStrBuf(returnState);
|
||||||
|
@ -1790,7 +1790,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
reconsume = true;
|
reconsume = true;
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
} else {
|
} else {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errCharRefLacksSemicolon();
|
errCharRefLacksSemicolon();
|
||||||
}
|
}
|
||||||
if (!(returnState & NS_HTML5TOKENIZER_DATA_AND_RCDATA_MASK)) {
|
if (!(returnState & NS_HTML5TOKENIZER_DATA_AND_RCDATA_MASK)) {
|
||||||
|
@ -1839,7 +1839,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
c = checkChar(buf, pos);
|
c = checkChar(buf, pos);
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case '>': {
|
case '>': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errLtSlashGt();
|
errLtSlashGt();
|
||||||
}
|
}
|
||||||
cstart = pos + 1;
|
cstart = pos + 1;
|
||||||
|
@ -1848,7 +1848,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
}
|
}
|
||||||
case '\r': {
|
case '\r': {
|
||||||
silentCarriageReturn();
|
silentCarriageReturn();
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errGarbageAfterLtSlash();
|
errGarbageAfterLtSlash();
|
||||||
}
|
}
|
||||||
clearLongStrBufAndAppend('\n');
|
clearLongStrBufAndAppend('\n');
|
||||||
|
@ -1857,7 +1857,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
}
|
}
|
||||||
case '\n': {
|
case '\n': {
|
||||||
silentLineFeed();
|
silentLineFeed();
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errGarbageAfterLtSlash();
|
errGarbageAfterLtSlash();
|
||||||
}
|
}
|
||||||
clearLongStrBufAndAppend('\n');
|
clearLongStrBufAndAppend('\n');
|
||||||
|
@ -1877,7 +1877,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
state = P::transition(mViewSource, NS_HTML5TOKENIZER_TAG_NAME, reconsume, pos);
|
state = P::transition(mViewSource, NS_HTML5TOKENIZER_TAG_NAME, reconsume, pos);
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
} else {
|
} else {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errGarbageAfterLtSlash();
|
errGarbageAfterLtSlash();
|
||||||
}
|
}
|
||||||
clearLongStrBufAndAppend(c);
|
clearLongStrBufAndAppend(c);
|
||||||
|
@ -2625,7 +2625,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
if (folded == nsHtml5Tokenizer::OCTYPE[index]) {
|
if (folded == nsHtml5Tokenizer::OCTYPE[index]) {
|
||||||
appendLongStrBuf(c);
|
appendLongStrBuf(c);
|
||||||
} else {
|
} else {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errBogusComment();
|
errBogusComment();
|
||||||
}
|
}
|
||||||
state = P::transition(mViewSource, NS_HTML5TOKENIZER_BOGUS_COMMENT, reconsume, pos);
|
state = P::transition(mViewSource, NS_HTML5TOKENIZER_BOGUS_COMMENT, reconsume, pos);
|
||||||
|
@ -2669,7 +2669,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_BREAK(doctypeloop);
|
NS_HTML5_BREAK(doctypeloop);
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errMissingSpaceBeforeDoctypeName();
|
errMissingSpaceBeforeDoctypeName();
|
||||||
}
|
}
|
||||||
state = P::transition(mViewSource, NS_HTML5TOKENIZER_BEFORE_DOCTYPE_NAME, reconsume, pos);
|
state = P::transition(mViewSource, NS_HTML5TOKENIZER_BEFORE_DOCTYPE_NAME, reconsume, pos);
|
||||||
|
@ -2704,7 +2704,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case '>': {
|
case '>': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNamelessDoctype();
|
errNamelessDoctype();
|
||||||
}
|
}
|
||||||
forceQuirks = true;
|
forceQuirks = true;
|
||||||
|
@ -2868,7 +2868,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_BREAK(afterdoctypepublickeywordloop);
|
NS_HTML5_BREAK(afterdoctypepublickeywordloop);
|
||||||
}
|
}
|
||||||
case '\"': {
|
case '\"': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNoSpaceBetweenDoctypePublicKeywordAndQuote();
|
errNoSpaceBetweenDoctypePublicKeywordAndQuote();
|
||||||
}
|
}
|
||||||
clearLongStrBuf();
|
clearLongStrBuf();
|
||||||
|
@ -2876,7 +2876,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
case '\'': {
|
case '\'': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNoSpaceBetweenDoctypePublicKeywordAndQuote();
|
errNoSpaceBetweenDoctypePublicKeywordAndQuote();
|
||||||
}
|
}
|
||||||
clearLongStrBuf();
|
clearLongStrBuf();
|
||||||
|
@ -2884,7 +2884,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
case '>': {
|
case '>': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errExpectedPublicId();
|
errExpectedPublicId();
|
||||||
}
|
}
|
||||||
forceQuirks = true;
|
forceQuirks = true;
|
||||||
|
@ -2931,7 +2931,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
case '>': {
|
case '>': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errExpectedPublicId();
|
errExpectedPublicId();
|
||||||
}
|
}
|
||||||
forceQuirks = true;
|
forceQuirks = true;
|
||||||
|
@ -2961,7 +2961,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_BREAK(doctypepublicidentifierdoublequotedloop);
|
NS_HTML5_BREAK(doctypepublicidentifierdoublequotedloop);
|
||||||
}
|
}
|
||||||
case '>': {
|
case '>': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errGtInPublicId();
|
errGtInPublicId();
|
||||||
}
|
}
|
||||||
forceQuirks = true;
|
forceQuirks = true;
|
||||||
|
@ -3016,7 +3016,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
case '\"': {
|
case '\"': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNoSpaceBetweenPublicAndSystemIds();
|
errNoSpaceBetweenPublicAndSystemIds();
|
||||||
}
|
}
|
||||||
clearLongStrBuf();
|
clearLongStrBuf();
|
||||||
|
@ -3024,7 +3024,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
case '\'': {
|
case '\'': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNoSpaceBetweenPublicAndSystemIds();
|
errNoSpaceBetweenPublicAndSystemIds();
|
||||||
}
|
}
|
||||||
clearLongStrBuf();
|
clearLongStrBuf();
|
||||||
|
@ -3096,7 +3096,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
case '>': {
|
case '>': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errGtInSystemId();
|
errGtInSystemId();
|
||||||
}
|
}
|
||||||
forceQuirks = true;
|
forceQuirks = true;
|
||||||
|
@ -3239,7 +3239,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_BREAK(afterdoctypesystemkeywordloop);
|
NS_HTML5_BREAK(afterdoctypesystemkeywordloop);
|
||||||
}
|
}
|
||||||
case '\"': {
|
case '\"': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNoSpaceBetweenDoctypeSystemKeywordAndQuote();
|
errNoSpaceBetweenDoctypeSystemKeywordAndQuote();
|
||||||
}
|
}
|
||||||
clearLongStrBuf();
|
clearLongStrBuf();
|
||||||
|
@ -3247,7 +3247,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
case '\'': {
|
case '\'': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errNoSpaceBetweenDoctypeSystemKeywordAndQuote();
|
errNoSpaceBetweenDoctypeSystemKeywordAndQuote();
|
||||||
}
|
}
|
||||||
clearLongStrBuf();
|
clearLongStrBuf();
|
||||||
|
@ -3255,7 +3255,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
case '>': {
|
case '>': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errExpectedPublicId();
|
errExpectedPublicId();
|
||||||
}
|
}
|
||||||
forceQuirks = true;
|
forceQuirks = true;
|
||||||
|
@ -3302,7 +3302,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_BREAK(beforedoctypesystemidentifierloop);
|
NS_HTML5_BREAK(beforedoctypesystemidentifierloop);
|
||||||
}
|
}
|
||||||
case '>': {
|
case '>': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errExpectedSystemId();
|
errExpectedSystemId();
|
||||||
}
|
}
|
||||||
forceQuirks = true;
|
forceQuirks = true;
|
||||||
|
@ -3332,7 +3332,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
case '>': {
|
case '>': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errGtInSystemId();
|
errGtInSystemId();
|
||||||
}
|
}
|
||||||
forceQuirks = true;
|
forceQuirks = true;
|
||||||
|
@ -3372,7 +3372,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
case '>': {
|
case '>': {
|
||||||
if (P::viewingSource) {
|
if (P::reportErrors) {
|
||||||
errGtInPublicId();
|
errGtInPublicId();
|
||||||
}
|
}
|
||||||
forceQuirks = true;
|
forceQuirks = true;
|
||||||
|
|
|
@ -64,67 +64,79 @@ nsHtml5Tokenizer::errWarnLtSlashInRcdata()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The null checks below annotated NS_LIKELY are not actually necessary.
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errUnquotedAttributeValOrNull(PRUnichar c)
|
nsHtml5Tokenizer::errUnquotedAttributeValOrNull(PRUnichar c)
|
||||||
{
|
{
|
||||||
switch (c) {
|
if (NS_LIKELY(mViewSource)) {
|
||||||
case '<':
|
switch (c) {
|
||||||
mViewSource->AddErrorToCurrentNode("errUnquotedAttributeLt");
|
case '<':
|
||||||
return;
|
mViewSource->AddErrorToCurrentNode("errUnquotedAttributeLt");
|
||||||
case '`':
|
return;
|
||||||
mViewSource->AddErrorToCurrentNode("errUnquotedAttributeGrave");
|
case '`':
|
||||||
return;
|
mViewSource->AddErrorToCurrentNode("errUnquotedAttributeGrave");
|
||||||
case '\'':
|
return;
|
||||||
case '"':
|
case '\'':
|
||||||
mViewSource->AddErrorToCurrentNode("errUnquotedAttributeQuote");
|
case '"':
|
||||||
return;
|
mViewSource->AddErrorToCurrentNode("errUnquotedAttributeQuote");
|
||||||
case '=':
|
return;
|
||||||
mViewSource->AddErrorToCurrentNode("errUnquotedAttributeEquals");
|
case '=':
|
||||||
return;
|
mViewSource->AddErrorToCurrentNode("errUnquotedAttributeEquals");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errLtOrEqualsOrGraveInUnquotedAttributeOrNull(PRUnichar c)
|
nsHtml5Tokenizer::errLtOrEqualsOrGraveInUnquotedAttributeOrNull(PRUnichar c)
|
||||||
{
|
{
|
||||||
switch (c) {
|
if (NS_LIKELY(mViewSource)) {
|
||||||
case '=':
|
switch (c) {
|
||||||
mViewSource->AddErrorToCurrentNode("errUnquotedAttributeStartEquals");
|
case '=':
|
||||||
return;
|
mViewSource->AddErrorToCurrentNode("errUnquotedAttributeStartEquals");
|
||||||
case '<':
|
return;
|
||||||
mViewSource->AddErrorToCurrentNode("errUnquotedAttributeStartLt");
|
case '<':
|
||||||
return;
|
mViewSource->AddErrorToCurrentNode("errUnquotedAttributeStartLt");
|
||||||
case '`':
|
return;
|
||||||
mViewSource->AddErrorToCurrentNode("errUnquotedAttributeStartGrave");
|
case '`':
|
||||||
return;
|
mViewSource->AddErrorToCurrentNode("errUnquotedAttributeStartGrave");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errBadCharBeforeAttributeNameOrNull(PRUnichar c)
|
nsHtml5Tokenizer::errBadCharBeforeAttributeNameOrNull(PRUnichar c)
|
||||||
{
|
{
|
||||||
if (c == '<') {
|
if (NS_LIKELY(mViewSource)) {
|
||||||
mViewSource->AddErrorToCurrentNode("errBadCharBeforeAttributeNameLt");
|
if (c == '<') {
|
||||||
} else if (c == '=') {
|
mViewSource->AddErrorToCurrentNode("errBadCharBeforeAttributeNameLt");
|
||||||
errEqualsSignBeforeAttributeName();
|
} else if (c == '=') {
|
||||||
} else if (c != 0xFFFD) {
|
errEqualsSignBeforeAttributeName();
|
||||||
errQuoteBeforeAttributeName(c);
|
} else if (c != 0xFFFD) {
|
||||||
|
errQuoteBeforeAttributeName(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errBadCharAfterLt(PRUnichar c)
|
nsHtml5Tokenizer::errBadCharAfterLt(PRUnichar c)
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errBadCharAfterLt");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errBadCharAfterLt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errQuoteOrLtInAttributeNameOrNull(PRUnichar c)
|
nsHtml5Tokenizer::errQuoteOrLtInAttributeNameOrNull(PRUnichar c)
|
||||||
{
|
{
|
||||||
if (c == '<') {
|
if (NS_LIKELY(mViewSource)) {
|
||||||
mViewSource->AddErrorToCurrentNode("errLtInAttributeName");
|
if (c == '<') {
|
||||||
} else if (c != 0xFFFD) {
|
mViewSource->AddErrorToCurrentNode("errLtInAttributeName");
|
||||||
mViewSource->AddErrorToCurrentNode("errQuoteInAttributeName");
|
} else if (c != 0xFFFD) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errQuoteInAttributeName");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,13 +189,17 @@ nsHtml5Tokenizer::errNcrControlChar(PRUnichar ch)
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errGarbageAfterLtSlash()
|
nsHtml5Tokenizer::errGarbageAfterLtSlash()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errGarbageAfterLtSlash");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errGarbageAfterLtSlash");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errLtSlashGt()
|
nsHtml5Tokenizer::errLtSlashGt()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errLtSlashGt");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errLtSlashGt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -205,19 +221,25 @@ nsHtml5Tokenizer::errNoDigitsInNCR()
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errGtInSystemId()
|
nsHtml5Tokenizer::errGtInSystemId()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errGtInSystemId");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errGtInSystemId");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errGtInPublicId()
|
nsHtml5Tokenizer::errGtInPublicId()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errGtInPublicId");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errGtInPublicId");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errNamelessDoctype()
|
nsHtml5Tokenizer::errNamelessDoctype()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errNamelessDoctype");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errNamelessDoctype");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -231,7 +253,9 @@ nsHtml5Tokenizer::errConsecutiveHyphens()
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errPrematureEndOfComment()
|
nsHtml5Tokenizer::errPrematureEndOfComment()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errPrematureEndOfComment");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errPrematureEndOfComment");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -245,37 +269,49 @@ nsHtml5Tokenizer::errBogusComment()
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errSlashNotFollowedByGt()
|
nsHtml5Tokenizer::errSlashNotFollowedByGt()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentSlash("errSlashNotFollowedByGt");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentSlash("errSlashNotFollowedByGt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errNoSpaceBetweenAttributes()
|
nsHtml5Tokenizer::errNoSpaceBetweenAttributes()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errNoSpaceBetweenAttributes");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errNoSpaceBetweenAttributes");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errAttributeValueMissing()
|
nsHtml5Tokenizer::errAttributeValueMissing()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errAttributeValueMissing");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errAttributeValueMissing");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errEqualsSignBeforeAttributeName()
|
nsHtml5Tokenizer::errEqualsSignBeforeAttributeName()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errEqualsSignBeforeAttributeName");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errEqualsSignBeforeAttributeName");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errLtGt()
|
nsHtml5Tokenizer::errLtGt()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errLtGt");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errLtGt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errProcessingInstruction()
|
nsHtml5Tokenizer::errProcessingInstruction()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errProcessingInstruction");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errProcessingInstruction");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -305,13 +341,17 @@ nsHtml5Tokenizer::errNoNamedCharacterMatch()
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errQuoteBeforeAttributeName(PRUnichar c)
|
nsHtml5Tokenizer::errQuoteBeforeAttributeName(PRUnichar c)
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errQuoteBeforeAttributeName");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errQuoteBeforeAttributeName");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errExpectedPublicId()
|
nsHtml5Tokenizer::errExpectedPublicId()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errExpectedPublicId");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errExpectedPublicId");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -453,19 +493,25 @@ nsHtml5Tokenizer::errEofInSystemId()
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errExpectedSystemId()
|
nsHtml5Tokenizer::errExpectedSystemId()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errExpectedSystemId");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errExpectedSystemId");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errMissingSpaceBeforeDoctypeName()
|
nsHtml5Tokenizer::errMissingSpaceBeforeDoctypeName()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errMissingSpaceBeforeDoctypeName");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errMissingSpaceBeforeDoctypeName");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errHyphenHyphenBang()
|
nsHtml5Tokenizer::errHyphenHyphenBang()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errHyphenHyphenBang");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errHyphenHyphenBang");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -487,17 +533,23 @@ nsHtml5Tokenizer::errNcrZero()
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errNoSpaceBetweenDoctypeSystemKeywordAndQuote()
|
nsHtml5Tokenizer::errNoSpaceBetweenDoctypeSystemKeywordAndQuote()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errNoSpaceBetweenDoctypeSystemKeywordAndQuote");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errNoSpaceBetweenDoctypeSystemKeywordAndQuote");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errNoSpaceBetweenPublicAndSystemIds()
|
nsHtml5Tokenizer::errNoSpaceBetweenPublicAndSystemIds()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errNoSpaceBetweenPublicAndSystemIds");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errNoSpaceBetweenPublicAndSystemIds");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5Tokenizer::errNoSpaceBetweenDoctypePublicKeywordAndQuote()
|
nsHtml5Tokenizer::errNoSpaceBetweenDoctypePublicKeywordAndQuote()
|
||||||
{
|
{
|
||||||
mViewSource->AddErrorToCurrentNode("errNoSpaceBetweenDoctypePublicKeywordAndQuote");
|
if (NS_LIKELY(mViewSource)) {
|
||||||
|
mViewSource->AddErrorToCurrentNode("errNoSpaceBetweenDoctypePublicKeywordAndQuote");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,13 @@
|
||||||
#ifndef nsHtml5TokenizerLoopPolicies_h_
|
#ifndef nsHtml5TokenizerLoopPolicies_h_
|
||||||
#define nsHtml5TokenizerLoopPolicies_h_
|
#define nsHtml5TokenizerLoopPolicies_h_
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This policy does not report tokenizer transitions anywhere. To be used
|
||||||
|
* when _not_ viewing source.
|
||||||
|
*/
|
||||||
struct nsHtml5SilentPolicy
|
struct nsHtml5SilentPolicy
|
||||||
{
|
{
|
||||||
static const bool viewingSource = false;
|
static const bool reportErrors = false;
|
||||||
static PRInt32 transition(nsHtml5Highlighter* aHighlighter,
|
static PRInt32 transition(nsHtml5Highlighter* aHighlighter,
|
||||||
PRInt32 aState,
|
PRInt32 aState,
|
||||||
bool aReconsume,
|
bool aReconsume,
|
||||||
|
@ -51,9 +55,13 @@ struct nsHtml5SilentPolicy
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This policy reports the tokenizer transitions to a highlighter. To be used
|
||||||
|
* when viewing source.
|
||||||
|
*/
|
||||||
struct nsHtml5ViewSourcePolicy
|
struct nsHtml5ViewSourcePolicy
|
||||||
{
|
{
|
||||||
static const bool viewingSource = true;
|
static const bool reportErrors = true;
|
||||||
static PRInt32 transition(nsHtml5Highlighter* aHighlighter,
|
static PRInt32 transition(nsHtml5Highlighter* aHighlighter,
|
||||||
PRInt32 aState,
|
PRInt32 aState,
|
||||||
bool aReconsume,
|
bool aReconsume,
|
||||||
|
|
|
@ -58,6 +58,29 @@
|
||||||
*/
|
*/
|
||||||
void documentMode(nsHtml5DocumentMode m);
|
void documentMode(nsHtml5DocumentMode m);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Using nsIContent** instead of nsIContent* is the parser deals with DOM
|
||||||
|
* nodes in a way that works off the main thread. Non-main-thread code
|
||||||
|
* can't refcount or otherwise touch nsIContent objects in any way.
|
||||||
|
* Yet, the off-the-main-thread code needs to have a way to hold onto a
|
||||||
|
* particular node and repeatedly operate on the same node.
|
||||||
|
*
|
||||||
|
* The way this works is that the off-the-main-thread code has an
|
||||||
|
* nsIContent** for each DOM node and a given nsIContent** is only ever
|
||||||
|
* actually dereferenced into an actual nsIContent* on the main thread.
|
||||||
|
* When the off-the-main-thread code requests a new node, it gets an
|
||||||
|
* nsIContent** immediately and a tree op is enqueued for later allocating
|
||||||
|
* an actual nsIContent object and writing a pointer to it into the memory
|
||||||
|
* location pointed to by the nsIContent**.
|
||||||
|
*
|
||||||
|
* Since tree ops are in a queue, the node creating tree op will always
|
||||||
|
* run before tree ops that try to further operate on the node that the
|
||||||
|
* nsIContent** is a handle to.
|
||||||
|
*
|
||||||
|
* On-the-main-thread parts of the parser use the same mechanism in order
|
||||||
|
* to avoid having to have duplicate code paths for on-the-main-thread and
|
||||||
|
* off-the-main-thread tree builder instances.)
|
||||||
|
*/
|
||||||
nsIContent** AllocateContentHandle();
|
nsIContent** AllocateContentHandle();
|
||||||
|
|
||||||
void accumulateCharactersForced(const PRUnichar* aBuf, PRInt32 aStart, PRInt32 aLength)
|
void accumulateCharactersForced(const PRUnichar* aBuf, PRInt32 aStart, PRInt32 aLength)
|
||||||
|
|
|
@ -905,6 +905,8 @@ nsHtml5TreeOpExecutor::GetViewSourceBaseURI()
|
||||||
NS_ASSERTION(nested, "URI with scheme view-source didn't QI to nested!");
|
NS_ASSERTION(nested, "URI with scheme view-source didn't QI to nested!");
|
||||||
nested->GetInnerURI(getter_AddRefs(mViewSourceBaseURI));
|
nested->GetInnerURI(getter_AddRefs(mViewSourceBaseURI));
|
||||||
} else {
|
} else {
|
||||||
|
// Fail gracefully if the base URL isn't a view-source: URL.
|
||||||
|
// Not sure if this can ever happen.
|
||||||
mViewSourceBaseURI = orig;
|
mViewSourceBaseURI = orig;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -715,6 +715,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||||
nsIContent* node = *(mOne.node);
|
nsIContent* node = *(mOne.node);
|
||||||
PRUnichar* str = mTwo.unicharPtr;
|
PRUnichar* str = mTwo.unicharPtr;
|
||||||
nsDependentString depStr(str);
|
nsDependentString depStr(str);
|
||||||
|
// See viewsource.css for the possible classes
|
||||||
nsAutoString klass;
|
nsAutoString klass;
|
||||||
node->GetAttr(kNameSpaceID_None, nsGkAtoms::_class, klass);
|
node->GetAttr(kNameSpaceID_None, nsGkAtoms::_class, klass);
|
||||||
if (!klass.IsEmpty()) {
|
if (!klass.IsEmpty()) {
|
||||||
|
@ -760,8 +761,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||||
rv = NS_URIChainHasFlags(uri,
|
rv = NS_URIChainHasFlags(uri,
|
||||||
nsIProtocolHandler::URI_OPENING_EXECUTES_SCRIPT,
|
nsIProtocolHandler::URI_OPENING_EXECUTES_SCRIPT,
|
||||||
&openingExecutesScript);
|
&openingExecutesScript);
|
||||||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
if (NS_FAILED(rv) || openingExecutesScript) {
|
||||||
if (openingExecutesScript) {
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -795,6 +795,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||||
char* msgId = mTwo.charPtr;
|
char* msgId = mTwo.charPtr;
|
||||||
nsCOMPtr<nsIAtom> atom = Reget(mThree.atom);
|
nsCOMPtr<nsIAtom> atom = Reget(mThree.atom);
|
||||||
nsCOMPtr<nsIAtom> otherAtom = Reget(mFour.atom);
|
nsCOMPtr<nsIAtom> otherAtom = Reget(mFour.atom);
|
||||||
|
// See viewsource.css for the possible classes in addition to "error".
|
||||||
nsAutoString klass;
|
nsAutoString klass;
|
||||||
node->GetAttr(kNameSpaceID_None, nsGkAtoms::_class, klass);
|
node->GetAttr(kNameSpaceID_None, nsGkAtoms::_class, klass);
|
||||||
if (!klass.IsEmpty()) {
|
if (!klass.IsEmpty()) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче