Bug 711049 - Adjust MathML text integration point treatment to comply with spec changes. rs=smaug.

This commit is contained in:
Henri Sivonen 2012-01-02 16:18:29 +02:00
parent 9f90e9e4dc
commit cf55919ff8
4 changed files with 19 additions and 31 deletions

View File

@ -939,7 +939,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
case IN_BODY:
case IN_CELL:
case IN_CAPTION:
if (!isInForeignButNotHtmlIntegrationPoint()) {
if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) {
reconstructTheActiveFormattingElements();
}
// fall through
@ -998,7 +998,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
* Reconstruct the active formatting
* elements, if any.
*/
if (!isInForeignButNotHtmlIntegrationPoint()) {
if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) {
flushCharacters();
reconstructTheActiveFormattingElements();
}
@ -1195,7 +1195,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
* Reconstruct the active formatting
* elements, if any.
*/
if (!isInForeignButNotHtmlIntegrationPoint()) {
if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) {
flushCharacters();
reconstructTheActiveFormattingElements();
}
@ -1310,11 +1310,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
return;
}
if (currentPtr >= 0) {
StackNode<T> stackNode = stack[currentPtr];
if (stackNode.ns == "http://www.w3.org/1999/xhtml") {
return;
}
if (stackNode.isHtmlIntegrationPoint()) {
if (isSpecialParentInForeign(stack[currentPtr])) {
return;
}
accumulateCharacters(REPLACEMENT_CHARACTER, 0, 1);
@ -5280,10 +5276,11 @@ public abstract class TreeBuilder<T> implements TokenHandler,
&& stack[currentPtr].ns != "http://www.w3.org/1999/xhtml";
}
private boolean isInForeignButNotHtmlIntegrationPoint() {
return currentPtr >= 0
&& stack[currentPtr].ns != "http://www.w3.org/1999/xhtml"
&& !stack[currentPtr].isHtmlIntegrationPoint();
private boolean isInForeignButNotHtmlOrMathTextIntegrationPoint() {
if (currentPtr < 0) {
return false;
}
return !isSpecialParentInForeign(stack[currentPtr]);
}
/**

View File

@ -200,7 +200,7 @@ nsHtml5TreeBuilder::characters(const PRUnichar* buf, PRInt32 start, PRInt32 leng
case NS_HTML5TREE_BUILDER_IN_BODY:
case NS_HTML5TREE_BUILDER_IN_CELL:
case NS_HTML5TREE_BUILDER_IN_CAPTION: {
if (!isInForeignButNotHtmlIntegrationPoint()) {
if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) {
reconstructTheActiveFormattingElements();
}
}
@ -246,7 +246,7 @@ nsHtml5TreeBuilder::characters(const PRUnichar* buf, PRInt32 start, PRInt32 leng
accumulateCharacters(buf, start, i - start);
start = i;
}
if (!isInForeignButNotHtmlIntegrationPoint()) {
if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) {
flushCharacters();
reconstructTheActiveFormattingElements();
}
@ -348,7 +348,7 @@ nsHtml5TreeBuilder::characters(const PRUnichar* buf, PRInt32 start, PRInt32 leng
accumulateCharacters(buf, start, i - start);
start = i;
}
if (!isInForeignButNotHtmlIntegrationPoint()) {
if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) {
flushCharacters();
reconstructTheActiveFormattingElements();
}
@ -438,11 +438,7 @@ nsHtml5TreeBuilder::zeroOriginatingReplacementCharacter()
return;
}
if (currentPtr >= 0) {
nsHtml5StackNode* stackNode = stack[currentPtr];
if (stackNode->ns == kNameSpaceID_XHTML) {
return;
}
if (stackNode->isHtmlIntegrationPoint()) {
if (isSpecialParentInForeign(stack[currentPtr])) {
return;
}
accumulateCharacters(REPLACEMENT_CHARACTER, 0, 1);
@ -3818,9 +3814,12 @@ nsHtml5TreeBuilder::isInForeign()
}
bool
nsHtml5TreeBuilder::isInForeignButNotHtmlIntegrationPoint()
nsHtml5TreeBuilder::isInForeignButNotHtmlOrMathTextIntegrationPoint()
{
return currentPtr >= 0 && stack[currentPtr]->ns != kNameSpaceID_XHTML && !stack[currentPtr]->isHtmlIntegrationPoint();
if (currentPtr < 0) {
return false;
}
return !isSpecialParentInForeign(stack[currentPtr]);
}
void

View File

@ -218,7 +218,7 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
private:
bool isInForeign();
bool isInForeignButNotHtmlIntegrationPoint();
bool isInForeignButNotHtmlOrMathTextIntegrationPoint();
public:
void setFragmentContext(nsIAtom* context, PRInt32 ns, nsIContent** node, bool quirks);
protected:

View File

@ -8,12 +8,4 @@ var html5Exceptions = {
"<!doctype html><keygen><frameset>" : true, // Bug 101019
"<select><keygen>" : true, // Bug 101019
"<!DOCTYPE html><body><keygen>A" : true, // Bug 101019
"<!DOCTYPE html><math><mtext><p><i></p>a" : true, // Bug 711049
"<!DOCTYPE html><table><tr><td><math><mtext><p><i></p>a" : true, // Bug 711049
"<!DOCTYPE html><table><tr><td><math><mtext>\u0000a" : true, // Bug 711049
"<!DOCTYPE html><math><mi>a\u0000b" : true, // Bug 711049
"<!DOCTYPE html><math><mo>a\u0000b" : true, // Bug 711049
"<!DOCTYPE html><math><mn>a\u0000b" : true, // Bug 711049
"<!DOCTYPE html><math><ms>a\u0000b" : true, // Bug 711049
"<!DOCTYPE html><math><mtext>a\u0000b" : true, // Bug 711049
}