/* * Copyright (c) 2020-2025, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include namespace Web::HTML { class HTMLTableElement final : public HTMLElement { WEB_PLATFORM_OBJECT(HTMLTableElement, HTMLElement); GC_DECLARE_ALLOCATOR(HTMLTableElement); public: virtual ~HTMLTableElement() override; GC::Ptr caption(); WebIDL::ExceptionOr set_caption(HTMLTableCaptionElement*); GC::Ref create_caption(); void delete_caption(); GC::Ptr t_head(); WebIDL::ExceptionOr set_t_head(HTMLTableSectionElement* thead); GC::Ref create_t_head(); void delete_t_head(); GC::Ptr t_foot(); WebIDL::ExceptionOr set_t_foot(HTMLTableSectionElement* tfoot); GC::Ref create_t_foot(); void delete_t_foot(); GC::Ref t_bodies(); GC::Ref create_t_body(); GC::Ref rows(); WebIDL::ExceptionOr> insert_row(WebIDL::Long index); WebIDL::ExceptionOr delete_row(WebIDL::Long index); // https://www.w3.org/TR/html-aria/#el-table virtual Optional default_role() const override { return ARIA::Role::table; } unsigned border() const; [[nodiscard]] Optional cellpadding() const; private: HTMLTableElement(DOM::Document&, DOM::QualifiedName); virtual bool is_html_table_element() const override { return true; } virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; virtual bool is_presentational_hint(FlyString const&) const override; virtual void apply_presentational_hints(GC::Ref) const override; virtual void attribute_changed(FlyString const& name, Optional const& old_value, Optional const& value, Optional const& namespace_) override; GC::Ptr mutable m_rows; GC::Ptr mutable m_t_bodies; Optional m_cellpadding; }; } namespace Web::DOM { template<> inline bool Node::fast_is() const { return is_html_table_element(); } }