HTMLTableRowElement.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/ARIA/Roles.h>
  8. #include <LibWeb/HTML/HTMLElement.h>
  9. namespace Web::HTML {
  10. class HTMLTableRowElement final : public HTMLElement {
  11. WEB_PLATFORM_OBJECT(HTMLTableRowElement, HTMLElement);
  12. JS_DECLARE_ALLOCATOR(HTMLTableRowElement);
  13. public:
  14. virtual ~HTMLTableRowElement() override;
  15. JS::NonnullGCPtr<DOM::HTMLCollection> cells() const;
  16. int row_index() const;
  17. int section_row_index() const;
  18. WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLTableCellElement>> insert_cell(i32 index);
  19. WebIDL::ExceptionOr<void> delete_cell(i32 index);
  20. // https://www.w3.org/TR/html-aria/#el-tr
  21. virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::row; }
  22. private:
  23. HTMLTableRowElement(DOM::Document&, DOM::QualifiedName);
  24. virtual bool is_html_table_row_element() const override { return true; }
  25. virtual void initialize(JS::Realm&) override;
  26. virtual void visit_edges(Cell::Visitor&) override;
  27. virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
  28. JS::GCPtr<DOM::HTMLCollection> mutable m_cells;
  29. };
  30. }
  31. namespace Web::DOM {
  32. template<>
  33. inline bool Node::fast_is<HTML::HTMLTableRowElement>() const { return is_html_table_row_element(); }
  34. }