2020-06-07 18:10:45 -03:00
|
|
|
/*
|
2024-10-04 08:19:50 -03:00
|
|
|
* Copyright (c) 2020, Andreas Kling <andreas@ladybird.org>
|
2020-06-07 18:10:45 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-07 18:10:45 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2020-07-26 10:08:16 -03:00
|
|
|
#include <LibWeb/HTML/HTMLElement.h>
|
2021-05-02 13:43:42 -03:00
|
|
|
#include <LibWeb/HTML/HTMLTableCaptionElement.h>
|
2021-04-26 12:36:40 -03:00
|
|
|
#include <LibWeb/HTML/HTMLTableRowElement.h>
|
2021-05-02 14:03:47 -03:00
|
|
|
#include <LibWeb/HTML/HTMLTableSectionElement.h>
|
2022-09-25 13:03:42 -03:00
|
|
|
#include <LibWeb/WebIDL/ExceptionOr.h>
|
2024-02-26 14:54:36 -03:00
|
|
|
#include <LibWeb/WebIDL/Types.h>
|
2020-06-07 18:10:45 -03:00
|
|
|
|
2020-07-28 13:20:36 -03:00
|
|
|
namespace Web::HTML {
|
2020-06-07 18:10:45 -03:00
|
|
|
|
2020-06-12 17:52:38 -03:00
|
|
|
class HTMLTableElement final : public HTMLElement {
|
2022-08-28 08:42:07 -03:00
|
|
|
WEB_PLATFORM_OBJECT(HTMLTableElement, HTMLElement);
|
2024-11-14 12:01:23 -03:00
|
|
|
GC_DECLARE_ALLOCATOR(HTMLTableElement);
|
2020-07-27 01:04:26 -03:00
|
|
|
|
2022-08-28 08:42:07 -03:00
|
|
|
public:
|
2020-06-07 18:10:45 -03:00
|
|
|
virtual ~HTMLTableElement() override;
|
2020-06-12 17:52:38 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<HTMLTableCaptionElement> caption();
|
2023-05-25 16:37:57 -03:00
|
|
|
WebIDL::ExceptionOr<void> set_caption(HTMLTableCaptionElement*);
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ref<HTMLTableCaptionElement> create_caption();
|
2021-05-02 13:43:42 -03:00
|
|
|
void delete_caption();
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<HTMLTableSectionElement> t_head();
|
2022-09-25 13:03:42 -03:00
|
|
|
WebIDL::ExceptionOr<void> set_t_head(HTMLTableSectionElement* thead);
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ref<HTMLTableSectionElement> create_t_head();
|
2021-05-02 14:03:47 -03:00
|
|
|
void delete_t_head();
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<HTMLTableSectionElement> t_foot();
|
2022-09-25 13:03:42 -03:00
|
|
|
WebIDL::ExceptionOr<void> set_t_foot(HTMLTableSectionElement* tfoot);
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ref<HTMLTableSectionElement> create_t_foot();
|
2021-05-02 14:07:45 -03:00
|
|
|
void delete_t_foot();
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ref<DOM::HTMLCollection> t_bodies();
|
|
|
|
|
GC::Ref<HTMLTableSectionElement> create_t_body();
|
2021-05-02 14:17:08 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ref<DOM::HTMLCollection> rows();
|
|
|
|
|
WebIDL::ExceptionOr<GC::Ref<HTMLTableRowElement>> insert_row(WebIDL::Long index);
|
2024-02-26 14:54:36 -03:00
|
|
|
WebIDL::ExceptionOr<void> delete_row(WebIDL::Long index);
|
2021-04-26 12:36:40 -03:00
|
|
|
|
2022-11-28 20:58:13 -03:00
|
|
|
// https://www.w3.org/TR/html-aria/#el-table
|
2023-01-28 19:23:16 -03:00
|
|
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::table; }
|
2022-11-28 20:58:13 -03:00
|
|
|
|
2023-08-21 20:44:07 -03:00
|
|
|
unsigned border() const;
|
2023-11-19 15:19:32 -03:00
|
|
|
unsigned padding() const;
|
2023-08-21 20:44:07 -03:00
|
|
|
|
2020-06-12 17:52:38 -03:00
|
|
|
private:
|
2022-08-28 08:42:07 -03:00
|
|
|
HTMLTableElement(DOM::Document&, DOM::QualifiedName);
|
|
|
|
|
|
2023-08-22 09:55:10 -03:00
|
|
|
virtual bool is_html_table_element() const override { return true; }
|
|
|
|
|
|
2023-08-07 03:41:28 -03:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2022-11-24 15:04:47 -03:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
|
|
2020-07-26 15:01:35 -03:00
|
|
|
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
2024-11-14 10:14:16 -03:00
|
|
|
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
|
2022-11-24 15:04:47 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<DOM::HTMLCollection> mutable m_rows;
|
|
|
|
|
GC::Ptr<DOM::HTMLCollection> mutable m_t_bodies;
|
2023-11-19 15:19:32 -03:00
|
|
|
unsigned m_padding { 1 };
|
2020-06-07 18:10:45 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
2023-08-22 09:55:10 -03:00
|
|
|
|
|
|
|
|
namespace Web::DOM {
|
|
|
|
|
template<>
|
|
|
|
|
inline bool Node::fast_is<HTML::HTMLTableElement>() const { return is_html_table_element(); }
|
|
|
|
|
}
|