Bug 901319 - Implement HTML spec change to Adoption Agency Algorithm to not reverse the order of nodes in the document, by removing nodes that we're not recreating from the stack of open elements. r=hsivonen

This commit is contained in:
William Chen
2014-03-04 18:06:15 -08:00
parent f6f8567a4c
commit 9be0c44303
3 changed files with 47 additions and 8 deletions

View File

@@ -3557,10 +3557,19 @@ nsHtml5TreeBuilder::adoptionAgencyEndTag(nsIAtom* name)
int32_t bookmark = formattingEltListPos;
int32_t nodePos = furthestBlockPos;
nsHtml5StackNode* lastNode = furthestBlock;
for (int32_t j = 0; j < 3; ++j) {
int32_t j = 0;
for (; ; ) {
++j;
nodePos--;
if (nodePos == formattingEltStackPos) {
break;
}
nsHtml5StackNode* node = stack[nodePos];
int32_t nodeListPos = findInListOfActiveFormattingElements(node);
if (j > 3 && nodeListPos != -1) {
removeFromListOfActiveFormattingElements(nodeListPos);
nodeListPos = -1;
}
if (nodeListPos == -1) {
MOZ_ASSERT(formattingEltStackPos < nodePos);
MOZ_ASSERT(bookmark < nodePos);
@@ -3569,9 +3578,6 @@ nsHtml5TreeBuilder::adoptionAgencyEndTag(nsIAtom* name)
furthestBlockPos--;
continue;
}
if (nodePos == formattingEltStackPos) {
break;
}
if (nodePos == furthestBlockPos) {
bookmark = nodeListPos + 1;
}