Unreviewed, revert r286855 as it caused form submission issues
https://bugs.webkit.org/show_bug.cgi?id=235645
<rdar://88020080>


LayoutTests/imported/w3c:

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

Source/WebCore:

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setChecked):
(WebCore::HTMLInputElement::didChangeForm):
(WebCore::HTMLInputElement::insertedIntoAncestor):
(WebCore::HTMLInputElement::removedFromAncestor):
(WebCore::HTMLInputElement::checkedRadioButtonForGroup const):
* html/InputType.h:
(WebCore::InputType::willUpdateCheckedness): Deleted.
* html/RadioInputType.cpp:
(WebCore::RadioInputType::valueMissing const):
(WebCore::RadioInputType::willUpdateCheckedness): Deleted.
* html/RadioInputType.h:

LayoutTests:

* fast/forms/radio/ValidityState-valueMissing-radio-expected.txt:
* fast/forms/radio/ValidityState-valueMissing-radio.html:
* fast/forms/radio/radio-live-validation-style-expected.txt:
* fast/forms/radio/radio-live-validation-style.html:
* platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt:
* platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt:
* platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt:
* platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@288631 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 3d5dee1..322ccf3 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
+2022-01-26  Chris Dumez  <cdumez@apple.com>
+
+        Unreviewed, revert r286855 as it caused form submission issues
+        https://bugs.webkit.org/show_bug.cgi?id=235645
+        <rdar://88020080>
+
+        * fast/forms/radio/ValidityState-valueMissing-radio-expected.txt:
+        * fast/forms/radio/ValidityState-valueMissing-radio.html:
+        * fast/forms/radio/radio-live-validation-style-expected.txt:
+        * fast/forms/radio/radio-live-validation-style.html:
+        * platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt:
+        * platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt:
+        * platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt:
+        * platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt:
+
 2022-01-26  Antti Koivisto  <antti@apple.com>
 
         [CSS Container Queries] container-type property should establish containment for 'size' and 'inline-size' values
diff --git a/LayoutTests/fast/forms/radio/ValidityState-valueMissing-radio-expected.txt b/LayoutTests/fast/forms/radio/ValidityState-valueMissing-radio-expected.txt
index 01e8096..4d90133 100644
--- a/LayoutTests/fast/forms/radio/ValidityState-valueMissing-radio-expected.txt
+++ b/LayoutTests/fast/forms/radio/ValidityState-valueMissing-radio-expected.txt
@@ -40,11 +40,11 @@
 PASS inputs[2].validity.valueMissing is false
 
 Not in a radio button group
-PASS requiredButton.validity.valueMissing is true
+PASS requiredButton.validity.valueMissing is false
 PASS requiredButton.validity.valueMissing is true
 PASS button.validity.valueMissing is true
 PASS button.validity.valueMissing is false
-PASS requiredButton.validity.valueMissing is true
+PASS requiredButton.validity.valueMissing is false
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/LayoutTests/fast/forms/radio/ValidityState-valueMissing-radio.html b/LayoutTests/fast/forms/radio/ValidityState-valueMissing-radio.html
index 1316c7c..9048c69 100644
--- a/LayoutTests/fast/forms/radio/ValidityState-valueMissing-radio.html
+++ b/LayoutTests/fast/forms/radio/ValidityState-valueMissing-radio.html
@@ -71,7 +71,7 @@
 requiredButton.type = 'radio';
 requiredButton.name = 'victim';
 requiredButton.required = true;
-shouldBeTrue('requiredButton.validity.valueMissing');
+shouldBeFalse('requiredButton.validity.valueMissing');
 
 parent.innerHTML = '<input name=victim type=radio required><input name=victim type=radio>';
 requiredButton = document.getElementsByName('victim')[0];
@@ -81,7 +81,7 @@
 parent.removeChild(button);
 shouldBeFalse('button.validity.valueMissing');
 parent.removeChild(requiredButton);
-shouldBeTrue('requiredButton.validity.valueMissing');
+shouldBeFalse('requiredButton.validity.valueMissing');
 
 </script>
 <script src="../../../resources/js-test-post.js"></script>
diff --git a/LayoutTests/fast/forms/radio/radio-live-validation-style-expected.txt b/LayoutTests/fast/forms/radio/radio-live-validation-style-expected.txt
index 745cb78..e1528e5 100644
--- a/LayoutTests/fast/forms/radio/radio-live-validation-style-expected.txt
+++ b/LayoutTests/fast/forms/radio/radio-live-validation-style-expected.txt
@@ -7,7 +7,7 @@
 PASS backgroundOf($("radio1")) is validColor
 PASS parent.removeChild($("radio2")); backgroundOf($("radio1")) is invalidColor
 PASS $("radio1").remove(); radio2.matches(":valid") is false
-PASS radio2.remove(); radio2.matches(":valid") is false
+PASS radio2.remove(); radio2.matches(":valid") is true
 
 Removing a checked radio button from a required radio button group by name attribute change:
 PASS $("radio2").name = "group2"; backgroundOf($("radio1")) is invalidColor
diff --git a/LayoutTests/fast/forms/radio/radio-live-validation-style.html b/LayoutTests/fast/forms/radio/radio-live-validation-style.html
index 1ca4ea7..62962ce 100644
--- a/LayoutTests/fast/forms/radio/radio-live-validation-style.html
+++ b/LayoutTests/fast/forms/radio/radio-live-validation-style.html
@@ -35,7 +35,7 @@
     '<input type=radio name=group1 required id=radio3>';
 var radio2 = $('radio2');
 shouldBeFalse('$("radio1").remove(); radio2.matches(":valid")');
-shouldBeFalse('radio2.remove(); radio2.matches(":valid")');
+shouldBeTrue('radio2.remove(); radio2.matches(":valid")');
 debug('');
 
 debug('Removing a checked radio button from a required radio button group by name attribute change:');
diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog
index b171727..9cbc8a6 100644
--- a/LayoutTests/imported/w3c/ChangeLog
+++ b/LayoutTests/imported/w3c/ChangeLog
@@ -1,3 +1,13 @@
+2022-01-26  Chris Dumez  <cdumez@apple.com>
+
+        Unreviewed, revert r286855 as it caused form submission issues
+        https://bugs.webkit.org/show_bug.cgi?id=235645
+        <rdar://88020080>
+
+        * web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt:
+        * web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt:
+        * web-platform-tests/html/semantics/forms/the-input-element/radio-expected.txt:
+
 2022-01-26  Antti Koivisto  <antti@apple.com>
 
         [CSS Container Queries] container-type property should establish containment for 'size' and 'inline-size' values
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt
index 5f56225..42299c8 100644
--- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt
+++ b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt
@@ -23,7 +23,7 @@
 PASS [INPUT in NUMBER status] validity.valid must be false if validity.stepMismatch is true
 PASS [INPUT in NUMBER status] validity.valid must be false if validity.valueMissing is true
 PASS [INPUT in CHECKBOX status] validity.valid must be false if validity.valueMissing is true
-PASS [INPUT in RADIO status] validity.valid must be false if validity.valueMissing is true
+FAIL [INPUT in RADIO status] validity.valid must be false if validity.valueMissing is true assert_false: The validity.valid should be false. expected false got true
 PASS [INPUT in FILE status] validity.valid must be false if validity.valueMissing is true
 PASS [select]  validity.valid must be false if validity.valueMissing is true
 PASS [textarea]  validity.valid must be false if validity.valueMissing is true
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt
index 70d14ef..73570f4 100644
--- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt
+++ b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt
@@ -38,7 +38,7 @@
 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
-PASS [INPUT in RADIO status] The checked attribute is false
+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
 PASS [INPUT in FILE status] The Files attribute is null
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/radio-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/radio-expected.txt
index 3b51e15..4759b04 100644
--- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/radio-expected.txt
+++ b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/radio-expected.txt
@@ -7,8 +7,8 @@
 PASS radio inputs with non-ASCII name attributes belong to the same radio button group
 PASS changing the name of a radio input element and setting its checkedness to true makes all the other elements' checkedness in the same radio button group be set to false
 PASS moving radio input element out of or into a form should still work as expected
-PASS Radio buttons in an orphan tree should make a group
-PASS Radio buttons in different groups (because they have different form owners or no form owner) do not affect each other's checkedness
+FAIL Radio buttons in an orphan tree should make a group assert_false: The second radio should be unchecked after setting checked expected false got true
+FAIL Radio buttons in different groups (because they have different form owners or no form owner) do not affect each other's checkedness assert_false: radio5 should be unchecked expected false got true
 PASS Radio buttons in different groups (because they are not in the same tree) do not affect each other's checkedness
 PASS Radio buttons in different groups (because they have different name attribute values, or no name attribute) do not affect each other's checkedness
 
diff --git a/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt b/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt
index bc1ba2b..af7357d 100644
--- a/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt
+++ b/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt
@@ -38,7 +38,7 @@
 PASS [INPUT in NUMBER status] validity.valid must be false if validity.stepMismatch is true
 PASS [INPUT in NUMBER status] validity.valid must be false if validity.valueMissing is true
 PASS [INPUT in CHECKBOX status] validity.valid must be false if validity.valueMissing is true
-PASS [INPUT in RADIO status] validity.valid must be false if validity.valueMissing is true
+FAIL [INPUT in RADIO status] validity.valid must be false if validity.valueMissing is true assert_false: The validity.valid should be false. expected false got true
 PASS [INPUT in FILE status] validity.valid must be false if validity.valueMissing is true
 PASS [select]  validity.valid must be false if validity.valueMissing is true
 PASS [textarea]  validity.valid must be false if validity.valueMissing is true
diff --git a/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt b/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt
index a61dba2..8cd074d 100644
--- a/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt
+++ b/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt
@@ -84,7 +84,7 @@
 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
-PASS [INPUT in RADIO status] The checked attribute is false
+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
 PASS [INPUT in FILE status] The Files attribute is null
diff --git a/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt b/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt
index bc1ba2b..af7357d 100644
--- a/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt
+++ b/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt
@@ -38,7 +38,7 @@
 PASS [INPUT in NUMBER status] validity.valid must be false if validity.stepMismatch is true
 PASS [INPUT in NUMBER status] validity.valid must be false if validity.valueMissing is true
 PASS [INPUT in CHECKBOX status] validity.valid must be false if validity.valueMissing is true
-PASS [INPUT in RADIO status] validity.valid must be false if validity.valueMissing is true
+FAIL [INPUT in RADIO status] validity.valid must be false if validity.valueMissing is true assert_false: The validity.valid should be false. expected false got true
 PASS [INPUT in FILE status] validity.valid must be false if validity.valueMissing is true
 PASS [select]  validity.valid must be false if validity.valueMissing is true
 PASS [textarea]  validity.valid must be false if validity.valueMissing is true
diff --git a/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt b/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt
index a61dba2..8cd074d 100644
--- a/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt
+++ b/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt
@@ -84,7 +84,7 @@
 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
-PASS [INPUT in RADIO status] The checked attribute is false
+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
 PASS [INPUT in FILE status] The Files attribute is null
diff --git a/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt b/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt
index bc1ba2b..af7357d 100644
--- a/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt
+++ b/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt
@@ -38,7 +38,7 @@
 PASS [INPUT in NUMBER status] validity.valid must be false if validity.stepMismatch is true
 PASS [INPUT in NUMBER status] validity.valid must be false if validity.valueMissing is true
 PASS [INPUT in CHECKBOX status] validity.valid must be false if validity.valueMissing is true
-PASS [INPUT in RADIO status] validity.valid must be false if validity.valueMissing is true
+FAIL [INPUT in RADIO status] validity.valid must be false if validity.valueMissing is true assert_false: The validity.valid should be false. expected false got true
 PASS [INPUT in FILE status] validity.valid must be false if validity.valueMissing is true
 PASS [select]  validity.valid must be false if validity.valueMissing is true
 PASS [textarea]  validity.valid must be false if validity.valueMissing is true
diff --git a/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt b/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt
index a61dba2..8cd074d 100644
--- a/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt
+++ b/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt
@@ -84,7 +84,7 @@
 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
-PASS [INPUT in RADIO status] The checked attribute is false
+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
 PASS [INPUT in FILE status] The Files attribute is null
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index ffc3c83..5199626 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2022-01-26  Chris Dumez  <cdumez@apple.com>
+
+        Unreviewed, revert r286855 as it caused form submission issues
+        https://bugs.webkit.org/show_bug.cgi?id=235645
+        <rdar://88020080>
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::setChecked):
+        (WebCore::HTMLInputElement::didChangeForm):
+        (WebCore::HTMLInputElement::insertedIntoAncestor):
+        (WebCore::HTMLInputElement::removedFromAncestor):
+        (WebCore::HTMLInputElement::checkedRadioButtonForGroup const):
+        * html/InputType.h:
+        (WebCore::InputType::willUpdateCheckedness): Deleted.
+        * html/RadioInputType.cpp:
+        (WebCore::RadioInputType::valueMissing const):
+        (WebCore::RadioInputType::willUpdateCheckedness): Deleted.
+        * html/RadioInputType.h:
+
 2022-01-26  Antti Koivisto  <antti@apple.com>
 
         [CSS Container Queries] container-type property should establish containment for 'size' and 'inline-size' values
diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp
index 1ed3c21..845f352 100644
--- a/Source/WebCore/html/HTMLInputElement.cpp
+++ b/Source/WebCore/html/HTMLInputElement.cpp
@@ -980,8 +980,6 @@
     if (checked() == isChecked)
         return;
 
-    m_inputType->willUpdateCheckedness(isChecked);
-
     Style::PseudoClassChangeInvalidation checkedInvalidation(*this, CSSSelector::PseudoClassChecked, isChecked);
 
     m_dirtyCheckednessFlag = true;
@@ -1578,14 +1576,12 @@
 
 void HTMLInputElement::didChangeForm()
 {
-    addToRadioButtonGroup();
     HTMLTextFormControlElement::didChangeForm();
+    addToRadioButtonGroup();
 }
 
 Node::InsertedIntoAncestorResult HTMLInputElement::insertedIntoAncestor(InsertionType insertionType, ContainerNode& parentOfInsertedTree)
 {
-    if (isRadioButton())
-        updateValidity();
     HTMLTextFormControlElement::insertedIntoAncestor(insertionType, parentOfInsertedTree);
 #if ENABLE(DATALIST_ELEMENT)
     resetListAttributeTargetObserver();
@@ -1612,8 +1608,6 @@
         removeFromRadioButtonGroup();
     HTMLTextFormControlElement::removedFromAncestor(removalType, oldParentOfRemovedTree);
     ASSERT(!isConnected());
-    if (removalType.disconnectedFromDocument && !form() && isRadioButton())
-        updateValidity();
 #if ENABLE(DATALIST_ELEMENT)
     resetListAttributeTargetObserver();
 #endif
@@ -1962,21 +1956,8 @@
 
 RefPtr<HTMLInputElement> HTMLInputElement::checkedRadioButtonForGroup() const
 {
-    if (checked())
-        return const_cast<HTMLInputElement*>(this);
-
-    auto& name = this->name();
     if (RadioButtonGroups* buttons = radioButtonGroups())
-        return buttons->checkedButtonForGroup(name);
-
-    if (name.isEmpty())
-        return nullptr;
-
-    // The input is not managed by a RadioButtonGroups, we'll need to traverse the tree.
-    for (auto& descendant : descendantsOfType<HTMLInputElement>(rootNode())) {
-        if (descendant.checked() && descendant.isRadioButton() && !descendant.form() && name == descendant.name())
-            return &descendant;
-    }
+        return buttons->checkedButtonForGroup(name());
     return nullptr;
 }
 
diff --git a/Source/WebCore/html/InputType.h b/Source/WebCore/html/InputType.h
index 1579ca3..e0eaa81 100644
--- a/Source/WebCore/html/InputType.h
+++ b/Source/WebCore/html/InputType.h
@@ -363,7 +363,6 @@
 #if ENABLE(DATALIST_ELEMENT)
     virtual bool isFocusingWithDataListDropdown() const { return false; };
 #endif
-    virtual void willUpdateCheckedness(bool /*nowChecked*/) { }
 
     // Parses the specified string for the type, and return
     // the Decimal value for the parsing result if the parsing
diff --git a/Source/WebCore/html/RadioInputType.cpp b/Source/WebCore/html/RadioInputType.cpp
index 11dd19f..7d22548 100644
--- a/Source/WebCore/html/RadioInputType.cpp
+++ b/Source/WebCore/html/RadioInputType.cpp
@@ -46,35 +46,7 @@
 bool RadioInputType::valueMissing(const String&) const
 {
     ASSERT(element());
-    auto& name = element()->name();
-    if (auto* buttons = element()->radioButtonGroups())
-        return !buttons->checkedButtonForGroup(name) && buttons->isInRequiredGroup(*element());
-
-    if (name.isEmpty())
-        return false;
-
-    bool isRequired = false;
-    for (auto& input : inclusiveDescendantsOfType<HTMLInputElement>(element()->rootNode())) {
-        if (!input.isRadioButton() || input.form() || input.name() != name)
-            continue;
-        if (input.checked())
-            return false;
-        if (input.isRequired())
-            isRequired = true;
-    }
-    return isRequired;
-}
-
-void RadioInputType::willUpdateCheckedness(bool nowChecked)
-{
-    if (!nowChecked)
-        return;
-    if (element()->radioButtonGroups()) {
-        // Buttons in RadioButtonGroups are handled in HTMLInputElement::setChecked().
-        return;
-    }
-    if (auto input = element()->checkedRadioButtonForGroup())
-        input->setChecked(false);
+    return element()->isInRequiredRadioButtonGroup() && !element()->checkedRadioButtonForGroup();
 }
 
 String RadioInputType::valueMissingText() const
diff --git a/Source/WebCore/html/RadioInputType.h b/Source/WebCore/html/RadioInputType.h
index 35440e4..40cea8f 100644
--- a/Source/WebCore/html/RadioInputType.h
+++ b/Source/WebCore/html/RadioInputType.h
@@ -52,7 +52,6 @@
     void willDispatchClick(InputElementClickState&) final;
     void didDispatchClick(Event&, const InputElementClickState&) final;
     bool matchesIndeterminatePseudoClass() const final;
-    void willUpdateCheckedness(bool nowChecked) final;
 };
 
 } // namespace WebCore