Changeset 73686 in webkit


Ignore:
Timestamp:
Dec 9, 2010 9:59:39 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-12-09 Kenichi Ishibashi <bashi@google.com>

Reviewed by Kent Tamura.

Improve validation API support of <object> and <keygen>
https://bugs.webkit.org/show_bug.cgi?id=50663

Adds tests for validation API for <object>.
Tests for <output> and <keygen> are also added.

  • fast/dom/plugin-attributes-enumeration-expected.txt: Updated.
  • fast/forms/ValidityState-001-expected.txt: Updated.
  • fast/forms/ValidityState-001.html: Updated.
  • fast/forms/checkValidity-001-expected.txt: Updated.
  • fast/forms/checkValidity-001.html: Updated.
  • fast/forms/script-tests/setCustomValidity-existence.js: Added.
  • fast/forms/script-tests/validationMessage.js: Updated.
  • fast/forms/script-tests/willvalidate.js: Updated.
  • fast/forms/setCustomValidity-existence-expected.txt: Added.
  • fast/forms/setCustomValidity-existence.html: Added.
  • fast/forms/validationMessage-expected.txt: Updated.
  • fast/forms/willvalidate-expected.txt: Updated.

2010-12-09 Kenichi Ishibashi <bashi@google.com>

Reviewed by Kent Tamura.

Improve validation API support of <object> and <keygen>
https://bugs.webkit.org/show_bug.cgi?id=50663

Adds validation API to HTMLObjectElement class.
Makes HTMLKeygenElement::willValidate() return false.

Test: fast/forms/setCustomValidity-existence.html

  • html/HTMLKeygenElement.h: (WebCore::HTMLKeygenElement::willValidate): Added.
  • html/HTMLObjectElement.h: (WebCore::HTMLObjectElement::validationMessage): Added. (WebCore::HTMLObjectElement::checkValidity): Added. (WebCore::HTMLObjectElement::setCustomValidity): Added.
  • html/HTMLObjectElement.idl: Added validation API properties.
Location:
trunk
Files:
3 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r73685 r73686  
     12010-12-09  Kenichi Ishibashi  <bashi@google.com>
     2
     3        Reviewed by Kent Tamura.
     4
     5        Improve validation API support of <object> and <keygen>
     6        https://bugs.webkit.org/show_bug.cgi?id=50663
     7
     8        Adds tests for validation API for <object>.
     9        Tests for <output> and <keygen> are also added.
     10
     11        * fast/dom/plugin-attributes-enumeration-expected.txt: Updated.
     12        * fast/forms/ValidityState-001-expected.txt: Updated.
     13        * fast/forms/ValidityState-001.html: Updated.
     14        * fast/forms/checkValidity-001-expected.txt: Updated.
     15        * fast/forms/checkValidity-001.html: Updated.
     16        * fast/forms/script-tests/setCustomValidity-existence.js: Added.
     17        * fast/forms/script-tests/validationMessage.js: Updated.
     18        * fast/forms/script-tests/willvalidate.js: Updated.
     19        * fast/forms/setCustomValidity-existence-expected.txt: Added.
     20        * fast/forms/setCustomValidity-existence.html: Added.
     21        * fast/forms/validationMessage-expected.txt: Updated.
     22        * fast/forms/willvalidate-expected.txt: Updated.
     23
    1242010-12-09  Sadrul Habib Chowdhury  <sadrul@chromium.org>
    225
  • trunk/LayoutTests/fast/dom/plugin-attributes-enumeration-expected.txt

    r47444 r73686  
    1919type
    2020useMap
     21validationMessage
     22validity
    2123vspace
    2224willValidate
  • trunk/LayoutTests/fast/forms/ValidityState-001-expected.txt

    r46099 r73686  
    11Each form control in this document exposes a validity attribute that returns a live instance of ValidityState.
    22
    3    
    4 SUCCESS
    5 SUCCESS
    6 SUCCESS
    7 SUCCESS
    8 SUCCESS
     3     
     4Test for FIELDSET: SUCCESS
     5Test for SELECT: SUCCESS
     6Test for INPUT: SUCCESS
     7Test for TEXTAREA: SUCCESS
     8Test for BUTTON: SUCCESS
     9Test for OUTPUT: SUCCESS
     10Test for OBJECT: SUCCESS
     11Test for KEYGEN: SUCCESS
  • trunk/LayoutTests/fast/forms/ValidityState-001.html

    r46099 r73686  
    2323
    2424        for (i = 0; i < v.length; i++)
    25             log((v[i].validity && countAttr(v[i].validity) == 9) ? "SUCCESS" : "FAILURE");
     25            log('Test for ' + v[i].tagName + ': ' + ((v[i].validity && countAttr(v[i].validity) == 9) ? "SUCCESS" : "FAILURE"));
    2626    }
    2727</script>
     
    3535<textarea name="victim"></textarea>
    3636<button name="victim"></button>
     37<output name="victim"></output>
     38<object name="victim"></object>
     39<keygen name="victim"></keygen>
    3740</fieldset>
    3841<hr>
  • trunk/LayoutTests/fast/forms/checkValidity-001-expected.txt

    r47649 r73686  
    44
    55
    6  lorem ipsum 
    7 PASS v[i].checkValidity() is true
    8 PASS v[i].checkValidity() is true
    9 PASS v[i].checkValidity() is true
    10 PASS v[i].checkValidity() is true
    11 PASS v[i].checkValidity() is true
     6 lorem ipsum     
     7PASS document.getElementsByTagName("fieldset")[0].checkValidity() is true
     8PASS document.getElementsByTagName("input")[0].checkValidity() is true
     9PASS document.getElementsByTagName("button")[0].checkValidity() is true
     10PASS document.getElementsByTagName("select")[0].checkValidity() is true
     11PASS document.getElementsByTagName("textarea")[0].checkValidity() is true
     12PASS document.getElementsByTagName("output")[0].checkValidity() is true
     13PASS document.getElementsByTagName("object")[0].checkValidity() is true
     14PASS document.getElementsByTagName("keygen")[0].checkValidity() is true
    1215PASS successfullyParsed is true
    1316
  • trunk/LayoutTests/fast/forms/checkValidity-001.html

    r47649 r73686  
    1313<select name="victim"></select>
    1414<textarea name="victim"></textarea>
     15<output name="victim"></output>
     16<object name="victim"></object>
     17<keygen name="victim"></keygen>
    1518</form>
    1619<div id="console"></div>
     
    1821description("This test checks if checkValidity() returns correctly a true (meaning no error) result.");
    1922
    20 v = document.getElementsByName("victim");
    21 for (i = 0; i < v.length; i++)
    22     shouldBe("v[i].checkValidity()", "true");
     23shouldBe('document.getElementsByTagName("fieldset")[0].checkValidity()', 'true');
     24shouldBe('document.getElementsByTagName("input")[0].checkValidity()', 'true');
     25shouldBe('document.getElementsByTagName("button")[0].checkValidity()', 'true');
     26shouldBe('document.getElementsByTagName("select")[0].checkValidity()', 'true');
     27shouldBe('document.getElementsByTagName("textarea")[0].checkValidity()', 'true');
     28shouldBe('document.getElementsByTagName("output")[0].checkValidity()', 'true');
     29shouldBe('document.getElementsByTagName("object")[0].checkValidity()', 'true');
     30shouldBe('document.getElementsByTagName("keygen")[0].checkValidity()', 'true');
    2331
    2432var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/validationMessage.js

    r73606 r73686  
    6363shouldBe("happySelect.validationMessage", "''");
    6464
     65// Output elements can't be validated
     66var happyOutput = document.createElement("output");
     67happySelect.name = "output";
     68form.appendChild(happyOutput);
     69shouldBe("happyOutput.validationMessage", "''");
     70
     71// Object elements can't be validated
     72var happyObject = document.createElement("object");
     73happySelect.name = "object";
     74form.appendChild(happyObject);
     75shouldBe("happyObject.validationMessage", "''");
     76
     77// Keygen controls can't be validated
     78var happyKeygen = document.createElement("keygen");
     79happySelect.name = "keygen";
     80form.appendChild(happyKeygen);
     81shouldBe("happyKeygen.validationMessage", "''");
     82
    6583var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/willvalidate.js

    r59647 r73686  
    1111    + '<button name="victim">'
    1212    + '<select name="victim"></select>'
     13    + '<output name="victim"></output>'
     14    + '<object name="victim"></object>'
     15    + '<keygen name="victim">'
    1316    + '</form>';
    1417var controls = document.getElementsByName('victim');
     
    6669shouldBeTrue('document.getElementsByTagName("textarea")[0].willValidate');
    6770
     71debug('');
     72debug('Output element');
     73parent.innerHTML = '<form><output></output></form>';
     74shouldBeFalse('document.getElementsByTagName("output")[0].willValidate');
     75
     76debug('');
     77debug('Object element');
     78parent.innerHTML = '<form><object></object></form>';
     79shouldBeFalse('document.getElementsByTagName("object")[0].willValidate');
     80
     81debug('');
     82debug('Keygen element');
     83parent.innerHTML = '<form><keygen></form>';
     84shouldBeFalse('document.getElementsByTagName("keygen")[0].willValidate');
     85
    6886var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/validationMessage-expected.txt

    r73606 r73686  
    1313PASS happyFieldset.validationMessage is ''
    1414PASS happySelect.validationMessage is ''
     15PASS happyOutput.validationMessage is ''
     16PASS happyObject.validationMessage is ''
     17PASS happyKeygen.validationMessage is ''
    1518PASS successfullyParsed is true
    1619
  • trunk/LayoutTests/fast/forms/willvalidate-expected.txt

    r59647 r73686  
    55
    66Existence of .willValidate
     7PASS typeof controls[i].willValidate is "boolean"
     8PASS typeof controls[i].willValidate is "boolean"
     9PASS typeof controls[i].willValidate is "boolean"
    710PASS typeof controls[i].willValidate is "boolean"
    811PASS typeof controls[i].willValidate is "boolean"
     
    3740Textarea element
    3841PASS document.getElementsByTagName("textarea")[0].willValidate is true
     42
     43Output element
     44PASS document.getElementsByTagName("output")[0].willValidate is false
     45
     46Object element
     47PASS document.getElementsByTagName("object")[0].willValidate is false
     48
     49Keygen element
     50PASS document.getElementsByTagName("keygen")[0].willValidate is false
    3951PASS successfullyParsed is true
    4052
  • trunk/WebCore/ChangeLog

    r73685 r73686  
     12010-12-09  Kenichi Ishibashi  <bashi@google.com>
     2
     3        Reviewed by Kent Tamura.
     4
     5        Improve validation API support of <object> and <keygen>
     6        https://bugs.webkit.org/show_bug.cgi?id=50663
     7
     8        Adds validation API to HTMLObjectElement class.
     9        Makes HTMLKeygenElement::willValidate() return false.
     10
     11        Test: fast/forms/setCustomValidity-existence.html
     12
     13        * html/HTMLKeygenElement.h:
     14        (WebCore::HTMLKeygenElement::willValidate): Added.
     15        * html/HTMLObjectElement.h:
     16        (WebCore::HTMLObjectElement::validationMessage): Added.
     17        (WebCore::HTMLObjectElement::checkValidity): Added.
     18        (WebCore::HTMLObjectElement::setCustomValidity): Added.
     19        * html/HTMLObjectElement.idl: Added validation API properties.
     20
    1212010-12-09  Sadrul Habib Chowdhury  <sadrul@chromium.org>
    222
  • trunk/WebCore/html/HTMLKeygenElement.h

    r72835 r73686  
    4040    virtual bool appendFormData(FormDataList&, bool);
    4141
     42    virtual bool willValidate() const { return false; }
    4243    virtual bool isOptionalFormControl() const { return false; }
    4344
  • trunk/WebCore/html/HTMLObjectElement.h

    r73430 r73686  
    5353    virtual bool appendFormData(FormDataList&, bool);
    5454
     55    // Implementations of constraint validation API.
     56    // Note that the object elements are always barred from constraint validation.
     57    String validationMessage() { return String(); }
     58    bool checkValidity() { return true; }
     59    void setCustomValidity(const String&) { }
     60
    5561    virtual void attributeChanged(Attribute*, bool preserveDecls = false);
    5662
  • trunk/WebCore/html/HTMLObjectElement.idl

    r66327 r73686  
    4444        attribute [Reflect] DOMString width;
    4545        readonly attribute boolean willValidate;
     46        readonly attribute ValidityState validity;
     47        readonly attribute DOMString validationMessage;
     48        boolean checkValidity();
     49        void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error);
    4650
    4751        // Introduced in DOM Level 2:
Note: See TracChangeset for help on using the changeset viewer.