Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1584)

Unified Diff: third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp

Issue 2201293002: FIELDSET element should not check inner controls in checkValidity(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/checkValidity-001-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp b/third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp
index 1192c3f47c8f3eaa3b4396c400d0106a7185dc30..15ef8c2b7a7b15a0a89f63eff0d9b7c614d74207 100644
--- a/third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp
@@ -462,6 +462,13 @@ void HTMLFormControlElement::setNeedsWillValidateCheck()
return;
m_willValidateInitialized = true;
m_willValidate = newWillValidate;
+ // Needs to force setNeedsValidityCheck() to invalidate validity state of
+ // FORM/FIELDSET. If this element updates willValidate twice and
+ // isValidElement() is not called between them, the second call of this
+ // function still has m_validityIsDirty==true, which means
+ // setNeedsValidityCheck() doesn't invalidate validity state of
+ // FORM/FIELDSET.
+ m_validityIsDirty = false;
setNeedsValidityCheck();
// No need to trigger style recalculation here because
// setNeedsValidityCheck() does it in the right away. This relies on
@@ -531,6 +538,8 @@ ValidationMessageClient* HTMLFormControlElement::validationMessageClient() const
bool HTMLFormControlElement::checkValidity(HeapVector<Member<HTMLFormControlElement>>* unhandledInvalidControls, CheckValidityEventBehavior eventBehavior)
{
+ if (!willValidate())
+ return true;
if (isValidElement())
return true;
if (eventBehavior != CheckValidityDispatchInvalidEvent)
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/checkValidity-001-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698