ladybird/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h
Aliaksandr Kalenik ca363f0024 LibWeb: Add basic "top layer" support
Implements the "top layer" concept from "CSS Positioned Layout Module
Level 4" specification.

- The tree builder is modified to ensure that layout nodes created by
  top layer elements are children of the viewport.
- Implements missing steps in `showModal()` to add an element top top
  layer.
- Implements missing steps in `close()` to remove an element from top
  layer.

Further steps could be:
- Add support for `::backdrop` pseudo-element.
- Implement the "inert" concept from HTML spec to block hit-testing
  when element from top layer is displayed.
2024-03-29 06:57:07 +01:00

46 lines
1.1 KiB
C++

/*
* Copyright (c) 2020, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/ARIA/Roles.h>
#include <LibWeb/HTML/HTMLElement.h>
namespace Web::HTML {
class HTMLDialogElement final : public HTMLElement {
WEB_PLATFORM_OBJECT(HTMLDialogElement, HTMLElement);
JS_DECLARE_ALLOCATOR(HTMLDialogElement);
public:
virtual ~HTMLDialogElement() override;
virtual void removed_from(Node*) override;
String return_value() const;
void set_return_value(String);
WebIDL::ExceptionOr<void> show();
WebIDL::ExceptionOr<void> show_modal();
void close(Optional<String> return_value);
// https://www.w3.org/TR/html-aria/#el-dialog
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::dialog; }
private:
HTMLDialogElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
void close_the_dialog(Optional<String> result);
void run_dialog_focusing_steps();
String m_return_value;
bool m_is_modal { false };
};
}