FormAssociatedElement.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/WeakPtr.h>
  8. #include <LibWeb/Forward.h>
  9. #include <LibWeb/HTML/HTMLElement.h>
  10. namespace Web::HTML {
  11. class FormAssociatedElement : public HTMLElement {
  12. public:
  13. HTMLFormElement* form() { return m_form; }
  14. HTMLFormElement const* form() const { return m_form; }
  15. void set_form(HTMLFormElement*);
  16. bool enabled() const;
  17. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  18. virtual bool is_listed() const { return false; }
  19. // https://html.spec.whatwg.org/multipage/forms.html#category-submit
  20. virtual bool is_submittable() const { return false; }
  21. // https://html.spec.whatwg.org/multipage/forms.html#category-reset
  22. virtual bool is_resettable() const { return false; }
  23. // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
  24. virtual bool is_auto_capitalize_inheriting() const { return false; }
  25. protected:
  26. FormAssociatedElement(DOM::Document& document, DOM::QualifiedName qualified_name)
  27. : HTMLElement(document, move(qualified_name))
  28. {
  29. }
  30. virtual ~FormAssociatedElement() = default;
  31. private:
  32. WeakPtr<HTMLFormElement> m_form;
  33. };
  34. }