Reviewed by Eric Seidel.
HTMLTreeBuilder needs to update to match new spec behavior for <button>
https://bugs.webkit.org/show_bug.cgi?id=42233
The spec has some typos in this area, but this is my best guess for
what Ian means. I've filed bugs against the spec for each typo.
* html/HTMLElementStack.cpp:
(WebCore::HTMLNames::isScopeMarker):
(WebCore::HTMLNames::isButtonScopeMarker):
(WebCore::HTMLElementStack::inButtonScope):
* html/HTMLElementStack.h:
* html/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processFakePEndTagIfPInButtonScope):
(WebCore::HTMLTreeBuilder::processCloseWhenNestedTag):
(WebCore::HTMLTreeBuilder::processStartTagForInBody):
(WebCore::HTMLTreeBuilder::processEndTagForInBody):
* html/HTMLTreeBuilder.h:
2010-07-21 Adam Barth <abarth@webkit.org>
Reviewed by Eric Seidel.
HTMLTreeBuilder needs to update to match new spec behavior for <button>
https://bugs.webkit.org/show_bug.cgi?id=42233
Test progression. There's one regression mixed in here. I'll
investigate in the next patch.
* html5lib/runner-expected-html5.txt:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63868
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2010-07-21 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ HTMLTreeBuilder needs to update to match new spec behavior for <button>
+ https://bugs.webkit.org/show_bug.cgi?id=42233
+
+ Test progression. There's one regression mixed in here. I'll
+ investigate in the next patch.
+
+ * html5lib/runner-expected-html5.txt:
+
2010-07-21 Justin Schuh <jschuh@chromium.org>
Unreviewed. Build fix.
CONSOLE MESSAGE: line 2: PASS
CONSOLE MESSAGE: line 2: FOO<span>BAR</span>BAZ
Content-Type: text/plain
-resources/tests1.dat:
-24
-98
-
-Test 24 of 114 in resources/tests1.dat failed. Input:
-<b><button>foo</b>bar
-Got:
-| <html>
-| <head>
-| <body>
-| <b>
-| <button>
-| "foobar"
-Expected:
-| <html>
-| <head>
-| <body>
-| <b>
-| <button>
-| <b>
-| "foo"
-| "bar"
+resources/tests1.dat: PASS
-Test 98 of 114 in resources/tests1.dat failed. Input:
-<b><button></b></button></b>
-Got:
-| <html>
-| <head>
-| <body>
-| <b>
-| <button>
-Expected:
-| <html>
-| <head>
-| <body>
-| <b>
-| <button>
-| <b>
resources/tests2.dat: PASS
resources/tests3.dat: PASS
| <article>
| "a"
resources/tests20.dat:
-20
-21
+16
24
25
-Test 20 of 25 in resources/tests20.dat failed. Input:
-<!doctype html><address><button></address>a
+Test 16 of 25 in resources/tests20.dat failed. Input:
+<!doctype html><p><button><table>
Got:
| <!DOCTYPE html>
| <html>
| <head>
| <body>
-| <address>
-| <button>
-| "a"
-Expected:
-| <!DOCTYPE html>
-| <html>
-| <head>
-| <body>
-| <address>
-| <button>
-| "a"
-
-Test 21 of 25 in resources/tests20.dat failed. Input:
-<!doctype html><address><button></address>a
-Got:
-| <!DOCTYPE html>
-| <html>
-| <head>
-| <body>
-| <address>
+| <p>
| <button>
-| "a"
+| <p>
+| <table>
Expected:
| <!DOCTYPE html>
| <html>
| <head>
| <body>
-| <address>
+| <p>
| <button>
-| "a"
+| <table>
Test 24 of 25 in resources/tests20.dat failed. Input:
<!doctype html><p><figcaption>
resources/comments01.dat: PASS
resources/adoption01.dat:
-3
12
-Test 3 of 12 in resources/adoption01.dat failed. Input:
-<a>1<button>2</a>3</button>
-Got:
-| <html>
-| <head>
-| <body>
-| <a>
-| "1"
-| <button>
-| "23"
-Expected:
-| <html>
-| <head>
-| <body>
-| <a>
-| "1"
-| <button>
-| <a>
-| "2"
-| "3"
-
Test 12 of 12 in resources/adoption01.dat failed. Input:
<table>A<td>B</td>C</table>
Got:
+2010-07-21 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ HTMLTreeBuilder needs to update to match new spec behavior for <button>
+ https://bugs.webkit.org/show_bug.cgi?id=42233
+
+ The spec has some typos in this area, but this is my best guess for
+ what Ian means. I've filed bugs against the spec for each typo.
+
+ * html/HTMLElementStack.cpp:
+ (WebCore::HTMLNames::isScopeMarker):
+ (WebCore::HTMLNames::isButtonScopeMarker):
+ (WebCore::HTMLElementStack::inButtonScope):
+ * html/HTMLElementStack.h:
+ * html/HTMLTreeBuilder.cpp:
+ (WebCore::HTMLTreeBuilder::processFakePEndTagIfPInButtonScope):
+ (WebCore::HTMLTreeBuilder::processCloseWhenNestedTag):
+ (WebCore::HTMLTreeBuilder::processStartTagForInBody):
+ (WebCore::HTMLTreeBuilder::processEndTagForInBody):
+ * html/HTMLTreeBuilder.h:
+
2010-07-21 Justin Schuh <jschuh@chromium.org>
Reviewed by Oliver Hunt.
inline bool isScopeMarker(Element* element)
{
return element->hasTagName(appletTag)
- || element->hasTagName(buttonTag)
|| element->hasTagName(captionTag)
#if ENABLE(SVG_FOREIGN_OBJECT)
|| element->hasTagName(SVGNames::foreignObjectTag)
|| element->hasTagName(htmlTag);
}
+inline bool isButtonScopeMarker(Element* element)
+{
+ return isScopeMarker(element)
+ || element->hasTagName(buttonTag);
+}
+
}
HTMLElementStack::ElementRecord::ElementRecord(PassRefPtr<Element> element, PassOwnPtr<ElementRecord> next)
return inTableScope(tagName.localName());
}
+bool HTMLElementStack::inButtonScope(const AtomicString& targetTag) const
+{
+ return inScopeCommon<isButtonScopeMarker>(m_top.get(), targetTag);
+}
+
+bool HTMLElementStack::inButtonScope(const QualifiedName& tagName) const
+{
+ // FIXME: Is localName() right for non-html elements?
+ return inButtonScope(tagName.localName());
+}
+
Element* HTMLElementStack::htmlElement() const
{
ASSERT(m_htmlElement);
bool inListItemScope(const QualifiedName&) const;
bool inTableScope(const AtomicString& tagName) const;
bool inTableScope(const QualifiedName&) const;
+ bool inButtonScope(const AtomicString& tagName) const;
+ bool inButtonScope(const QualifiedName&) const;
bool hasOnlyHTMLElementsInScope() const;
bool isScopingTag(const AtomicString& tagName)
{
return tagName == appletTag
- || tagName == buttonTag
|| tagName == captionTag
|| tagName == SVGNames::foreignObjectTag
|| tagName == htmlTag
processCharacterBuffer(buffer);
}
-void HTMLTreeBuilder::processFakePEndTagIfPInScope()
+void HTMLTreeBuilder::processFakePEndTagIfPInButtonScope()
{
- if (!m_tree.openElements()->inScope(pTag.localName()))
+ if (!m_tree.openElements()->inButtonScope(pTag.localName()))
return;
AtomicHTMLToken endP(HTMLToken::EndTag, pTag.localName());
processEndTag(endP);
break;
nodeRecord = nodeRecord->next();
}
- processFakePEndTagIfPInScope();
+ processFakePEndTagIfPInButtonScope();
m_tree.insertHTMLElement(token);
}
|| token.name() == pTag
|| token.name() == sectionTag
|| token.name() == ulTag) {
- processFakePEndTagIfPInScope();
+ processFakePEndTagIfPInButtonScope();
m_tree.insertHTMLElement(token);
return;
}
if (isNumberedHeaderTag(token.name())) {
- processFakePEndTagIfPInScope();
+ processFakePEndTagIfPInButtonScope();
if (isNumberedHeaderTag(m_tree.currentElement()->localName())) {
parseError(token);
m_tree.openElements()->pop();
return;
}
if (token.name() == preTag || token.name() == listingTag) {
- processFakePEndTagIfPInScope();
+ processFakePEndTagIfPInButtonScope();
m_tree.insertHTMLElement(token);
m_tokenizer->skipLeadingNewLineForListing();
m_framesetOk = false;
parseError(token);
return;
}
- processFakePEndTagIfPInScope();
+ processFakePEndTagIfPInButtonScope();
m_tree.insertHTMLFormElement(token);
return;
}
return;
}
if (token.name() == plaintextTag) {
- processFakePEndTagIfPInScope();
+ processFakePEndTagIfPInButtonScope();
m_tree.insertHTMLElement(token);
m_tokenizer->setState(HTMLTokenizer::PLAINTEXTState);
return;
return;
}
if (token.name() == hrTag) {
- processFakePEndTagIfPInScope();
+ processFakePEndTagIfPInButtonScope();
m_tree.insertSelfClosingHTMLElement(token);
m_framesetOk = false;
return;
return;
}
if (token.name() == xmpTag) {
- processFakePEndTagIfPInScope();
+ processFakePEndTagIfPInButtonScope();
m_tree.reconstructTheActiveFormattingElements();
m_framesetOk = false;
processGenericRawTextStartTag(token);
m_tree.openElements()->remove(node.get());
}
if (token.name() == pTag) {
- if (!m_tree.openElements()->inScope(token.name())) {
+ if (!m_tree.openElements()->inButtonScope(token.name())) {
parseError(token);
processFakeStartTag(pTag);
ASSERT(m_tree.openElements()->inScope(token.name()));
void processFakeStartTag(const QualifiedName&, PassRefPtr<NamedNodeMap> attributes = 0);
void processFakeEndTag(const QualifiedName&);
void processFakeCharacters(const String&);
- void processFakePEndTagIfPInScope();
+ void processFakePEndTagIfPInButtonScope();
void processGenericRCDATAStartTag(AtomicHTMLToken&);
void processGenericRawTextStartTag(AtomicHTMLToken&);