| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
| 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 HeapVector<Member<HTMLFormControlElement>> unhandledInvalidControls; | 261 HeapVector<Member<HTMLFormControlElement>> unhandledInvalidControls; |
| 262 if (!checkInvalidControlsAndCollectUnhandled(&unhandledInvalidControls, Chec
kValidityDispatchInvalidEvent)) | 262 if (!checkInvalidControlsAndCollectUnhandled(&unhandledInvalidControls, Chec
kValidityDispatchInvalidEvent)) |
| 263 return true; | 263 return true; |
| 264 UseCounter::count(document(), UseCounter::FormValidationAbortedSubmission); | 264 UseCounter::count(document(), UseCounter::FormValidationAbortedSubmission); |
| 265 // Because the form has invalid controls, we abort the form submission and | 265 // Because the form has invalid controls, we abort the form submission and |
| 266 // show a validation message on a focusable form control. | 266 // show a validation message on a focusable form control. |
| 267 | 267 |
| 268 // Needs to update layout now because we'd like to call isFocusable(), which | 268 // Needs to update layout now because we'd like to call isFocusable(), which |
| 269 // has !layoutObject()->needsLayout() assertion. | 269 // has !layoutObject()->needsLayout() assertion. |
| 270 document().updateLayoutIgnorePendingStylesheets(); | 270 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 271 | 271 |
| 272 // Focus on the first focusable control and show a validation message. | 272 // Focus on the first focusable control and show a validation message. |
| 273 for (unsigned i = 0; i < unhandledInvalidControls.size(); ++i) { | 273 for (unsigned i = 0; i < unhandledInvalidControls.size(); ++i) { |
| 274 HTMLFormControlElement* unhandled = unhandledInvalidControls[i].get(); | 274 HTMLFormControlElement* unhandled = unhandledInvalidControls[i].get(); |
| 275 if (unhandled->isFocusable()) { | 275 if (unhandled->isFocusable()) { |
| 276 unhandled->showValidationMessage(); | 276 unhandled->showValidationMessage(); |
| 277 UseCounter::count(document(), UseCounter::FormValidationShowedMessag
e); | 277 UseCounter::count(document(), UseCounter::FormValidationShowedMessag
e); |
| 278 break; | 278 break; |
| 279 } | 279 } |
| 280 } | 280 } |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 { | 815 { |
| 816 for (const auto& control : associatedElements()) { | 816 for (const auto& control : associatedElements()) { |
| 817 if (!control->isFormControlElement()) | 817 if (!control->isFormControlElement()) |
| 818 continue; | 818 continue; |
| 819 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton()) | 819 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton()) |
| 820 toHTMLFormControlElement(control)->pseudoStateChanged(CSSSelector::P
seudoDefault); | 820 toHTMLFormControlElement(control)->pseudoStateChanged(CSSSelector::P
seudoDefault); |
| 821 } | 821 } |
| 822 } | 822 } |
| 823 | 823 |
| 824 } // namespace blink | 824 } // namespace blink |
| OLD | NEW |