The HTML parser doesn't enforce the "Noah's Ark condition" from the HTML5 spec
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Dec 2011 08:28:06 +0000 (08:28 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Dec 2011 08:28:06 +0000 (08:28 +0000)
commitd5c74d1095b35e216540c753e95dc4745d3528db
treef1e1c3d780d951a86754f4ec322bdc0fe8bb71ab
parenta7bc8efc48b2ef1567a39d664ad5f813b55028cc
The HTML parser doesn't enforce the "Noah's Ark condition" from the HTML5 spec
https://bugs.webkit.org/show_bug.cgi?id=74828

Reviewed by Darin Adler.

Source/WebCore:

This patch implement the "Noah's Ark condition" from the HTML5
specification.  This condition limits the number of identitical
elements that can be in the list of active formatting elements.  I'm not
entirely sure that enforcing this condition is worth the complexity,
but given that we've come this far in support of the HTML5 parsing
algorithm, we might as well finish it.

After this patch, we pass all but one of the html5lib parsing tests!

Tests: html5lib/runner.html

* html/parser/HTMLFormattingElementList.cpp:
(WebCore::attributeCount):
(WebCore::HTMLFormattingElementList::append):
(WebCore::HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly):
(WebCore::HTMLFormattingElementList::ensureNoahsArkCondition):
* html/parser/HTMLFormattingElementList.h:

LayoutTests:

Show test progression.

* fast/parser/residual-style-dom-expected.txt:
    - This isn't a great test because it's hard to see how changes
      affect the output.  However, we have good coverage of these
      topics in the HTML5lib tests.
* html5lib/runner-expected.txt:
* platform/chromium/html5lib/runner-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@103223 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/parser/residual-style-dom-expected.txt
LayoutTests/html5lib/runner-expected.txt
LayoutTests/platform/chromium/html5lib/runner-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/html/parser/HTMLFormattingElementList.cpp
Source/WebCore/html/parser/HTMLFormattingElementList.h