/* * Copyright (c) 2020, 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); JS_DECLARE_ALLOCATOR(HTMLTableElement); public: virtual ~HTMLTableElement() override; JS::GCPtr caption(); WebIDL::ExceptionOr set_caption(HTMLTableCaptionElement*); JS::NonnullGCPtr create_caption(); void delete_caption(); JS::GCPtr t_head(); WebIDL::ExceptionOr set_t_head(HTMLTableSectionElement* thead); JS::NonnullGCPtr create_t_head(); void delete_t_head(); JS::GCPtr t_foot(); WebIDL::ExceptionOr set_t_foot(HTMLTableSectionElement* tfoot); JS::NonnullGCPtr create_t_foot(); void delete_t_foot(); JS::NonnullGCPtr t_bodies(); JS::NonnullGCPtr create_t_body(); JS::NonnullGCPtr 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; unsigned padding() 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 void apply_presentational_hints(CSS::StyleProperties&) const override; virtual void attribute_changed(FlyString const& name, Optional const& value) override; JS::GCPtr mutable m_rows; JS::GCPtr mutable m_t_bodies; unsigned m_padding { 1 }; }; } namespace Web::DOM { template<> inline bool Node::fast_is() const { return is_html_table_element(); } }