Serenity Operating System
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/ARIA/Roles.h>
10#include <LibWeb/HTML/HTMLElement.h>
11
12namespace Web::HTML {
13
14class HTMLTableRowElement final : public HTMLElement {
15 WEB_PLATFORM_OBJECT(HTMLTableRowElement, HTMLElement);
16
17public:
18 virtual ~HTMLTableRowElement() override;
19
20 JS::NonnullGCPtr<DOM::HTMLCollection> cells() const;
21
22 int row_index() const;
23 int section_row_index() const;
24 WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLTableCellElement>> insert_cell(i32 index);
25 WebIDL::ExceptionOr<void> delete_cell(i32 index);
26
27 // https://www.w3.org/TR/html-aria/#el-tr
28 virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::row; }
29
30private:
31 HTMLTableRowElement(DOM::Document&, DOM::QualifiedName);
32
33 virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
34 virtual void visit_edges(Cell::Visitor&) override;
35
36 JS::GCPtr<DOM::HTMLCollection> mutable m_cells;
37};
38
39}