HTMLProgressElement.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) 2020-2022, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/ARIA/Roles.h>
  8. #include <LibWeb/HTML/HTMLElement.h>
  9. namespace Web::HTML {
  10. class HTMLProgressElement final : public HTMLElement {
  11. WEB_PLATFORM_OBJECT(HTMLProgressElement, HTMLElement);
  12. public:
  13. virtual ~HTMLProgressElement() override;
  14. virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
  15. double value() const;
  16. WebIDL::ExceptionOr<void> set_value(double);
  17. double max() const;
  18. WebIDL::ExceptionOr<void> set_max(double value);
  19. double position() const;
  20. // ^HTMLElement
  21. // https://html.spec.whatwg.org/multipage/forms.html#category-label
  22. virtual bool is_labelable() const override { return true; }
  23. bool using_system_appearance() const;
  24. // https://www.w3.org/TR/html-aria/#el-progress
  25. virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::progressbar; }
  26. private:
  27. HTMLProgressElement(DOM::Document&, DOM::QualifiedName);
  28. // ^DOM::Node
  29. virtual bool is_html_progress_element() const final { return true; }
  30. virtual void initialize(JS::Realm&) override;
  31. void progress_position_updated();
  32. bool is_determinate() const { return has_attribute(HTML::AttributeNames::value); }
  33. };
  34. }
  35. namespace Web::DOM {
  36. template<>
  37. inline bool Node::fast_is<HTML::HTMLProgressElement>() const { return is_html_progress_element(); }
  38. }