HTMLDialogElement.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) 2020, 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 HTMLDialogElement final : public HTMLElement {
  11. WEB_PLATFORM_OBJECT(HTMLDialogElement, HTMLElement);
  12. JS_DECLARE_ALLOCATOR(HTMLDialogElement);
  13. public:
  14. virtual ~HTMLDialogElement() override;
  15. virtual void removed_from(Node*) override;
  16. String return_value() const;
  17. void set_return_value(String);
  18. WebIDL::ExceptionOr<void> show();
  19. WebIDL::ExceptionOr<void> show_modal();
  20. void close(Optional<String> return_value);
  21. // https://www.w3.org/TR/html-aria/#el-dialog
  22. virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::dialog; }
  23. private:
  24. HTMLDialogElement(DOM::Document&, DOM::QualifiedName);
  25. virtual void initialize(JS::Realm&) override;
  26. void close_the_dialog(Optional<String> result);
  27. void run_dialog_focusing_steps();
  28. String m_return_value;
  29. bool m_is_modal { false };
  30. };
  31. }