mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:08:11 +00:00
LibWeb: Add form associated element categories
This commit is contained in:
parent
d2e18175ef
commit
432d496ed6
11 changed files with 117 additions and 0 deletions
|
@ -21,6 +21,18 @@ public:
|
|||
|
||||
bool enabled() const;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
|
||||
virtual bool is_listed() const { return false; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-submit
|
||||
virtual bool is_submittable() const { return false; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-reset
|
||||
virtual bool is_resettable() const { return false; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
|
||||
virtual bool is_auto_capitalize_inheriting() const { return false; }
|
||||
|
||||
protected:
|
||||
FormAssociatedElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: HTMLElement(document, move(qualified_name))
|
||||
|
|
|
@ -16,6 +16,20 @@ public:
|
|||
|
||||
HTMLButtonElement(DOM::Document&, DOM::QualifiedName);
|
||||
virtual ~HTMLButtonElement() override;
|
||||
|
||||
// ^FormAssociatedElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
|
||||
virtual bool is_listed() const override { return true; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-submit
|
||||
virtual bool is_submittable() const override { return true; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
|
||||
virtual bool is_auto_capitalize_inheriting() const override { return true; }
|
||||
|
||||
// ^HTMLElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-label
|
||||
virtual bool is_labelable() const override { return true; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -46,6 +46,9 @@ public:
|
|||
|
||||
bool fire_a_synthetic_pointer_event(FlyString const& type, DOM::Element& target, bool not_trusted);
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-label
|
||||
virtual bool is_labelable() const { return false; }
|
||||
|
||||
protected:
|
||||
virtual void parse_attribute(const FlyString& name, const String& value) override;
|
||||
|
||||
|
|
|
@ -22,6 +22,13 @@ public:
|
|||
static String fieldset = "fieldset";
|
||||
return fieldset;
|
||||
}
|
||||
|
||||
// ^FormAssociatedElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
|
||||
virtual bool is_listed() const override { return true; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
|
||||
virtual bool is_auto_capitalize_inheriting() const override { return true; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -83,6 +83,23 @@ public:
|
|||
virtual void parse_attribute(FlyString const&, String const&) override;
|
||||
virtual void did_remove_attribute(FlyString const&) override;
|
||||
|
||||
// ^FormAssociatedElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
|
||||
virtual bool is_listed() const override { return true; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-submit
|
||||
virtual bool is_submittable() const override { return true; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-reset
|
||||
virtual bool is_resettable() const override { return true; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
|
||||
virtual bool is_auto_capitalize_inheriting() const override { return true; }
|
||||
|
||||
// ^HTMLElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-label
|
||||
virtual bool is_labelable() const override { return type_state() != TypeAttributeState::Hidden; }
|
||||
|
||||
private:
|
||||
// ^DOM::Node
|
||||
virtual void inserted() override;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -16,6 +17,10 @@ public:
|
|||
|
||||
HTMLMeterElement(DOM::Document&, DOM::QualifiedName);
|
||||
virtual ~HTMLMeterElement() override;
|
||||
|
||||
// ^HTMLElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-label
|
||||
virtual bool is_labelable() const override { return true; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,10 @@ public:
|
|||
String data() const { return attribute(HTML::AttributeNames::data); }
|
||||
String type() const { return attribute(HTML::AttributeNames::type); }
|
||||
|
||||
// ^FormAssociatedElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
|
||||
virtual bool is_listed() const override { return true; }
|
||||
|
||||
private:
|
||||
virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -22,6 +23,20 @@ public:
|
|||
static String output = "output";
|
||||
return output;
|
||||
}
|
||||
|
||||
// ^FormAssociatedElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
|
||||
virtual bool is_listed() const override { return true; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
|
||||
virtual bool is_resettable() const override { return true; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
|
||||
virtual bool is_auto_capitalize_inheriting() const override { return true; }
|
||||
|
||||
// ^HTMLElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-label
|
||||
virtual bool is_labelable() const override { return true; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,10 @@ public:
|
|||
|
||||
double position() const;
|
||||
|
||||
// ^HTMLElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-label
|
||||
virtual bool is_labelable() const override { return true; }
|
||||
|
||||
private:
|
||||
bool is_determinate() const { return has_attribute(HTML::AttributeNames::value); }
|
||||
};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -19,6 +20,23 @@ public:
|
|||
HTMLSelectElement(DOM::Document&, DOM::QualifiedName);
|
||||
virtual ~HTMLSelectElement() override;
|
||||
|
||||
// ^FormAssociatedElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
|
||||
virtual bool is_listed() const override { return true; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-submit
|
||||
virtual bool is_submittable() const override { return true; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-reset
|
||||
virtual bool is_resettable() const override { return true; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
|
||||
virtual bool is_auto_capitalize_inheriting() const override { return true; }
|
||||
|
||||
// ^HTMLElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-label
|
||||
virtual bool is_labelable() const override { return true; }
|
||||
|
||||
private:
|
||||
// ^DOM::Node
|
||||
virtual void inserted() override;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -22,6 +23,23 @@ public:
|
|||
static String textarea = "textarea";
|
||||
return textarea;
|
||||
}
|
||||
|
||||
// ^FormAssociatedElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
|
||||
virtual bool is_listed() const override { return true; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-submit
|
||||
virtual bool is_submittable() const override { return true; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-reset
|
||||
virtual bool is_resettable() const override { return true; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
|
||||
virtual bool is_auto_capitalize_inheriting() const override { return true; }
|
||||
|
||||
// ^HTMLElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-label
|
||||
virtual bool is_labelable() const override { return true; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue