2020-01-18 09:38:21 +01:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
|
2020-01-18 09:38:21 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
2019-09-29 12:24:58 +02:00
|
|
|
#pragma once
|
|
|
|
|
2023-01-28 22:23:16 +00:00
|
|
|
#include <LibWeb/ARIA/Roles.h>
|
2020-07-26 15:08:16 +02:00
|
|
|
#include <LibWeb/HTML/HTMLElement.h>
|
2019-09-29 12:24:58 +02:00
|
|
|
|
2020-07-28 18:20:36 +02:00
|
|
|
namespace Web::HTML {
|
2020-03-07 10:27:02 +01:00
|
|
|
|
2020-07-28 02:54:19 +01:00
|
|
|
class HTMLHeadingElement final : public HTMLElement {
|
2022-08-28 13:42:07 +02:00
|
|
|
WEB_PLATFORM_OBJECT(HTMLHeadingElement, HTMLElement);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(HTMLHeadingElement);
|
2022-08-28 13:42:07 +02:00
|
|
|
|
2019-09-29 12:24:58 +02:00
|
|
|
public:
|
2022-08-28 13:42:07 +02:00
|
|
|
virtual ~HTMLHeadingElement() override;
|
2020-07-27 05:04:26 +01:00
|
|
|
|
2022-12-21 12:05:03 +02:00
|
|
|
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
|
|
|
|
2022-11-28 17:58:13 -06:00
|
|
|
// https://www.w3.org/TR/html-aria/#el-h1-h6
|
2023-01-28 22:23:16 +00:00
|
|
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::heading; }
|
2023-01-29 19:12:00 +01:00
|
|
|
|
2023-10-06 07:43:52 +13:00
|
|
|
virtual Optional<String> aria_level() const override
|
2022-11-28 17:58:13 -06:00
|
|
|
{
|
|
|
|
// TODO: aria-level = the number in the element's tag name
|
2024-01-02 21:23:53 +13:00
|
|
|
return get_attribute("aria-level"_fly_string);
|
2022-11-28 17:58:13 -06:00
|
|
|
}
|
|
|
|
|
2022-08-28 13:42:07 +02:00
|
|
|
private:
|
2022-02-18 21:00:52 +01:00
|
|
|
HTMLHeadingElement(DOM::Document&, DOM::QualifiedName);
|
2023-01-10 06:28:20 -05:00
|
|
|
|
2023-08-07 08:41:28 +02:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2019-09-29 12:24:58 +02:00
|
|
|
};
|
2020-03-07 10:27:02 +01:00
|
|
|
|
|
|
|
}
|