mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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:
parent
85c733191c
commit
e1d3d37020
@ -4638,10 +4638,22 @@ public abstract class TreeBuilder<T> implements TokenHandler,
|
||||
int bookmark = formattingEltListPos;
|
||||
int nodePos = furthestBlockPos;
|
||||
StackNode<T> lastNode = furthestBlock; // weak ref
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
int j = 0;
|
||||
for (;;) {
|
||||
++j;
|
||||
nodePos--;
|
||||
if (nodePos == formattingEltStackPos) {
|
||||
break;
|
||||
}
|
||||
StackNode<T> node = stack[nodePos]; // weak ref
|
||||
int nodeListPos = findInListOfActiveFormattingElements(node);
|
||||
|
||||
if (j > 3 && nodeListPos != -1) {
|
||||
removeFromListOfActiveFormattingElements(nodeListPos);
|
||||
// Update position to reflect removal from list.
|
||||
nodeListPos = -1;
|
||||
}
|
||||
|
||||
if (nodeListPos == -1) {
|
||||
assert formattingEltStackPos < nodePos;
|
||||
assert bookmark < nodePos;
|
||||
@ -4652,9 +4664,6 @@ public abstract class TreeBuilder<T> implements TokenHandler,
|
||||
continue;
|
||||
}
|
||||
// now node is both on stack and in the list
|
||||
if (nodePos == formattingEltStackPos) {
|
||||
break;
|
||||
}
|
||||
if (nodePos == furthestBlockPos) {
|
||||
bookmark = nodeListPos + 1;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -37,3 +37,27 @@
|
||||
| <address>
|
||||
| <a>
|
||||
| <a>
|
||||
|
||||
#data
|
||||
<b><i><a><s><tt><div></b>first</b></div></tt></s></a>second</i>
|
||||
#errors
|
||||
3: Start tag seen without seeing a doctype first. Expected "<!DOCTYPE html>".
|
||||
25: End tag "b" violates nesting rules.
|
||||
34: Stray end tag "b".
|
||||
63: Stray end tag "i".
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <b>
|
||||
| <i>
|
||||
| <a>
|
||||
| <s>
|
||||
| <tt>
|
||||
| <a>
|
||||
| <s>
|
||||
| <tt>
|
||||
| <div>
|
||||
| <b>
|
||||
| "first"
|
||||
| "second"
|
||||
|
Loading…
Reference in New Issue
Block a user