Changeset 63116 in webkit


Ignore:
Timestamp:
Jul 12, 2010 2:13:09 PM (14 years ago)
Author:
eric@webkit.org
Message:

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:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r63115 r63116  
     12010-07-12  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        HTMLTreeBuilder needs to support mixing SVG and MathML content
     6        https://bugs.webkit.org/show_bug.cgi?id=42096
     7
     8        * html5lib/runner-expected-html5.txt:
     9
    1102010-07-12  Eric Seidel  <eric@webkit.org>
    211
  • trunk/LayoutTests/html5lib/runner-expected-html5.txt

    r63115 r63116  
    729729|       <math math>
    730730|         <math mtext>
    731 |           <math i>
     731|           <i>
    732732|             "baz"
    733733|         <math annotation-xml>
    734 |           <math svg>
    735 |             <math desc>
    736 |               <math b>
     734|           <svg svg>
     735|             <svg desc>
     736|               <b>
    737737|                 "eggs"
    738 |             <math g>
    739 |               <math foreignobject>
    740 |                 <math p>
     738|             <svg g>
     739|               <svg foreignObject>
     740|                 <p>
    741741|                   "spam"
    742 |                   <math table>
    743 |                     <math tr>
    744 |                       <math td>
    745 |                         <math img>
    746 |                           <math g>
    747 |                             "quux"
    748 |                           "bar"
     742|                 <table>
     743|                   <tbody>
     744|                     <tr>
     745|                       <td>
     746|                         <img>
     747|                 <g>
     748|                   "quux"
     749|                 "bar"
    749750Expected:
    750751| <!DOCTYPE html>
     
    786787|     <math math>
    787788|       <math mtext>
    788 |         <math i>
     789|         <i>
    789790|           "baz"
    790791|       <math annotation-xml>
    791 |         <math svg>
    792 |           <math desc>
    793 |             <math b>
     792|         <svg svg>
     793|           <svg desc>
     794|             <b>
    794795|               "eggs"
    795 |           <math g>
    796 |             <math foreignobject>
    797 |               <math p>
     796|           <svg g>
     797|             <svg foreignObject>
     798|               <p>
    798799|                 "spam"
    799 |                 <math table>
    800 |                   <math tr>
    801 |                     <math td>
    802 |                       <math img>
    803 |                         <math g>
    804 |                           "quux"
    805 |                         "bar"
     800|               <table>
     801|                 <tbody>
     802|                   <tr>
     803|                     <td>
     804|                       <img>
     805|               <g>
     806|                 "quux"
     807|               "bar"
    806808Expected:
    807809| <!DOCTYPE html>
  • trunk/WebCore/ChangeLog

    r63115 r63116  
     12010-07-12  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        HTMLTreeBuilder needs to support mixing SVG and MathML content
     6        https://bugs.webkit.org/show_bug.cgi?id=42096
     7
     8        This is just a direct transcription of another paragraph of the
     9        HTML5 spec.
     10
     11        This improved a couple results in html5lib/runner.html, but more
     12        work to do yet to pass all the foreign content tests.
     13
     14        * html/HTMLTreeBuilder.cpp:
     15        (WebCore::HTMLTreeBuilder::processStartTag):
     16        (WebCore::HTMLTreeBuilder::processEndTag):
     17        (WebCore::HTMLTreeBuilder::processUsingSecondaryInsertionModeAndAdjustInsertionMode):
     18        * html/HTMLTreeBuilder.h:
     19        * mathml/mathtags.in:
     20
    1212010-07-12  Eric Seidel  <eric@webkit.org>
    222
  • trunk/WebCore/html/HTMLTreeBuilder.cpp

    r63115 r63116  
    11491149}
    11501150
     1151namespace {
     1152
     1153bool shouldProcessUsingSecondaryInsertionMode(AtomicHTMLToken& token, Element* currentElement)
     1154{
     1155    ASSERT(token.type() == HTMLToken::StartTag);
     1156    if (currentElement->hasTagName(MathMLNames::miTag)
     1157        || currentElement->hasTagName(MathMLNames::moTag)
     1158        || currentElement->hasTagName(MathMLNames::mnTag)
     1159        || currentElement->hasTagName(MathMLNames::msTag)
     1160        || currentElement->hasTagName(MathMLNames::mtextTag)) {
     1161        return token.name() != MathMLNames::mglyphTag
     1162            && token.name() != MathMLNames::malignmarkTag;
     1163    }
     1164    if (currentElement->hasTagName(MathMLNames::annotation_xmlTag))
     1165        return token.name() == SVGNames::svgTag;
     1166    if (currentElement->hasTagName(SVGNames::foreignObjectTag)
     1167        || currentElement->hasTagName(SVGNames::descTag)
     1168        || currentElement->hasTagName(SVGNames::titleTag))
     1169        return true;
     1170    return currentElement->namespaceURI() == HTMLNames::xhtmlNamespaceURI;
     1171}
     1172
     1173}
     1174
    11511175void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token)
    11521176{
     
    14641488    case InForeignContentMode: {
    14651489        // FIXME: We're missing a bunch of if branches here.
     1490        if (shouldProcessUsingSecondaryInsertionMode(token, m_tree.currentElement())) {
     1491            processUsingSecondaryInsertionModeAndAdjustInsertionMode(token);
     1492            return;
     1493        }
    14661494        notImplemented();
    14671495        const AtomicString& currentNamespace = m_tree.currentElement()->namespaceURI();
     
    22792307                nodeRecord = nodeRecord->next();
    22802308                if (nodeRecord->element()->namespaceURI() == xhtmlNamespaceURI)
    2281                     processEndTagUsingSecondaryInsertionModeAndAdjustInsertionMode(token);
     2309                    processUsingSecondaryInsertionModeAndAdjustInsertionMode(token);
    22822310            }
    22832311            return;
    22842312        }
    2285         processEndTagUsingSecondaryInsertionModeAndAdjustInsertionMode(token);
     2313        processUsingSecondaryInsertionModeAndAdjustInsertionMode(token);
    22862314        break;
    22872315    }
     
    23112339// the insertion mode.  These are separate steps in the spec, but always occur
    23122340// right after one another.
    2313 void HTMLTreeBuilder::processEndTagUsingSecondaryInsertionModeAndAdjustInsertionMode(AtomicHTMLToken& token)
    2314 {
     2341void HTMLTreeBuilder::processUsingSecondaryInsertionModeAndAdjustInsertionMode(AtomicHTMLToken& token)
     2342{
     2343    ASSERT(token.type() == HTMLToken::StartTag || token.type() == HTMLToken::EndTag);
    23152344    {
    23162345        FakeInsertionMode fakeMode(this, m_secondaryInsertionMode);
    2317         processEndTag(token);
     2346        processToken(token);
    23182347    }
    23192348    if (insertionMode() == InForeignContentMode && m_tree.openElements()->hasOnlyHTMLElementsInScope())
  • trunk/WebCore/html/HTMLTreeBuilder.h

    r62926 r63116  
    154154    void processDefaultForInTableTextMode(AtomicHTMLToken&);
    155155
    156     void processEndTagUsingSecondaryInsertionModeAndAdjustInsertionMode(AtomicHTMLToken&);
     156    void processUsingSecondaryInsertionModeAndAdjustInsertionMode(AtomicHTMLToken&);
    157157
    158158    PassRefPtr<NamedNodeMap> attributesForIsindexInput(AtomicHTMLToken&);
  • trunk/WebCore/mathml/mathtags.in

    r60342 r63116  
    1919msub interfaceName=MathMLElement
    2020msup interfaceName=MathMLElement
     21
     22#if 0 // Curently only for MathMLNames used by HTMLTreeBuilder.
     23ms
     24mglyph
     25malignmark
     26annotation-xml
     27#endif
Note: See TracChangeset for help on using the changeset viewer.