2010-12-09  Dai Mikurube  <dmikurube@google.com>

        Reviewed by Kent Tamura.

        Implement "required" attribute for select tags
        https://bugs.webkit.org/show_bug.cgi?id=50380

        Added tests for require attributes, valueMissing and vadility check for select elements.

        * fast/forms/ValidityState-valueMissing-001-expected.txt:
        * fast/forms/ValidityState-valueMissing-001.html:
        * fast/forms/ValidityState-valueMissing-002-expected.txt:
        * fast/forms/ValidityState-valueMissing-002.html:
        * fast/forms/ValidityState-valueMissing-003-expected.txt:
        * fast/forms/ValidityState-valueMissing-003.html:
        * fast/forms/checkValidity-002-expected.txt:
        * fast/forms/checkValidity-002.html:
        * fast/forms/required-attribute-001-expected.txt:
        * fast/forms/required-attribute-001.html:
        * fast/forms/required-attribute-002-expected.txt:
        * fast/forms/required-attribute-002.html:
        * fast/forms/resources/select-live-pseudo-selectors.js: Added.
        (makeInvalid):
        (appendOption):
        (backgroundOf):
        * fast/forms/script-tests/validationMessage.js:
        * fast/forms/select-live-pseudo-selectors-expected.txt: Added.
        * fast/forms/select-live-pseudo-selectors.html: Added.
        * fast/forms/validationMessage-expected.txt:
        * platform/mac/fast/objc/dom-html-select-live-pseudo-selectors.html: Added.
        * platform/mac/fast/objc/dom-html-select-live-pseudo-selectors-expected.txt: Added.
2010-12-09  Dai Mikurube  <dmikurube@google.com>

        Reviewed by Kent Tamura.

        Implement "required" attribute for select tags
        https://bugs.webkit.org/show_bug.cgi?id=50380

        Test: fast/forms/select-live-pseudo-selectors.html
              platform/mac/fast/objc/dom-html-select-live-pseudo-selectors.html

        * dom/SelectElement.cpp:
        (WebCore::SelectElement::updateValidity): Added. It's a pure virtual function which is prepared so that HTMLSelectElement::updateValidity() calls HTMLSelectElement::setNeedsValidityCheck().
        (WebCore::SelectElement::parseMultipleAttribute): Added calling updateValidity().
        * html/HTMLSelectElement.cpp:
        (WebCore::HTMLSelectElement::deselectItems): Added calling setNeedsValidityCheck() to enable validity check after changing. No tests for this change since this function is not exposed to JavaScript or any web interface.
        (WebCore::HTMLSelectElement::setSelectedIndex): Added calling setNeedsValidityCheck().
        (WebCore::HTMLSelectElement::setSelectedIndexByUser): Added calling setNeedsValidityCheck().
        (WebCore::HTMLSelectElement::valueMissing): Added valueMissing() to check if selecting an invalid or placeholder label option when a valid required attribute is specified.
        (WebCore::HTMLSelectElement::listBoxSelectItem): Added calling setNeedsValidityCheck(). No tests for this change since it is not called yet. Look at the bug 36177 and the changeset 56180.
        (WebCore::HTMLSelectElement::add): Added calling setNeedsValidityCheck().
        (WebCore::HTMLSelectElement::remove): Added calling setNeedsValidityCheck().
        (WebCore::HTMLSelectElement::restoreFormControlState): Added calling setNeedsValidityCheck().
        (WebCore::HTMLSelectElement::parseMappedAttribute): Added calling setNeedsValidityCheck().
        (WebCore::HTMLSelectElement::selectAll): Added calling setNeedsValidityCheck().
        (WebCore::HTMLSelectElement::reset): Added calling setNeedsValidityCheck().
        (WebCore::HTMLSelectElement::updateListBoxSelection): Added calling setNeedsValidityCheck(). Skipped adding tests for this change as too complicated..
        (WebCore::HTMLSelectElement::setLength): Added calling setNeedsValidityCheck().
        (WebCore::HTMLSelectElement::isRequiredFormControl): Check if required or not.
        (WebCore::HTMLSelectElement::hasPlaceholderLabelOption): Added.
        (WebCore::HTMLSelectElement::updateValidity): Added. It calls setNeedsValidityCheck().
        * html/HTMLSelectElement.h:
        (WebCore::HTMLSelectElement::isOptionalFormControl): Check if not required.
        * html/HTMLSelectElement.idl: Added a required attribute to select elements..
        * html/ValidityState.cpp:
        (WebCore::ValidityState::valueMissing): Added valueMissing check for select elements into the global checker, ValidityState::valueMissing().
        * wml/WMLSelectElement.h:
        (WebCore::WMLSelectElement::updateValidity): Added. It does nothing.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73606 268f45cc-cd09-0410-ab3c-d52691b4dbfc
28 files changed