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

Unified Diff: Source/core/html/HTMLFormElement.cpp

Issue 17076013: Implementing blink side of 'invalid' AutocompleteErrorEvent#reason (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: . Created 7 years, 6 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 | « Source/core/html/HTMLFormElement.h ('k') | public/web/WebFormElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLFormElement.cpp
diff --git a/Source/core/html/HTMLFormElement.cpp b/Source/core/html/HTMLFormElement.cpp
index 633d4b9a15736ef180928eba707270253b8b0752..95b0dd84705dc524b5ab17d24dd0356efb86a822 100644
--- a/Source/core/html/HTMLFormElement.cpp
+++ b/Source/core/html/HTMLFormElement.cpp
@@ -224,7 +224,7 @@ bool HTMLFormElement::validateInteractively(Event* event)
}
Vector<RefPtr<FormAssociatedElement> > unhandledInvalidControls;
- if (!checkInvalidControlsAndCollectUnhandled(unhandledInvalidControls))
+ if (!checkInvalidControlsAndCollectUnhandled(&unhandledInvalidControls))
return true;
// Because the form has invalid controls, we abort the form submission and
// show a validation message on a focusable form control.
@@ -636,10 +636,15 @@ HTMLFormControlElement* HTMLFormElement::defaultButton() const
bool HTMLFormElement::checkValidity()
{
Vector<RefPtr<FormAssociatedElement> > controls;
- return !checkInvalidControlsAndCollectUnhandled(controls);
+ return !checkInvalidControlsAndCollectUnhandled(&controls);
}
-bool HTMLFormElement::checkInvalidControlsAndCollectUnhandled(Vector<RefPtr<FormAssociatedElement> >& unhandledInvalidControls)
+bool HTMLFormElement::checkValidityWithoutDispatchingEvents()
+{
+ return !checkInvalidControlsAndCollectUnhandled(0, HTMLFormControlElement::CheckValidityDispatchEventsNone);
+}
+
+bool HTMLFormElement::checkInvalidControlsAndCollectUnhandled(Vector<RefPtr<FormAssociatedElement> >* unhandledInvalidControls, HTMLFormControlElement::CheckValidityDispatchEvents dispatchEvents)
{
RefPtr<HTMLFormElement> protector(this);
// Copy m_associatedElements because event handlers called from
@@ -652,7 +657,7 @@ bool HTMLFormElement::checkInvalidControlsAndCollectUnhandled(Vector<RefPtr<Form
for (unsigned i = 0; i < elements.size(); ++i) {
if (elements[i]->form() == this && elements[i]->isFormControlElement()) {
HTMLFormControlElement* control = static_cast<HTMLFormControlElement*>(elements[i].get());
- if (!control->checkValidity(&unhandledInvalidControls) && control->form() == this)
+ if (!control->checkValidity(unhandledInvalidControls, dispatchEvents) && control->form() == this)
hasInvalidControls = true;
}
}
« no previous file with comments | « Source/core/html/HTMLFormElement.h ('k') | public/web/WebFormElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698