Serenity Operating System
at master 60 lines 2.0 kB view raw
1/* 2 * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#pragma once 8 9#include <LibWeb/HTML/HTMLElement.h> 10#include <LibWeb/HTML/HTMLTableCaptionElement.h> 11#include <LibWeb/HTML/HTMLTableRowElement.h> 12#include <LibWeb/HTML/HTMLTableSectionElement.h> 13#include <LibWeb/WebIDL/ExceptionOr.h> 14 15namespace Web::HTML { 16 17class HTMLTableElement final : public HTMLElement { 18 WEB_PLATFORM_OBJECT(HTMLTableElement, HTMLElement); 19 20public: 21 virtual ~HTMLTableElement() override; 22 23 JS::GCPtr<HTMLTableCaptionElement> caption(); 24 void set_caption(HTMLTableCaptionElement*); 25 JS::NonnullGCPtr<HTMLTableCaptionElement> create_caption(); 26 void delete_caption(); 27 28 JS::GCPtr<HTMLTableSectionElement> t_head(); 29 WebIDL::ExceptionOr<void> set_t_head(HTMLTableSectionElement* thead); 30 JS::NonnullGCPtr<HTMLTableSectionElement> create_t_head(); 31 void delete_t_head(); 32 33 JS::GCPtr<HTMLTableSectionElement> t_foot(); 34 WebIDL::ExceptionOr<void> set_t_foot(HTMLTableSectionElement* tfoot); 35 JS::NonnullGCPtr<HTMLTableSectionElement> create_t_foot(); 36 void delete_t_foot(); 37 38 JS::NonnullGCPtr<DOM::HTMLCollection> t_bodies(); 39 JS::NonnullGCPtr<HTMLTableSectionElement> create_t_body(); 40 41 JS::NonnullGCPtr<DOM::HTMLCollection> rows(); 42 WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLTableRowElement>> insert_row(long index); 43 WebIDL::ExceptionOr<void> delete_row(long index); 44 45 // https://www.w3.org/TR/html-aria/#el-table 46 virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::table; } 47 48private: 49 HTMLTableElement(DOM::Document&, DOM::QualifiedName); 50 51 virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; 52 virtual void visit_edges(Cell::Visitor&) override; 53 54 virtual void apply_presentational_hints(CSS::StyleProperties&) const override; 55 56 JS::GCPtr<DOM::HTMLCollection> mutable m_rows; 57 JS::GCPtr<DOM::HTMLCollection> mutable m_t_bodies; 58}; 59 60}