2020-06-08 00:10:45 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-08 00:10:45 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-07-26 16:08:16 +03:00
|
|
|
#include <LibWeb/HTML/HTMLElement.h>
|
2021-05-02 19:43:42 +03:00
|
|
|
#include <LibWeb/HTML/HTMLTableCaptionElement.h>
|
2021-04-26 18:36:40 +03:00
|
|
|
#include <LibWeb/HTML/HTMLTableRowElement.h>
|
2021-05-02 20:03:47 +03:00
|
|
|
#include <LibWeb/HTML/HTMLTableSectionElement.h>
|
2022-09-25 19:03:42 +03:00
|
|
|
#include <LibWeb/WebIDL/ExceptionOr.h>
|
2020-06-08 00:10:45 +03:00
|
|
|
|
2020-07-28 19:20:36 +03:00
|
|
|
namespace Web::HTML {
|
2020-06-08 00:10:45 +03:00
|
|
|
|
2020-06-12 23:52:38 +03:00
|
|
|
class HTMLTableElement final : public HTMLElement {
|
2022-08-28 14:42:07 +03:00
|
|
|
WEB_PLATFORM_OBJECT(HTMLTableElement, HTMLElement);
|
2020-07-27 07:04:26 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
public:
|
2020-06-08 00:10:45 +03:00
|
|
|
virtual ~HTMLTableElement() override;
|
2020-06-12 23:52:38 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
JS::GCPtr<HTMLTableCaptionElement> caption();
|
2021-07-05 07:45:20 +03:00
|
|
|
void set_caption(HTMLTableCaptionElement*);
|
2022-08-28 14:42:07 +03:00
|
|
|
JS::NonnullGCPtr<HTMLTableCaptionElement> create_caption();
|
2021-05-02 19:43:42 +03:00
|
|
|
void delete_caption();
|
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
JS::GCPtr<HTMLTableSectionElement> t_head();
|
2022-09-25 19:03:42 +03:00
|
|
|
WebIDL::ExceptionOr<void> set_t_head(HTMLTableSectionElement* thead);
|
2022-08-28 14:42:07 +03:00
|
|
|
JS::NonnullGCPtr<HTMLTableSectionElement> create_t_head();
|
2021-05-02 20:03:47 +03:00
|
|
|
void delete_t_head();
|
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
JS::GCPtr<HTMLTableSectionElement> t_foot();
|
2022-09-25 19:03:42 +03:00
|
|
|
WebIDL::ExceptionOr<void> set_t_foot(HTMLTableSectionElement* tfoot);
|
2022-08-28 14:42:07 +03:00
|
|
|
JS::NonnullGCPtr<HTMLTableSectionElement> create_t_foot();
|
2021-05-02 20:07:45 +03:00
|
|
|
void delete_t_foot();
|
|
|
|
|
2022-09-01 21:50:16 +03:00
|
|
|
JS::NonnullGCPtr<DOM::HTMLCollection> t_bodies();
|
2022-08-28 14:42:07 +03:00
|
|
|
JS::NonnullGCPtr<HTMLTableSectionElement> create_t_body();
|
2021-05-02 20:17:08 +03:00
|
|
|
|
2022-09-01 21:50:16 +03:00
|
|
|
JS::NonnullGCPtr<DOM::HTMLCollection> rows();
|
2022-09-25 19:03:42 +03:00
|
|
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLTableRowElement>> insert_row(long index);
|
|
|
|
WebIDL::ExceptionOr<void> delete_row(long index);
|
2021-04-26 18:36:40 +03:00
|
|
|
|
2022-11-29 02:58:13 +03:00
|
|
|
// https://www.w3.org/TR/html-aria/#el-table
|
2023-01-29 21:12:00 +03:00
|
|
|
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::table; }
|
2022-11-29 02:58:13 +03:00
|
|
|
|
2020-06-12 23:52:38 +03:00
|
|
|
private:
|
2022-08-28 14:42:07 +03:00
|
|
|
HTMLTableElement(DOM::Document&, DOM::QualifiedName);
|
|
|
|
|
2023-01-28 20:33:35 +03:00
|
|
|
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
2022-11-24 21:04:47 +03:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
|
2020-07-26 21:01:35 +03:00
|
|
|
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
2022-11-24 21:04:47 +03:00
|
|
|
|
|
|
|
JS::GCPtr<DOM::HTMLCollection> mutable m_rows;
|
|
|
|
JS::GCPtr<DOM::HTMLCollection> mutable m_t_bodies;
|
2020-06-08 00:10:45 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|