HTMLInputElement.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/HTML/FormAssociatedElement.h>
  8. #include <LibWeb/HTML/HTMLElement.h>
  9. namespace Web::HTML {
  10. class HTMLInputElement final
  11. : public HTMLElement
  12. , public FormAssociatedElement {
  13. public:
  14. using WrapperType = Bindings::HTMLInputElementWrapper;
  15. HTMLInputElement(DOM::Document&, QualifiedName);
  16. virtual ~HTMLInputElement() override;
  17. virtual RefPtr<Layout::Node> create_layout_node() override;
  18. String type() const { return attribute(HTML::AttributeNames::type); }
  19. String default_value() const { return attribute(HTML::AttributeNames::value); }
  20. String name() const { return attribute(HTML::AttributeNames::name); }
  21. String value() const;
  22. void set_value(String);
  23. bool checked() const { return m_checked; }
  24. void set_checked(bool);
  25. bool enabled() const;
  26. void did_click_button(Badge<Layout::ButtonBox>);
  27. private:
  28. // ^DOM::Node
  29. virtual void inserted() override;
  30. virtual void removed_from(Node*) override;
  31. // ^HTML::FormAssociatedElement
  32. virtual HTMLElement& form_associated_element_to_html_element() override { return *this; }
  33. void create_shadow_tree_if_needed();
  34. RefPtr<DOM::Text> m_text_node;
  35. bool m_checked { false };
  36. };
  37. }