Bug 886390 part 2 - Disable foreign content breakout in the fragment case. r=wchen.

This commit is contained in:
Henri Sivonen 2014-10-27 11:48:11 +02:00
parent 3e8d28c188
commit 24d6e9838a
2 changed files with 16 additions and 23 deletions

View File

@ -1694,20 +1694,17 @@ public abstract class TreeBuilder<T> implements TokenHandler,
case P:
case PRE_OR_LISTING:
case TABLE:
errHtmlStartTagInForeignContext(name);
while (!isSpecialParentInForeign(stack[currentPtr])) {
pop();
}
continue starttagloop;
case FONT:
if (attributes.contains(AttributeName.COLOR)
|| attributes.contains(AttributeName.FACE)
|| attributes.contains(AttributeName.SIZE)) {
// re-check FONT to deal with the special case
if (!(group == FONT && !(attributes.contains(AttributeName.COLOR)
|| attributes.contains(AttributeName.FACE) || attributes.contains(AttributeName.SIZE)))) {
errHtmlStartTagInForeignContext(name);
while (!isSpecialParentInForeign(stack[currentPtr])) {
pop();
}
continue starttagloop;
if (!fragment) {
while (!isSpecialParentInForeign(stack[currentPtr])) {
pop();
}
continue starttagloop;
} // else fall thru
}
// else fall thru
default:

View File

@ -630,20 +630,16 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
case NS_HTML5TREE_BUILDER_NOBR:
case NS_HTML5TREE_BUILDER_P:
case NS_HTML5TREE_BUILDER_PRE_OR_LISTING:
case NS_HTML5TREE_BUILDER_TABLE: {
errHtmlStartTagInForeignContext(name);
while (!isSpecialParentInForeign(stack[currentPtr])) {
pop();
}
NS_HTML5_CONTINUE(starttagloop);
}
case NS_HTML5TREE_BUILDER_TABLE:
case NS_HTML5TREE_BUILDER_FONT: {
if (attributes->contains(nsHtml5AttributeName::ATTR_COLOR) || attributes->contains(nsHtml5AttributeName::ATTR_FACE) || attributes->contains(nsHtml5AttributeName::ATTR_SIZE)) {
if (!(group == NS_HTML5TREE_BUILDER_FONT && !(attributes->contains(nsHtml5AttributeName::ATTR_COLOR) || attributes->contains(nsHtml5AttributeName::ATTR_FACE) || attributes->contains(nsHtml5AttributeName::ATTR_SIZE)))) {
errHtmlStartTagInForeignContext(name);
while (!isSpecialParentInForeign(stack[currentPtr])) {
pop();
if (!fragment) {
while (!isSpecialParentInForeign(stack[currentPtr])) {
pop();
}
NS_HTML5_CONTINUE(starttagloop);
}
NS_HTML5_CONTINUE(starttagloop);
}
}
default: {