From 50d3f85f754c9ee4faa99d24857a596406ec181c Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 6 Mar 2024 14:44:05 -0500 Subject: [PATCH] LibWeb: Stub out a few HTMLTextArea validity IDL methods These are invoked by GitHub when submitting a comment. Stub them out for now, as this is enough to let GitHub proceed with (attempting) to submit the comment. --- .../LibWeb/HTML/HTMLTextAreaElement.cpp | 20 +++++++++++++++++++ .../LibWeb/HTML/HTMLTextAreaElement.h | 4 ++++ .../LibWeb/HTML/HTMLTextAreaElement.idl | 6 +++--- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp index 0b2e294966..74eff6e4fa 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp @@ -148,6 +148,26 @@ u32 HTMLTextAreaElement::text_length() const return Utf16View { utf16_data }.length_in_code_units(); } +// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-checkvalidity +bool HTMLTextAreaElement::check_validity() +{ + dbgln("(STUBBED) HTMLTextAreaElement::check_validity(). Called on: {}", debug_description()); + return true; +} + +// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-reportvalidity +bool HTMLTextAreaElement::report_validity() +{ + dbgln("(STUBBED) HTMLTextAreaElement::report_validity(). Called on: {}", debug_description()); + return true; +} + +// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-setcustomvalidity +void HTMLTextAreaElement::set_custom_validity(String const& error) +{ + dbgln("(STUBBED) HTMLTextAreaElement::set_custom_validity(\"{}\"). Called on: {}", error, debug_description()); +} + // https://html.spec.whatwg.org/multipage/form-elements.html#dom-textarea-maxlength WebIDL::Long HTMLTextAreaElement::max_length() const { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h index 76cee0b6a6..3e296b8820 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h @@ -79,6 +79,10 @@ public: u32 text_length() const; + bool check_validity(); + bool report_validity(); + void set_custom_validity(String const& error); + WebIDL::Long max_length() const; WebIDL::ExceptionOr set_max_length(WebIDL::Long); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.idl index 0929acc7d5..5e7349437a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.idl +++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.idl @@ -28,9 +28,9 @@ interface HTMLTextAreaElement : HTMLElement { // FIXME: readonly attribute boolean willValidate; // FIXME: readonly attribute ValidityState validity; // FIXME: readonly attribute DOMString validationMessage; - // FIXME: boolean checkValidity(); - // FIXME: boolean reportValidity(); - // FIXME: undefined setCustomValidity(DOMString error); + boolean checkValidity(); + boolean reportValidity(); + undefined setCustomValidity(DOMString error); // FIXME: readonly attribute NodeList labels;