瀏覽代碼

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.
Timothy Flynn 1 年之前
父節點
當前提交
50d3f85f75

+ 20 - 0
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
 {

+ 4 - 0
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<void> set_max_length(WebIDL::Long);
 

+ 3 - 3
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;