Commit 59d020c0 authored by eric@webkit.org's avatar eric@webkit.org

2010-07-12 Eric Seidel <eric@webkit.org>

        Reviewed by Adam Barth.

        HTMLTreeBuilder needs to support mixing SVG and MathML content
        https://bugs.webkit.org/show_bug.cgi?id=42096

        * html5lib/runner-expected-html5.txt:
2010-07-12  Eric Seidel  <eric@webkit.org>

        Reviewed by Adam Barth.

        HTMLTreeBuilder needs to support mixing SVG and MathML content
        https://bugs.webkit.org/show_bug.cgi?id=42096

        This is just a direct transcription of another paragraph of the
        HTML5 spec.

        This improved a couple results in html5lib/runner.html, but more
        work to do yet to pass all the foreign content tests.

        * html/HTMLTreeBuilder.cpp:
        (WebCore::HTMLTreeBuilder::processStartTag):
        (WebCore::HTMLTreeBuilder::processEndTag):
        (WebCore::HTMLTreeBuilder::processUsingSecondaryInsertionModeAndAdjustInsertionMode):
        * html/HTMLTreeBuilder.h:
        * mathml/mathtags.in:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63116 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1c1d3ce8
2010-07-12 Eric Seidel <eric@webkit.org>
Reviewed by Adam Barth.
HTMLTreeBuilder needs to support mixing SVG and MathML content
https://bugs.webkit.org/show_bug.cgi?id=42096
* html5lib/runner-expected-html5.txt:
2010-07-12 Eric Seidel <eric@webkit.org>
Reviewed by Adam Barth.
......@@ -728,24 +728,25 @@ Got:
| "foo"
| <math math>
| <math mtext>
| <math i>
| <i>
| "baz"
| <math annotation-xml>
| <math svg>
| <math desc>
| <math b>
| <svg svg>
| <svg desc>
| <b>
| "eggs"
| <math g>
| <math foreignobject>
| <math p>
| <svg g>
| <svg foreignObject>
| <p>
| "spam"
| <math table>
| <math tr>
| <math td>
| <math img>
| <math g>
| "quux"
| "bar"
| <table>
| <tbody>
| <tr>
| <td>
| <img>
| <g>
| "quux"
| "bar"
Expected:
| <!DOCTYPE html>
| <html>
......@@ -785,24 +786,25 @@ Got:
| "foo"
| <math math>
| <math mtext>
| <math i>
| <i>
| "baz"
| <math annotation-xml>
| <math svg>
| <math desc>
| <math b>
| <svg svg>
| <svg desc>
| <b>
| "eggs"
| <math g>
| <math foreignobject>
| <math p>
| <svg g>
| <svg foreignObject>
| <p>
| "spam"
| <math table>
| <math tr>
| <math td>
| <math img>
| <math g>
| "quux"
| "bar"
| <table>
| <tbody>
| <tr>
| <td>
| <img>
| <g>
| "quux"
| "bar"
Expected:
| <!DOCTYPE html>
| <html>
......
2010-07-12 Eric Seidel <eric@webkit.org>
Reviewed by Adam Barth.
HTMLTreeBuilder needs to support mixing SVG and MathML content
https://bugs.webkit.org/show_bug.cgi?id=42096
This is just a direct transcription of another paragraph of the
HTML5 spec.
This improved a couple results in html5lib/runner.html, but more
work to do yet to pass all the foreign content tests.
* html/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processStartTag):
(WebCore::HTMLTreeBuilder::processEndTag):
(WebCore::HTMLTreeBuilder::processUsingSecondaryInsertionModeAndAdjustInsertionMode):
* html/HTMLTreeBuilder.h:
* mathml/mathtags.in:
2010-07-12 Eric Seidel <eric@webkit.org>
Reviewed by Adam Barth.
......@@ -1148,6 +1148,30 @@ void HTMLTreeBuilder::processStartTagForInTable(AtomicHTMLToken& token)
processStartTagForInBody(token);
}
namespace {
bool shouldProcessUsingSecondaryInsertionMode(AtomicHTMLToken& token, Element* currentElement)
{
ASSERT(token.type() == HTMLToken::StartTag);
if (currentElement->hasTagName(MathMLNames::miTag)
|| currentElement->hasTagName(MathMLNames::moTag)
|| currentElement->hasTagName(MathMLNames::mnTag)
|| currentElement->hasTagName(MathMLNames::msTag)
|| currentElement->hasTagName(MathMLNames::mtextTag)) {
return token.name() != MathMLNames::mglyphTag
&& token.name() != MathMLNames::malignmarkTag;
}
if (currentElement->hasTagName(MathMLNames::annotation_xmlTag))
return token.name() == SVGNames::svgTag;
if (currentElement->hasTagName(SVGNames::foreignObjectTag)
|| currentElement->hasTagName(SVGNames::descTag)
|| currentElement->hasTagName(SVGNames::titleTag))
return true;
return currentElement->namespaceURI() == HTMLNames::xhtmlNamespaceURI;
}
}
void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token)
{
ASSERT(token.type() == HTMLToken::StartTag);
......@@ -1463,6 +1487,10 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token)
break;
case InForeignContentMode: {
// FIXME: We're missing a bunch of if branches here.
if (shouldProcessUsingSecondaryInsertionMode(token, m_tree.currentElement())) {
processUsingSecondaryInsertionModeAndAdjustInsertionMode(token);
return;
}
notImplemented();
const AtomicString& currentNamespace = m_tree.currentElement()->namespaceURI();
if (currentNamespace == MathMLNames::mathmlNamespaceURI)
......@@ -2278,11 +2306,11 @@ void HTMLTreeBuilder::processEndTag(AtomicHTMLToken& token)
}
nodeRecord = nodeRecord->next();
if (nodeRecord->element()->namespaceURI() == xhtmlNamespaceURI)
processEndTagUsingSecondaryInsertionModeAndAdjustInsertionMode(token);
processUsingSecondaryInsertionModeAndAdjustInsertionMode(token);
}
return;
}
processEndTagUsingSecondaryInsertionModeAndAdjustInsertionMode(token);
processUsingSecondaryInsertionModeAndAdjustInsertionMode(token);
break;
}
}
......@@ -2310,11 +2338,12 @@ private:
// This handles both secondary insertion mode processing, as well as updating
// the insertion mode. These are separate steps in the spec, but always occur
// right after one another.
void HTMLTreeBuilder::processEndTagUsingSecondaryInsertionModeAndAdjustInsertionMode(AtomicHTMLToken& token)
void HTMLTreeBuilder::processUsingSecondaryInsertionModeAndAdjustInsertionMode(AtomicHTMLToken& token)
{
ASSERT(token.type() == HTMLToken::StartTag || token.type() == HTMLToken::EndTag);
{
FakeInsertionMode fakeMode(this, m_secondaryInsertionMode);
processEndTag(token);
processToken(token);
}
if (insertionMode() == InForeignContentMode && m_tree.openElements()->hasOnlyHTMLElementsInScope())
setInsertionMode(m_secondaryInsertionMode);
......
......@@ -153,7 +153,7 @@ private:
void processDefaultForAfterHeadMode(AtomicHTMLToken&);
void processDefaultForInTableTextMode(AtomicHTMLToken&);
void processEndTagUsingSecondaryInsertionModeAndAdjustInsertionMode(AtomicHTMLToken&);
void processUsingSecondaryInsertionModeAndAdjustInsertionMode(AtomicHTMLToken&);
PassRefPtr<NamedNodeMap> attributesForIsindexInput(AtomicHTMLToken&);
......
......@@ -18,3 +18,10 @@ mo interfaceName=MathMLTextElement
mtext interfaceName=MathMLTextElement
msub interfaceName=MathMLElement
msup interfaceName=MathMLElement
#if 0 // Curently only for MathMLNames used by HTMLTreeBuilder.
ms
mglyph
malignmark
annotation-xml
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment