Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug 818976 - Part 3: Generated code for HTML5 parser. r=hsivonen

  • Loading branch information...
commit ed3fd99a7afc7ed750b9cf9928c44502ab277ee5 1 parent be5cd8e
William Chen authored
View
15 parser/html/javasrc/ElementName.java
@@ -32,7 +32,7 @@
public final class ElementName
// uncomment when regenerating self
-// implements Comparable<ElementName>
+// implements Comparable<ElementName>
{
/**
@@ -190,7 +190,7 @@ protected ElementName(@Local String name) {
// }
// if ((flags & SCOPING) != 0) {
// buf.append(" | SCOPING");
-// }
+// }
// if ((flags & SCOPING_AS_MATHML) != 0) {
// buf.append(" | SCOPING_AS_MATHML");
// }
@@ -202,7 +202,7 @@ protected ElementName(@Local String name) {
// }
// return buf.toString();
// }
-//
+//
// private String constName() {
// char[] buf = new char[name.length()];
// for (int i = 0; i < name.length(); i++) {
@@ -312,6 +312,8 @@ protected ElementName(@Local String name) {
// return "TEXTAREA";
// case TreeBuilder.TITLE:
// return "TITLE";
+// case TreeBuilder.TEMPLATE:
+// return "TEMPLATE";
// case TreeBuilder.TR:
// return "TR";
// case TreeBuilder.XMP:
@@ -349,7 +351,7 @@ protected ElementName(@Local String name) {
// case TreeBuilder.FIELDSET:
// return "FIELDSET";
// case TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY:
-// return "ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_NAV_OR_SECTION_OR_SUMMARY";
+// return "ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY";
// case TreeBuilder.RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR:
// return "RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR";
// case TreeBuilder.RT_OR_RP:
@@ -374,7 +376,7 @@ protected ElementName(@Local String name) {
//
// /**
// * Regenerate self
-// *
+// *
// * @param args
// */
// public static void main(String[] args) {
@@ -724,6 +726,7 @@ protected ElementName(@Local String name) {
public static final ElementName QUOTIENT = new ElementName("quotient", "quotient", TreeBuilder.OTHER);
public static final ElementName SELECTOR = new ElementName("selector", "selector", TreeBuilder.OTHER);
public static final ElementName TEXTAREA = new ElementName("textarea", "textarea", TreeBuilder.TEXTAREA | SPECIAL);
+ public static final ElementName TEMPLATE = new ElementName("template", "template", TreeBuilder.TEMPLATE | SPECIAL);
public static final ElementName TEXTPATH = new ElementName("textpath", "textPath", TreeBuilder.OTHER);
public static final ElementName VARIANCE = new ElementName("variance", "variance", TreeBuilder.OTHER);
public static final ElementName ANIMATION = new ElementName("animation", "animation", TreeBuilder.OTHER);
@@ -1118,6 +1121,7 @@ protected ElementName(@Local String name) {
QUOTIENT,
SELECTOR,
TEXTAREA,
+ TEMPLATE,
TEXTPATH,
VARIANCE,
ANIMATION,
@@ -1513,6 +1517,7 @@ protected ElementName(@Local String name) {
286931113,
288964227,
289445441,
+ 289591340,
289689648,
291671489,
303512884,
View
10 parser/html/javasrc/MetaScanner.java
@@ -36,22 +36,24 @@
/**
* Constant for "charset".
*/
- private static final char[] CHARSET = "harset".toCharArray();
+ private static final char[] CHARSET = { 'h', 'a', 'r', 's', 'e', 't' };
/**
* Constant for "content".
*/
- private static final char[] CONTENT = "ontent".toCharArray();
+ private static final char[] CONTENT = { 'o', 'n', 't', 'e', 'n', 't' };
/**
* Constant for "http-equiv".
*/
- private static final char[] HTTP_EQUIV = "ttp-equiv".toCharArray();
+ private static final char[] HTTP_EQUIV = { 't', 't', 'p', '-', 'e', 'q',
+ 'u', 'i', 'v' };
/**
* Constant for "content-type".
*/
- private static final char[] CONTENT_TYPE = "content-type".toCharArray();
+ private static final char[] CONTENT_TYPE = { 'c', 'o', 'n', 't', 'e', 'n',
+ 't', '-', 't', 'y', 'p', 'e' };
private static final int NO = 0;
View
10 parser/html/javasrc/Tokenizer.java
@@ -270,22 +270,24 @@
/**
* "CDATA[" as <code>char[]</code>
*/
- private static final @NoLength char[] CDATA_LSQB = "CDATA[".toCharArray();
+ private static final @NoLength char[] CDATA_LSQB = { 'C', 'D', 'A', 'T',
+ 'A', '[' };
/**
* "octype" as <code>char[]</code>
*/
- private static final @NoLength char[] OCTYPE = "octype".toCharArray();
+ private static final @NoLength char[] OCTYPE = { 'o', 'c', 't', 'y', 'p',
+ 'e' };
/**
* "ublic" as <code>char[]</code>
*/
- private static final @NoLength char[] UBLIC = "ublic".toCharArray();
+ private static final @NoLength char[] UBLIC = { 'u', 'b', 'l', 'i', 'c' };
/**
* "ystem" as <code>char[]</code>
*/
- private static final @NoLength char[] YSTEM = "ystem".toCharArray();
+ private static final @NoLength char[] YSTEM = { 'y', 's', 't', 'e', 'm' };
private static final char[] TITLE_ARR = { 't', 'i', 't', 'l', 'e' };
View
596 parser/html/javasrc/TreeBuilder.java
@@ -1,35 +1,35 @@
/*
* Copyright (c) 2007 Henri Sivonen
* Copyright (c) 2007-2011 Mozilla Foundation
- * Portions of comments Copyright 2004-2008 Apple Computer, Inc., Mozilla
+ * Portions of comments Copyright 2004-2008 Apple Computer, Inc., Mozilla
* Foundation, and Opera Software ASA.
*
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
- * The above copyright notice and this permission notice shall be included in
+ * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*
- * The comments following this one that use the same comment syntax as this
- * comment are quotes from the WHATWG HTML 5 spec as of 27 June 2007
+ * The comments following this one that use the same comment syntax as this
+ * comment are quotes from the WHATWG HTML 5 spec as of 27 June 2007
* amended as of June 28 2007.
* That document came with this statement:
- * "© Copyright 2004-2007 Apple Computer, Inc., Mozilla Foundation, and
- * Opera Software ASA. You are granted a license to use, reproduce and
+ * "© Copyright 2004-2007 Apple Computer, Inc., Mozilla Foundation, and
+ * Opera Software ASA. You are granted a license to use, reproduce and
* create derivative works of this document."
*/
@@ -61,12 +61,12 @@
public abstract class TreeBuilder<T> implements TokenHandler,
TreeBuilderState<T> {
-
+
/**
* Array version of U+FFFD.
*/
private static final @NoLength char[] REPLACEMENT_CHARACTER = { '\uFFFD' };
-
+
// Start dispatch groups
final static int OTHER = 0;
@@ -201,6 +201,8 @@
final static int MENUITEM = 66;
+ final static int TEMPLATE = 67;
+
// start insertion modes
private static final int IN_ROW = 0;
@@ -222,29 +224,29 @@
private static final int IN_HEAD_NOSCRIPT = 8;
// no fall-through
-
+
private static final int IN_COLUMN_GROUP = 9;
// no fall-through
-
+
private static final int IN_SELECT_IN_TABLE = 10;
private static final int IN_SELECT = 11;
// no fall-through
-
+
private static final int AFTER_BODY = 12;
// no fall-through
-
+
private static final int IN_FRAMESET = 13;
private static final int AFTER_FRAMESET = 14;
- // no fall-through
-
+ // no fall-through
+
private static final int INITIAL = 15;
-
+
// could add fall-through
private static final int BEFORE_HTML = 16;
@@ -253,22 +255,24 @@
private static final int BEFORE_HEAD = 17;
- // no fall-through
-
+ // no fall-through
+
private static final int AFTER_HEAD = 18;
- // no fall-through
-
+ // no fall-through
+
private static final int AFTER_AFTER_BODY = 19;
- // no fall-through
-
+ // no fall-through
+
private static final int AFTER_AFTER_FRAMESET = 20;
- // no fall-through
-
+ // no fall-through
+
private static final int TEXT = 21;
+ private static final int TEMPLATE_CONTENTS = 22;
+
// start charset states
private static final int CHARSET_INITIAL = 0;
@@ -365,13 +369,13 @@
// [NOCPP[
private static final @Local String HTML_LOCAL = "html";
-
+
// ]NOCPP]
private int mode = INITIAL;
private int originalMode = INITIAL;
-
+
/**
* Used only when moving back to IN_BODY.
*/
@@ -388,7 +392,7 @@
private DoctypeExpectation doctypeExpectation = DoctypeExpectation.HTML;
private LocatorImpl firstCommentLocation;
-
+
// ]NOCPP]
private boolean scriptingEnabled = false;
@@ -409,6 +413,16 @@
private T contextNode;
+ /**
+ * Stack of template insertion modes
+ */
+ private @Auto int[] templateModeStack;
+
+ /**
+ * Current template mode stack pointer.
+ */
+ private int templateModePtr = -1;
+
private @Auto StackNode<T>[] stack;
private int currentPtr = -1;
@@ -451,7 +465,7 @@ protected TreeBuilder() {
/**
* Reports an condition that would make the infoset incompatible with XML
* 1.0 as fatal.
- *
+ *
* @throws SAXException
* @throws SAXParseException
*/
@@ -479,7 +493,7 @@ final void fatal(String s) throws SAXException {
/**
* Reports a Parse Error.
- *
+ *
* @param message
* the message
* @throws SAXException
@@ -490,10 +504,10 @@ final void err(String message) throws SAXException {
}
errNoCheck(message);
}
-
+
/**
* Reports a Parse Error without checking if an error handler is present.
- *
+ *
* @param message
* the message
* @throws SAXException
@@ -513,7 +527,7 @@ private void errListUnclosedStartTags(int eltPos) throws SAXException {
/**
* Reports the name and location of an unclosed element.
- *
+ *
* @throws SAXException
*/
private final void reportUnclosedElementNameAndLocation(int pos) throws SAXException {
@@ -533,7 +547,7 @@ private final void reportUnclosedElementNameAndLocation(int pos) throws SAXExcep
/**
* Reports a warning
- *
+ *
* @param message
* the message
* @throws SAXException
@@ -548,7 +562,7 @@ final void warn(String message) throws SAXException {
/**
* Reports a warning with an explicit locator
- *
+ *
* @param message
* the message
* @throws SAXException
@@ -562,13 +576,15 @@ final void warn(String message, Locator locator) throws SAXException {
}
// ]NOCPP]
-
+
@SuppressWarnings("unchecked") public final void startTokenization(Tokenizer self) throws SAXException {
tokenizer = self;
stack = new StackNode[64];
+ templateModeStack = new int[64];
listOfActiveFormattingElements = new StackNode[64];
needToDropLF = false;
originalMode = INITIAL;
+ templateModePtr = -1;
currentPtr = -1;
listPtr = -1;
formPointer = null;
@@ -598,6 +614,9 @@ final void warn(String message, Locator locator) throws SAXException {
);
currentPtr++;
stack[currentPtr] = node;
+ if ("template" == contextName) {
+ pushTemplateMode(TEMPLATE_CONTENTS);
+ }
resetTheInsertionMode();
if ("title" == contextName || "textarea" == contextName) {
tokenizer.setStateAndEndTagExpectation(Tokenizer.RCDATA, contextName);
@@ -838,7 +857,7 @@ public final void doctype(@Local String name, String publicIdentifier,
// ]NOCPP]
/*
- *
+ *
* Then, switch to the root element mode of the tree construction
* stage.
*/
@@ -988,6 +1007,7 @@ public final void characters(@Const @NoLength char[] buf, int start, int length)
*/
continue;
case FRAMESET_OK:
+ case TEMPLATE_CONTENTS:
case IN_BODY:
case IN_CELL:
case IN_CAPTION:
@@ -1069,7 +1089,7 @@ public final void characters(@Const @NoLength char[] buf, int start, int length)
}
// ]NOCPP]
/*
- *
+ *
* Set the document to quirks mode.
*/
documentModeInternal(
@@ -1117,7 +1137,7 @@ public final void characters(@Const @NoLength char[] buf, int start, int length)
mode = IN_HEAD;
/*
* then reprocess the current token.
- *
+ *
* This will result in an empty head element
* being generated, with the current token
* being reprocessed in the "after head"
@@ -1186,6 +1206,7 @@ public final void characters(@Const @NoLength char[] buf, int start, int length)
mode = IN_BODY;
i--;
continue;
+ case TEMPLATE_CONTENTS:
case IN_BODY:
case IN_CELL:
case IN_CAPTION:
@@ -1225,7 +1246,8 @@ public final void characters(@Const @NoLength char[] buf, int start, int length)
* that token wasn't ignored, reprocess the
* current token.
*/
- if (currentPtr == 0) {
+ if (currentPtr == 0 || stack[currentPtr].getGroup() ==
+ TreeBuilder.TEMPLATE) {
errNonSpaceInColgroupInFragment();
start = i + 1;
continue;
@@ -1353,7 +1375,7 @@ public final void eof() throws SAXException {
}
// ]NOCPP]
/*
- *
+ *
* Set the document to quirks mode.
*/
documentModeInternal(DocumentMode.QUIRKS_MODE, null, null,
@@ -1466,6 +1488,17 @@ public final void eof() throws SAXException {
}
// ]NOCPP]
break eofloop;
+ case TEMPLATE_CONTENTS:
+ if (currentPtr == 0) {
+ assert fragment;
+ break eofloop;
+ }
+
+ // TODO: Parse error. Add error reporting.
+ popOnEof();
+ resetTheInsertionMode();
+ // Reprocess token.
+ continue;
case AFTER_BODY:
case AFTER_FRAMESET:
case AFTER_AFTER_BODY:
@@ -1497,6 +1530,7 @@ public final void endTokenization() throws SAXException {
formPointer = null;
headPointer = null;
deepTreeSurrogateParent = null;
+ templateModeStack = null;
if (stack != null) {
while (currentPtr > -1) {
stack[currentPtr].release();
@@ -1615,6 +1649,74 @@ public final void startTag(ElementName elementName,
} // foreignObject / annotation-xml
}
switch (mode) {
+ case TEMPLATE_CONTENTS:
+ switch (group) {
+ case FRAME:
+ popTemplateMode();
+ pushTemplateMode(IN_FRAMESET);
+ mode = IN_FRAMESET;
+ // Reprocess token.
+ continue;
+ case COL:
+ popTemplateMode();
+ pushTemplateMode(IN_COLUMN_GROUP);
+ mode = IN_COLUMN_GROUP;
+ // Reprocess token.
+ continue;
+ case CAPTION:
+ case COLGROUP:
+ case TBODY_OR_THEAD_OR_TFOOT:
+ popTemplateMode();
+ pushTemplateMode(IN_TABLE);
+ mode = IN_TABLE;
+ // Reprocess token.
+ continue;
+ case TR:
+ popTemplateMode();
+ pushTemplateMode(IN_TABLE_BODY);
+ mode = IN_TABLE_BODY;
+ // Reprocess token.
+ continue;
+ case TD_OR_TH:
+ popTemplateMode();
+ pushTemplateMode(IN_ROW);
+ mode = IN_ROW;
+ // Reprocess token.
+ continue;
+ case META:
+ checkMetaCharset(attributes);
+ appendVoidElementToCurrentMayFoster(
+ elementName,
+ attributes);
+ selfClosing = false;
+ attributes = null; // CPP
+ break starttagloop;
+ case LINK_OR_BASEFONT_OR_BGSOUND:
+ appendVoidElementToCurrentMayFoster(
+ elementName,
+ attributes);
+ selfClosing = false;
+ attributes = null; // CPP
+ break starttagloop;
+ case SCRIPT:
+ startTagScriptInHead(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case STYLE:
+ startTagGenericRawText(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case TEMPLATE:
+ startTagTemplateInHead(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ default:
+ popTemplateMode();
+ pushTemplateMode(IN_BODY);
+ mode = IN_BODY;
+ // Reprocess token.
+ continue;
+ }
case IN_ROW:
switch (group) {
case TD_OR_TH:
@@ -1633,7 +1735,7 @@ public final void startTag(ElementName elementName,
case TR:
eltPos = findLastOrRoot(TreeBuilder.TR);
if (eltPos == 0) {
- assert fragment;
+ assert fragment || isTemplateContents();
errNoTableRowToClose();
break starttagloop;
}
@@ -1647,7 +1749,7 @@ public final void startTag(ElementName elementName,
case IN_TABLE_BODY:
switch (group) {
case TR:
- clearStackBackTo(findLastInTableScopeOrRootTbodyTheadTfoot());
+ clearStackBackTo(findLastInTableScopeOrRootTemplateTbodyTheadTfoot());
appendToCurrentNodeAndPushElement(
elementName,
attributes);
@@ -1656,7 +1758,7 @@ public final void startTag(ElementName elementName,
break starttagloop;
case TD_OR_TH:
errStartTagInTableBody(name);
- clearStackBackTo(findLastInTableScopeOrRootTbodyTheadTfoot());
+ clearStackBackTo(findLastInTableScopeOrRootTemplateTbodyTheadTfoot());
appendToCurrentNodeAndPushElement(
ElementName.TR,
HtmlAttributes.EMPTY_ATTRIBUTES);
@@ -1666,8 +1768,9 @@ public final void startTag(ElementName elementName,
case COL:
case COLGROUP:
case TBODY_OR_THEAD_OR_TFOOT:
- eltPos = findLastInTableScopeOrRootTbodyTheadTfoot();
- if (eltPos == 0) {
+ eltPos = findLastInTableScopeOrRootTemplateTbodyTheadTfoot();
+ if (eltPos == 0 || stack[eltPos].getGroup() == TEMPLATE) {
+ assert fragment || isTemplateContents();
errStrayStartTag(name);
break starttagloop;
} else {
@@ -1722,11 +1825,14 @@ public final void startTag(ElementName elementName,
HtmlAttributes.EMPTY_ATTRIBUTES);
mode = IN_TABLE_BODY;
continue starttagloop;
+ case TEMPLATE:
+ // fall through to IN_HEAD
+ break intableloop;
case TABLE:
errTableSeenWhileTableOpen();
eltPos = findLastInTableScope(name);
if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- assert fragment;
+ assert fragment || isTemplateContents();
break starttagloop;
}
generateImpliedEndTags();
@@ -1841,7 +1947,7 @@ public final void startTag(ElementName elementName,
case FRAMESET:
if (mode == FRAMESET_OK) {
if (currentPtr == 0 || stack[1].getGroup() != BODY) {
- assert fragment;
+ assert fragment || isTemplateContents();
errStrayStartTag(name);
break starttagloop;
} else {
@@ -1895,7 +2001,7 @@ public final void startTag(ElementName elementName,
switch (group) {
case HTML:
errStrayStartTag(name);
- if (!fragment) {
+ if (!fragment && !isTemplateContents()) {
addAttributesToHtml(attributes);
attributes = null; // CPP
}
@@ -1907,12 +2013,12 @@ public final void startTag(ElementName elementName,
case SCRIPT:
case TITLE:
case COMMAND:
+ case TEMPLATE:
// Fall through to IN_HEAD
break inbodyloop;
case BODY:
- if (currentPtr == 0
- || stack[1].getGroup() != BODY) {
- assert fragment;
+ if (currentPtr == 0 || stack[1].getGroup() != BODY || isTemplateContents()) {
+ assert fragment || isTemplateContents();
errStrayStartTag(name);
break starttagloop;
}
@@ -2244,13 +2350,7 @@ public final void startTag(ElementName elementName,
case NOFRAMES:
case IFRAME:
case NOEMBED:
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(
- Tokenizer.RAWTEXT, elementName);
+ startTagGenericRawText(elementName, attributes);
attributes = null; // CPP
break starttagloop;
case SELECT:
@@ -2360,7 +2460,7 @@ public final void startTag(ElementName elementName,
switch (group) {
case HTML:
errStrayStartTag(name);
- if (!fragment) {
+ if (!fragment && !isTemplateContents()) {
addAttributesToHtml(attributes);
attributes = null; // CPP
}
@@ -2405,28 +2505,12 @@ public final void startTag(ElementName elementName,
attributes = null; // CPP
break starttagloop;
case SCRIPT:
- // XXX need to manage much more stuff
- // here if
- // supporting
- // document.write()
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(
- Tokenizer.SCRIPT_DATA, elementName);
+ startTagScriptInHead(elementName, attributes);
attributes = null; // CPP
break starttagloop;
case STYLE:
case NOFRAMES:
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(
- Tokenizer.RAWTEXT, elementName);
+ startTagGenericRawText(elementName, attributes);
attributes = null; // CPP
break starttagloop;
case HEAD:
@@ -2434,6 +2518,10 @@ public final void startTag(ElementName elementName,
errFooSeenWhenFooOpen(name);
/* Ignore the token. */
break starttagloop;
+ case TEMPLATE:
+ startTagTemplateInHead(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
default:
pop();
mode = AFTER_HEAD;
@@ -2446,7 +2534,7 @@ public final void startTag(ElementName elementName,
// XXX did Hixie really mean to omit "base"
// here?
errStrayStartTag(name);
- if (!fragment) {
+ if (!fragment && !isTemplateContents()) {
addAttributesToHtml(attributes);
attributes = null; // CPP
}
@@ -2493,7 +2581,7 @@ public final void startTag(ElementName elementName,
switch (group) {
case HTML:
errStrayStartTag(name);
- if (!fragment) {
+ if (!fragment && !isTemplateContents()) {
addAttributesToHtml(attributes);
attributes = null; // CPP
}
@@ -2505,9 +2593,13 @@ public final void startTag(ElementName elementName,
selfClosing = false;
attributes = null; // CPP
break starttagloop;
+ case TEMPLATE:
+ startTagTemplateInHead(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
default:
- if (currentPtr == 0) {
- assert fragment;
+ if (currentPtr == 0 || stack[currentPtr].getGroup() == TEMPLATE) {
+ assert fragment || isTemplateContents();
errGarbageInColgroup();
break starttagloop;
}
@@ -2595,17 +2687,11 @@ public final void startTag(ElementName elementName,
resetTheInsertionMode();
continue;
case SCRIPT:
- // XXX need to manage much more stuff
- // here if
- // supporting
- // document.write()
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(
- Tokenizer.SCRIPT_DATA, elementName);
+ startTagScriptInHead(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case TEMPLATE:
+ startTagTemplateInHead(elementName, attributes);
attributes = null; // CPP
break starttagloop;
default:
@@ -2616,7 +2702,7 @@ public final void startTag(ElementName elementName,
switch (group) {
case HTML:
errStrayStartTag(name);
- if (!fragment) {
+ if (!fragment && !isTemplateContents()) {
addAttributesToHtml(attributes);
attributes = null; // CPP
}
@@ -2641,6 +2727,10 @@ public final void startTag(ElementName elementName,
selfClosing = false;
attributes = null; // CPP
break starttagloop;
+ case TEMPLATE:
+ startTagTemplateInHead(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
default:
// fall through to AFTER_FRAMESET
}
@@ -2648,7 +2738,7 @@ public final void startTag(ElementName elementName,
switch (group) {
case HTML:
errStrayStartTag(name);
- if (!fragment) {
+ if (!fragment && !isTemplateContents()) {
addAttributesToHtml(attributes);
attributes = null; // CPP
}
@@ -2691,7 +2781,7 @@ public final void startTag(ElementName elementName,
}
// ]NOCPP]
/*
- *
+ *
* Set the document to quirks mode.
*/
documentModeInternal(DocumentMode.QUIRKS_MODE, null, null,
@@ -2742,7 +2832,7 @@ public final void startTag(ElementName elementName,
switch (group) {
case HTML:
errStrayStartTag(name);
- if (!fragment) {
+ if (!fragment && !isTemplateContents()) {
addAttributesToHtml(attributes);
attributes = null; // CPP
}
@@ -2750,12 +2840,12 @@ public final void startTag(ElementName elementName,
case HEAD:
/*
* A start tag whose tag name is "head"
- *
+ *
* Create an element for the token.
- *
+ *
* Set the head element pointer to this new element
* node.
- *
+ *
* Append the new element to the current node and
* push it onto the stack of open elements.
*/
@@ -2769,7 +2859,7 @@ public final void startTag(ElementName elementName,
default:
/*
* Any other start tag token
- *
+ *
* Act as if a start tag token with the tag name
* "head" and no attributes had been seen,
*/
@@ -2777,7 +2867,7 @@ public final void startTag(ElementName elementName,
mode = IN_HEAD;
/*
* then reprocess the current token.
- *
+ *
* This will result in an empty head element being
* generated, with the current token being
* reprocessed in the "after head" insertion mode.
@@ -2788,7 +2878,7 @@ public final void startTag(ElementName elementName,
switch (group) {
case HTML:
errStrayStartTag(name);
- if (!fragment) {
+ if (!fragment && !isTemplateContents()) {
addAttributesToHtml(attributes);
attributes = null; // CPP
}
@@ -2894,7 +2984,7 @@ public final void startTag(ElementName elementName,
switch (group) {
case HTML:
errStrayStartTag(name);
- if (!fragment) {
+ if (!fragment && !isTemplateContents()) {
addAttributesToHtml(attributes);
attributes = null; // CPP
}
@@ -2909,19 +2999,13 @@ public final void startTag(ElementName elementName,
switch (group) {
case HTML:
errStrayStartTag(name);
- if (!fragment) {
+ if (!fragment && !isTemplateContents()) {
addAttributesToHtml(attributes);
attributes = null; // CPP
}
break starttagloop;
case NOFRAMES:
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(
- Tokenizer.SCRIPT_DATA, elementName);
+ startTagScriptInHead(elementName, attributes);
attributes = null; // CPP
break starttagloop;
default:
@@ -2942,6 +3026,33 @@ public final void startTag(ElementName elementName,
}
}
+ private void startTagGenericRawText(ElementName elementName, HtmlAttributes attributes) throws SAXException {
+ appendToCurrentNodeAndPushElementMayFoster(elementName, attributes);
+ originalMode = mode;
+ mode = TEXT;
+ tokenizer.setStateAndEndTagExpectation(Tokenizer.RAWTEXT, elementName);
+ }
+
+ private void startTagScriptInHead(ElementName elementName, HtmlAttributes attributes) throws SAXException {
+ // XXX need to manage much more stuff here if supporting document.write()
+ appendToCurrentNodeAndPushElementMayFoster(elementName, attributes);
+ originalMode = mode;
+ mode = TEXT;
+ tokenizer.setStateAndEndTagExpectation(Tokenizer.SCRIPT_DATA, elementName);
+ }
+
+ private void startTagTemplateInHead(ElementName elementName, HtmlAttributes attributes) throws SAXException {
+ insertMarker();
+ appendToCurrentNodeAndPushElement(elementName, attributes);
+ originalMode = mode;
+ mode = TEMPLATE_CONTENTS;
+ pushTemplateMode(TEMPLATE_CONTENTS);
+ }
+
+ private boolean isTemplateContents() {
+ return TreeBuilder.NOT_FOUND_ON_STACK != findLast("template");
+ }
+
private boolean isSpecialParentInForeign(StackNode<T> stackNode) {
@NsUri String ns = stackNode.ns;
return ("http://www.w3.org/1999/xhtml" == ns)
@@ -2950,10 +3061,10 @@ private boolean isSpecialParentInForeign(StackNode<T> stackNode) {
}
/**
- *
+ *
* <p>
* C++ memory note: The return value must be released.
- *
+ *
* @return
* @throws SAXException
* @throws StopSniffingException
@@ -3122,7 +3233,7 @@ private void checkMetaCharset(HtmlAttributes attributes)
if (tokenizer.internalEncodingDeclaration(charset)) {
requestSuspension();
return;
- }
+ }
return;
}
if (!Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
@@ -3137,7 +3248,7 @@ private void checkMetaCharset(HtmlAttributes attributes)
if (extract != null) {
if (tokenizer.internalEncodingDeclaration(extract)) {
requestSuspension();
- }
+ }
}
Portability.releaseString(extract);
}
@@ -3168,12 +3279,21 @@ public final void endTag(ElementName elementName) throws SAXException {
}
}
switch (mode) {
+ case TEMPLATE_CONTENTS:
+ switch (group) {
+ case TEMPLATE:
+ // fall through to IN_HEAD
+ break;
+ default:
+ errStrayEndTag(name);
+ break endtagloop;
+ }
case IN_ROW:
switch (group) {
case TR:
eltPos = findLastOrRoot(TreeBuilder.TR);
if (eltPos == 0) {
- assert fragment;
+ assert fragment || isTemplateContents();
errNoTableRowToClose();
break endtagloop;
}
@@ -3184,7 +3304,7 @@ public final void endTag(ElementName elementName) throws SAXException {
case TABLE:
eltPos = findLastOrRoot(TreeBuilder.TR);
if (eltPos == 0) {
- assert fragment;
+ assert fragment || isTemplateContents();
errNoTableRowToClose();
break endtagloop;
}
@@ -3199,7 +3319,7 @@ public final void endTag(ElementName elementName) throws SAXException {
}
eltPos = findLastOrRoot(TreeBuilder.TR);
if (eltPos == 0) {
- assert fragment;
+ assert fragment || isTemplateContents();
errNoTableRowToClose();
break endtagloop;
}
@@ -3231,9 +3351,9 @@ public final void endTag(ElementName elementName) throws SAXException {
mode = IN_TABLE;
break endtagloop;
case TABLE:
- eltPos = findLastInTableScopeOrRootTbodyTheadTfoot();
- if (eltPos == 0) {
- assert fragment;
+ eltPos = findLastInTableScopeOrRootTemplateTbodyTheadTfoot();
+ if (eltPos == 0 || stack[eltPos].getGroup() == TEMPLATE) {
+ assert fragment || isTemplateContents();
errStrayEndTag(name);
break endtagloop;
}
@@ -3258,7 +3378,7 @@ public final void endTag(ElementName elementName) throws SAXException {
case TABLE:
eltPos = findLast("table");
if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- assert fragment;
+ assert fragment || isTemplateContents();
errStrayEndTag(name);
break endtagloop;
}
@@ -3277,6 +3397,9 @@ public final void endTag(ElementName elementName) throws SAXException {
case TR:
errStrayEndTag(name);
break endtagloop;
+ case TEMPLATE:
+ // fall through to IN_HEAD
+ break;
default:
errStrayEndTag(name);
// fall through to IN_BODY
@@ -3348,6 +3471,7 @@ public final void endTag(ElementName elementName) throws SAXException {
case TBODY_OR_THEAD_OR_TFOOT:
case TR:
if (findLastInTableScope(name) == TreeBuilder.NOT_FOUND_ON_STACK) {
+ assert name == "tbody" || name == "tfoot" || name == "thead" || fragment || isTemplateContents();
errStrayEndTag(name);
break endtagloop;
}
@@ -3368,7 +3492,7 @@ public final void endTag(ElementName elementName) throws SAXException {
switch (group) {
case BODY:
if (!isSecondOnStackBody()) {
- assert fragment;
+ assert fragment || isTemplateContents();
errStrayEndTag(name);
break endtagloop;
}
@@ -3395,7 +3519,7 @@ public final void endTag(ElementName elementName) throws SAXException {
break endtagloop;
case HTML:
if (!isSecondOnStackBody()) {
- assert fragment;
+ assert fragment || isTemplateContents();
errStrayEndTag(name);
break endtagloop;
}
@@ -3552,6 +3676,9 @@ public final void endTag(ElementName elementName) throws SAXException {
elementName,
HtmlAttributes.EMPTY_ATTRIBUTES);
break endtagloop;
+ case TEMPLATE:
+ // fall through to IN_HEAD;
+ break;
case AREA_OR_WBR:
// CPPONLY: case MENUITEM:
case PARAM_OR_SOURCE_OR_TRACK:
@@ -3622,6 +3749,9 @@ public final void endTag(ElementName elementName) throws SAXException {
pop();
mode = AFTER_HEAD;
continue;
+ case TEMPLATE:
+ endTagTemplateInHead(name);
+ break endtagloop;
default:
errStrayEndTag(name);
break endtagloop;
@@ -3644,8 +3774,9 @@ public final void endTag(ElementName elementName) throws SAXException {
case IN_COLUMN_GROUP:
switch (group) {
case COLGROUP:
- if (currentPtr == 0) {
- assert fragment;
+ if (currentPtr == 0 || stack[currentPtr].getGroup() ==
+ TreeBuilder.TEMPLATE) {
+ assert fragment || isTemplateContents();
errGarbageInColgroup();
break endtagloop;
}
@@ -3655,9 +3786,13 @@ public final void endTag(ElementName elementName) throws SAXException {
case COL:
errStrayEndTag(name);
break endtagloop;
+ case TEMPLATE:
+ endTagTemplateInHead(name);
+ break endtagloop;
default:
- if (currentPtr == 0) {
- assert fragment;
+ if (currentPtr == 0 || stack[currentPtr].getGroup() ==
+ TreeBuilder.TEMPLATE) {
+ assert fragment || isTemplateContents();
errGarbageInColgroup();
break endtagloop;
}
@@ -3723,6 +3858,9 @@ public final void endTag(ElementName elementName) throws SAXException {
}
resetTheInsertionMode();
break endtagloop;
+ case TEMPLATE:
+ endTagTemplateInHead(name);
+ break endtagloop;
default:
errStrayEndTag(name);
break endtagloop;
@@ -3745,8 +3883,8 @@ public final void endTag(ElementName elementName) throws SAXException {
case IN_FRAMESET:
switch (group) {
case FRAMESET:
- if (currentPtr == 0) {
- assert fragment;
+ if (currentPtr == 0 || isTemplateContents()) {
+ assert fragment || isTemplateContents();
errStrayEndTag(name);
break endtagloop;
}
@@ -3755,6 +3893,9 @@ public final void endTag(ElementName elementName) throws SAXException {
mode = AFTER_FRAMESET;
}
break endtagloop;
+ case TEMPLATE:
+ endTagTemplateInHead(name);
+ break endtagloop;
default:
errStrayEndTag(name);
break endtagloop;
@@ -3792,7 +3933,7 @@ public final void endTag(ElementName elementName) throws SAXException {
}
// ]NOCPP]
/*
- *
+ *
* Set the document to quirks mode.
*/
documentModeInternal(DocumentMode.QUIRKS_MODE, null, null,
@@ -3873,9 +4014,28 @@ public final void endTag(ElementName elementName) throws SAXException {
} // endtagloop
}
- private int findLastInTableScopeOrRootTbodyTheadTfoot() {
+ private void endTagTemplateInHead(@Local String name) throws SAXException {
+ int eltPos = findLast(name);
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ errStrayEndTag(name);
+ return;
+ }
+ generateImpliedEndTags();
+ if (errorHandler != null && !isCurrent(name)) {
+ errUnclosedElements(eltPos, name);
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ clearTheListOfActiveFormattingElementsUpToTheLastMarker();
+ popTemplateMode();
+ resetTheInsertionMode();
+ }
+
+ private int findLastInTableScopeOrRootTemplateTbodyTheadTfoot() {
for (int i = currentPtr; i > 0; i--) {
- if (stack[i].getGroup() == TreeBuilder.TBODY_OR_THEAD_OR_TFOOT) {
+ if (stack[i].getGroup() == TreeBuilder.TBODY_OR_THEAD_OR_TFOOT ||
+ stack[i].getGroup() == TreeBuilder.TEMPLATE) {
return i;
}
}
@@ -3895,7 +4055,7 @@ private int findLastInTableScope(@Local String name) {
for (int i = currentPtr; i > 0; i--) {
if (stack[i].name == name) {
return i;
- } else if (stack[i].name == "table") {
+ } else if (stack[i].name == "table" || stack[i].name == "template") {
return TreeBuilder.NOT_FOUND_ON_STACK;
}
}
@@ -3934,7 +4094,7 @@ private int findLastInListScope(@Local String name) {
}
return TreeBuilder.NOT_FOUND_ON_STACK;
}
-
+
private int findLastInScopeHn() {
for (int i = currentPtr; i > 0; i--) {
if (stack[i].getGroup() == TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6) {
@@ -4090,7 +4250,7 @@ private int findLastInTableScopeTdTh() {
@Local String name = stack[i].name;
if ("td" == name || "th" == name) {
return i;
- } else if (name == "table") {
+ } else if (name == "table" || name == "template") {
return TreeBuilder.NOT_FOUND_ON_STACK;
}
}
@@ -4098,7 +4258,12 @@ private int findLastInTableScopeTdTh() {
}
private void clearStackBackTo(int eltPos) throws SAXException {
+ int eltGroup = stack[eltPos].getGroup();
while (currentPtr > eltPos) { // > not >= intentional
+ if (stack[currentPtr].getGroup() == TEMPLATE
+ && (eltGroup == TABLE || eltGroup == TBODY_OR_THEAD_OR_TFOOT|| eltGroup == TR || eltGroup == HTML)) {
+ return;
+ }
pop();
}
}
@@ -4120,7 +4285,11 @@ private void resetTheInsertionMode() {
return;
}
}
- if ("select" == name) {
+ if ("template" == name) {
+ mode = templateModeStack[templateModePtr];
+ return;
+ } else if ("select" == name) {
+ // TODO: Fragment case. Add error reporting.
mode = IN_SELECT;
return;
} else if ("td" == name || "th" == name) {
@@ -4136,6 +4305,7 @@ private void resetTheInsertionMode() {
mode = IN_CAPTION;
return;
} else if ("colgroup" == name) {
+ // TODO: Fragment case. Add error reporting.
mode = IN_COLUMN_GROUP;
return;
} else if ("table" == name) {
@@ -4145,16 +4315,23 @@ private void resetTheInsertionMode() {
mode = framesetOk ? FRAMESET_OK : IN_BODY;
return;
} else if ("head" == name) {
- mode = framesetOk ? FRAMESET_OK : IN_BODY; // really
+ if (name == contextName) {
+ // TODO: Fragment case. Add error reporting.
+ mode = framesetOk ? FRAMESET_OK : IN_BODY; // really
+ } else {
+ mode = IN_HEAD;
+ }
return;
} else if ("body" == name) {
mode = framesetOk ? FRAMESET_OK : IN_BODY;
return;
} else if ("frameset" == name) {
+ // TODO: Fragment case. Add error reporting.
mode = IN_FRAMESET;
return;
} else if ("html" == name) {
if (headPointer == null) {
+ // TODO: Fragment case. Add error reporting.
mode = BEFORE_HEAD;
} else {
mode = AFTER_HEAD;
@@ -4169,7 +4346,7 @@ private void resetTheInsertionMode() {
/**
* @throws SAXException
- *
+ *
*/
private void implicitlyCloseP() throws SAXException {
int eltPos = findLastInButtonScope("p");
@@ -4195,6 +4372,16 @@ private boolean debugOnlyClearLastListSlot() {
return true;
}
+ private void pushTemplateMode(int mode) {
+ templateModePtr++;
+ if (templateModePtr == templateModeStack.length) {
+ int[] newStack = new int[templateModeStack.length + 64];
+ System.arraycopy(templateModeStack, 0, newStack, 0, templateModeStack.length);
+ templateModeStack = newStack;
+ }
+ templateModeStack[templateModePtr] = mode;
+ }
+
@SuppressWarnings("unchecked") private void push(StackNode<T> node) throws SAXException {
currentPtr++;
if (currentPtr == stack.length) {
@@ -4399,7 +4586,7 @@ private boolean adoptionAgencyEndTag(@Local String name) throws SAXException {
node.name, clone, node.popName, node.attributes
// [NOCPP[
, node.getLocator()
- // ]NOCPP]
+ // ]NOCPP]
); // creation
// ownership
// goes
@@ -4523,7 +4710,7 @@ private void maybeForgetEarlierDuplicateFormattingElement(
removeFromListOfActiveFormattingElements(candidate);
}
}
-
+
private int findLastOrRoot(@Local String name) {
for (int i = currentPtr; i > 0; i--) {
if (stack[i].name == name) {
@@ -4585,7 +4772,7 @@ private void pushHeadPointerOntoStack() throws SAXException {
/**
* @throws SAXException
- *
+ *
*/
private void reconstructTheActiveFormattingElements() throws SAXException {
if (listPtr == -1) {
@@ -4637,14 +4824,16 @@ private void reconstructTheActiveFormattingElements() throws SAXException {
}
private void insertIntoFosterParent(T child) throws SAXException {
- int eltPos = findLastOrRoot(TreeBuilder.TABLE);
- StackNode<T> node = stack[eltPos];
- T elt = node.node;
- if (eltPos == 0) {
- appendElement(child, elt);
+ int tablePos = findLastOrRoot(TreeBuilder.TABLE);
+ int templatePos = findLastOrRoot(TreeBuilder.TEMPLATE);
+
+ if (templatePos >= tablePos) {
+ appendElement(child, stack[templatePos].node);
return;
}
- insertFosterParentedChild(child, elt, stack[eltPos - 1].node);
+
+ StackNode<T> node = stack[tablePos];
+ insertFosterParentedChild(child, node.node, stack[tablePos - 1].node);
}
private boolean isInStack(StackNode<T> node) {
@@ -4656,6 +4845,10 @@ private boolean isInStack(StackNode<T> node) {
return false;
}
+ private void popTemplateMode() {
+ templateModePtr--;
+ }
+
private void pop() throws SAXException {
StackNode<T> node = stack[currentPtr];
assert debugOnlyClearLastStackSlot();
@@ -4878,6 +5071,9 @@ private void appendToCurrentNodeAndPushElement(ElementName elementName,
// This method can't be called for custom elements
T elt = createElement("http://www.w3.org/1999/xhtml", elementName.name, attributes);
appendElement(elt, stack[currentPtr].node);
+ if (ElementName.TEMPLATE == elementName) {
+ elt = getDocumentFragmentForTemplate(elt);
+ }
StackNode<T> node = new StackNode<T>(elementName, elt
// [NOCPP[
, errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
@@ -4945,6 +5141,12 @@ private void appendToCurrentNodeAndPushElementMayFosterMathML(
push(node);
}
+ // [NOCPP[
+ T getDocumentFragmentForTemplate(T template) {
+ return template;
+ }
+ // ]NOCPP]
+
private boolean annotationXmlEncodingPermitsHtml(HtmlAttributes attributes) {
String encoding = attributes.getValue(AttributeName.ENCODING);
if (encoding == null) {
@@ -5118,7 +5320,7 @@ private void appendVoidFormToCurrent(HtmlAttributes attributes) throws SAXExcept
}
// [NOCPP[
-
+
private final void accumulateCharactersForced(@Const @NoLength char[] buf,
int start, int length) throws SAXException {
int newLen = charBufferLen + length;
@@ -5130,9 +5332,9 @@ private final void accumulateCharactersForced(@Const @NoLength char[] buf,
System.arraycopy(buf, start, charBuffer, charBufferLen, length);
charBufferLen = newLen;
}
-
+
// ]NOCPP]
-
+
protected void accumulateCharacters(@Const @NoLength char[] buf, int start,
int length) throws SAXException {
appendCharacters(stack[currentPtr].node, buf, start, length);
@@ -5176,7 +5378,7 @@ protected abstract void appendCharacters(T parent, @NoLength char[] buf,
int start, int length) throws SAXException;
protected abstract void appendIsindexPrompt(T parent) throws SAXException;
-
+
protected abstract void appendComment(T parent, @NoLength char[] buf,
int start, int length) throws SAXException;
@@ -5235,7 +5437,7 @@ public void setIgnoringComments(boolean ignoreComments) {
/**
* Sets the errorHandler.
- *
+ *
* @param errorHandler
* the errorHandler to set
*/
@@ -5245,7 +5447,7 @@ public final void setErrorHandler(ErrorHandler errorHandler) {
/**
* Returns the errorHandler.
- *
+ *
* @return the errorHandler
*/
public ErrorHandler getErrorHandler() {
@@ -5254,7 +5456,7 @@ public ErrorHandler getErrorHandler() {
/**
* The argument MUST be an interned string or <code>null</code>.
- *
+ *
* @param context
*/
public final void setFragmentContext(@Local String context) {
@@ -5273,7 +5475,7 @@ public final void setFragmentContext(@Local String context) {
@Inline public boolean cdataSectionAllowed() throws SAXException {
return isInForeign();
}
-
+
private boolean isInForeign() {
return currentPtr >= 0
&& stack[currentPtr].ns != "http://www.w3.org/1999/xhtml";
@@ -5288,7 +5490,7 @@ private boolean isInForeignButNotHtmlOrMathTextIntegrationPoint() {
/**
* The argument MUST be an interned string or <code>null</code>.
- *
+ *
* @param context
*/
public final void setFragmentContext(@Local String context,
@@ -5306,7 +5508,7 @@ protected final T currentNode() {
/**
* Returns the scriptingEnabled.
- *
+ *
* @return the scriptingEnabled
*/
public boolean isScriptingEnabled() {
@@ -5315,7 +5517,7 @@ public boolean isScriptingEnabled() {
/**
* Sets the scriptingEnabled.
- *
+ *
* @param scriptingEnabled
* the scriptingEnabled to set
*/
@@ -5327,7 +5529,7 @@ public void setScriptingEnabled(boolean scriptingEnabled) {
/**
* Sets the doctypeExpectation.
- *
+ *
* @param doctypeExpectation
* the doctypeExpectation to set
*/
@@ -5341,7 +5543,7 @@ public void setNamePolicy(XmlViolationPolicy namePolicy) {
/**
* Sets the documentModeHandler.
- *
+ *
* @param documentModeHandler
* the documentModeHandler to set
*/
@@ -5351,7 +5553,7 @@ public void setDocumentModeHandler(DocumentModeHandler documentModeHandler) {
/**
* Sets the reportingDoctype.
- *
+ *
* @param reportingDoctype
* the reportingDoctype to set
*/
@@ -5417,7 +5619,7 @@ private boolean charBufferContainsNonWhitespace() {
* creation is only supported immediately after a script end tag has been
* processed. In C++ the caller is responsible for calling
* <code>delete</code> on the returned object.
- *
+ *
* @return a snapshot.
* @throws SAXException
*/
@@ -5506,7 +5708,7 @@ public boolean snapshotMatches(TreeBuilderState<T> snapshot) {
int stackLen = snapshot.getStackLength();
StackNode<T>[] listCopy = snapshot.getListOfActiveFormattingElements();
int listLen = snapshot.getListOfActiveFormattingElementsLength();
-
+
for (int i = 0; i <= listPtr; i++) {
if (listOfActiveFormattingElements[i] != null) {
listOfActiveFormattingElements[i].release();
@@ -5551,7 +5753,7 @@ public boolean snapshotMatches(TreeBuilderState<T> snapshot) {
null
// [NOCPP[
, node.getLocator()
- // ]NOCPP]
+ // ]NOCPP]
);
stack[i] = newNode;
} else {
@@ -5587,16 +5789,16 @@ public T getFormPointer() {
/**
* Returns the headPointer.
- *
+ *
* @return the headPointer
*/
public T getHeadPointer() {
return headPointer;
}
-
+
/**
* Returns the deepTreeSurrogateParent.
- *
+ *
* @return the deepTreeSurrogateParent
*/
public T getDeepTreeSurrogateParent() {
@@ -5619,7 +5821,7 @@ public T getDeepTreeSurrogateParent() {
/**
* Returns the mode.
- *
+ *
* @return the mode
*/
public int getMode() {
@@ -5628,7 +5830,7 @@ public int getMode() {
/**
* Returns the originalMode.
- *
+ *
* @return the originalMode
*/
public int getOriginalMode() {
@@ -5637,16 +5839,16 @@ public int getOriginalMode() {
/**
* Returns the framesetOk.
- *
+ *
* @return the framesetOk
*/
public boolean isFramesetOk() {
return framesetOk;
}
-
+
/**
* Returns the needToDropLF.
- *
+ *
* @return the needToDropLF
*/
public boolean isNeedToDropLF() {
@@ -5655,7 +5857,7 @@ public boolean isNeedToDropLF() {
/**
* Returns the quirks.
- *
+ *
* @return the quirks
*/
public boolean isQuirks() {
@@ -5679,30 +5881,30 @@ public int getStackLength() {
/**
* Reports a stray start tag.
* @param name the name of the stray tag
- *
+ *
* @throws SAXException
*/
private void errStrayStartTag(@Local String name) throws SAXException {
- err("Stray end tag \u201C" + name + "\u201D.");
+ err("Stray start tag \u201C" + name + "\u201D.");
}
/**
* Reports a stray end tag.
* @param name the name of the stray tag
- *
+ *
* @throws SAXException
*/
private void errStrayEndTag(@Local String name) throws SAXException {
err("Stray end tag \u201C" + name + "\u201D.");
}
-
+
/**
* Reports a state when elements expected to be closed were not.
- *
+ *
* @param eltPos the position of the start tag on the stack of the element
* being closed.
* @param name the name of the end tag
- *
+ *
* @throws SAXException
*/
private void errUnclosedElements(int eltPos, @Local String name) throws SAXException {
@@ -5711,13 +5913,13 @@ private void errUnclosedElements(int eltPos, @Local String name) throws SAXExcep
}
/**
- * Reports a state when elements expected to be closed ahead of an implied
+ * Reports a state when elements expected to be closed ahead of an implied
* end tag but were not.
- *
+ *
* @param eltPos the position of the start tag on the stack of the element
* being closed.
* @param name the name of the end tag
- *
+ *
* @throws SAXException
*/
private void errUnclosedElementsImplied(int eltPos, String name) throws SAXException {
@@ -5726,9 +5928,9 @@ private void errUnclosedElementsImplied(int eltPos, String name) throws SAXExcep
}
/**
- * Reports a state when elements expected to be closed ahead of an implied
+ * Reports a state when elements expected to be closed ahead of an implied
* table cell close.
- *
+ *
* @param eltPos the position of the start tag on the stack of the element
* being closed.
* @throws SAXException
@@ -5737,7 +5939,7 @@ private void errUnclosedElementsCell(int eltPos) throws SAXException {
errNoCheck("A table cell was implicitly closed, but there were open elements.");
errListUnclosedStartTags(eltPos);
}
-
+
private void errStrayDoctype() throws SAXException {
err("Stray doctype.");
}
@@ -5970,7 +6172,7 @@ private void errEofWithUnclosedElements() throws SAXException {
/**
* Reports arriving at/near end of document with unclosed elements remaining.
- *
+ *
* @param message
* the message
* @throws SAXException
View
8 parser/html/nsHtml5AtomList.h
@@ -21,6 +21,7 @@
*/
HTML5_ATOM(emptystring, "")
+HTML5_ATOM(template_, "template")
HTML5_ATOM(title, "title")
HTML5_ATOM(textarea, "textarea")
HTML5_ATOM(style, "style")
@@ -44,6 +45,9 @@ HTML5_ATOM(option, "option")
HTML5_ATOM(ruby, "ruby")
HTML5_ATOM(select, "select")
HTML5_ATOM(optgroup, "optgroup")
+HTML5_ATOM(tbody, "tbody")
+HTML5_ATOM(tfoot, "tfoot")
+HTML5_ATOM(thead, "thead")
HTML5_ATOM(frameset, "frameset")
HTML5_ATOM(button, "button")
HTML5_ATOM(ul, "ul")
@@ -52,9 +56,6 @@ HTML5_ATOM(html, "html")
HTML5_ATOM(td, "td")
HTML5_ATOM(th, "th")
HTML5_ATOM(tr, "tr")
-HTML5_ATOM(tbody, "tbody")
-HTML5_ATOM(thead, "thead")
-HTML5_ATOM(tfoot, "tfoot")
HTML5_ATOM(colgroup, "colgroup")
HTML5_ATOM(head, "head")
HTML5_ATOM(body, "body")
@@ -331,7 +332,6 @@ HTML5_ATOM(mathsize, "mathsize")
HTML5_ATOM(multiple, "multiple")
HTML5_ATOM(longdesc, "longdesc")
HTML5_ATOM(language, "language")
-HTML5_ATOM(template_, "template")
HTML5_ATOM(tabindex, "tabindex")
HTML5_ATOM(readonly, "readonly")
HTML5_ATOM(selected, "selected")
View
2  parser/html/nsHtml5AttributeName.cpp
@@ -776,7 +776,7 @@ nsHtml5AttributeName* nsHtml5AttributeName::ATTR_COLOR_INTERPOLATION_FILTERS = n
nsHtml5AttributeName* nsHtml5AttributeName::ATTR_GLYPH_ORIENTATION_HORIZONTAL = nullptr;
nsHtml5AttributeName** nsHtml5AttributeName::ATTRIBUTE_NAMES = 0;
static int32_t const ATTRIBUTE_HASHES_DATA[] = { 1153, 1383, 1601, 1793, 1827, 1857, 68600, 69146, 69177, 70237, 70270, 71572, 71669, 72415, 72444, 74846, 74904, 74943, 75001, 75276, 75590, 84742, 84839, 85575, 85963, 85992, 87204, 88074, 88171, 89130, 89163, 3207892, 3283895, 3284791, 3338752, 3358197, 3369562, 3539124, 3562402, 3574260, 3670335, 3696933, 3721879, 135280021, 135346322, 136317019, 136475749, 136548517, 136652214, 136884919, 136902418, 136942992, 137292068, 139120259, 139785574, 142250603, 142314056, 142331176, 142519584, 144752417, 145106895, 146147200, 146765926, 148805544, 149655723, 149809441, 150018784, 150445028, 150813181, 150923321, 152528754, 152536216, 152647366, 152962785, 155219321, 155654904, 157317483, 157350248, 157437941, 157447478, 157604838, 157685404, 157894402, 158315188, 166078431, 169409980, 169700259, 169856932, 170007032, 170409695, 170466488, 170513710, 170608367, 173028944, 173896963, 176090625, 176129212, 179390001, 179489057, 179627464, 179840468, 179849042, 180004216, 181779081, 183027151, 183645319, 183698797, 185922012, 185997252, 188312483, 188675799, 190977533, 190992569, 191006194, 191033518, 191038774, 191096249, 191166163, 191194426, 191522106, 191568039, 200104642, 202506661, 202537381, 202602917, 203070590, 203120766, 203389054, 203690071, 203971238, 203986524, 209040857, 209125756, 212055489, 212322418, 212746849, 213002877, 213055164, 213088023, 213259873, 213273386, 213435118, 213437318, 213438231, 213493071, 213532268, 213542834, 213584431, 213659891, 215285828, 215880731, 216112976, 216684637, 217369699, 217565298, 217576549, 218186795, 219743185, 220082234, 221623802, 221986406, 222283890, 223089542, 223138630, 223311265, 224547358, 224587256, 224589550, 224655650, 224785518, 224810917, 224813302, 225429618, 225432950, 225440869, 236107233, 236709921, 236838947, 237117095, 237143271, 237172455, 237209953, 237354143, 237372743, 237668065, 237703073, 237714273, 239743521, 240512803, 240522627, 240560417, 240656513, 241015715, 241062755, 241065383, 243523041, 245865199, 246261793, 246556195, 246774817, 246923491, 246928419, 246981667, 247014847, 247058369, 247112833, 247118177, 247119137, 247128739, 247316903, 249533729, 250235623, 250269543, 251402351, 252339047, 253260911, 253293679, 254844367, 255547879, 256077281, 256345377, 258124199, 258354465, 258605063, 258744193, 258845603, 258856961, 258926689, 269869248, 270174334, 270709417, 270778994, 270781796, 271102503, 271478858, 271490090, 272870654, 273335275, 273369140, 273924313, 274108530, 274116736, 276818662, 277476156, 279156579, 279349675, 280108533, 280128712, 280132869, 280162403, 280280292, 280413430, 280506130, 280677397, 280678580, 280686710, 280689066, 282736758, 283110901, 283275116, 283823226, 283890012, 284479340, 284606461, 286700477, 286798916, 291557706, 291665349, 291804100, 292138018, 292166446, 292418738, 292451039, 300298041, 300374839, 300597935, 303073389, 303083839, 303266673, 303354997, 303430688, 303576261, 303724281, 303819694, 304242723, 304382625, 306247792, 307227811, 307468786, 307724489, 309671175, 310252031, 310358241, 310373094, 311015256, 313357609, 313683893, 313701861, 313706996, 313707317, 313710350, 314027746, 314038181, 314091299, 314205627, 314233813, 316741830, 316797986, 317486755, 317794164, 320076137, 322657125, 322887778, 323506876, 323572412, 323605180, 325060058, 325320188, 325398738, 325541490, 325671619, 333868843, 336806130, 337212108, 337282686, 337285434, 337585223, 338036037, 338298087, 338566051, 340943551, 341190970, 342995704, 343352124, 343912673, 344585053, 346977248, 347218098, 347262163, 347278576, 347438191, 347655959, 347684788, 347726430, 347727772, 347776035, 347776629, 349500753, 350880161, 350887073, 353384123, 355496998, 355906922, 355979793, 356545959, 358637867, 358905016, 359164318, 359247286, 359350571, 359579447, 365560330, 367399355, 367420285, 367510727, 368013212, 370234760, 370353345, 370710317, 371074566, 371122285, 371194213, 371448425, 371448430, 371545055, 371593469, 371596922, 371758751, 371964792, 372151328, 376550136, 376710172, 376795771, 376826271, 376906556, 380514830, 380774774, 380775037, 381030322, 381136500, 381281631, 381282269, 381285504, 381330595, 381331422, 381335911, 381336484, 383907298, 383917408, 384595009, 384595013, 387799894, 387823201, 392581647, 392584937, 392742684, 392906485, 393003349, 400644707, 400973830, 404428547, 404432113, 404432865, 404469244, 404478897, 404694860, 406887479, 408294949, 408789955, 410022510, 410467324, 410586448, 410945965, 411845275, 414327152, 414327932, 414329781, 414346257, 414346439, 414639928, 414835998, 414894517, 414986533, 417465377, 417465381, 417492216, 418259232, 419310946, 420103495, 420242342, 420380455, 420658662, 420717432, 423183880, 424539259, 425929170, 425972964, 426050649, 426126450, 426142833, 426607922, 437289840, 437347469, 437412335, 437423943, 437455540, 437462252, 437597991, 437617485, 437986305, 437986507, 437986828, 437987072, 438015591, 438034813, 438038966, 438179623, 438347971, 438483573, 438547062, 438895551, 441592676, 442032555, 443548979, 447881379, 447881655, 447881895, 447887844, 448416189, 448445746, 448449012, 450942191, 452816744, 453668677, 454434495, 456610076, 456642844, 456738709, 457544600, 459451897, 459680944, 468058810, 468083581, 470964084, 471470955, 471567278, 472267822, 481177859, 481210627, 481435874, 481455115, 481485378, 481490218, 485105638, 486005878, 486383494, 487988916, 488103783, 490661867, 491574090, 491578272, 493041952, 493441205, 493582844, 493716979, 504577572, 504740359, 505091638, 505592418, 505656212, 509516275, 514998531, 515571132, 515594682, 518712698, 521362273, 526592419, 526807354, 527348842, 538294791, 539214049, 544689535, 545535009, 548544752, 548563346, 548595116, 551679010, 558034099, 560329411, 560356209, 560671018, 560671152, 560692590, 560845442, 569212097, 569474241, 572252718, 572768481, 575326764, 576174758, 576190819, 582099184, 582099438, 582372519, 582558889, 586552164, 591325418, 594231990, 594243961, 605711268, 615672071, 616086845, 621792370, 624879850, 627432831, 640040548, 654392808, 658675477, 659420283, 672891587, 694768102, 705890982, 725543146, 759097578, 761686526, 795383908, 843809551, 878105336, 908643300, 945213471 };
-staticJArray<int32_t,int32_t> nsHtml5AttributeName::ATTRIBUTE_HASHES = { ATTRIBUTE_HASHES_DATA, NS_ARRAY_LENGTH(ATTRIBUTE_HASHES_DATA) };
+staticJArray<int32_t,int32_t> nsHtml5AttributeName::ATTRIBUTE_HASHES = { ATTRIBUTE_HASHES_DATA, MOZ_ARRAY_LENGTH(ATTRIBUTE_HASHES_DATA) };
void
nsHtml5AttributeName::initializeStatics()
{
View
162 parser/html/nsHtml5ElementName.cpp
@@ -451,6 +451,7 @@ nsHtml5ElementName* nsHtml5ElementName::ELT_PRSUBSET = nullptr;
nsHtml5ElementName* nsHtml5ElementName::ELT_QUOTIENT = nullptr;
nsHtml5ElementName* nsHtml5ElementName::ELT_SELECTOR = nullptr;
nsHtml5ElementName* nsHtml5ElementName::ELT_TEXTAREA = nullptr;
+nsHtml5ElementName* nsHtml5ElementName::ELT_TEMPLATE = nullptr;
nsHtml5ElementName* nsHtml5ElementName::ELT_TEXTPATH = nullptr;
nsHtml5ElementName* nsHtml5ElementName::ELT_VARIANCE = nullptr;
nsHtml5ElementName* nsHtml5ElementName::ELT_ANIMATION = nullptr;
@@ -528,8 +529,8 @@ nsHtml5ElementName* nsHtml5ElementName::ELT_FESPECULARLIGHTING = nullptr;
nsHtml5ElementName* nsHtml5ElementName::ELT_DOMAINOFAPPLICATION = nullptr;
nsHtml5ElementName* nsHtml5ElementName::ELT_FECOMPONENTTRANSFER = nullptr;
nsHtml5ElementName** nsHtml5ElementName::ELEMENT_NAMES = 0;
-static int32_t const ELEMENT_HASHES_DATA[] = { 1057, 1090, 1255, 1321, 1552, 1585, 1651, 1717, 68162, 68899, 69059, 69764, 70020, 70276, 71077, 71205, 72134, 72232, 72264, 72296, 72328, 72360, 72392, 73351, 74312, 75209, 78124, 78284, 78476, 79149, 79309, 79341, 79469, 81295, 81487, 82224, 84498, 84626, 86164, 86292, 86612, 86676, 87445, 3183041, 3186241, 3198017, 3218722, 3226754, 3247715, 3256803, 3263971, 3264995, 3289252, 3291332, 3295524, 3299620, 3326725, 3379303, 3392679, 3448233, 3460553, 3461577, 3510347, 3546604, 3552364, 3556524, 3576461, 3586349, 3588141, 3590797, 3596333, 3622062, 3625454, 3627054, 3675728, 3749042, 3771059, 3771571, 3776211, 3782323, 3782963, 3784883, 3785395, 3788979, 3815476, 3839605, 3885110, 3917911, 3948984, 3951096, 135304769, 135858241, 136498210, 136906434, 137138658, 137512995, 137531875, 137548067, 137629283, 137645539, 137646563, 137775779, 138529956, 138615076, 139040932, 140954086, 141179366, 141690439, 142738600, 143013512, 146979116, 147175724, 147475756, 147902637, 147936877, 148017645, 148131885, 148228141, 148229165, 148309165, 148317229, 148395629, 148551853, 148618829, 149076462, 149490158, 149572782, 151277616, 151639440, 153268914, 153486514, 153563314, 153750706, 153763314, 153914034, 154406067, 154417459, 154600979, 154678323, 154680979, 154866835, 155366708, 155375188, 155391572, 155465780, 155869364, 158045494, 168988979, 169321621, 169652752, 173151309, 174240818, 174247297, 174669292, 175391532, 176638123, 177380397, 177879204, 177886734, 180753473, 181020073, 181503558, 181686320, 181999237, 181999311, 182048201, 182074866, 182078003, 182083764, 182920847, 184716457, 184976961, 185145071, 187281445, 187872052, 188100653, 188875944, 188919873, 188920457, 189107250, 189203987, 189371817, 189414886, 189567458, 190266670, 191318187, 191337609, 202479203, 202493027, 202835587, 202843747, 203013219, 203036048, 203045987, 203177552, 203898516, 204648562, 205067918, 205078130, 205096654, 205689142, 205690439, 205988909, 207213161, 207794484, 207800999, 208023602, 208213644, 208213647, 210261490, 210310273, 210940978, 213325049, 213946445, 214055079, 215125040, 215134273, 215135028, 215237420, 215418148, 215553166, 215553394, 215563858, 215627949, 215754324, 217529652, 217713834, 217732628, 218731945, 221417045, 221424946, 221493746, 221515401, 221658189, 221908140, 221910626, 221921586, 222659762, 225001091, 236105833, 236113965, 236194995, 236195427, 236206132, 236206387, 236211683, 236212707, 236381647, 236571826, 237124271, 238172205, 238210544, 238270764, 238435405, 238501172, 239224867, 239257644, 239710497, 240307721, 241208789, 241241557, 241318060, 241319404, 241343533, 241344069, 241405397, 241765845, 243864964, 244502085, 244946220, 245109902, 247647266, 247707956, 248648814, 248648836, 248682161, 248986932, 249058914, 249697357, 252132601, 252135604, 252317348, 255007012, 255278388, 255641645, 256365156, 257566121, 269763372, 271202790, 271863856, 272049197, 272127474, 274339449, 274939471, 275388004, 275388005, 275388006, 275977800, 278267602, 278513831, 278712622, 281613765, 281683369, 282120228, 282250732, 282498697, 282508942, 283743649, 283787570, 284710386, 285391148, 285478533, 285854898, 285873762, 286931113, 288964227, 289445441, 289689648, 291671489, 303512884, 305319975, 305610036, 305764101, 308448294, 308675890, 312085683, 312264750, 315032867, 316391000, 317331042, 317902135, 318950711, 319447220, 321499182, 322538804, 323145200, 337067316, 337826293, 339905989, 340833697, 341457068, 342310196, 345302593, 349554733, 349771471, 349786245, 350819405, 356072847, 370349192, 373962798, 375558638, 375574835, 376053993, 383276530, 383373833, 383407586, 384439906, 386079012, 404133513, 404307343, 407031852, 408072233, 409112005, 409608425, 409771500, 419040932, 437730612, 439529766, 442616365, 442813037, 443157674, 443295316, 450118444, 450482697, 456789668, 459935396, 471217869, 474073645, 476230702, 476665218, 476717289, 483014825, 485083298, 489306281, 538364390, 540675748, 543819186, 543958612, 576960820, 577242548, 610515252, 642202932, 644420819 };
-staticJArray<int32_t,int32_t> nsHtml5ElementName::ELEMENT_HASHES = { ELEMENT_HASHES_DATA, NS_ARRAY_LENGTH(ELEMENT_HASHES_DATA) };
+static int32_t const ELEMENT_HASHES_DATA[] = { 1057, 1090, 1255, 1321, 1552, 1585, 1651, 1717, 68162, 68899, 69059, 69764, 70020, 70276, 71077, 71205, 72134, 72232, 72264, 72296, 72328, 72360, 72392, 73351, 74312, 75209, 78124, 78284, 78476, 79149, 79309, 79341, 79469, 81295, 81487, 82224, 84498, 84626, 86164, 86292, 86612, 86676, 87445, 3183041, 3186241, 3198017, 3218722, 3226754, 3247715, 3256803, 3263971, 3264995, 3289252, 3291332, 3295524, 3299620, 3326725, 3379303, 3392679, 3448233, 3460553, 3461577, 3510347, 3546604, 3552364, 3556524, 3576461, 3586349, 3588141, 3590797, 3596333, 3622062, 3625454, 3627054, 3675728, 3749042, 3771059, 3771571, 3776211, 3782323, 3782963, 3784883, 3785395, 3788979, 3815476, 3839605, 3885110, 3917911, 3948984, 3951096, 135304769, 135858241, 136498210, 136906434, 137138658, 137512995, 137531875, 137548067, 137629283, 137645539, 137646563, 137775779, 138529956, 138615076, 139040932, 140954086, 141179366, 141690439, 142738600, 143013512, 146979116, 147175724, 147475756, 147902637, 147936877, 148017645, 148131885, 148228141, 148229165, 148309165, 148317229, 148395629, 148551853, 148618829, 149076462, 149490158, 149572782, 151277616, 151639440, 153268914, 153486514, 153563314, 153750706, 153763314, 153914034, 154406067, 154417459, 154600979, 154678323, 154680979, 154866835, 155366708, 155375188, 155391572, 155465780, 155869364, 158045494, 168988979, 169321621, 169652752, 173151309, 174240818, 174247297, 174669292, 175391532, 176638123, 177380397, 177879204, 177886734, 180753473, 181020073, 181503558, 181686320, 181999237, 181999311, 182048201, 182074866, 182078003, 182083764, 182920847, 184716457, 184976961, 185145071, 187281445, 187872052, 188100653, 188875944, 188919873, 188920457, 189107250, 189203987, 189371817, 189414886, 189567458, 190266670, 191318187, 191337609, 202479203, 202493027, 202835587, 202843747, 203013219, 203036048, 203045987, 203177552, 203898516, 204648562, 205067918, 205078130, 205096654, 205689142, 205690439, 205988909, 207213161, 207794484, 207800999, 208023602, 208213644, 208213647, 210261490, 210310273, 210940978, 213325049, 213946445, 214055079, 215125040, 215134273, 215135028, 215237420, 215418148, 215553166, 215553394, 215563858, 215627949, 215754324, 217529652, 217713834, 217732628, 218731945, 221417045, 221424946, 221493746, 221515401, 221658189, 221908140, 221910626, 221921586, 222659762, 225001091, 236105833, 236113965, 236194995, 236195427, 236206132, 236206387, 236211683, 236212707, 236381647, 236571826, 237124271, 238172205, 238210544, 238270764, 238435405, 238501172, 239224867, 239257644, 239710497, 240307721, 241208789, 241241557, 241318060, 241319404, 241343533, 241344069, 241405397, 241765845, 243864964, 244502085, 244946220, 245109902, 247647266, 247707956, 248648814, 248648836, 248682161, 248986932, 249058914, 249697357, 252132601, 252135604, 252317348, 255007012, 255278388, 255641645, 256365156, 257566121, 269763372, 271202790, 271863856, 272049197, 272127474, 274339449, 274939471, 275388004, 275388005, 275388006, 275977800, 278267602, 278513831, 278712622, 281613765, 281683369, 282120228, 282250732, 282498697, 282508942, 283743649, 283787570, 284710386, 285391148, 285478533, 285854898, 285873762, 286931113, 288964227, 289445441, 289591340, 289689648, 291671489, 303512884, 305319975, 305610036, 305764101, 308448294, 308675890, 312085683, 312264750, 315032867, 316391000, 317331042, 317902135, 318950711, 319447220, 321499182, 322538804, 323145200, 337067316, 337826293, 339905989, 340833697, 341457068, 342310196, 345302593, 349554733, 349771471, 349786245, 350819405, 356072847, 370349192, 373962798, 375558638, 375574835, 376053993, 383276530, 383373833, 383407586, 384439906, 386079012, 404133513, 404307343, 407031852, 408072233, 409112005, 409608425, 409771500, 419040932, 437730612, 439529766, 442616365, 442813037, 443157674, 443295316, 450118444, 450482697, 456789668, 459935396, 471217869, 474073645, 476230702, 476665218, 476717289, 483014825, 485083298, 489306281, 538364390, 540675748, 543819186, 543958612, 576960820, 577242548, 610515252, 642202932, 644420819 };
+staticJArray<int32_t,int32_t> nsHtml5ElementName::ELEMENT_HASHES = { ELEMENT_HASHES_DATA, MOZ_ARRAY_LENGTH(ELEMENT_HASHES_DATA) };
void
nsHtml5ElementName::initializeStatics()
{
@@ -851,6 +852,7 @@ nsHtml5ElementName::initializeStatics()
ELT_QUOTIENT = new nsHtml5ElementName(nsHtml5Atoms::quotient, nsHtml5Atoms::quotient, NS_HTML5TREE_BUILDER_OTHER);
ELT_SELECTOR = new nsHtml5ElementName(nsHtml5Atoms::selector, nsHtml5Atoms::selector, NS_HTML5TREE_BUILDER_OTHER);
ELT_TEXTAREA = new nsHtml5ElementName(nsHtml5Atoms::textarea, nsHtml5Atoms::textarea, NS_HTML5TREE_BUILDER_TEXTAREA | NS_HTML5ELEMENT_NAME_SPECIAL);
+ ELT_TEMPLATE = new nsHtml5ElementName(nsHtml5Atoms::template_, nsHtml5Atoms::template_, NS_HTML5TREE_BUILDER_TEMPLATE | NS_HTML5ELEMENT_NAME_SPECIAL);
ELT_TEXTPATH = new nsHtml5ElementName(nsHtml5Atoms::textpath, nsHtml5Atoms::textPath, NS_HTML5TREE_BUILDER_OTHER);
ELT_VARIANCE = new nsHtml5ElementName(nsHtml5Atoms::variance, nsHtml5Atoms::variance, NS_HTML5TREE_BUILDER_OTHER);
ELT_ANIMATION = new nsHtml5ElementName(nsHtml5Atoms::animation, nsHtml5Atoms::animation, NS_HTML5TREE_BUILDER_OTHER);
@@ -927,7 +929,7 @@ nsHtml5ElementName::initializeStatics()
ELT_FESPECULARLIGHTING = new nsHtml5ElementName(nsHtml5Atoms::fespecularlighting, nsHtml5Atoms::feSpecularLighting, NS_HTML5TREE_BUILDER_OTHER);
ELT_DOMAINOFAPPLICATION = new nsHtml5ElementName(nsHtml5Atoms::domainofapplication, nsHtml5Atoms::domainofapplication, NS_HTML5TREE_BUILDER_OTHER);
ELT_FECOMPONENTTRANSFER = new nsHtml5ElementName(nsHtml5Atoms::fecomponenttransfer, nsHtml5Atoms::feComponentTransfer, NS_HTML5TREE_BUILDER_OTHER);
- ELEMENT_NAMES = new nsHtml5ElementName*[393];
+ ELEMENT_NAMES = new nsHtml5ElementName*[394];
ELEMENT_NAMES[0] = ELT_A;
ELEMENT_NAMES[1] = ELT_B;
ELEMENT_NAMES[2] = ELT_G;
@@ -1245,82 +1247,83 @@ nsHtml5ElementName::initializeStatics()
ELEMENT_NAMES[314] = ELT_QUOTIENT;
ELEMENT_NAMES[315] = ELT_SELECTOR;
ELEMENT_NAMES[316] = ELT_TEXTAREA;
- ELEMENT_NAMES[317] = ELT_TEXTPATH;
- ELEMENT_NAMES[318] = ELT_VARIANCE;
- ELEMENT_NAMES[319] = ELT_ANIMATION;
- ELEMENT_NAMES[320] = ELT_CONJUGATE;
- ELEMENT_NAMES[321] = ELT_CONDITION;
- ELEMENT_NAMES[322] = ELT_COMPLEXES;
- ELEMENT_NAMES[323] = ELT_FONT_FACE;
- ELEMENT_NAMES[324] = ELT_FACTORIAL;
- ELEMENT_NAMES[325] = ELT_INTERSECT;
- ELEMENT_NAMES[326] = ELT_IMAGINARY;
- ELEMENT_NAMES[327] = ELT_LAPLACIAN;
- ELEMENT_NAMES[328] = ELT_MATRIXROW;
- ELEMENT_NAMES[329] = ELT_NOTSUBSET;
- ELEMENT_NAMES[330] = ELT_OTHERWISE;
- ELEMENT_NAMES[331] = ELT_PIECEWISE;
- ELEMENT_NAMES[332] = ELT_PLAINTEXT;
- ELEMENT_NAMES[333] = ELT_RATIONALS;
- ELEMENT_NAMES[334] = ELT_SEMANTICS;
- ELEMENT_NAMES[335] = ELT_TRANSPOSE;
- ELEMENT_NAMES[336] = ELT_ANNOTATION;
- ELEMENT_NAMES[337] = ELT_BLOCKQUOTE;
- ELEMENT_NAMES[338] = ELT_DIVERGENCE;
- ELEMENT_NAMES[339] = ELT_EULERGAMMA;
- ELEMENT_NAMES[340] = ELT_EQUIVALENT;
- ELEMENT_NAMES[341] = ELT_FIGCAPTION;
- ELEMENT_NAMES[342] = ELT_IMAGINARYI;
- ELEMENT_NAMES[343] = ELT_MALIGNMARK;
- ELEMENT_NAMES[344] = ELT_MUNDEROVER;
- ELEMENT_NAMES[345] = ELT_MLABELEDTR;
- ELEMENT_NAMES[346] = ELT_NOTANUMBER;
- ELEMENT_NAMES[347] = ELT_SOLIDCOLOR;
- ELEMENT_NAMES[348] = ELT_ALTGLYPHDEF;
- ELEMENT_NAMES[349] = ELT_DETERMINANT;
- ELEMENT_NAMES[350] = ELT_FEMERGENODE;
- ELEMENT_NAMES[351] = ELT_FECOMPOSITE;
- ELEMENT_NAMES[352] = ELT_FESPOTLIGHT;
- ELEMENT_NAMES[353] = ELT_MALIGNGROUP;
- ELEMENT_NAMES[354] = ELT_MPRESCRIPTS;
- ELEMENT_NAMES[355] = ELT_MOMENTABOUT;
- ELEMENT_NAMES[356] = ELT_NOTPRSUBSET;
- ELEMENT_NAMES[357] = ELT_PARTIALDIFF;
- ELEMENT_NAMES[358] = ELT_ALTGLYPHITEM;
- ELEMENT_NAMES[359] = ELT_ANIMATECOLOR;
- ELEMENT_NAMES[360] = ELT_DATATEMPLATE;
- ELEMENT_NAMES[361] = ELT_EXPONENTIALE;
- ELEMENT_NAMES[362] = ELT_FETURBULENCE;
- ELEMENT_NAMES[363] = ELT_FEPOINTLIGHT;
- ELEMENT_NAMES[364] = ELT_FEMORPHOLOGY;
- ELEMENT_NAMES[365] = ELT_OUTERPRODUCT;
- ELEMENT_NAMES[366] = ELT_ANIMATEMOTION;
- ELEMENT_NAMES[367] = ELT_COLOR_PROFILE;
- ELEMENT_NAMES[368] = ELT_FONT_FACE_SRC;
- ELEMENT_NAMES[369] = ELT_FONT_FACE_URI;
- ELEMENT_NAMES[370] = ELT_FOREIGNOBJECT;
- ELEMENT_NAMES[371] = ELT_FECOLORMATRIX;
- ELEMENT_NAMES[372] = ELT_MISSING_GLYPH;
- ELEMENT_NAMES[373] = ELT_MMULTISCRIPTS;
- ELEMENT_NAMES[374] = ELT_SCALARPRODUCT;
- ELEMENT_NAMES[375] = ELT_VECTORPRODUCT;
- ELEMENT_NAMES[376] = ELT_ANNOTATION_XML;
- ELEMENT_NAMES[377] = ELT_DEFINITION_SRC;
- ELEMENT_NAMES[378] = ELT_FONT_FACE_NAME;
- ELEMENT_NAMES[379] = ELT_FEGAUSSIANBLUR;
- ELEMENT_NAMES[380] = ELT_FEDISTANTLIGHT;
- ELEMENT_NAMES[381] = ELT_LINEARGRADIENT;
- ELEMENT_NAMES[382] = ELT_NATURALNUMBERS;
- ELEMENT_NAMES[383] = ELT_RADIALGRADIENT;
- ELEMENT_NAMES[384] = ELT_ANIMATETRANSFORM;
- ELEMENT_NAMES[385] = ELT_CARTESIANPRODUCT;
- ELEMENT_NAMES[386] = ELT_FONT_FACE_FORMAT;
- ELEMENT_NAMES[387] = ELT_FECONVOLVEMATRIX;
- ELEMENT_NAMES[388] = ELT_FEDIFFUSELIGHTING;
- ELEMENT_NAMES[389] = ELT_FEDISPLACEMENTMAP;
- ELEMENT_NAMES[390] = ELT_FESPECULARLIGHTING;
- ELEMENT_NAMES[391] = ELT_DOMAINOFAPPLICATION;
- ELEMENT_NAMES[392] = ELT_FECOMPONENTTRANSFER;
+ ELEMENT_NAMES[317] = ELT_TEMPLATE;
+ ELEMENT_NAMES[318] = ELT_TEXTPATH;
+ ELEMENT_NAMES[319] = ELT_VARIANCE;
+ ELEMENT_NAMES[320] = ELT_ANIMATION;
+ ELEMENT_NAMES[321] = ELT_CONJUGATE;
+ ELEMENT_NAMES[322] = ELT_CONDITION;
+ ELEMENT_NAMES[323] = ELT_COMPLEXES;
+ ELEMENT_NAMES[324] = ELT_FONT_FACE;
+ ELEMENT_NAMES[325] = ELT_FACTORIAL;
+ ELEMENT_NAMES[326] = ELT_INTERSECT;
+ ELEMENT_NAMES[327] = ELT_IMAGINARY;
+ ELEMENT_NAMES[328] = ELT_LAPLACIAN;
+ ELEMENT_NAMES[329] = ELT_MATRIXROW;
+ ELEMENT_NAMES[330] = ELT_NOTSUBSET;
+ ELEMENT_NAMES[331] = ELT_OTHERWISE;
+ ELEMENT_NAMES[332] = ELT_PIECEWISE;
+ ELEMENT_NAMES[333] = ELT_PLAINTEXT;
+ ELEMENT_NAMES[334] = ELT_RATIONALS;
+ ELEMENT_NAMES[335] = ELT_SEMANTICS;
+ ELEMENT_NAMES[336] = ELT_TRANSPOSE;
+ ELEMENT_NAMES[337] = ELT_ANNOTATION;
+ ELEMENT_NAMES[338] = ELT_BLOCKQUOTE;
+ ELEMENT_NAMES[339] = ELT_DIVERGENCE;
+ ELEMENT_NAMES[340] = ELT_EULERGAMMA;
+ ELEMENT_NAMES[341] = ELT_EQUIVALENT;
+ ELEMENT_NAMES[342] = ELT_FIGCAPTION;
+ ELEMENT_NAMES[343] = ELT_IMAGINARYI;
+ ELEMENT_NAMES[344] = ELT_MALIGNMARK;
+ ELEMENT_NAMES[345] = ELT_MUNDEROVER;
+ ELEMENT_NAMES[346] = ELT_MLABELEDTR;
+ ELEMENT_NAMES[347] = ELT_NOTANUMBER;
+ ELEMENT_NAMES[348] = ELT_SOLIDCOLOR;
+ ELEMENT_NAMES[349] = ELT_ALTGLYPHDEF;
+ ELEMENT_NAMES[350] = ELT_DETERMINANT;
+ ELEMENT_NAMES[351] = ELT_FEMERGENODE;
+ ELEMENT_NAMES[352] = ELT_FECOMPOSITE;
+ ELEMENT_NAMES[353] = ELT_FESPOTLIGHT;
+ ELEMENT_NAMES[354] = ELT_MALIGNGROUP;
+ ELEMENT_NAMES[355] = ELT_MPRESCRIPTS;
+ ELEMENT_NAMES[356] = ELT_MOMENTABOUT;
+ ELEMENT_NAMES[357] = ELT_NOTPRSUBSET;
+ ELEMENT_NAMES[358] = ELT_PARTIALDIFF;
+ ELEMENT_NAMES[359] = ELT_ALTGLYPHITEM;
+ ELEMENT_NAMES[360] = ELT_ANIMATECOLOR;
+ ELEMENT_NAMES[361] = ELT_DATATEMPLATE;
+ ELEMENT_NAMES[362] = ELT_EXPONENTIALE;
+ ELEMENT_NAMES[363] = ELT_FETURBULENCE;
+ ELEMENT_NAMES[364] = ELT_FEPOINTLIGHT;
+ ELEMENT_NAMES[365] = ELT_FEMORPHOLOGY;
+ ELEMENT_NAMES[366] = ELT_OUTERPRODUCT;
+ ELEMENT_NAMES[367] = ELT_ANIMATEMOTION;
+ ELEMENT_NAMES[368] = ELT_COLOR_PROFILE;
+ ELEMENT_NAMES[369] = ELT_FONT_FACE_SRC;
+ ELEMENT_NAMES[370] = ELT_FONT_FACE_URI;
+ ELEMENT_NAMES[371] = ELT_FOREIGNOBJECT;
+ ELEMENT_NAMES[372] = ELT_FECOLORMATRIX;
+ ELEMENT_NAMES[373] = ELT_MISSING_GLYPH;
+ ELEMENT_NAMES[374] = ELT_MMULTISCRIPTS;
+ ELEMENT_NAMES[375] = ELT_SCALARPRODUCT;
+ ELEMENT_NAMES[376] = ELT_VECTORPRODUCT;
+ ELEMENT_NAMES[377] = ELT_ANNOTATION_XML;
+ ELEMENT_NAMES[378] = ELT_DEFINITION_SRC;
+ ELEMENT_NAMES[379] = ELT_FONT_FACE_NAME;
+ ELEMENT_NAMES[380] = ELT_FEGAUSSIANBLUR;
+ ELEMENT_NAMES[381] = ELT_FEDISTANTLIGHT;
+ ELEMENT_NAMES[382] = ELT_LINEARGRADIENT;
+ ELEMENT_NAMES[383] = ELT_NATURALNUMBERS;
+ ELEMENT_NAMES[384] = ELT_RADIALGRADIENT;
+ ELEMENT_NAMES[385] = ELT_ANIMATETRANSFORM;
+ ELEMENT_NAMES[386] = ELT_CARTESIANPRODUCT;
+ ELEMENT_NAMES[387] = ELT_FONT_FACE_FORMAT;
+ ELEMENT_NAMES[388] = ELT_FECONVOLVEMATRIX;
+ ELEMENT_NAMES[389] = ELT_FEDIFFUSELIGHTING;
+ ELEMENT_NAMES[390] = ELT_FEDISPLACEMENTMAP;
+ ELEMENT_NAMES[391] = ELT_FESPECULARLIGHTING;
+ ELEMENT_NAMES[392] = ELT_DOMAINOFAPPLICATION;
+ ELEMENT_NAMES[393] = ELT_FECOMPONENTTRANSFER;
}
void
@@ -1644,6 +1647,7 @@ nsHtml5ElementName::releaseStatics()
delete ELT_QUOTIENT;
delete ELT_SELECTOR;
delete ELT_TEXTAREA;
+ delete ELT_TEMPLATE;
delete ELT_TEXTPATH;
delete ELT_VARIANCE;
delete ELT_ANIMATION;
View
1  parser/html/nsHtml5ElementName.h
@@ -395,6 +395,7 @@ class nsHtml5ElementName
static nsHtml5ElementName* ELT_QUOTIENT;
static nsHtml5ElementName* ELT_SELECTOR;
static nsHtml5ElementName* ELT_TEXTAREA;
+ static nsHtml5ElementName* ELT_TEMPLATE;
static nsHtml5ElementName* ELT_TEXTPATH;
static nsHtml5ElementName* ELT_VARIANCE;
static nsHtml5ElementName* ELT_ANIMATION;
View
8 parser/html/nsHtml5MetaScanner.cpp
@@ -55,13 +55,13 @@
#include "nsHtml5MetaScanner.h"
static PRUnichar const CHARSET_DATA[] = { 'h', 'a', 'r', 's', 'e', 't' };
-staticJArray<PRUnichar,int32_t> nsHtml5MetaScanner::CHARSET = { CHARSET_DATA, NS_ARRAY_LENGTH(CHARSET_DATA) };
+staticJArray<PRUnichar,int32_t> nsHtml5MetaScanner::CHARSET = { CHARSET_DATA, MOZ_ARRAY_LENGTH(CHARSET_DATA) };
static PRUnichar const CONTENT_DATA[] = { 'o', 'n', 't', 'e', 'n', 't' };
-staticJArray<PRUnichar,int32_t> nsHtml5MetaScanner::CONTENT = { CONTENT_DATA, NS_ARRAY_LENGTH(CONTENT_DATA) };
+staticJArray<PRUnichar,int32_t> nsHtml5MetaScanner::CONTENT = { CONTENT_DATA, MOZ_ARRAY_LENGTH(CONTENT_DATA) };
static PRUnichar const HTTP_EQUIV_DATA[] = { 't', 't', 'p', '-', 'e', 'q', 'u', 'i', 'v' };
-staticJArray<PRUnichar,int32_t> nsHtml5MetaScanner::HTTP_EQUIV = { HTTP_EQUIV_DATA, NS_ARRAY_LENGTH(HTTP_EQUIV_DATA) };
+staticJArray<PRUnichar,int32_t> nsHtml5MetaScanner::HTTP_EQUIV = { HTTP_EQUIV_DATA, MOZ_ARRAY_LENGTH(HTTP_EQUIV_DATA) };
static PRUnichar const CONTENT_TYPE_DATA[] = { 'c', 'o', 'n', 't', 'e', 'n', 't', '-', 't', 'y', 'p', 'e' };
-staticJArray<PRUnichar,int32_t> nsHtml5MetaScanner::CONTENT_TYPE = { CONTENT_TYPE_DATA, NS_ARRAY_LENGTH(CONTENT_TYPE_DATA) };
+staticJArray<PRUnichar,int32_t> nsHtml5MetaScanner::CONTENT_TYPE = { CONTENT_TYPE_DATA, MOZ_ARRAY_LENGTH(CONTENT_TYPE_DATA) };
nsHtml5MetaScanner::nsHtml5MetaScanner()
: readable(nullptr),
View
20 parser/html/nsHtml5Tokenizer.cpp
@@ -68,25 +68,25 @@ PRUnichar nsHtml5Tokenizer::OCTYPE[] = { 'o', 'c', 't', 'y', 'p', 'e' };
PRUnichar nsHtml5Tokenizer::UBLIC[] = { 'u', 'b', 'l', 'i', 'c' };
PRUnichar nsHtml5Tokenizer::YSTEM[] = { 'y', 's', 't', 'e', 'm' };