Bug 551344 part 6 - Address more review comments from sicking in the Java parts of the HTML5 parser. r=jonas.

--HG--
extra : rebase_source : b89e63cce5869fc0518eacc1102f0d1b4b12d356
This commit is contained in:
Henri Sivonen 2010-04-19 16:25:13 +03:00
parent 79f934beea
commit 3f683051fc
27 changed files with 3558 additions and 3617 deletions

View File

@ -39,7 +39,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
private final boolean framesetOk;
private final int foreignFlag;
private final boolean inForeign;
private final boolean needToDropLF;
@ -56,7 +56,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
* @param mode
*/
StateSnapshot(StackNode<T>[] stack,
StackNode<T>[] listOfActiveFormattingElements, T formPointer, T headPointer, int mode, int originalMode, boolean framesetOk, int foreignFlag, boolean needToDropLF, boolean quirks) {
StackNode<T>[] listOfActiveFormattingElements, T formPointer, T headPointer, int mode, int originalMode, boolean framesetOk, boolean inForeign, boolean needToDropLF, boolean quirks) {
this.stack = stack;
this.listOfActiveFormattingElements = listOfActiveFormattingElements;
this.formPointer = formPointer;
@ -64,7 +64,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
this.mode = mode;
this.originalMode = originalMode;
this.framesetOk = framesetOk;
this.foreignFlag = foreignFlag;
this.inForeign = inForeign;
this.needToDropLF = needToDropLF;
this.quirks = quirks;
}
@ -127,12 +127,12 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
}
/**
* Returns the foreignFlag.
* Returns the inForeign.
*
* @return the foreignFlag
* @return the inForeign
*/
public int getForeignFlag() {
return foreignFlag;
public boolean isInForeign() {
return inForeign;
}
/**

View File

@ -68,7 +68,7 @@ public class Tokenizer implements Locator {
private static final int DATA_AND_RCDATA_MASK = ~1;
public static final int DATA = 0;
public static final int DATA = 0;
public static final int RCDATA = 1;
@ -2443,7 +2443,7 @@ public class Tokenizer implements Locator {
state = Tokenizer.MARKUP_DECLARATION_OCTYPE;
continue stateloop;
case '[':
if (tokenHandler.inForeign()) {
if (tokenHandler.isInForeign()) {
clearLongStrBufAndAppend(c);
index = 0;
state = Tokenizer.CDATA_START;

File diff suppressed because it is too large Load Diff

View File

@ -38,6 +38,11 @@
#ifndef nsAHtml5TreeBuilderState_h___
#define nsAHtml5TreeBuilderState_h___
/**
* Interface for exposing the internal state of the HTML5 tree builder.
* For more documentation, please see
* http://hg.mozilla.org/projects/htmlparser/file/tip/src/nu/validator/htmlparser/impl/StateSnapshot.java
*/
class nsAHtml5TreeBuilderState {
public:
@ -59,7 +64,7 @@ class nsAHtml5TreeBuilderState {
virtual PRBool isFramesetOk() = 0;
virtual PRInt32 getForeignFlag() = 0;
virtual PRBool isInForeign() = 0;
virtual PRBool isNeedToDropLF() = 0;

View File

@ -9,7 +9,6 @@ HTML5_ATOM(noframes, "noframes")
HTML5_ATOM(noscript, "noscript")
HTML5_ATOM(plaintext, "plaintext")
HTML5_ATOM(script, "script")
HTML5_ATOM(table, "table")
HTML5_ATOM(caption, "caption")
HTML5_ATOM(p, "p")
HTML5_ATOM(address, "address")
@ -21,6 +20,7 @@ HTML5_ATOM(option, "option")
HTML5_ATOM(ruby, "ruby")
HTML5_ATOM(select, "select")
HTML5_ATOM(optgroup, "optgroup")
HTML5_ATOM(table, "table")
HTML5_ATOM(frameset, "frameset")
HTML5_ATOM(ul, "ul")
HTML5_ATOM(ol, "ol")

View File

@ -43,6 +43,7 @@
#include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h"
#include "nsAHtml5TreeBuilderState.h"
#include "nsHtml5Macros.h"
#include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h"

View File

@ -44,6 +44,7 @@
#include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h"
#include "nsAHtml5TreeBuilderState.h"
#include "nsHtml5Macros.h"
class nsHtml5StreamParser;

View File

@ -43,6 +43,7 @@
#include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h"
#include "nsAHtml5TreeBuilderState.h"
#include "nsHtml5Macros.h"
#include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h"

View File

@ -44,6 +44,7 @@
#include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h"
#include "nsAHtml5TreeBuilderState.h"
#include "nsHtml5Macros.h"
class nsHtml5StreamParser;

View File

@ -44,6 +44,7 @@
#include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h"
#include "nsAHtml5TreeBuilderState.h"
#include "nsHtml5Macros.h"
#include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h"

View File

@ -45,6 +45,7 @@
#include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h"
#include "nsAHtml5TreeBuilderState.h"
#include "nsHtml5Macros.h"
class nsHtml5StreamParser;

View File

@ -0,0 +1,47 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is HTML Parser C++ Translator code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henri Sivonen <hsivonen@iki.fi>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsHtml5Macros_h_
#define nsHtml5Macros_h_
#define NS_HTML5_CONTINUE(target) \
goto target
#define NS_HTML5_BREAK(target) \
goto target ## _end
#endif /* nsHtml5Macros_h_ */

View File

@ -44,6 +44,7 @@
#include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h"
#include "nsAHtml5TreeBuilderState.h"
#include "nsHtml5Macros.h"
#include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h"
@ -73,11 +74,11 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
}
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case '<': {
state = NS_HTML5META_SCANNER_TAG_OPEN;
goto dataloop_end;
NS_HTML5_BREAK(dataloop);
}
default: {
continue;
@ -91,36 +92,36 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
c = read();
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case 'm':
case 'M': {
metaState = NS_HTML5META_SCANNER_M;
state = NS_HTML5META_SCANNER_TAG_NAME;
goto tagopenloop_end;
NS_HTML5_BREAK(tagopenloop);
}
case '!': {
state = NS_HTML5META_SCANNER_MARKUP_DECLARATION_OPEN;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case '\?':
case '/': {
state = NS_HTML5META_SCANNER_SCAN_UNTIL_GT;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case '>': {
state = NS_HTML5META_SCANNER_DATA;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
default: {
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
metaState = NS_HTML5META_SCANNER_NO;
state = NS_HTML5META_SCANNER_TAG_NAME;
goto tagopenloop_end;
NS_HTML5_BREAK(tagopenloop);
}
state = NS_HTML5META_SCANNER_DATA;
reconsume = PR_TRUE;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
}
}
@ -131,22 +132,22 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
c = read();
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case ' ':
case '\t':
case '\n':
case '\f': {
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME;
goto tagnameloop_end;
NS_HTML5_BREAK(tagnameloop);
}
case '/': {
state = NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case '>': {
state = NS_HTML5META_SCANNER_DATA;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case 'e':
case 'E': {
@ -192,7 +193,7 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
}
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case ' ':
case '\t':
@ -202,24 +203,24 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
}
case '/': {
state = NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case '>': {
state = NS_HTML5META_SCANNER_DATA;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case 'c':
case 'C': {
contentIndex = 0;
charsetIndex = 0;
state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
goto beforeattributenameloop_end;
NS_HTML5_BREAK(beforeattributenameloop);
}
default: {
contentIndex = -1;
charsetIndex = -1;
state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
goto beforeattributenameloop_end;
NS_HTML5_BREAK(beforeattributenameloop);
}
}
}
@ -230,27 +231,27 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
c = read();
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case ' ':
case '\t':
case '\n':
case '\f': {
state = NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_NAME;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case '/': {
state = NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case '=': {
strBufLen = 0;
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_VALUE;
goto attributenameloop_end;
NS_HTML5_BREAK(attributenameloop);
}
case '>': {
state = NS_HTML5META_SCANNER_DATA;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
default: {
if (metaState == NS_HTML5META_SCANNER_A) {
@ -279,7 +280,7 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
c = read();
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case ' ':
case '\t':
@ -289,22 +290,22 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
}
case '\"': {
state = NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_DOUBLE_QUOTED;
goto beforeattributevalueloop_end;
NS_HTML5_BREAK(beforeattributevalueloop);
}
case '\'': {
state = NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_SINGLE_QUOTED;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case '>': {
state = NS_HTML5META_SCANNER_DATA;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
default: {
if (charsetIndex == 6 || contentIndex == 6) {
addToBuffer(c);
}
state = NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_UNQUOTED;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
}
}
@ -319,14 +320,14 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
}
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case '\"': {
if (tryCharset()) {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
state = NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_VALUE_QUOTED;
goto attributevaluedoublequotedloop_end;
NS_HTML5_BREAK(attributevaluedoublequotedloop);
}
default: {
if (metaState == NS_HTML5META_SCANNER_A && (contentIndex == 6 || charsetIndex == 6)) {
@ -343,27 +344,27 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
c = read();
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case ' ':
case '\t':
case '\n':
case '\f': {
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case '/': {
state = NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG;
goto afterattributevaluequotedloop_end;
NS_HTML5_BREAK(afterattributevaluequotedloop);
}
case '>': {
state = NS_HTML5META_SCANNER_DATA;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
default: {
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME;
reconsume = PR_TRUE;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
}
}
@ -373,16 +374,16 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
c = read();
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case '>': {
state = NS_HTML5META_SCANNER_DATA;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
default: {
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME;
reconsume = PR_TRUE;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
}
}
@ -395,24 +396,24 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
}
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case ' ':
case '\t':
case '\n':
case '\f': {
if (tryCharset()) {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case '>': {
if (tryCharset()) {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
state = NS_HTML5META_SCANNER_DATA;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
default: {
if (metaState == NS_HTML5META_SCANNER_A && (contentIndex == 6 || charsetIndex == 6)) {
@ -428,7 +429,7 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
c = read();
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case ' ':
case '\t':
@ -438,34 +439,34 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
}
case '/': {
if (tryCharset()) {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
state = NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case '=': {
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_VALUE;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case '>': {
if (tryCharset()) {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
state = NS_HTML5META_SCANNER_DATA;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case 'c':
case 'C': {
contentIndex = 0;
charsetIndex = 0;
state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
default: {
contentIndex = -1;
charsetIndex = -1;
state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
}
}
@ -475,16 +476,16 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
c = read();
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case '-': {
state = NS_HTML5META_SCANNER_MARKUP_DECLARATION_HYPHEN;
goto markupdeclarationopenloop_end;
NS_HTML5_BREAK(markupdeclarationopenloop);
}
default: {
state = NS_HTML5META_SCANNER_SCAN_UNTIL_GT;
reconsume = PR_TRUE;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
}
}
@ -495,16 +496,16 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
c = read();
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case '-': {
state = NS_HTML5META_SCANNER_COMMENT_START;
goto markupdeclarationhyphenloop_end;
NS_HTML5_BREAK(markupdeclarationhyphenloop);
}
default: {
state = NS_HTML5META_SCANNER_SCAN_UNTIL_GT;
reconsume = PR_TRUE;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
}
}
@ -515,19 +516,19 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
c = read();
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case '-': {
state = NS_HTML5META_SCANNER_COMMENT_START_DASH;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case '>': {
state = NS_HTML5META_SCANNER_DATA;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
default: {
state = NS_HTML5META_SCANNER_COMMENT;
goto commentstartloop_end;
NS_HTML5_BREAK(commentstartloop);
}
}
}
@ -538,11 +539,11 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
c = read();
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case '-': {
state = NS_HTML5META_SCANNER_COMMENT_END_DASH;
goto commentloop_end;
NS_HTML5_BREAK(commentloop);
}
default: {
continue;
@ -556,15 +557,15 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
c = read();
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case '-': {
state = NS_HTML5META_SCANNER_COMMENT_END;
goto commentenddashloop_end;
NS_HTML5_BREAK(commentenddashloop);
}
default: {
state = NS_HTML5META_SCANNER_COMMENT;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
}
}
@ -575,18 +576,18 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
c = read();
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case '>': {
state = NS_HTML5META_SCANNER_DATA;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case '-': {
continue;
}
default: {
state = NS_HTML5META_SCANNER_COMMENT;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
}
}
@ -595,19 +596,19 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
c = read();
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case '-': {
state = NS_HTML5META_SCANNER_COMMENT_END;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
case '>': {
state = NS_HTML5META_SCANNER_DATA;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
default: {
state = NS_HTML5META_SCANNER_COMMENT;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
}
}
@ -620,14 +621,14 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
}
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case '\'': {
if (tryCharset()) {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
state = NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_VALUE_QUOTED;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
default: {
if (metaState == NS_HTML5META_SCANNER_A && (contentIndex == 6 || charsetIndex == 6)) {
@ -647,11 +648,11 @@ nsHtml5MetaScanner::stateLoop(PRInt32 state)
}
switch(c) {
case -1: {
goto stateloop_end;
NS_HTML5_BREAK(stateloop);
}
case '>': {
state = NS_HTML5META_SCANNER_DATA;
goto stateloop;
NS_HTML5_CONTINUE(stateloop);
}
default: {
continue;

View File

@ -45,6 +45,7 @@
#include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h"
#include "nsAHtml5TreeBuilderState.h"
#include "nsHtml5Macros.h"
class nsHtml5StreamParser;

View File

@ -44,6 +44,7 @@
#include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h"
#include "nsAHtml5TreeBuilderState.h"
#include "nsHtml5Macros.h"
class nsHtml5StreamParser;

View File

@ -44,6 +44,7 @@
#include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h"
#include "nsAHtml5TreeBuilderState.h"
#include "nsHtml5Macros.h"
#include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h"

View File

@ -45,6 +45,7 @@
#include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h"
#include "nsAHtml5TreeBuilderState.h"
#include "nsHtml5Macros.h"
class nsHtml5StreamParser;

View File

@ -43,6 +43,7 @@
#include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h"
#include "nsAHtml5TreeBuilderState.h"
#include "nsHtml5Macros.h"
#include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h"
@ -57,7 +58,7 @@
#include "nsHtml5StateSnapshot.h"
nsHtml5StateSnapshot::nsHtml5StateSnapshot(jArray<nsHtml5StackNode*,PRInt32> stack, jArray<nsHtml5StackNode*,PRInt32> listOfActiveFormattingElements, nsIContent** formPointer, nsIContent** headPointer, PRInt32 mode, PRInt32 originalMode, PRBool framesetOk, PRInt32 foreignFlag, PRBool needToDropLF, PRBool quirks)
nsHtml5StateSnapshot::nsHtml5StateSnapshot(jArray<nsHtml5StackNode*,PRInt32> stack, jArray<nsHtml5StackNode*,PRInt32> listOfActiveFormattingElements, nsIContent** formPointer, nsIContent** headPointer, PRInt32 mode, PRInt32 originalMode, PRBool framesetOk, PRBool inForeign, PRBool needToDropLF, PRBool quirks)
: stack(stack),
listOfActiveFormattingElements(listOfActiveFormattingElements),
formPointer(formPointer),
@ -65,7 +66,7 @@ nsHtml5StateSnapshot::nsHtml5StateSnapshot(jArray<nsHtml5StackNode*,PRInt32> sta
mode(mode),
originalMode(originalMode),
framesetOk(framesetOk),
foreignFlag(foreignFlag),
inForeign(inForeign),
needToDropLF(needToDropLF),
quirks(quirks)
{
@ -114,10 +115,10 @@ nsHtml5StateSnapshot::isFramesetOk()
return framesetOk;
}
PRInt32
nsHtml5StateSnapshot::getForeignFlag()
PRBool
nsHtml5StateSnapshot::isInForeign()
{
return foreignFlag;
return inForeign;
}
PRBool
@ -153,7 +154,7 @@ nsHtml5StateSnapshot::~nsHtml5StateSnapshot()
}
stack.release();
for (PRInt32 i = 0; i < listOfActiveFormattingElements.length; i++) {
if (!!listOfActiveFormattingElements[i]) {
if (listOfActiveFormattingElements[i]) {
listOfActiveFormattingElements[i]->release();
}
}

View File

@ -44,6 +44,7 @@
#include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h"
#include "nsAHtml5TreeBuilderState.h"
#include "nsHtml5Macros.h"
class nsHtml5StreamParser;
@ -67,11 +68,11 @@ class nsHtml5StateSnapshot : public nsAHtml5TreeBuilderState
PRInt32 mode;
PRInt32 originalMode;
PRBool framesetOk;
PRInt32 foreignFlag;
PRBool inForeign;
PRBool needToDropLF;
PRBool quirks;
public:
nsHtml5StateSnapshot(jArray<nsHtml5StackNode*,PRInt32> stack, jArray<nsHtml5StackNode*,PRInt32> listOfActiveFormattingElements, nsIContent** formPointer, nsIContent** headPointer, PRInt32 mode, PRInt32 originalMode, PRBool framesetOk, PRInt32 foreignFlag, PRBool needToDropLF, PRBool quirks);
nsHtml5StateSnapshot(jArray<nsHtml5StackNode*,PRInt32> stack, jArray<nsHtml5StackNode*,PRInt32> listOfActiveFormattingElements, nsIContent** formPointer, nsIContent** headPointer, PRInt32 mode, PRInt32 originalMode, PRBool framesetOk, PRBool inForeign, PRBool needToDropLF, PRBool quirks);
jArray<nsHtml5StackNode*,PRInt32> getStack();
jArray<nsHtml5StackNode*,PRInt32> getListOfActiveFormattingElements();
nsIContent** getFormPointer();
@ -79,7 +80,7 @@ class nsHtml5StateSnapshot : public nsAHtml5TreeBuilderState
PRInt32 getMode();
PRInt32 getOriginalMode();
PRBool isFramesetOk();
PRInt32 getForeignFlag();
PRBool isInForeign();
PRBool isNeedToDropLF();
PRBool isQuirks();
PRInt32 getListOfActiveFormattingElementsLength();

View File

@ -904,9 +904,7 @@ nsHtml5StreamParser::ContinueAfterScripts(nsHtml5Tokenizer* aTokenizer,
{
mozilla::MutexAutoLock speculationAutoLock(mSpeculationMutex);
if (mSpeculations.IsEmpty()) {
// Not quite sure how exactly this happens...
// Maybe an artifact of defer scripts?
NS_WARNING("ContinueAfterScripts called without speculations.");
NS_NOTREACHED("ContinueAfterScripts called without speculations.");
return;
}
nsHtml5Speculation* speculation = mSpeculations.ElementAt(0);

View File

@ -134,6 +134,7 @@ class nsHtml5StreamParser : public nsIStreamListener,
NS_IMETHOD Notify(const char* aCharset, nsDetectionConfident aConf);
// EncodingDeclarationHandler
// http://hg.mozilla.org/projects/htmlparser/file/tip/src/nu/validator/htmlparser/common/EncodingDeclarationHandler.java
/**
* Tree builder uses this to report a late <meta charset>
*/

File diff suppressed because it is too large Load Diff

View File

@ -47,6 +47,7 @@
#include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h"
#include "nsAHtml5TreeBuilderState.h"
#include "nsHtml5Macros.h"
class nsHtml5StreamParser;

File diff suppressed because it is too large Load Diff

View File

@ -75,7 +75,7 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
PRInt32 mode;
PRInt32 originalMode;
PRBool framesetOk;
PRInt32 foreignFlag;
PRBool inForeign;
protected:
nsHtml5Tokenizer* tokenizer;
private:
@ -210,7 +210,6 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
public:
PRBool isScriptingEnabled();
void setScriptingEnabled(PRBool scriptingEnabled);
PRBool inForeign();
void flushCharacters();
private:
PRBool charBufferContainsNonWhitespace();
@ -228,7 +227,7 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
PRInt32 getMode();
PRInt32 getOriginalMode();
PRBool isFramesetOk();
PRInt32 getForeignFlag();
PRBool isInForeign();
PRBool isNeedToDropLF();
PRBool isQuirks();
PRInt32 getListOfActiveFormattingElementsLength();
@ -344,8 +343,6 @@ jArray<const char*,PRInt32> nsHtml5TreeBuilder::QUIRKY_PUBLIC_IDS = nsnull;
#define NS_HTML5TREE_BUILDER_CHARSET_DOUBLE_QUOTED 10
#define NS_HTML5TREE_BUILDER_CHARSET_UNQUOTED 11
#define NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK PR_INT32_MAX
#define NS_HTML5TREE_BUILDER_IN_FOREIGN 0
#define NS_HTML5TREE_BUILDER_NOT_IN_FOREIGN 1
#endif

View File

@ -43,6 +43,7 @@
#include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h"
#include "nsAHtml5TreeBuilderState.h"
#include "nsHtml5Macros.h"
#include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h"

View File

@ -44,6 +44,7 @@
#include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h"
#include "nsAHtml5TreeBuilderState.h"
#include "nsHtml5Macros.h"
class nsHtml5StreamParser;