Changeset 46869 in webkit


Ignore:
Timestamp:
Aug 6, 2009 4:45:37 PM (15 years ago)
Author:
abarth@webkit.org
Message:

2009-08-06 Michelangelo De Simone <micdesim@gmail.com>

Reviewed by Darin Adler.

https://bugs.webkit.org/show_bug.cgi?id=27455
Test suite for form controls' custom validation message.

  • fast/dom/domListEnumeration-expected.txt: Corrected
  • fast/dom/resources/domListEnumeration.js: Corrected
  • fast/forms/ValidityState-customError-001-expected.txt: Added.
  • fast/forms/ValidityState-customError-001.html: Added.
  • fast/forms/ValidityState-customError-002-expected.txt: Added.
  • fast/forms/ValidityState-customError-002.html: Added.
  • fast/forms/ValidityState-customError-003-expected.txt: Added.
  • fast/forms/ValidityState-customError-003.html: Added.
  • fast/forms/ValidityState-customError-004-expected.txt: Added.
  • fast/forms/ValidityState-customError-004.html: Added.

2009-08-06 Michelangelo De Simone <micdesim@gmail.com>

Reviewed by Darin Adler.

https://bugs.webkit.org/show_bug.cgi?id=27455
Support for a custom validation message in ValidityState and related
form controls.
http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#dom-cva-setcustomvalidity

Tests: fast/forms/ValidityState-customError-001.html

fast/forms/ValidityState-customError-002.html
fast/forms/ValidityState-customError-003.html
fast/forms/ValidityState-customError-004.html

  • html/HTMLButtonElement.idl: setCustomValidity DOM method
  • html/HTMLFieldSetElement.idl: ditto
  • html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::setCustomValidity): ditto
  • html/HTMLFormControlElement.h: (WebCore::HTMLFormControlElement::valueMissing): moved down
  • html/HTMLInputElement.idl: ditto
  • html/HTMLSelectElement.idl: ditto
  • html/HTMLTextAreaElement.idl:
  • html/ValidityState.h: (WebCore::ValidityState::setCustomErrorMessage): method to set custom validation message (WebCore::ValidityState::customError): validation flag
Location:
trunk
Files:
8 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r46861 r46869  
     12009-08-06  Michelangelo De Simone  <micdesim@gmail.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=27455
     6        Test suite for form controls' custom validation message.
     7
     8        * fast/dom/domListEnumeration-expected.txt: Corrected
     9        * fast/dom/resources/domListEnumeration.js: Corrected
     10        * fast/forms/ValidityState-customError-001-expected.txt: Added.
     11        * fast/forms/ValidityState-customError-001.html: Added.
     12        * fast/forms/ValidityState-customError-002-expected.txt: Added.
     13        * fast/forms/ValidityState-customError-002.html: Added.
     14        * fast/forms/ValidityState-customError-003-expected.txt: Added.
     15        * fast/forms/ValidityState-customError-003.html: Added.
     16        * fast/forms/ValidityState-customError-004-expected.txt: Added.
     17        * fast/forms/ValidityState-customError-004.html: Added.
     18
    1192009-08-06  Ryosuke Niwa  <rniwa@webkit.org>
    220
  • trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt

    r45888 r46869  
    4242
    4343[object HTMLSelectElement]
    44 PASS resultArray.length is 137
     44PASS resultArray.length is 138
    4545PASS resultArray[0].i is '0'
    4646PASS resultArray[0].item is document.getElementsByTagName('option')[0]
  • trunk/LayoutTests/fast/dom/resources/domListEnumeration.js

    r45888 r46869  
    142142var htmlSelectElement = document.getElementsByTagName('select')[0];
    143143resultArray = iterateList(htmlSelectElement);
    144 shouldBe("resultArray.length", "137");
     144shouldBe("resultArray.length", "138");
    145145shouldBe("resultArray[0].i", "'0'");
    146146shouldBe("resultArray[0].item", "document.getElementsByTagName('option')[0]");
  • trunk/WebCore/ChangeLog

    r46868 r46869  
     12009-08-06  Michelangelo De Simone  <micdesim@gmail.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=27455
     6        Support for a custom validation message in ValidityState and related
     7        form controls.
     8        http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#dom-cva-setcustomvalidity
     9
     10        Tests: fast/forms/ValidityState-customError-001.html
     11               fast/forms/ValidityState-customError-002.html
     12               fast/forms/ValidityState-customError-003.html
     13               fast/forms/ValidityState-customError-004.html
     14
     15        * html/HTMLButtonElement.idl: setCustomValidity DOM method
     16        * html/HTMLFieldSetElement.idl: ditto
     17        * html/HTMLFormControlElement.cpp:
     18        (WebCore::HTMLFormControlElement::setCustomValidity): ditto
     19        * html/HTMLFormControlElement.h:
     20        (WebCore::HTMLFormControlElement::valueMissing): moved down
     21        * html/HTMLInputElement.idl: ditto
     22        * html/HTMLSelectElement.idl: ditto
     23        * html/HTMLTextAreaElement.idl:
     24        * html/ValidityState.h:
     25        (WebCore::ValidityState::setCustomErrorMessage): method to set custom
     26        validation message
     27        (WebCore::ValidityState::customError): validation flag
     28
    1292009-08-06  Mark Rowe  <mrowe@apple.com>
    230
  • trunk/WebCore/html/HTMLButtonElement.idl

    r45888 r46869  
    3737                 attribute  [ConvertNullToNullString] DOMString            value;
    3838        readonly attribute boolean               willValidate;
     39        void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error);
    3940        void click();
    4041    };
  • trunk/WebCore/html/HTMLFieldSetElement.idl

    r45888 r46869  
    3030#endif
    3131        readonly attribute boolean         willValidate;
     32        void     setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error);
    3233    };
    3334
  • trunk/WebCore/html/HTMLFormControlElement.cpp

    r46062 r46869  
    263263    return form() && name().length() && !disabled() && !isReadOnlyFormControl();
    264264}
     265
     266void HTMLFormControlElement::setCustomValidity(const String& error)
     267{
     268    validity()->setCustomErrorMessage(error);
     269}
    265270   
    266271void HTMLFormControlElement::dispatchFocusEvent()
  • trunk/WebCore/html/HTMLFormControlElement.h

    r46423 r46869  
    7878    void setRequired(bool);
    7979
    80     virtual bool valueMissing() const { return false; }
    81 
    8280    virtual void recalcStyle(StyleChange);
    8381
     
    105103
    106104    virtual bool willValidate() const;
     105    void setCustomValidity(const String&);
    107106
     107    virtual bool valueMissing() const { return false; }
    108108    virtual bool patternMismatch() const { return false; }
    109109
  • trunk/WebCore/html/HTMLInputElement.idl

    r46423 r46869  
    5757                 attribute [ConvertNullToNullString] DOMString value;
    5858        readonly attribute boolean         willValidate;
     59        void               setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error);
    5960        void               select();
    6061        void               click();
  • trunk/WebCore/html/HTMLSelectElement.idl

    r45888 r46869  
    4646#endif
    4747        readonly attribute boolean         willValidate;
     48        void               setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error);
    4849
    4950        // Modified in DOM Level 2:
  • trunk/WebCore/html/HTMLTextAreaElement.idl

    r46062 r46869  
    4545
    4646        readonly attribute boolean         willValidate;
     47        void     setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error);
    4748
    4849       // WinIE & FireFox extension:
  • trunk/WebCore/html/ValidityState.h

    r46423 r46869  
    3939        HTMLFormControlElement* control() const { return m_control; }
    4040
     41        void setCustomErrorMessage(const String& message) { m_customErrorMessage = message; }
     42
    4143        bool valueMissing() { return control()->valueMissing(); }
    4244        bool typeMismatch() { return false; }
     
    4648        bool rangeOverflow() { return false; }
    4749        bool stepMismatch() { return false; }
    48         bool customError() { return false; }
     50        bool customError() { return !m_customErrorMessage.isEmpty(); }
    4951        bool valid();
    5052
     
    5254        ValidityState(HTMLFormControlElement*);
    5355        HTMLFormControlElement* m_control;
     56        String m_customErrorMessage;
    5457    };
    5558
Note: See TracChangeset for help on using the changeset viewer.