Changeset 63815 in webkit


Ignore:
Timestamp:
Jul 21, 2010 5:53:21 AM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-07-21 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Associate elements with the active form
https://bugs.webkit.org/show_bug.cgi?id=42728

This patch fixes fast/forms/formmove3.html. The test still doesn't
pass due to some render tree differences, but it works as intended now.

To fix this test, I needed to deviate from the spec slight. Minefield
seems to have the same deviation:

  • html/HTMLConstructionSite.cpp: (WebCore::HTMLConstructionSite::takeForm): (WebCore::HTMLConstructionSite::setForm): (WebCore::HTMLConstructionSite::createHTMLElement):
  • html/HTMLConstructionSite.h: (WebCore::HTMLConstructionSite::form):
  • html/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::processStartTagForInBody):
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r63814 r63815  
     12010-07-21  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Associate elements with the active form
     6        https://bugs.webkit.org/show_bug.cgi?id=42728
     7
     8        This patch fixes fast/forms/formmove3.html.  The test still doesn't
     9        pass due to some render tree differences, but it works as intended now.
     10
     11        To fix this test, I needed to deviate from the spec slight.  Minefield
     12        seems to have the same deviation:
     13          - http://www.w3.org/Bugs/Public/show_bug.cgi?id=10216
     14
     15        * html/HTMLConstructionSite.cpp:
     16        (WebCore::HTMLConstructionSite::takeForm):
     17        (WebCore::HTMLConstructionSite::setForm):
     18        (WebCore::HTMLConstructionSite::createHTMLElement):
     19        * html/HTMLConstructionSite.h:
     20        (WebCore::HTMLConstructionSite::form):
     21        * html/HTMLTreeBuilder.cpp:
     22        (WebCore::HTMLTreeBuilder::processStartTagForInBody):
     23
    1242010-07-21  Adam Barth  <abarth@webkit.org>
    225
  • trunk/WebCore/html/HTMLConstructionSite.cpp

    r63814 r63815  
    3333#include "Frame.h"
    3434#include "HTMLDocument.h"
     35#include "HTMLElementFactory.h"
     36#include "HTMLFormElement.h"
    3537#include "HTMLHtmlElement.h"
    3638#include "HTMLNames.h"
     
    142144}
    143145
     146PassRefPtr<HTMLFormElement> HTMLConstructionSite::takeForm()
     147{
     148    return m_form.release();
     149}
     150
    144151void HTMLConstructionSite::dispatchDocumentElementAvailableIfNeeded()
    145152{
     
    233240    ASSERT(!shouldFosterParent());
    234241    m_openElements.pushHTMLBodyElement(attachToCurrent(createHTMLElement(token)));
     242}
     243
     244void HTMLConstructionSite::insertHTMLFormElement(AtomicHTMLToken& token)
     245{
     246    insertHTMLElement(token);
     247    ASSERT(currentElement()->isHTMLElement());
     248    ASSERT(currentElement()->hasTagName(formTag));
     249    m_form = static_cast<HTMLFormElement*>(currentElement());
    235250}
    236251
     
    308323PassRefPtr<Element> HTMLConstructionSite::createHTMLElement(AtomicHTMLToken& token)
    309324{
    310     RefPtr<Element> element = createElement(token, xhtmlNamespaceURI);
     325    QualifiedName tagName(nullAtom, token.name(), xhtmlNamespaceURI);
     326    // FIXME: This can't use HTMLConstructionSite::createElement because we
     327    // have to pass the current form element.  We should rework form association
     328    // to occur after construction to allow better code sharing here.
     329    RefPtr<Element> element = HTMLElementFactory::createHTMLElement(tagName, m_document, form(), true);
     330    element->setAttributeMap(token.takeAtributes(), m_fragmentScriptingPermission);
    311331    ASSERT(element->isHTMLElement());
    312332    return element.release();
  • trunk/WebCore/html/HTMLConstructionSite.h

    r63762 r63815  
    5656    void insertHTMLHeadElement(AtomicHTMLToken&);
    5757    void insertHTMLBodyElement(AtomicHTMLToken&);
     58    void insertHTMLFormElement(AtomicHTMLToken&);
    5859    void insertScriptElement(AtomicHTMLToken&);
    5960    void insertTextNode(const String&);
     
    8485    Element* head() const { return m_head.get(); }
    8586
    86     Element* form() const { return m_form.get(); }
    87     PassRefPtr<Element> takeForm() { return m_form.release(); }
    88 
    89     void setForm(PassRefPtr<Element> form) { m_form = form; }
     87    HTMLFormElement* form() const { return m_form.get(); }
     88    PassRefPtr<HTMLFormElement> takeForm();
    9089
    9190    class RedirectToFosterParentGuard : public Noncopyable {
     
    129128    Document* m_document;
    130129    RefPtr<Element> m_head;
    131     RefPtr<Element> m_form;
     130    RefPtr<HTMLFormElement> m_form;
    132131    mutable HTMLElementStack m_openElements;
    133132    mutable HTMLFormattingElementList m_activeFormattingElements;
  • trunk/WebCore/html/HTMLTreeBuilder.cpp

    r63814 r63815  
    3434#include "HTMLDocument.h"
    3535#include "HTMLElementFactory.h"
     36#include "HTMLFormElement.h"
    3637#include "HTMLHtmlElement.h"
    3738#include "HTMLNames.h"
     
    846847        }
    847848        processFakePEndTagIfPInScope();
    848         m_tree.insertHTMLElement(token);
    849         m_tree.setForm(m_tree.currentElement());
     849        m_tree.insertHTMLFormElement(token);
    850850        return;
    851851    }
     
    11431143        if (m_tree.form())
    11441144            return;
    1145         m_tree.insertSelfClosingHTMLElement(token);
     1145        // FIXME: This deviates from the spec:
     1146        //        http://www.w3.org/Bugs/Public/show_bug.cgi?id=10216
     1147        m_tree.insertHTMLFormElement(token);
     1148        m_tree.openElements()->pop();
    11461149        return;
    11471150    }
Note: See TracChangeset for help on using the changeset viewer.