mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Implement validity IDL attribute
This commit is contained in:
parent
184ae687c5
commit
83c4e22247
Notes:
github-actions[bot]
2025-02-18 06:38:10 +00:00
Author: https://github.com/Psychpsyo
Commit: 83c4e22247
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3583
Reviewed-by: https://github.com/shannonbooth
Reviewed-by: https://github.com/tcl3 ✅
33 changed files with 2007 additions and 31 deletions
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/HTML/FormAssociatedElement.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
@ -16,12 +17,40 @@ class ValidityState final : public Bindings::PlatformObject {
|
|||
GC_DECLARE_ALLOCATOR(ValidityState);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static GC::Ref<ValidityState> create(JS::Realm&, FormAssociatedElement const&);
|
||||
|
||||
virtual ~ValidityState() override = default;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-valuemissing
|
||||
bool value_missing() const;
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-typemismatch
|
||||
bool type_mismatch() const;
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-patternmismatch
|
||||
bool pattern_mismatch() const;
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-toolong
|
||||
bool too_long() const;
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-tooshort
|
||||
bool too_short() const;
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-rangeunderflow
|
||||
bool range_underflow() const;
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-rangeoverflow
|
||||
bool range_overflow() const;
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-stepmismatch
|
||||
bool step_mismatch() const;
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-badinput
|
||||
bool bad_input() const;
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-customerror
|
||||
bool custom_error() const;
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-valid
|
||||
bool valid() const;
|
||||
|
||||
private:
|
||||
ValidityState(JS::Realm&);
|
||||
ValidityState(JS::Realm&, FormAssociatedElement const&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
FormAssociatedElement const& m_control;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue