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

Unified Diff: Source/core/html/HTMLFormControlElement.h

Issue 672163002: Fix bug where form/fieldset :valid/:invalid won't be recalculated upon control's willValidate change Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add layout tests to catch the problem Created 6 years, 2 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
Index: Source/core/html/HTMLFormControlElement.h
diff --git a/Source/core/html/HTMLFormControlElement.h b/Source/core/html/HTMLFormControlElement.h
index 33f94439400cef0307050237ae35b88e057cfdb1..5257c2f8fba7f95bf5a3f54d5c8481187047aa30 100644
--- a/Source/core/html/HTMLFormControlElement.h
+++ b/Source/core/html/HTMLFormControlElement.h
@@ -34,6 +34,7 @@ class HTMLFormElement;
class ValidationMessageClient;
enum CheckValidityEventBehavior { CheckValidityDispatchNoEvent, CheckValidityDispatchInvalidEvent };
+enum ValidityChangeAction { ElementAddition, ElementRemoval, ElementModification };
keishi 2014/10/24 10:25:49 nit: It might be just me. The name * Action gives
Bartek Nowierski 2014/10/24 10:48:30 Reason seems like a much better option. Done.
// HTMLFormControlElement is the default implementation of FormAssociatedElement,
// and form-associated element implementations should use HTMLFormControlElement
@@ -127,8 +128,7 @@ protected:
virtual void attach(const AttachContext& = AttachContext()) override;
virtual InsertionNotificationRequest insertedInto(ContainerNode*) override;
virtual void removedFrom(ContainerNode*) override;
- virtual void willChangeForm() override;
- virtual void didChangeForm() override;
+ virtual void didChangeForm(HTMLFormElement* oldForm) override;
virtual void didMoveToNewDocument(Document& oldDocument) override;
virtual bool supportsFocus() const override;
@@ -162,13 +162,15 @@ private:
virtual bool isDefaultButtonForForm() const override final;
virtual bool isValidElement() override;
virtual bool matchesValidityPseudoClasses() const override;
+ // Refreshes willValidate cache. Returns true if anything changed.
+ bool refreshWillValidate();
void updateAncestorDisabledState() const;
bool isValidationMessageVisible() const;
ValidationMessageClient* validationMessageClient() const;
// Requests validity recalc for the form owner, if one exists.
- void formOwnerSetNeedsValidityCheck();
+ void formOwnerSetNeedsValidityCheck(ValidityChangeAction, bool isValid);
// Requests validity recalc for all ancestor fieldsets, if exist.
void fieldSetAncestorsSetNeedsValidityCheck(Node*);

Powered by Google App Engine
This is Rietveld 408576698