Bug 870787 HTML parser part - Make <img> a form-associated element in the HTML parser. r=smaug

This commit is contained in:
Henri Sivonen 2013-06-06 11:02:30 +03:00
parent 2d7f4e5a2e
commit 58fa997e45
8 changed files with 28 additions and 30 deletions

View File

@ -468,7 +468,7 @@ public final class ElementName
public static final ElementName EXP = new ElementName("exp", "exp", TreeBuilder.OTHER);
public static final ElementName GCD = new ElementName("gcd", "gcd", TreeBuilder.OTHER);
public static final ElementName GEQ = new ElementName("geq", "geq", TreeBuilder.OTHER);
public static final ElementName IMG = new ElementName("img", "img", TreeBuilder.EMBED_OR_IMG | SPECIAL);
public static final ElementName IMG = new ElementName("img", "img", TreeBuilder.IMG | SPECIAL);
public static final ElementName INS = new ElementName("ins", "ins", TreeBuilder.OTHER);
public static final ElementName INT = new ElementName("int", "int", TreeBuilder.OTHER);
public static final ElementName KBD = new ElementName("kbd", "kbd", TreeBuilder.OTHER);
@ -559,7 +559,7 @@ public final class ElementName
public static final ElementName ASIDE = new ElementName("aside", "aside", 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 | SPECIAL);
public static final ElementName AUDIO = new ElementName("audio", "audio", TreeBuilder.OTHER);
public static final ElementName APPLY = new ElementName("apply", "apply", TreeBuilder.OTHER);
public static final ElementName EMBED = new ElementName("embed", "embed", TreeBuilder.EMBED_OR_IMG | SPECIAL);
public static final ElementName EMBED = new ElementName("embed", "embed", TreeBuilder.EMBED | SPECIAL);
public static final ElementName FRAME = new ElementName("frame", "frame", TreeBuilder.FRAME | SPECIAL);
public static final ElementName FALSE = new ElementName("false", "false", TreeBuilder.OTHER);
public static final ElementName FLOOR = new ElementName("floor", "floor", TreeBuilder.OTHER);

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2005-2007 Henri Sivonen
* Copyright (c) 2007-2010 Mozilla Foundation
* Copyright (c) 2007-2013 Mozilla Foundation
* Portions of comments Copyright 2004-2010 Apple Computer, Inc., Mozilla
* Foundation, and Opera Software ASA.
*
@ -6545,19 +6545,6 @@ public class Tokenizer implements Locator {
return buf[pos];
}
// [NOCPP[
/**
* Returns the alreadyComplainedAboutNonAscii.
*
* @return the alreadyComplainedAboutNonAscii
*/
public boolean isAlreadyComplainedAboutNonAscii() {
return true;
}
// ]NOCPP]
public boolean internalEncodingDeclaration(String internalCharset)
throws SAXException {
if (encodingDeclarationHandler != null) {

View File

@ -163,7 +163,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
final static int IFRAME = 47;
final static int EMBED_OR_IMG = 48;
final static int EMBED = 48;
final static int AREA_OR_WBR = 49;
@ -203,6 +203,8 @@ public abstract class TreeBuilder<T> implements TokenHandler,
final static int TEMPLATE = 67;
final static int IMG = 68;
// start insertion modes
private static final int IN_ROW = 0;
@ -1593,7 +1595,8 @@ public abstract class TreeBuilder<T> implements TokenHandler,
case RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR:
case DD_OR_DT:
case UL_OR_OL_OR_DL:
case EMBED_OR_IMG:
case EMBED:
case IMG:
case H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6:
case HEAD:
case HR:
@ -1977,7 +1980,8 @@ public abstract class TreeBuilder<T> implements TokenHandler,
case TABLE:
case AREA_OR_WBR:
case BR:
case EMBED_OR_IMG:
case EMBED:
case IMG:
case INPUT:
case KEYGEN:
case HR:
@ -2208,7 +2212,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
attributes = null; // CPP
break starttagloop;
case BR:
case EMBED_OR_IMG:
case EMBED:
case AREA_OR_WBR:
reconstructTheActiveFormattingElements();
// FALL THROUGH to PARAM_OR_SOURCE_OR_TRACK
@ -2232,6 +2236,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
errImage();
elementName = ElementName.IMG;
continue starttagloop;
case IMG:
case KEYGEN:
case INPUT:
reconstructTheActiveFormattingElements();
@ -3682,7 +3687,8 @@ public abstract class TreeBuilder<T> implements TokenHandler,
case AREA_OR_WBR:
// CPPONLY: case MENUITEM:
case PARAM_OR_SOURCE_OR_TRACK:
case EMBED_OR_IMG:
case EMBED:
case IMG:
case IMAGE:
case INPUT:
case KEYGEN: // XXX??

View File

@ -594,7 +594,7 @@ nsHtml5ElementName::initializeStatics()
ELT_EXP = new nsHtml5ElementName(nsHtml5Atoms::exp, nsHtml5Atoms::exp, NS_HTML5TREE_BUILDER_OTHER);
ELT_GCD = new nsHtml5ElementName(nsHtml5Atoms::gcd, nsHtml5Atoms::gcd, NS_HTML5TREE_BUILDER_OTHER);
ELT_GEQ = new nsHtml5ElementName(nsHtml5Atoms::geq, nsHtml5Atoms::geq, NS_HTML5TREE_BUILDER_OTHER);
ELT_IMG = new nsHtml5ElementName(nsHtml5Atoms::img, nsHtml5Atoms::img, NS_HTML5TREE_BUILDER_EMBED_OR_IMG | NS_HTML5ELEMENT_NAME_SPECIAL);
ELT_IMG = new nsHtml5ElementName(nsHtml5Atoms::img, nsHtml5Atoms::img, NS_HTML5TREE_BUILDER_IMG | NS_HTML5ELEMENT_NAME_SPECIAL);
ELT_INS = new nsHtml5ElementName(nsHtml5Atoms::ins, nsHtml5Atoms::ins, NS_HTML5TREE_BUILDER_OTHER);
ELT_INT = new nsHtml5ElementName(nsHtml5Atoms::int_, nsHtml5Atoms::int_, NS_HTML5TREE_BUILDER_OTHER);
ELT_KBD = new nsHtml5ElementName(nsHtml5Atoms::kbd, nsHtml5Atoms::kbd, NS_HTML5TREE_BUILDER_OTHER);
@ -685,7 +685,7 @@ nsHtml5ElementName::initializeStatics()
ELT_ASIDE = new nsHtml5ElementName(nsHtml5Atoms::aside, nsHtml5Atoms::aside, NS_HTML5TREE_BUILDER_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 | NS_HTML5ELEMENT_NAME_SPECIAL);
ELT_AUDIO = new nsHtml5ElementName(nsHtml5Atoms::audio, nsHtml5Atoms::audio, NS_HTML5TREE_BUILDER_OTHER);
ELT_APPLY = new nsHtml5ElementName(nsHtml5Atoms::apply, nsHtml5Atoms::apply, NS_HTML5TREE_BUILDER_OTHER);
ELT_EMBED = new nsHtml5ElementName(nsHtml5Atoms::embed, nsHtml5Atoms::embed, NS_HTML5TREE_BUILDER_EMBED_OR_IMG | NS_HTML5ELEMENT_NAME_SPECIAL);
ELT_EMBED = new nsHtml5ElementName(nsHtml5Atoms::embed, nsHtml5Atoms::embed, NS_HTML5TREE_BUILDER_EMBED | NS_HTML5ELEMENT_NAME_SPECIAL);
ELT_FRAME = new nsHtml5ElementName(nsHtml5Atoms::frame, nsHtml5Atoms::frame, NS_HTML5TREE_BUILDER_FRAME | NS_HTML5ELEMENT_NAME_SPECIAL);
ELT_FALSE = new nsHtml5ElementName(nsHtml5Atoms::false_, nsHtml5Atoms::false_, NS_HTML5TREE_BUILDER_OTHER);
ELT_FLOOR = new nsHtml5ElementName(nsHtml5Atoms::floor, nsHtml5Atoms::floor, NS_HTML5TREE_BUILDER_OTHER);

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2005-2007 Henri Sivonen
* Copyright (c) 2007-2010 Mozilla Foundation
* Copyright (c) 2007-2013 Mozilla Foundation
* Portions of comments Copyright 2004-2010 Apple Computer, Inc., Mozilla
* Foundation, and Opera Software ASA.
*

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2005-2007 Henri Sivonen
* Copyright (c) 2007-2010 Mozilla Foundation
* Copyright (c) 2007-2013 Mozilla Foundation
* Portions of comments Copyright 2004-2010 Apple Computer, Inc., Mozilla
* Foundation, and Opera Software ASA.
*

View File

@ -595,7 +595,8 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
case NS_HTML5TREE_BUILDER_RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR:
case NS_HTML5TREE_BUILDER_DD_OR_DT:
case NS_HTML5TREE_BUILDER_UL_OR_OL_OR_DL:
case NS_HTML5TREE_BUILDER_EMBED_OR_IMG:
case NS_HTML5TREE_BUILDER_EMBED:
case NS_HTML5TREE_BUILDER_IMG:
case NS_HTML5TREE_BUILDER_H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6:
case NS_HTML5TREE_BUILDER_HEAD:
case NS_HTML5TREE_BUILDER_HR:
@ -967,7 +968,8 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
case NS_HTML5TREE_BUILDER_TABLE:
case NS_HTML5TREE_BUILDER_AREA_OR_WBR:
case NS_HTML5TREE_BUILDER_BR:
case NS_HTML5TREE_BUILDER_EMBED_OR_IMG:
case NS_HTML5TREE_BUILDER_EMBED:
case NS_HTML5TREE_BUILDER_IMG:
case NS_HTML5TREE_BUILDER_INPUT:
case NS_HTML5TREE_BUILDER_KEYGEN:
case NS_HTML5TREE_BUILDER_HR:
@ -1176,7 +1178,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
NS_HTML5_BREAK(starttagloop);
}
case NS_HTML5TREE_BUILDER_BR:
case NS_HTML5TREE_BUILDER_EMBED_OR_IMG:
case NS_HTML5TREE_BUILDER_EMBED:
case NS_HTML5TREE_BUILDER_AREA_OR_WBR: {
reconstructTheActiveFormattingElements();
}
@ -1201,6 +1203,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
elementName = nsHtml5ElementName::ELT_IMG;
NS_HTML5_CONTINUE(starttagloop);
}
case NS_HTML5TREE_BUILDER_IMG:
case NS_HTML5TREE_BUILDER_KEYGEN:
case NS_HTML5TREE_BUILDER_INPUT: {
reconstructTheActiveFormattingElements();
@ -2620,7 +2623,8 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
case NS_HTML5TREE_BUILDER_MENUITEM:
#endif
case NS_HTML5TREE_BUILDER_PARAM_OR_SOURCE_OR_TRACK:
case NS_HTML5TREE_BUILDER_EMBED_OR_IMG:
case NS_HTML5TREE_BUILDER_EMBED:
case NS_HTML5TREE_BUILDER_IMG:
case NS_HTML5TREE_BUILDER_IMAGE:
case NS_HTML5TREE_BUILDER_INPUT:
case NS_HTML5TREE_BUILDER_KEYGEN:

View File

@ -310,7 +310,7 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
#define NS_HTML5TREE_BUILDER_B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U 45
#define NS_HTML5TREE_BUILDER_UL_OR_OL_OR_DL 46
#define NS_HTML5TREE_BUILDER_IFRAME 47
#define NS_HTML5TREE_BUILDER_EMBED_OR_IMG 48
#define NS_HTML5TREE_BUILDER_EMBED 48
#define NS_HTML5TREE_BUILDER_AREA_OR_WBR 49
#define NS_HTML5TREE_BUILDER_DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU 50
#define NS_HTML5TREE_BUILDER_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 51
@ -330,6 +330,7 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
#define NS_HTML5TREE_BUILDER_KEYGEN 65
#define NS_HTML5TREE_BUILDER_MENUITEM 66
#define NS_HTML5TREE_BUILDER_TEMPLATE 67
#define NS_HTML5TREE_BUILDER_IMG 68
#define NS_HTML5TREE_BUILDER_IN_ROW 0
#define NS_HTML5TREE_BUILDER_IN_TABLE_BODY 1
#define NS_HTML5TREE_BUILDER_IN_TABLE 2