Changeset 72003 in webkit


Ignore:
Timestamp:
Nov 15, 2010 4:43:05 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-11-15 Dai Mikurube <dmikurube@google.com>

Reviewed by Kent Tamura.

Implement formaction, formenctype, formmethod and formtarget attributes for input and button tags
https://bugs.webkit.org/show_bug.cgi?id=49240

  • fast/forms/formaction-attribute-expected.txt: Added.
  • fast/forms/formaction-attribute.html: Added.
  • fast/forms/formmethod-attribute-button-html-expected.txt: Added.
  • fast/forms/formmethod-attribute-button-html.html: Added.
  • fast/forms/formmethod-attribute-input-html-expected.txt: Added.
  • fast/forms/formmethod-attribute-input-html.html: Added.
  • fast/forms/formtarget-attribute-button-html-expected.txt: Added.
  • fast/forms/formtarget-attribute-button-html.html: Added.
  • fast/forms/formtarget-attribute-input-html-expected.txt: Added.
  • fast/forms/formtarget-attribute-input-html.html: Added.
  • fast/forms/mailto/formenctype-attribute-button-html-expected.txt: Added.
  • fast/forms/mailto/formenctype-attribute-button-html.html: Added.
  • fast/forms/mailto/formenctype-attribute-input-html-expected.txt: Added.
  • fast/forms/mailto/formenctype-attribute-input-html.html: Added.
  • fast/forms/script-tests/submit-form-attributes.js: Added.
  • fast/forms/submit-form-attributes-expected.txt: Added.
  • fast/forms/submit-form-attributes.html: Added.

2010-11-15 Dai Mikurube <dmikurube@google.com>

Reviewed by Kent Tamura.

Implement formaction, formenctype, formmethod and formtarget attributes for input and button tags
https://bugs.webkit.org/show_bug.cgi?id=49240

Tests: fast/forms/formaction-attribute.html

fast/forms/formmethod-attribute-button-html.html
fast/forms/formmethod-attribute-input-html.html
fast/forms/formtarget-attribute-button-html.html
fast/forms/formtarget-attribute-input-html.html
fast/forms/mailto/formenctype-attribute-button-html.html
fast/forms/mailto/formenctype-attribute-input-html.html
fast/forms/submit-form-attributes.html

  • html/HTMLAttributeNames.in: Added formaction, formmethod, formtarget and formenctype attributes
  • html/HTMLButtonElement.idl:
  • html/HTMLInputElement.idl:
  • loader/FormSubmission.cpp: Modified to check the pressed button and its attributes (WebCore::FormSubmission::Attributes::copyFrom): (WebCore::FormSubmission::create):
  • loader/FormSubmission.h:
Location:
trunk
Files:
17 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r72000 r72003  
     12010-11-15  Dai Mikurube  <dmikurube@google.com>
     2
     3        Reviewed by Kent Tamura.
     4
     5        Implement formaction, formenctype, formmethod and formtarget attributes for input and button tags
     6        https://bugs.webkit.org/show_bug.cgi?id=49240
     7
     8        * fast/forms/formaction-attribute-expected.txt: Added.
     9        * fast/forms/formaction-attribute.html: Added.
     10        * fast/forms/formmethod-attribute-button-html-expected.txt: Added.
     11        * fast/forms/formmethod-attribute-button-html.html: Added.
     12        * fast/forms/formmethod-attribute-input-html-expected.txt: Added.
     13        * fast/forms/formmethod-attribute-input-html.html: Added.
     14        * fast/forms/formtarget-attribute-button-html-expected.txt: Added.
     15        * fast/forms/formtarget-attribute-button-html.html: Added.
     16        * fast/forms/formtarget-attribute-input-html-expected.txt: Added.
     17        * fast/forms/formtarget-attribute-input-html.html: Added.
     18        * fast/forms/mailto/formenctype-attribute-button-html-expected.txt: Added.
     19        * fast/forms/mailto/formenctype-attribute-button-html.html: Added.
     20        * fast/forms/mailto/formenctype-attribute-input-html-expected.txt: Added.
     21        * fast/forms/mailto/formenctype-attribute-input-html.html: Added.
     22        * fast/forms/script-tests/submit-form-attributes.js: Added.
     23        * fast/forms/submit-form-attributes-expected.txt: Added.
     24        * fast/forms/submit-form-attributes.html: Added.
     25
    1262010-11-15  Alejandro G. Castro  <alex@igalia.com>
    227
  • trunk/WebCore/ChangeLog

    r72002 r72003  
     12010-11-15  Dai Mikurube  <dmikurube@google.com>
     2
     3        Reviewed by Kent Tamura.
     4
     5        Implement formaction, formenctype, formmethod and formtarget attributes for input and button tags
     6        https://bugs.webkit.org/show_bug.cgi?id=49240
     7
     8        Tests: fast/forms/formaction-attribute.html
     9               fast/forms/formmethod-attribute-button-html.html
     10               fast/forms/formmethod-attribute-input-html.html
     11               fast/forms/formtarget-attribute-button-html.html
     12               fast/forms/formtarget-attribute-input-html.html
     13               fast/forms/mailto/formenctype-attribute-button-html.html
     14               fast/forms/mailto/formenctype-attribute-input-html.html
     15               fast/forms/submit-form-attributes.html
     16
     17        * html/HTMLAttributeNames.in: Added formaction, formmethod, formtarget and formenctype attributes
     18        * html/HTMLButtonElement.idl:
     19        * html/HTMLInputElement.idl:
     20        * loader/FormSubmission.cpp: Modified to check the pressed button and its attributes
     21        (WebCore::FormSubmission::Attributes::copyFrom):
     22        (WebCore::FormSubmission::create):
     23        * loader/FormSubmission.h:
     24
    1252010-11-15  Pavel Feldman  <pfeldman@chromium.org>
    226
  • trunk/WebCore/html/HTMLAttributeNames.in

    r71994 r72003  
    9696for
    9797form
     98formaction
     99formenctype
     100formmethod
    98101formnovalidate
     102formtarget
    99103frame
    100104frameborder
  • trunk/WebCore/html/HTMLButtonElement.idl

    r61413 r72003  
    2424        readonly attribute HTMLFormElement form;
    2525
     26        attribute [Reflect, URL] DOMString formAction;
     27        attribute [Reflect] DOMString formEnctype;
     28        attribute [Reflect] DOMString formMethod;
    2629        attribute [Reflect] boolean formNoValidate;
     30        attribute [Reflect] DOMString formTarget;
    2731        readonly attribute ValidityState validity;
    2832
  • trunk/WebCore/html/HTMLInputElement.idl

    r71880 r72003  
    2525        attribute [Reflect=checked] boolean defaultChecked;
    2626        readonly attribute HTMLFormElement form;
     27        attribute [Reflect, URL] DOMString formAction;
     28        attribute [Reflect] DOMString formEnctype;
     29        attribute [Reflect] DOMString formMethod;
    2730        attribute [Reflect] boolean formNoValidate;
     31        attribute [Reflect] DOMString formTarget;
    2832        readonly attribute ValidityState validity;
    2933        attribute [Reflect] DOMString accept;
  • trunk/WebCore/loader/FormSubmission.cpp

    r68854 r72003  
    111111}
    112112
     113void FormSubmission::Attributes::copyFrom(const Attributes& other)
     114{
     115    m_method = other.m_method;
     116    m_isMultiPartForm = other.m_isMultiPartForm;
     117
     118    m_action = other.m_action;
     119    m_target = other.m_target;
     120    m_encodingType = other.m_encodingType;
     121    m_acceptCharset = other.m_acceptCharset;
     122}
     123
    113124inline FormSubmission::FormSubmission(Method method, const KURL& action, const String& target, const String& contentType, PassRefPtr<FormState> state, PassRefPtr<FormData> data, const String& boundary, bool lockHistory, PassRefPtr<Event> event)
    114125    : m_method(method)
     
    127138{
    128139    ASSERT(form);
     140
     141    HTMLFormControlElement* submitButton = 0;
     142    if (event && event->target() && event->target()->toNode())
     143        submitButton = static_cast<HTMLFormControlElement*>(event->target()->toNode());
     144
     145    FormSubmission::Attributes copiedAttributes;
     146    copiedAttributes.copyFrom(attributes);
     147    if (submitButton) {
     148        String attributeValue;
     149        if (!(attributeValue = submitButton->getAttribute(formactionAttr)).isNull())
     150            copiedAttributes.parseAction(attributeValue);
     151        if (!(attributeValue = submitButton->getAttribute(formenctypeAttr)).isNull())
     152            copiedAttributes.parseEncodingType(attributeValue);
     153        if (!(attributeValue = submitButton->getAttribute(formmethodAttr)).isNull())
     154            copiedAttributes.parseMethodType(attributeValue);
     155        if (!(attributeValue = submitButton->getAttribute(formtargetAttr)).isNull())
     156            copiedAttributes.setTarget(attributeValue);
     157    }
     158   
    129159    Document* document = form->document();
    130     KURL actionURL = document->completeURL(attributes.action().isEmpty() ? document->url().string() : attributes.action());
     160    KURL actionURL = document->completeURL(copiedAttributes.action().isEmpty() ? document->url().string() : copiedAttributes.action());
    131161    bool isMailtoForm = actionURL.protocolIs("mailto");
    132162    bool isMultiPartForm = false;
    133     String encodingType = attributes.encodingType();
    134 
    135     if (attributes.method() == PostMethod) {
    136         isMultiPartForm = attributes.isMultiPartForm();
     163    String encodingType = copiedAttributes.encodingType();
     164
     165    if (copiedAttributes.method() == PostMethod) {
     166        isMultiPartForm = copiedAttributes.isMultiPartForm();
    137167        if (isMultiPartForm && isMailtoForm) {
    138168            encodingType = "application/x-www-form-urlencoded";
     
    141171    }
    142172
    143     TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : FormDataBuilder::encodingFromAcceptCharset(attributes.acceptCharset(), document);
     173    TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : FormDataBuilder::encodingFromAcceptCharset(copiedAttributes.acceptCharset(), document);
    144174    RefPtr<DOMFormData> domFormData = DOMFormData::create(dataEncoding.encodingForFormSubmission());
    145175    Vector<pair<String, String> > formValues;
     
    167197    } else {
    168198        formData = FormData::create(*(static_cast<FormDataList*>(domFormData.get())), domFormData->encoding());
    169         if (attributes.method() == PostMethod && isMailtoForm) {
     199        if (copiedAttributes.method() == PostMethod && isMailtoForm) {
    170200            // Convert the form data into a string that we put into the URL.
    171201            appendMailtoPostFormDataToURL(actionURL, *formData, encodingType);
     
    175205
    176206    formData->setIdentifier(generateFormDataIdentifier());
    177     String targetOrBaseTarget = attributes.target().isEmpty() ? document->baseTarget() : attributes.target();
     207    String targetOrBaseTarget = copiedAttributes.target().isEmpty() ? document->baseTarget() : copiedAttributes.target();
    178208    RefPtr<FormState> formState = FormState::create(form, formValues, document->frame(), trigger);
    179     return adoptRef(new FormSubmission(attributes.method(), actionURL, targetOrBaseTarget, encodingType, formState.release(), formData.release(), boundary, lockHistory, event));
     209    return adoptRef(new FormSubmission(copiedAttributes.method(), actionURL, targetOrBaseTarget, encodingType, formState.release(), formData.release(), boundary, lockHistory, event));
    180210}
    181211
  • trunk/WebCore/loader/FormSubmission.h

    r65340 r72003  
    7373        void setAcceptCharset(const String& value) { m_acceptCharset = value; }
    7474
     75        void copyFrom(const Attributes&);
     76
    7577    private:
    7678        Method m_method;
Note: See TracChangeset for help on using the changeset viewer.