Changeset 100965 in webkit


Ignore:
Timestamp:
Nov 21, 2011 3:13:00 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Need support for dirname attribute
https://bugs.webkit.org/show_bug.cgi?id=65542

Patch by Rakesh KN <rakesh.kn@motorola.com> on 2011-11-21
Reviewed by Eric Seidel.

Implemented 'dirname' form attribute.

Source/WebCore:

Tests: fast/forms/form-dirname-attribute.html

fast/forms/submit-form-with-dirname-attribute-with-ancestor-dir-attribute.html
fast/forms/submit-form-with-dirname-attribute-with-nonhtml-ancestor.html
fast/forms/submit-form-with-dirname-attribute.html

  • html/HTMLAttributeNames.in:

Added "dirname" attribute.

  • html/HTMLInputElement.idl:

Add "dirName" property to HTMLInputElement interface.

  • html/HTMLTextAreaElement.cpp:

(WebCore::HTMLTextAreaElement::appendFormData):
Append dirname form data.

  • html/HTMLTextAreaElement.idl:

Add "dirName" property to HTMLTextAreaElement interface.

  • html/HTMLTextFormControlElement.cpp:

(WebCore::parentHTMLElement):
Helper function which returns only HTML parent element.
(WebCore::HTMLTextFormControlElement::directionForFormData):
Helper function for finding directionality of the Element.

  • html/HTMLTextFormControlElement.h:

Helper function for finding directionality of the Element.

  • html/TextFieldInputType.cpp:

(WebCore::TextFieldInputType::appendFormData):
Append dirname form data.

  • html/TextFieldInputType.h:

Append dirname form data.

LayoutTests:

  • fast/forms/form-dirname-attribute-expected.txt: Added.
  • fast/forms/form-dirname-attribute.html: Added.
  • fast/forms/submit-form-with-dirname-attribute-expected.txt: Added.
  • fast/forms/submit-form-with-dirname-attribute-with-ancestor-dir-attribute-expected.txt: Added.
  • fast/forms/submit-form-with-dirname-attribute-with-ancestor-dir-attribute.html: Added.
  • fast/forms/submit-form-with-dirname-attribute-with-nonhtml-ancestor-expected.txt: Added.
  • fast/forms/submit-form-with-dirname-attribute-with-nonhtml-ancestor.html: Added.
  • fast/forms/submit-form-with-dirname-attribute.html: Added.
Location:
trunk
Files:
8 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r100962 r100965  
     12011-11-21  Rakesh KN  <rakesh.kn@motorola.com>
     2
     3        Need support for dirname attribute
     4        https://bugs.webkit.org/show_bug.cgi?id=65542
     5
     6        Reviewed by Eric Seidel.
     7
     8        Implemented 'dirname' form attribute.
     9
     10        * fast/forms/form-dirname-attribute-expected.txt: Added.
     11        * fast/forms/form-dirname-attribute.html: Added.
     12        * fast/forms/submit-form-with-dirname-attribute-expected.txt: Added.
     13        * fast/forms/submit-form-with-dirname-attribute-with-ancestor-dir-attribute-expected.txt: Added.
     14        * fast/forms/submit-form-with-dirname-attribute-with-ancestor-dir-attribute.html: Added.
     15        * fast/forms/submit-form-with-dirname-attribute-with-nonhtml-ancestor-expected.txt: Added.
     16        * fast/forms/submit-form-with-dirname-attribute-with-nonhtml-ancestor.html: Added.
     17        * fast/forms/submit-form-with-dirname-attribute.html: Added.
     18
    1192011-11-21  Adam Klein  <adamk@chromium.org>
    220
  • trunk/Source/WebCore/ChangeLog

    r100959 r100965  
     12011-11-21  Rakesh KN  <rakesh.kn@motorola.com>
     2
     3        Need support for dirname attribute
     4        https://bugs.webkit.org/show_bug.cgi?id=65542
     5
     6        Reviewed by Eric Seidel.
     7
     8        Implemented 'dirname' form attribute.
     9
     10        Tests: fast/forms/form-dirname-attribute.html
     11               fast/forms/submit-form-with-dirname-attribute-with-ancestor-dir-attribute.html
     12               fast/forms/submit-form-with-dirname-attribute-with-nonhtml-ancestor.html
     13               fast/forms/submit-form-with-dirname-attribute.html
     14
     15        * html/HTMLAttributeNames.in:
     16        Added "dirname" attribute.
     17        * html/HTMLInputElement.idl:
     18        Add "dirName" property to HTMLInputElement interface.
     19        * html/HTMLTextAreaElement.cpp:
     20        (WebCore::HTMLTextAreaElement::appendFormData):
     21        Append dirname form data.
     22        * html/HTMLTextAreaElement.idl:
     23        Add "dirName" property to HTMLTextAreaElement interface.
     24        * html/HTMLTextFormControlElement.cpp:
     25        (WebCore::parentHTMLElement):
     26        Helper function which returns only HTML parent element.
     27        (WebCore::HTMLTextFormControlElement::directionForFormData):
     28        Helper function for finding directionality of the Element.
     29        * html/HTMLTextFormControlElement.h:
     30        Helper function for finding directionality of the Element.
     31        * html/TextFieldInputType.cpp:
     32        (WebCore::TextFieldInputType::appendFormData):
     33        Append dirname form data.
     34        * html/TextFieldInputType.h:
     35        Append dirname form data.
     36
    1372011-11-21  Joshua Bell  <jsbell@chromium.org>
    238
  • trunk/Source/WebCore/html/HTMLAttributeNames.in

    r100159 r100965  
    9191dir
    9292direction
     93dirname
    9394disabled
    9495download
  • trunk/Source/WebCore/html/HTMLInputElement.idl

    r100805 r100965  
    2424        attribute [ConvertNullToNullString] DOMString defaultValue;
    2525        attribute [Reflect=checked] boolean defaultChecked;
     26        attribute [Reflect] DOMString dirName;
    2627        readonly attribute HTMLFormElement form;
    2728        attribute [Reflect, URL] DOMString formAction;
  • trunk/Source/WebCore/html/HTMLTextAreaElement.cpp

    r99821 r100965  
    174174    const String& text = (m_wrap == HardWrap) ? valueWithHardLineBreaks() : value();
    175175    encoding.appendData(name(), text);
    176     return true;
     176
     177    const AtomicString& dirnameAttrValue = fastGetAttribute(dirnameAttr);
     178    if (!dirnameAttrValue.isNull())
     179        encoding.appendData(dirnameAttrValue, directionForFormData());
     180    return true;   
    177181}
    178182
  • trunk/Source/WebCore/html/HTMLTextAreaElement.idl

    r100805 r100965  
    2727        readonly attribute ValidityState validity;
    2828        attribute long cols;
     29        attribute [Reflect] DOMString dirName;
    2930        attribute [Reflect] boolean disabled;
    3031        attribute [Reflect] boolean autofocus;
  • trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp

    r99821 r100965  
    571571}
    572572
     573static const Element* parentHTMLElement(const Element* element)
     574{
     575    while (element) {
     576        element = element->parentElement();
     577        if (element && element->isHTMLElement())
     578            return element;
     579    }
     580    return 0;
     581}
     582
     583String HTMLTextFormControlElement::directionForFormData() const
     584{
     585    for (const Element* element = this; element; element = parentHTMLElement(element)) {
     586        const AtomicString& dirAttributeValue = element->fastGetAttribute(dirAttr);
     587        if (dirAttributeValue.isNull())
     588            continue;
     589
     590        if (equalIgnoringCase(dirAttributeValue, "rtl") || equalIgnoringCase(dirAttributeValue, "ltr"))
     591            return dirAttributeValue;
     592
     593        if (equalIgnoringCase(dirAttributeValue, "auto")) {
     594            bool isAuto;
     595            TextDirection textDirection = static_cast<const HTMLElement*>(element)->directionalityIfhasDirAutoAttribute(isAuto);
     596            return textDirection == RTL ? "rtl" : "ltr";
     597        }
     598    }
     599
     600    return "ltr";
     601}
     602
    573603} // namespace Webcore
  • trunk/Source/WebCore/html/HTMLTextFormControlElement.h

    r99821 r100965  
    8080    String innerTextValue() const;
    8181
     82    String directionForFormData() const;
     83
    8284protected:
    8385    HTMLTextFormControlElement(const QualifiedName&, Document*, HTMLFormElement*);
  • trunk/Source/WebCore/html/TextFieldInputType.cpp

    r99821 r100965  
    3434
    3535#include "BeforeTextInsertedEvent.h"
     36#include "FormDataList.h"
    3637#include "Frame.h"
    3738#include "HTMLInputElement.h"
     39#include "HTMLNames.h"
    3840#include "KeyboardEvent.h"
    3941#include "Page.h"
     
    5052namespace WebCore {
    5153
     54using namespace HTMLNames;
     55
    5256TextFieldInputType::TextFieldInputType(HTMLInputElement* element)
    5357    : InputType(element)
     
    365369}
    366370
     371bool TextFieldInputType::appendFormData(FormDataList& list, bool multipart) const
     372{
     373    InputType::appendFormData(list, multipart);
     374    const AtomicString& dirnameAttrValue = element()->fastGetAttribute(dirnameAttr);
     375    if (!dirnameAttrValue.isNull())
     376        list.appendData(dirnameAttrValue, element()->directionForFormData());
     377    return true;
     378}
     379
    367380} // namespace WebCore
  • trunk/Source/WebCore/html/TextFieldInputType.h

    r99821 r100965  
    3636namespace WebCore {
    3737
     38class FormDataList;
    3839class SpinButtonElement;
    3940
     
    7879    virtual HTMLElement* placeholderElement() const;
    7980    virtual void updatePlaceholderText();
     81    virtual bool appendFormData(FormDataList&, bool multipart) const;
    8082
    8183    RefPtr<HTMLElement> m_container;
Note: See TracChangeset for help on using the changeset viewer.