Changeset 62618 in webkit


Ignore:
Timestamp:
Jul 6, 2010 9:23:03 PM (14 years ago)
Author:
eric@webkit.org
Message:

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

Reviewed by Adam Barth.

Fix </optgroup> in "in select" mode
https://bugs.webkit.org/show_bug.cgi?id=41733

  • html5lib/runner-expected-html5.txt:

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

Reviewed by Adam Barth.

Fix </optgroup> in "in select" mode
https://bugs.webkit.org/show_bug.cgi?id=41733

I had to add a oneBelowTop() accessor.
I added some ASSERTs after looking at the fragment case
documentation. I'm now convinced that top() and oneBeforeTop()
should never be NULL, so we just ASSERT they aren't.

This is a very obscure corner of the HTML spec, but at least
we have a test for it. This makes one more html5lib test pass.

  • html/HTMLConstructionSite.h: (WebCore::HTMLConstructionSite::oneBelowTop):
  • html/HTMLElementStack.cpp: (WebCore::HTMLElementStack::topRecord): (WebCore::HTMLElementStack::top): (WebCore::HTMLElementStack::oneBelowTop):
  • html/HTMLElementStack.h:
  • html/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::processEndTag):
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r62613 r62618  
     12010-07-06  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Fix </optgroup> in "in select" mode
     6        https://bugs.webkit.org/show_bug.cgi?id=41733
     7
     8        * html5lib/runner-expected-html5.txt:
     9
    1102010-07-06  Eric Seidel  <eric@webkit.org>
    211
  • trunk/LayoutTests/html5lib/runner-expected-html5.txt

    r62617 r62618  
    33233211
    33333313
    334 36
    33533447
    33633548
     
    374373|       <tbody>
    375374|         <tr>
    376 
    377 Test 36 of 59 in resources/tests2.dat failed. Input:
    378 <!DOCTYPE html><select><optgroup><option></optgroup><option><select><option>
    379 Got:
    380 | <!DOCTYPE html>
    381 | <html>
    382 |   <head>
    383 |   <body>
    384 |     <select>
    385 |       <optgroup>
    386 |         <option>
    387 |         <option>
    388 |     <option>
    389 Expected:
    390 | <!DOCTYPE html>
    391 | <html>
    392 |   <head>
    393 |   <body>
    394 |     <select>
    395 |       <optgroup>
    396 |         <option>
    397 |       <option>
    398 |     <option>
    399375
    400376Test 47 of 59 in resources/tests2.dat failed. Input:
  • trunk/WebCore/ChangeLog

    r62617 r62618  
     12010-07-06  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Fix </optgroup> in "in select" mode
     6        https://bugs.webkit.org/show_bug.cgi?id=41733
     7
     8        I had to add a oneBelowTop() accessor.
     9        I added some ASSERTs after looking at the fragment case
     10        documentation.  I'm now convinced that top() and oneBeforeTop()
     11        should never be NULL, so we just ASSERT they aren't.
     12
     13        This is a very obscure corner of the HTML spec, but at least
     14        we have a test for it.  This makes one more html5lib test pass.
     15
     16        * html/HTMLConstructionSite.h:
     17        (WebCore::HTMLConstructionSite::oneBelowTop):
     18        * html/HTMLElementStack.cpp:
     19        (WebCore::HTMLElementStack::topRecord):
     20        (WebCore::HTMLElementStack::top):
     21        (WebCore::HTMLElementStack::oneBelowTop):
     22        * html/HTMLElementStack.h:
     23        * html/HTMLTreeBuilder.cpp:
     24        (WebCore::HTMLTreeBuilder::processEndTag):
     25
    1262010-07-06  Eric Seidel  <eric@webkit.org>
    227
  • trunk/WebCore/html/HTMLConstructionSite.h

    r62611 r62618  
    7373
    7474    Element* currentElement() const { return m_openElements.top(); }
     75    Element* oneBelowTop() const { return m_openElements.oneBelowTop(); }
     76
    7577    HTMLElementStack* openElements() const { return &m_openElements; }
    7678    HTMLFormattingElementList* activeFormattingElements() const { return &m_activeFormattingElements; }
  • trunk/WebCore/html/HTMLElementStack.cpp

    r62573 r62618  
    241241HTMLElementStack::ElementRecord* HTMLElementStack::topRecord() const
    242242{
     243    ASSERT(m_top);
    243244    return m_top.get();
    244245}
     
    246247Element* HTMLElementStack::top() const
    247248{
     249    ASSERT(m_top->element());
    248250    return m_top->element();
     251}
     252
     253Element* HTMLElementStack::oneBelowTop() const
     254{
     255    // We should never be calling this if it could be 0.
     256    ASSERT(m_top);
     257    ASSERT(m_top->next());
     258    return m_top->next()->element();
    249259}
    250260
  • trunk/WebCore/html/HTMLElementStack.h

    r62563 r62618  
    6969   
    7070    Element* top() const;
     71    Element* oneBelowTop() const;
    7172    ElementRecord* topRecord() const;
    7273    Element* bottom() const;
  • trunk/WebCore/html/HTMLTreeBuilder.cpp

    r62617 r62618  
    18741874        ASSERT(insertionMode() == InSelectMode || insertionMode() == InSelectInTableMode);
    18751875        if (token.name() == optgroupTag) {
    1876             if (m_tree.currentElement()->hasTagName(optionTag))
    1877                 notImplemented();
     1876            if (m_tree.currentElement()->hasTagName(optionTag) && m_tree.oneBelowTop()->hasTagName(optgroupTag))
     1877                processFakeEndTag(optionTag);
    18781878            if (m_tree.currentElement()->hasTagName(optgroupTag)) {
    18791879                m_tree.openElements()->pop();
Note: See TracChangeset for help on using the changeset viewer.