Bug 558302 - Make <button> non-scoping in the HTML5 parser. r=bnewman.

This commit is contained in:
Henri Sivonen 2010-04-16 13:52:06 +03:00
Родитель 7add467de8
Коммит bf48dfb18a
6 изменённых файлов: 28 добавлений и 17 удалений

Просмотреть файл

@ -539,7 +539,7 @@ public final class ElementName
public static final ElementName APPLET = new ElementName("applet", "applet", TreeBuilder.MARQUEE_OR_APPLET, false, true, false);
public static final ElementName ARCCOT = new ElementName("arccot", "arccot", TreeBuilder.OTHER, false, false, false);
public static final ElementName APPROX = new ElementName("approx", "approx", TreeBuilder.OTHER, false, false, false);
public static final ElementName BUTTON = new ElementName("button", "button", TreeBuilder.BUTTON, false, true, false);
public static final ElementName BUTTON = new ElementName("button", "button", TreeBuilder.BUTTON, false, false, false);
public static final ElementName CIRCLE = new ElementName("circle", "circle", TreeBuilder.OTHER, false, false, false);
public static final ElementName CENTER = new ElementName("center", "center", TreeBuilder.DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU, true, false, false);
public static final ElementName CURSOR = new ElementName("cursor", "cursor", TreeBuilder.OTHER, false, false, false);

Просмотреть файл

@ -1958,14 +1958,14 @@ public abstract class TreeBuilder<T> implements TokenHandler,
eltPos = findLastInScope(name);
if (eltPos != TreeBuilder.NOT_FOUND_ON_STACK) {
err("\u201Cbutton\u201D start tag seen when there was an open \u201Cbutton\u201D element in scope.");
generateImpliedEndTags();
if (!isCurrent("button")) {
err("There was an open \u201Cbutton\u201D element in scope with unclosed children.");
if (!isCurrent(name)) {
err("End tag \u201Cbutton\u201D seen but there were unclosed elements.");
}
while (currentPtr >= eltPos) {
pop();
}
clearTheListOfActiveFormattingElementsUpToTheLastMarker();
continue starttagloop;
} else {
reconstructTheActiveFormattingElements();
@ -1973,7 +1973,6 @@ public abstract class TreeBuilder<T> implements TokenHandler,
"http://www.w3.org/1999/xhtml",
elementName, attributes,
formPointer);
insertMarker();
attributes = null; // CPP
break starttagloop;
}
@ -3375,6 +3374,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
case UL_OR_OL_OR_DL:
case PRE_OR_LISTING:
case FIELDSET:
case BUTTON:
case ADDRESS_OR_DIR_OR_ARTICLE_OR_ASIDE_OR_DATAGRID_OR_DETAILS_OR_HGROUP_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_NAV_OR_SECTION:
eltPos = findLastInScope(name);
if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
@ -3495,7 +3495,6 @@ public abstract class TreeBuilder<T> implements TokenHandler,
case NOBR:
adoptionAgencyEndTag(name);
break endtagloop;
case BUTTON:
case OBJECT:
case MARQUEE_OR_APPLET:
eltPos = findLastInScope(name);

Просмотреть файл

@ -16,7 +16,6 @@ HTML5_ATOM(address, "address")
HTML5_ATOM(div, "div")
HTML5_ATOM(a, "a")
HTML5_ATOM(nobr, "nobr")
HTML5_ATOM(button, "button")
HTML5_ATOM(input, "input")
HTML5_ATOM(option, "option")
HTML5_ATOM(ruby, "ruby")
@ -836,6 +835,7 @@ HTML5_ATOM(arccos, "arccos")
HTML5_ATOM(applet, "applet")
HTML5_ATOM(arccot, "arccot")
HTML5_ATOM(approx, "approx")
HTML5_ATOM(button, "button")
HTML5_ATOM(circle, "circle")
HTML5_ATOM(center, "center")
HTML5_ATOM(canvas, "canvas")

Просмотреть файл

@ -330,7 +330,7 @@ nsHtml5ElementName::initializeStatics()
ELT_APPLET = new nsHtml5ElementName(nsHtml5Atoms::applet, nsHtml5Atoms::applet, NS_HTML5TREE_BUILDER_MARQUEE_OR_APPLET, PR_FALSE, PR_TRUE, PR_FALSE);
ELT_ARCCOT = new nsHtml5ElementName(nsHtml5Atoms::arccot, nsHtml5Atoms::arccot, NS_HTML5TREE_BUILDER_OTHER, PR_FALSE, PR_FALSE, PR_FALSE);
ELT_APPROX = new nsHtml5ElementName(nsHtml5Atoms::approx, nsHtml5Atoms::approx, NS_HTML5TREE_BUILDER_OTHER, PR_FALSE, PR_FALSE, PR_FALSE);
ELT_BUTTON = new nsHtml5ElementName(nsHtml5Atoms::button, nsHtml5Atoms::button, NS_HTML5TREE_BUILDER_BUTTON, PR_FALSE, PR_TRUE, PR_FALSE);
ELT_BUTTON = new nsHtml5ElementName(nsHtml5Atoms::button, nsHtml5Atoms::button, NS_HTML5TREE_BUILDER_BUTTON, PR_FALSE, PR_FALSE, PR_FALSE);
ELT_CIRCLE = new nsHtml5ElementName(nsHtml5Atoms::circle, nsHtml5Atoms::circle, NS_HTML5TREE_BUILDER_OTHER, PR_FALSE, PR_FALSE, PR_FALSE);
ELT_CENTER = new nsHtml5ElementName(nsHtml5Atoms::center, nsHtml5Atoms::center, NS_HTML5TREE_BUILDER_DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU, PR_TRUE, PR_FALSE, PR_FALSE);
ELT_CURSOR = new nsHtml5ElementName(nsHtml5Atoms::cursor, nsHtml5Atoms::cursor, NS_HTML5TREE_BUILDER_OTHER, PR_FALSE, PR_FALSE, PR_FALSE);

Просмотреть файл

@ -1052,18 +1052,16 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
if (eltPos != NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) {
generateImpliedEndTags();
if (!isCurrent(nsHtml5Atoms::button)) {
if (!isCurrent(name)) {
}
while (currentPtr >= eltPos) {
pop();
}
clearTheListOfActiveFormattingElementsUpToTheLastMarker();
goto starttagloop;
} else {
reconstructTheActiveFormattingElements();
appendToCurrentNodeAndPushElementMayFoster(kNameSpaceID_XHTML, elementName, attributes, formPointer);
insertMarker();
attributes = nsnull;
goto starttagloop_end;
}
@ -2271,6 +2269,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
case NS_HTML5TREE_BUILDER_UL_OR_OL_OR_DL:
case NS_HTML5TREE_BUILDER_PRE_OR_LISTING:
case NS_HTML5TREE_BUILDER_FIELDSET:
case NS_HTML5TREE_BUILDER_BUTTON:
case NS_HTML5TREE_BUILDER_ADDRESS_OR_DIR_OR_ARTICLE_OR_ASIDE_OR_DATAGRID_OR_DETAILS_OR_HGROUP_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_NAV_OR_SECTION: {
eltPos = findLastInScope(name);
if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) {
@ -2381,7 +2380,6 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
adoptionAgencyEndTag(name);
goto endtagloop_end;
}
case NS_HTML5TREE_BUILDER_BUTTON:
case NS_HTML5TREE_BUILDER_OBJECT:
case NS_HTML5TREE_BUILDER_MARQUEE_OR_APPLET: {
eltPos = findLastInScope(name);

Просмотреть файл

@ -227,7 +227,7 @@ Line: 1 Col: 30 Expected closing tag. Unexpected end of file.
#data
<h1>Hello<h2>World
#errors
4: Start tag seen without seeing a doctype first. Expected “<!DOCTYPE html>”.
4: Start tag seen without seeing a doctype first. Expected “<!DOCTYPE html>”.
13: Heading cannot be a child of another heading.
18: End of file seen and there were open elements.
#document
@ -270,6 +270,20 @@ Line: 1 Col: 15 End tag (b) violates step 1, paragraph 1 of the adoption agency
| <b>
| <button>
#data
<!DOCTYPE html><span><button>foo</span>bar
#errors
39: End tag “span” seen but there were unclosed elements.
#document
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <span>
| <button>
| "foo"
| "bar"
#data
<p><b><div><marquee></p></b></div>X
#errors
@ -1438,7 +1452,7 @@ Line: 1 Col: 29 Expected closing tag. Unexpected end of file.
#data
<h1><h2>
#errors
4: Start tag seen without seeing a doctype first. Expected “<!DOCTYPE html>”.
4: Start tag seen without seeing a doctype first. Expected “<!DOCTYPE html>”.
8: Heading cannot be a child of another heading.
8: End of file seen and there were open elements.
#document
@ -1634,11 +1648,11 @@ Line: 1 Col: 10 Unexpected start tag (frameset). Expected DOCTYPE.
#data
<h1><table><td><h3></table><h3></h1>
#errors
4: Start tag seen without seeing a doctype first. Expected “<!DOCTYPE html>”.
15: “td” start tag in table body.
4: Start tag seen without seeing a doctype first. Expected “<!DOCTYPE html>”.
15: “td” start tag in table body.
27: Unclosed elements.
31: Heading cannot be a child of another heading.
36: End tag “h1” seen but there were unclosed elements.
36: End tag “h1” seen but there were unclosed elements.
#document
| <html>
| <head>