| Index: Source/core/html/HTMLFormControlElement.cpp
|
| diff --git a/Source/core/html/HTMLFormControlElement.cpp b/Source/core/html/HTMLFormControlElement.cpp
|
| index e68ef591c249e14d48f2e2c46acd21bf7c96fe0b..75f2402d2c782128eb57e2c5c92b7f9adfe90112 100644
|
| --- a/Source/core/html/HTMLFormControlElement.cpp
|
| +++ b/Source/core/html/HTMLFormControlElement.cpp
|
| @@ -502,7 +502,7 @@ ValidationMessageClient* HTMLFormControlElement::validationMessageClient() const
|
| return &page->validationMessageClient();
|
| }
|
|
|
| -bool HTMLFormControlElement::checkValidity(WillBeHeapVector<RefPtrWillBeMember<FormAssociatedElement> >* unhandledInvalidControls, CheckValidityEventBehavior eventBehavior)
|
| +bool HTMLFormControlElement::checkValidity(WillBeHeapVector<RefPtrWillBeMember<HTMLFormControlElement> >* unhandledInvalidControls, CheckValidityEventBehavior eventBehavior)
|
| {
|
| if (!willValidate() || isValidElement())
|
| return true;
|
| @@ -517,6 +517,37 @@ bool HTMLFormControlElement::checkValidity(WillBeHeapVector<RefPtrWillBeMember<F
|
| return false;
|
| }
|
|
|
| +void HTMLFormControlElement::showValidationMessage()
|
| +{
|
| + scrollIntoViewIfNeeded(false);
|
| + RefPtrWillBeRawPtr<HTMLFormControlElement> protector(this);
|
| + focus();
|
| + updateVisibleValidationMessage();
|
| +}
|
| +
|
| +bool HTMLFormControlElement::reportValidity()
|
| +{
|
| + WillBeHeapVector<RefPtrWillBeMember<HTMLFormControlElement> > unhandledInvalidControls;
|
| + bool isValid = checkValidity(&unhandledInvalidControls, CheckValidityDispatchInvalidEvent);
|
| + if (isValid || unhandledInvalidControls.isEmpty())
|
| + return isValid;
|
| + ASSERT(unhandledInvalidControls.size() == 1);
|
| + ASSERT(unhandledInvalidControls[0].get() == this);
|
| + // Update layout now before calling isFocusable(), which has
|
| + // !renderer()->needsLayout() assertion.
|
| + document().updateLayoutIgnorePendingStylesheets();
|
| + if (isFocusable()) {
|
| + showValidationMessage();
|
| + return false;
|
| + }
|
| + if (document().frame()) {
|
| + String message("An invalid form control with name='%name' is not focusable.");
|
| + message.replace("%name", name());
|
| + document().addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMessageLevel, message));
|
| + }
|
| + return false;
|
| +}
|
| +
|
| bool HTMLFormControlElement::matchesValidityPseudoClasses() const
|
| {
|
| return willValidate();
|
|
|