Title: [272247] trunk/Source/WebCore
Revision
272247
Author
[email protected]
Date
2021-02-02 17:32:57 -0800 (Tue, 02 Feb 2021)

Log Message

Rename HTMLFormControlElement::setNeedsWillValidateCheck() to updateWillValidateAndValidity()
https://bugs.webkit.org/show_bug.cgi?id=221297

Reviewed by Wenson Hsieh.

Simple rename: setNeedsWillValidateCheck() eagerly updated both 'willValid' and 'isValid'
so call it what it is.

* html/HTMLButtonElement.cpp:
(WebCore::HTMLButtonElement::parseAttribute):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::disabledStateChanged):
(WebCore::HTMLFormControlElement::readOnlyStateChanged):
(WebCore::HTMLFormControlElement::insertedIntoAncestor):
(WebCore::HTMLFormControlElement::removedFromAncestor):
(WebCore::HTMLFormControlElement::willValidate const):
(WebCore::HTMLFormControlElement::updateWillValidateAndValidity):
(WebCore::HTMLFormControlElement::setNeedsWillValidateCheck): Deleted.
* html/HTMLFormControlElement.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::updateType):
(WebCore::HTMLInputElement::initializeInputType):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (272246 => 272247)


--- trunk/Source/WebCore/ChangeLog	2021-02-03 00:26:34 UTC (rev 272246)
+++ trunk/Source/WebCore/ChangeLog	2021-02-03 01:32:57 UTC (rev 272247)
@@ -1,3 +1,28 @@
+2021-02-02  Simon Fraser  <[email protected]>
+
+        Rename HTMLFormControlElement::setNeedsWillValidateCheck() to updateWillValidateAndValidity()
+        https://bugs.webkit.org/show_bug.cgi?id=221297
+
+        Reviewed by Wenson Hsieh.
+
+        Simple rename: setNeedsWillValidateCheck() eagerly updated both 'willValid' and 'isValid'
+        so call it what it is.
+
+        * html/HTMLButtonElement.cpp:
+        (WebCore::HTMLButtonElement::parseAttribute):
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElement::disabledStateChanged):
+        (WebCore::HTMLFormControlElement::readOnlyStateChanged):
+        (WebCore::HTMLFormControlElement::insertedIntoAncestor):
+        (WebCore::HTMLFormControlElement::removedFromAncestor):
+        (WebCore::HTMLFormControlElement::willValidate const):
+        (WebCore::HTMLFormControlElement::updateWillValidateAndValidity):
+        (WebCore::HTMLFormControlElement::setNeedsWillValidateCheck): Deleted.
+        * html/HTMLFormControlElement.h:
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::updateType):
+        (WebCore::HTMLInputElement::initializeInputType):
+
 2021-02-02  Per Arne Vollan  <[email protected]>
 
         Register for power notifications in the UI process

Modified: trunk/Source/WebCore/html/HTMLButtonElement.cpp (272246 => 272247)


--- trunk/Source/WebCore/html/HTMLButtonElement.cpp	2021-02-03 00:26:34 UTC (rev 272246)
+++ trunk/Source/WebCore/html/HTMLButtonElement.cpp	2021-02-03 01:32:57 UTC (rev 272247)
@@ -117,7 +117,7 @@
         else
             m_type = SUBMIT;
         if (oldType != m_type) {
-            setNeedsWillValidateCheck();
+            updateWillValidateAndValidity();
             if (form() && (oldType == SUBMIT || m_type == SUBMIT))
                 form()->resetDefaultButton();
         }

Modified: trunk/Source/WebCore/html/HTMLFormControlElement.cpp (272246 => 272247)


--- trunk/Source/WebCore/html/HTMLFormControlElement.cpp	2021-02-03 00:26:34 UTC (rev 272246)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.cpp	2021-02-03 01:32:57 UTC (rev 272247)
@@ -180,7 +180,7 @@
 
 void HTMLFormControlElement::disabledStateChanged()
 {
-    setNeedsWillValidateCheck();
+    updateWillValidateAndValidity();
     invalidateStyleForSubtree();
     if (renderer() && renderer()->style().hasAppearance())
         renderer()->theme().stateChanged(*renderer(), ControlStates::EnabledState);
@@ -188,7 +188,7 @@
 
 void HTMLFormControlElement::readOnlyStateChanged()
 {
-    setNeedsWillValidateCheck();
+    updateWillValidateAndValidity();
     invalidateStyleForSubtree();
 }
 
@@ -293,7 +293,7 @@
     if (m_dataListAncestorState == NotInsideDataList)
         m_dataListAncestorState = Unknown;
 
-    setNeedsWillValidateCheck();
+    updateWillValidateAndValidity();
     if (willValidate() && !isValidFormControlElement())
         addInvalidElementToAncestorFromInsertionPoint(*this, &parentOfInsertedTree);
     if (document().hasDisabledFieldsetElement())
@@ -329,7 +329,7 @@
         removeInvalidElementToAncestorFromInsertionPoint(*this, &oldParentOfRemovedTree);
 
     if (wasInsideDataList)
-        setNeedsWillValidateCheck();
+        updateWillValidateAndValidity();
 }
 
 void HTMLFormControlElement::setChangedSinceLastFormControlChangeEvent(bool changed)
@@ -431,7 +431,7 @@
         if (m_willValidate != newWillValidate)
             m_willValidate = newWillValidate;
     } else {
-        // If the following assertion fails, setNeedsWillValidateCheck() is not
+        // If the following assertion fails, updateWillValidateAndValidity() is not
         // called correctly when something which changes computeWillValidate() result
         // is updated.
         ASSERT(m_willValidate == computeWillValidate());
@@ -439,7 +439,7 @@
     return m_willValidate;
 }
 
-void HTMLFormControlElement::setNeedsWillValidateCheck()
+void HTMLFormControlElement::updateWillValidateAndValidity()
 {
     // We need to recalculate willValidate immediately because willValidate change can causes style change.
     bool newWillValidate = computeWillValidate();

Modified: trunk/Source/WebCore/html/HTMLFormControlElement.h (272246 => 272247)


--- trunk/Source/WebCore/html/HTMLFormControlElement.h	2021-02-03 00:26:34 UTC (rev 272246)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.h	2021-02-03 01:32:57 UTC (rev 272247)
@@ -153,7 +153,7 @@
     void dispatchBlurEvent(RefPtr<Element>&& newFocusedElement) override;
 
     // This must be called any time the result of willValidate() has changed.
-    void setNeedsWillValidateCheck();
+    void updateWillValidateAndValidity();
     virtual bool computeWillValidate() const;
 
     bool validationMessageShadowTreeContains(const Node&) const;

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (272246 => 272247)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2021-02-03 00:26:34 UTC (rev 272246)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2021-02-03 01:32:57 UTC (rev 272247)
@@ -563,7 +563,7 @@
     m_inputType = WTFMove(newType);
     m_inputType->createShadowSubtreeAndUpdateInnerTextElementEditability(m_parsingInProgress ? ChildChange::Source::Parser : ChildChange::Source::API, isInnerTextElementEditable());
 
-    setNeedsWillValidateCheck();
+    updateWillValidateAndValidity();
 
     if (!didStoreValue && willStoreValue)
         m_valueIfDirty = sanitizeValue(attributeWithoutSynchronization(valueAttr));
@@ -711,7 +711,7 @@
     if (type.isNull()) {
         m_inputType = InputType::createText(*this);
         ensureUserAgentShadowRoot();
-        setNeedsWillValidateCheck();
+        updateWillValidateAndValidity();
         return;
     }
 
@@ -718,7 +718,7 @@
     m_hasType = true;
     m_inputType = InputType::create(*this, type);
     ensureUserAgentShadowRoot();
-    setNeedsWillValidateCheck();
+    updateWillValidateAndValidity();
     registerForSuspensionCallbackIfNeeded();
     runPostTypeUpdateTasks();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to