mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-21 16:58:58 +00:00
LibWeb: Unify check_validity for form associated elements
This commit is contained in:
parent
44053ed3c2
commit
af88a43e9a
Notes:
github-actions[bot]
2025-08-29 18:29:05 +00:00
Author: https://github.com/tete17
Commit: af88a43e9a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6024
Reviewed-by: https://github.com/tcl3 ✅
12 changed files with 14 additions and 25 deletions
|
@ -244,6 +244,13 @@ bool FormAssociatedElement::report_validity()
|
||||||
return report_validity_steps();
|
return report_validity_steps();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-checkvalidity
|
||||||
|
bool FormAssociatedElement::check_validity()
|
||||||
|
{
|
||||||
|
// The checkValidity() method, when invoked, must run the check validity steps on this element.
|
||||||
|
return check_validity_steps();
|
||||||
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#check-validity-steps
|
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#check-validity-steps
|
||||||
bool FormAssociatedElement::check_validity_steps()
|
bool FormAssociatedElement::check_validity_steps()
|
||||||
{
|
{
|
||||||
|
|
|
@ -143,6 +143,9 @@ public:
|
||||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-reportvalidity
|
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-reportvalidity
|
||||||
bool report_validity();
|
bool report_validity();
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-checkvalidity
|
||||||
|
bool check_validity();
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-validity
|
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-validity
|
||||||
GC::Ref<ValidityState const> validity() const;
|
GC::Ref<ValidityState const> validity() const;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ interface HTMLButtonElement : HTMLElement {
|
||||||
readonly attribute boolean willValidate;
|
readonly attribute boolean willValidate;
|
||||||
readonly attribute ValidityState validity;
|
readonly attribute ValidityState validity;
|
||||||
[FIXME] readonly attribute DOMString validationMessage;
|
[FIXME] readonly attribute DOMString validationMessage;
|
||||||
[FIXME] boolean checkValidity();
|
boolean checkValidity();
|
||||||
boolean reportValidity();
|
boolean reportValidity();
|
||||||
undefined setCustomValidity(DOMString error);
|
undefined setCustomValidity(DOMString error);
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ interface HTMLFieldSetElement : HTMLElement {
|
||||||
readonly attribute boolean willValidate;
|
readonly attribute boolean willValidate;
|
||||||
[FIXME, SameObject] readonly attribute ValidityState validity;
|
[FIXME, SameObject] readonly attribute ValidityState validity;
|
||||||
[FIXME] readonly attribute DOMString validationMessage;
|
[FIXME] readonly attribute DOMString validationMessage;
|
||||||
[FIXME] boolean checkValidity();
|
boolean checkValidity();
|
||||||
boolean reportValidity();
|
boolean reportValidity();
|
||||||
undefined setCustomValidity(DOMString error);
|
undefined setCustomValidity(DOMString error);
|
||||||
};
|
};
|
||||||
|
|
|
@ -2920,12 +2920,6 @@ bool HTMLInputElement::will_validate()
|
||||||
return is_candidate_for_constraint_validation();
|
return is_candidate_for_constraint_validation();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-checkvalidity
|
|
||||||
WebIDL::ExceptionOr<bool> HTMLInputElement::check_validity()
|
|
||||||
{
|
|
||||||
return check_validity_steps();
|
|
||||||
}
|
|
||||||
|
|
||||||
Optional<ARIA::Role> HTMLInputElement::default_role() const
|
Optional<ARIA::Role> HTMLInputElement::default_role() const
|
||||||
{
|
{
|
||||||
// http://wpt.live/html-aam/roles-dynamic-switch.tentative.window.html "Disconnected <input type=checkbox switch>"
|
// http://wpt.live/html-aam/roles-dynamic-switch.tentative.window.html "Disconnected <input type=checkbox switch>"
|
||||||
|
|
|
@ -160,7 +160,6 @@ public:
|
||||||
WebIDL::ExceptionOr<void> step_down(WebIDL::Long n = 1);
|
WebIDL::ExceptionOr<void> step_down(WebIDL::Long n = 1);
|
||||||
|
|
||||||
bool will_validate();
|
bool will_validate();
|
||||||
WebIDL::ExceptionOr<bool> check_validity();
|
|
||||||
|
|
||||||
WebIDL::ExceptionOr<void> show_picker();
|
WebIDL::ExceptionOr<void> show_picker();
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ interface HTMLObjectElement : HTMLElement {
|
||||||
readonly attribute boolean willValidate;
|
readonly attribute boolean willValidate;
|
||||||
readonly attribute ValidityState validity;
|
readonly attribute ValidityState validity;
|
||||||
[FIXME] readonly attribute DOMString validationMessage;
|
[FIXME] readonly attribute DOMString validationMessage;
|
||||||
[FIXME] boolean checkValidity();
|
boolean checkValidity();
|
||||||
boolean reportValidity();
|
boolean reportValidity();
|
||||||
undefined setCustomValidity(DOMString error);
|
undefined setCustomValidity(DOMString error);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ interface HTMLOutputElement : HTMLElement {
|
||||||
readonly attribute boolean willValidate;
|
readonly attribute boolean willValidate;
|
||||||
readonly attribute ValidityState validity;
|
readonly attribute ValidityState validity;
|
||||||
[FIXME] readonly attribute DOMString validationMessage;
|
[FIXME] readonly attribute DOMString validationMessage;
|
||||||
[FIXME] boolean checkValidity();
|
boolean checkValidity();
|
||||||
boolean reportValidity();
|
boolean reportValidity();
|
||||||
undefined setCustomValidity(DOMString error);
|
undefined setCustomValidity(DOMString error);
|
||||||
|
|
||||||
|
|
|
@ -698,12 +698,6 @@ bool HTMLSelectElement::will_validate()
|
||||||
return is_candidate_for_constraint_validation();
|
return is_candidate_for_constraint_validation();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-checkvalidity
|
|
||||||
bool HTMLSelectElement::check_validity()
|
|
||||||
{
|
|
||||||
return check_validity_steps();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool HTMLSelectElement::is_focusable() const
|
bool HTMLSelectElement::is_focusable() const
|
||||||
{
|
{
|
||||||
return enabled();
|
return enabled();
|
||||||
|
|
|
@ -63,7 +63,6 @@ public:
|
||||||
Vector<GC::Root<HTMLOptionElement>> list_of_options() const;
|
Vector<GC::Root<HTMLOptionElement>> list_of_options() const;
|
||||||
|
|
||||||
bool will_validate();
|
bool will_validate();
|
||||||
bool check_validity();
|
|
||||||
|
|
||||||
// ^EventTarget
|
// ^EventTarget
|
||||||
// https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-select-element
|
// https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-select-element
|
||||||
|
|
|
@ -239,12 +239,6 @@ bool HTMLTextAreaElement::will_validate()
|
||||||
return is_candidate_for_constraint_validation();
|
return is_candidate_for_constraint_validation();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-checkvalidity
|
|
||||||
bool HTMLTextAreaElement::check_validity()
|
|
||||||
{
|
|
||||||
return check_validity_steps();
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-textarea-maxlength
|
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-textarea-maxlength
|
||||||
WebIDL::Long HTMLTextAreaElement::max_length() const
|
WebIDL::Long HTMLTextAreaElement::max_length() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -99,7 +99,6 @@ public:
|
||||||
u32 text_length() const;
|
u32 text_length() const;
|
||||||
|
|
||||||
bool will_validate();
|
bool will_validate();
|
||||||
bool check_validity();
|
|
||||||
|
|
||||||
WebIDL::Long max_length() const;
|
WebIDL::Long max_length() const;
|
||||||
WebIDL::ExceptionOr<void> set_max_length(WebIDL::Long);
|
WebIDL::ExceptionOr<void> set_max_length(WebIDL::Long);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue