Vector<RefPtr<HTMLFormControlElement> > unhandledInvalidControls;
collectUnhandledInvalidControls(unhandledInvalidControls);
if (unhandledInvalidControls.isEmpty())
Vector<RefPtr<HTMLFormControlElement> > unhandledInvalidControls;
collectUnhandledInvalidControls(unhandledInvalidControls);
if (unhandledInvalidControls.isEmpty())
// If the form has invalid controls, abort submission.
RefPtr<HTMLFormElement> protector(this);
// If the form has invalid controls, abort submission.
RefPtr<HTMLFormElement> protector(this);
for (unsigned i = 0; i < unhandledInvalidControls.size(); ++i) {
HTMLFormControlElement* unhandled = unhandledInvalidControls[i].get();
if (unhandled->isFocusable() && unhandled->inDocument()) {
for (unsigned i = 0; i < unhandledInvalidControls.size(); ++i) {
HTMLFormControlElement* unhandled = unhandledInvalidControls[i].get();
if (unhandled->isFocusable() && unhandled->inDocument()) {
// moved to another document.
if (unhandled->isFocusable() && unhandled->inDocument() && originalDocument == unhandled->document()) {
unhandled->focus();
// moved to another document.
if (unhandled->isFocusable() && unhandled->inDocument() && originalDocument == unhandled->document()) {
unhandled->focus();