Changeset 65785 in webkit


Ignore:
Timestamp:
Aug 22, 2010 11:38:38 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-08-22 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

HTML5 TreeBuilder builds wrong DOM for <a><svg><tr><input></a>
https://bugs.webkit.org/show_bug.cgi?id=44390

  • html5lib/resources/adoption01.dat:

2010-08-22 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

HTML5 TreeBuilder builds wrong DOM for <a><svg><tr><input></a>
https://bugs.webkit.org/show_bug.cgi?id=44390

The HTML5 spec has changed since Adam and I original wrote
the HTMLTreeBuilder. Most important for this change was resolution of:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=9580

I also removed our "phrasing" tag support since that was also removed
from the spec as part of other bug fixes.

This is tested by tonyg's <a><svg><tr><input></a> test in adoption01.dat.

  • html/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::processCloseWhenNestedTag): (WebCore::HTMLTreeBuilder::processAnyOtherEndTagForInBody): (WebCore::HTMLTreeBuilder::furthestBlockForFormattingElement): (WebCore::HTMLTreeBuilder::processEndTag):
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r65783 r65785  
     12010-08-22  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        HTML5 TreeBuilder builds wrong DOM for <a><svg><tr><input></a>
     6        https://bugs.webkit.org/show_bug.cgi?id=44390
     7
     8        * html5lib/resources/adoption01.dat:
     9
    1102010-08-22  Andreas Kling  <andreas.kling@nokia.com>
    211
  • trunk/LayoutTests/html5lib/resources/adoption01.dat

    r65769 r65785  
    192192|     <a>
    193193|       <svg svg>
    194 |     <svg tr>
    195 |       <a>
    196 |   <svg input>
    197 |     <a>
     194|         <svg tr>
     195|           <svg input>
  • trunk/WebCore/ChangeLog

    r65784 r65785  
     12010-08-22  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        HTML5 TreeBuilder builds wrong DOM for <a><svg><tr><input></a>
     6        https://bugs.webkit.org/show_bug.cgi?id=44390
     7
     8        The HTML5 spec has changed since Adam and I original wrote
     9        the HTMLTreeBuilder.  Most important for this change was resolution of:
     10        http://www.w3.org/Bugs/Public/show_bug.cgi?id=9580
     11
     12        I also removed our "phrasing" tag support since that was also removed
     13        from the spec as part of other bug fixes.
     14
     15        This is tested by tonyg's <a><svg><tr><input></a> test in adoption01.dat.
     16
     17        * html/HTMLTreeBuilder.cpp:
     18        (WebCore::HTMLTreeBuilder::processCloseWhenNestedTag):
     19        (WebCore::HTMLTreeBuilder::processAnyOtherEndTagForInBody):
     20        (WebCore::HTMLTreeBuilder::furthestBlockForFormattingElement):
     21        (WebCore::HTMLTreeBuilder::processEndTag):
     22
    1232010-08-22  Andreas Kling  <andreas.kling@nokia.com>
    224
  • trunk/WebCore/html/HTMLTreeBuilder.cpp

    r65769 r65785  
    134134
    135135// http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#special
    136 bool isSpecialTag(const AtomicString& tagName)
    137 {
     136bool isSpecialNode(Node* node)
     137{
     138    if (node->namespaceURI() != xhtmlNamespaceURI)
     139        return false;
     140    const AtomicString& tagName = node->localName();
    138141    return tagName == addressTag
    139142        || tagName == articleTag
     
    242245}
    243246
    244 // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#phrasing
    245 bool isPhrasingTag(const AtomicString& tagName)
    246 {
    247     return !isSpecialTag(tagName) && !isScopingTag(tagName) && !isFormattingTag(tagName);
    248 }
    249 
    250 bool isNotFormattingAndNotPhrasing(const Element* element)
    251 {
    252     // The spec often says "node is not in the formatting category, and is not
    253     // in the phrasing category". !phrasing && !formatting == scoping || special
    254     // scoping || special is easier to compute.
    255     // FIXME: localName() is wrong for non-html content.
    256     const AtomicString& tagName = element->localName();
    257     return isScopingTag(tagName) || isSpecialTag(tagName);
    258 }
    259 
    260247HTMLFormElement* closestFormAncestor(Element* element)
    261248{
     
    766753            break;
    767754        }
    768         if (isNotFormattingAndNotPhrasing(node) && !node->hasTagName(addressTag) && !node->hasTagName(divTag) && !node->hasTagName(pTag))
     755        if (isSpecialNode(node) && !node->hasTagName(addressTag) && !node->hasTagName(divTag) && !node->hasTagName(pTag))
    769756            break;
    770757        nodeRecord = nodeRecord->next();
     
    17271714            return;
    17281715        }
    1729         if (isNotFormattingAndNotPhrasing(node)) {
     1716        if (isSpecialNode(node)) {
    17301717            parseError(token);
    17311718            return;
     
    17431730        if (record->element() == formattingElement)
    17441731            return furthestBlock;
    1745         if (isNotFormattingAndNotPhrasing(record->element()))
     1732        if (isSpecialNode(record->element()))
    17461733            furthestBlock = record;
    17471734    }
     
    24952482            // FIXME: This code just wants an Element* iterator, instead of an ElementRecord*
    24962483            HTMLElementStack::ElementRecord* nodeRecord = m_tree.openElements()->topRecord();
    2497             if (!nodeRecord->element()->hasLocalName(token.name())) {
     2484            if (!nodeRecord->element()->hasLocalName(token.name()))
    24982485                parseError(token);
    2499                 // FIXME: This return is not in the spec but it needed for now
    2500                 // to prevent walking off the bottom of the stack.
    2501                 // http://www.w3.org/Bugs/Public/show_bug.cgi?id=10118
    2502                 if (!m_tree.openElements()->contains(token.name()))
    2503                     return;
    2504             }
    25052486            while (1) {
    25062487                if (nodeRecord->element()->hasLocalName(token.name())) {
    25072488                    m_tree.openElements()->popUntilPopped(nodeRecord->element());
    2508                     return;
     2489                    break;
    25092490                }
    25102491                nodeRecord = nodeRecord->next();
    2511                 if (nodeRecord->element()->namespaceURI() == xhtmlNamespaceURI) {
    2512                     processUsingSecondaryInsertionModeAndAdjustInsertionMode(token);
    2513                     // FIXME: This is a hack around a spec bug and is likely wrong.
    2514                     // http://www.w3.org/Bugs/Public/show_bug.cgi?id=9581
    2515                     if (nodeRecord != m_tree.openElements()->topRecord())
    2516                         return;
    2517                 }
     2492                if (nodeRecord->element()->namespaceURI() == xhtmlNamespaceURI)
     2493                    break;
    25182494            }
    2519             return;
    2520         }
     2495        }
     2496        // Any other end tag (also the last two steps of "An end tag, if the current node is not an element in the HTML namespace."
    25212497        processUsingSecondaryInsertionModeAndAdjustInsertionMode(token);
    25222498        break;
Note: See TracChangeset for help on using the changeset viewer.