Title: [286413] trunk
Revision
286413
Author
[email protected]
Date
2021-12-01 22:05:10 -0800 (Wed, 01 Dec 2021)

Log Message

validity.valueMissing should not rely on element's disabled state for inputs of type radio/file/checkbox
https://bugs.webkit.org/show_bug.cgi?id=233735

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline WPT tests now that more checks are passing.

* web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt:
* web-platform-tests/html/semantics/forms/constraints/radio-valueMissing-expected.txt:

Source/WebCore:

validity.valueMissing should not rely on element's disabled state for inputs of type radio/file/checkbox:
- https://html.spec.whatwg.org/multipage/input.html#radio-button-state-(type=radio):suffering-from-being-missing
- https://html.spec.whatwg.org/multipage/input.html#file-upload-state-(type=file):suffering-from-being-missing
- https://html.spec.whatwg.org/multipage/input.html#checkbox-state-(type=checkbox):suffering-from-being-missing

This was causing us to fail a few WPT tests that are passing in both Blink and Gecko.

* html/BaseDateAndTimeInputType.cpp:
(WebCore::BaseDateAndTimeInputType::valueMissing const):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::valueMissing const):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::valueMissing const):

LayoutTests:

Rebaseline WPT tests now that more checks are passing.

* platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (286412 => 286413)


--- trunk/LayoutTests/ChangeLog	2021-12-02 05:03:13 UTC (rev 286412)
+++ trunk/LayoutTests/ChangeLog	2021-12-02 06:05:10 UTC (rev 286413)
@@ -1,3 +1,14 @@
+2021-12-01  Chris Dumez  <[email protected]>
+
+        validity.valueMissing should not rely on element's disabled state for inputs of type radio/file/checkbox
+        https://bugs.webkit.org/show_bug.cgi?id=233735
+
+        Reviewed by Darin Adler.
+
+        Rebaseline WPT tests now that more checks are passing.
+
+        * platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt:
+
 2021-12-01  Arcady Goldmints-Orlov  <[email protected]>
 
         [GLIB] Update test expectations and baselines. Unreviewed test gardening.

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (286412 => 286413)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-12-02 05:03:13 UTC (rev 286412)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-12-02 06:05:10 UTC (rev 286413)
@@ -1,3 +1,15 @@
+2021-12-01  Chris Dumez  <[email protected]>
+
+        validity.valueMissing should not rely on element's disabled state for inputs of type radio/file/checkbox
+        https://bugs.webkit.org/show_bug.cgi?id=233735
+
+        Reviewed by Darin Adler.
+
+        Rebaseline WPT tests now that more checks are passing.
+
+        * web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt:
+        * web-platform-tests/html/semantics/forms/constraints/radio-valueMissing-expected.txt:
+
 2021-12-01  Antti Koivisto  <[email protected]>
 
         [:has() pseudo-class] Sibling combinator invalidation

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt (286412 => 286413)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt	2021-12-02 05:03:13 UTC (rev 286412)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt	2021-12-02 06:05:10 UTC (rev 286413)
@@ -35,13 +35,13 @@
 PASS [INPUT in NUMBER status] The value attribute is empty string
 PASS [INPUT in CHECKBOX status] The required attribute is not set
 PASS [INPUT in CHECKBOX status] The checked attribute is true
-FAIL [INPUT in CHECKBOX status] The checked attribute is false assert_true: The validity.valueMissing should be true, when control is disabled. expected true got false
+PASS [INPUT in CHECKBOX status] The checked attribute is false
 PASS [INPUT in RADIO status] The required attribute is not set
 PASS [INPUT in RADIO status] The checked attribute is true
 FAIL [INPUT in RADIO status] The checked attribute is false assert_true: The validity.valueMissing should be true. expected true got false
 PASS [INPUT in RADIO status] The checked attribute is false and the name attribute is empty
 PASS [INPUT in FILE status] The required attribute is not set
-FAIL [INPUT in FILE status] The Files attribute is null assert_true: The validity.valueMissing should be true, when control is disabled. expected true got false
+PASS [INPUT in FILE status] The Files attribute is null
 PASS [select]  The required attribute is not set
 PASS [select]  Selected the option with value equals to 1
 FAIL [select]  Selected the option with value equals to empty assert_true: The validity.valueMissing should be true, when control is disabled. expected true got false

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/radio-valueMissing-expected.txt (286412 => 286413)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/radio-valueMissing-expected.txt	2021-12-02 05:03:13 UTC (rev 286412)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/radio-valueMissing-expected.txt	2021-12-02 06:05:10 UTC (rev 286413)
@@ -3,6 +3,6 @@
 PASS One of the radios is required, but none checked
 PASS One of the radios is required and checked
 PASS One of the radios is required and another one is checked
-FAIL One of the radios is required and disabled, but none checked assert_true: The radio10.validity.valueMissing should be true expected true got false
+PASS One of the radios is required and disabled, but none checked
 PASS One of the radios is required, checked and disabled
 

Modified: trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt (286412 => 286413)


--- trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt	2021-12-02 05:03:13 UTC (rev 286412)
+++ trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt	2021-12-02 06:05:10 UTC (rev 286413)
@@ -81,13 +81,13 @@
 PASS [INPUT in NUMBER status] The value attribute is empty string
 PASS [INPUT in CHECKBOX status] The required attribute is not set
 PASS [INPUT in CHECKBOX status] The checked attribute is true
-FAIL [INPUT in CHECKBOX status] The checked attribute is false assert_true: The validity.valueMissing should be true, when control is disabled. expected true got false
+PASS [INPUT in CHECKBOX status] The checked attribute is false
 PASS [INPUT in RADIO status] The required attribute is not set
 PASS [INPUT in RADIO status] The checked attribute is true
 FAIL [INPUT in RADIO status] The checked attribute is false assert_true: The validity.valueMissing should be true. expected true got false
 PASS [INPUT in RADIO status] The checked attribute is false and the name attribute is empty
 PASS [INPUT in FILE status] The required attribute is not set
-FAIL [INPUT in FILE status] The Files attribute is null assert_true: The validity.valueMissing should be true, when control is disabled. expected true got false
+PASS [INPUT in FILE status] The Files attribute is null
 PASS [select]  The required attribute is not set
 PASS [select]  Selected the option with value equals to 1
 FAIL [select]  Selected the option with value equals to empty assert_true: The validity.valueMissing should be true, when control is disabled. expected true got false

Modified: trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt (286412 => 286413)


--- trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt	2021-12-02 05:03:13 UTC (rev 286412)
+++ trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt	2021-12-02 06:05:10 UTC (rev 286413)
@@ -81,13 +81,13 @@
 PASS [INPUT in NUMBER status] The value attribute is empty string
 PASS [INPUT in CHECKBOX status] The required attribute is not set
 PASS [INPUT in CHECKBOX status] The checked attribute is true
-FAIL [INPUT in CHECKBOX status] The checked attribute is false assert_true: The validity.valueMissing should be true, when control is disabled. expected true got false
+PASS [INPUT in CHECKBOX status] The checked attribute is false
 PASS [INPUT in RADIO status] The required attribute is not set
 PASS [INPUT in RADIO status] The checked attribute is true
 FAIL [INPUT in RADIO status] The checked attribute is false assert_true: The validity.valueMissing should be true. expected true got false
 PASS [INPUT in RADIO status] The checked attribute is false and the name attribute is empty
 PASS [INPUT in FILE status] The required attribute is not set
-FAIL [INPUT in FILE status] The Files attribute is null assert_true: The validity.valueMissing should be true, when control is disabled. expected true got false
+PASS [INPUT in FILE status] The Files attribute is null
 PASS [select]  The required attribute is not set
 PASS [select]  Selected the option with value equals to 1
 FAIL [select]  Selected the option with value equals to empty assert_true: The validity.valueMissing should be true, when control is disabled. expected true got false

Modified: trunk/Source/WebCore/ChangeLog (286412 => 286413)


--- trunk/Source/WebCore/ChangeLog	2021-12-02 05:03:13 UTC (rev 286412)
+++ trunk/Source/WebCore/ChangeLog	2021-12-02 06:05:10 UTC (rev 286413)
@@ -1,3 +1,24 @@
+2021-12-01  Chris Dumez  <[email protected]>
+
+        validity.valueMissing should not rely on element's disabled state for inputs of type radio/file/checkbox
+        https://bugs.webkit.org/show_bug.cgi?id=233735
+
+        Reviewed by Darin Adler.
+
+        validity.valueMissing should not rely on element's disabled state for inputs of type radio/file/checkbox:
+        - https://html.spec.whatwg.org/multipage/input.html#radio-button-state-(type=radio):suffering-from-being-missing
+        - https://html.spec.whatwg.org/multipage/input.html#file-upload-state-(type=file):suffering-from-being-missing
+        - https://html.spec.whatwg.org/multipage/input.html#checkbox-state-(type=checkbox):suffering-from-being-missing
+
+        This was causing us to fail a few WPT tests that are passing in both Blink and Gecko.
+
+        * html/BaseDateAndTimeInputType.cpp:
+        (WebCore::BaseDateAndTimeInputType::valueMissing const):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::valueMissing const):
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::valueMissing const):
+
 2021-12-01  Simon Fraser  <[email protected]>
 
         Scrolling complex websites can stutter: scrolling thread frame can fail to process wheel events

Modified: trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp (286412 => 286413)


--- trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp	2021-12-02 05:03:13 UTC (rev 286412)
+++ trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp	2021-12-02 06:05:10 UTC (rev 286413)
@@ -242,7 +242,7 @@
 bool BaseDateAndTimeInputType::valueMissing(const String& value) const
 {
     ASSERT(element());
-    return element()->isRequired() && value.isEmpty();
+    return !element()->isDisabledOrReadOnly() && element()->isRequired() && value.isEmpty();
 }
 
 bool BaseDateAndTimeInputType::isKeyboardFocusable(KeyboardEvent*) const

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (286412 => 286413)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2021-12-02 05:03:13 UTC (rev 286412)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2021-12-02 06:05:10 UTC (rev 286413)
@@ -301,7 +301,7 @@
 
 bool HTMLInputElement::valueMissing() const
 {
-    return willValidate() && m_inputType->valueMissing(value());
+    return m_inputType->valueMissing(value());
 }
 
 bool HTMLInputElement::hasBadInput() const

Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (286412 => 286413)


--- trunk/Source/WebCore/html/TextFieldInputType.cpp	2021-12-02 05:03:13 UTC (rev 286412)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp	2021-12-02 06:05:10 UTC (rev 286413)
@@ -120,7 +120,7 @@
 bool TextFieldInputType::valueMissing(const String& value) const
 {
     ASSERT(element());
-    return element()->isRequired() && value.isEmpty();
+    return !element()->isDisabledOrReadOnly() && element()->isRequired() && value.isEmpty();
 }
 
 void TextFieldInputType::setValue(const String& sanitizedValue, bool valueChanged, TextFieldEventBehavior eventBehavior)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to