2020-08-01 05:05:43 +03:00
|
|
|
/*
|
2022-02-16 21:12:54 +03:00
|
|
|
* Copyright (c) 2020-2022, the SerenityOS developers.
|
2020-08-01 05:05:43 +03:00
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-08-01 05:05:43 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2023-01-29 01:23:16 +03:00
|
|
|
#include <LibWeb/ARIA/Roles.h>
|
2020-08-01 05:05:43 +03:00
|
|
|
#include <LibWeb/HTML/HTMLElement.h>
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
class HTMLProgressElement final : public HTMLElement {
|
2022-08-28 14:42:07 +03:00
|
|
|
WEB_PLATFORM_OBJECT(HTMLProgressElement, HTMLElement);
|
2023-11-19 21:47:52 +03:00
|
|
|
JS_DECLARE_ALLOCATOR(HTMLProgressElement);
|
2020-08-01 05:05:43 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
public:
|
2020-08-01 05:05:43 +03:00
|
|
|
virtual ~HTMLProgressElement() override;
|
2022-02-16 21:12:54 +03:00
|
|
|
|
2022-10-17 15:41:50 +03:00
|
|
|
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
2022-02-16 21:12:54 +03:00
|
|
|
|
|
|
|
double value() const;
|
2023-05-25 22:37:57 +03:00
|
|
|
WebIDL::ExceptionOr<void> set_value(double);
|
2022-02-16 21:12:54 +03:00
|
|
|
|
|
|
|
double max() const;
|
2023-05-25 22:37:57 +03:00
|
|
|
WebIDL::ExceptionOr<void> set_max(double value);
|
2022-02-16 21:12:54 +03:00
|
|
|
|
|
|
|
double position() const;
|
|
|
|
|
2022-03-02 00:03:30 +03:00
|
|
|
// ^HTMLElement
|
|
|
|
// https://html.spec.whatwg.org/multipage/forms.html#category-label
|
|
|
|
virtual bool is_labelable() const override { return true; }
|
|
|
|
|
2022-07-22 18:08:03 +03:00
|
|
|
bool using_system_appearance() const;
|
|
|
|
|
2022-11-29 02:58:13 +03:00
|
|
|
// https://www.w3.org/TR/html-aria/#el-progress
|
2023-01-29 01:23:16 +03:00
|
|
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::progressbar; }
|
2022-11-29 02:58:13 +03:00
|
|
|
|
2022-02-16 21:12:54 +03:00
|
|
|
private:
|
2022-08-28 14:42:07 +03:00
|
|
|
HTMLProgressElement(DOM::Document&, DOM::QualifiedName);
|
|
|
|
|
2023-03-10 23:16:18 +03:00
|
|
|
// ^DOM::Node
|
2023-03-17 02:50:11 +03:00
|
|
|
virtual bool is_html_progress_element() const final { return true; }
|
2023-03-10 23:16:18 +03:00
|
|
|
|
2023-08-07 09:41:28 +03:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2023-01-10 14:28:20 +03:00
|
|
|
|
2022-07-22 18:08:03 +03:00
|
|
|
void progress_position_updated();
|
|
|
|
|
2022-02-16 21:12:54 +03:00
|
|
|
bool is_determinate() const { return has_attribute(HTML::AttributeNames::value); }
|
2020-08-01 05:05:43 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2023-03-10 23:16:18 +03:00
|
|
|
|
|
|
|
namespace Web::DOM {
|
|
|
|
template<>
|
|
|
|
inline bool Node::fast_is<HTML::HTMLProgressElement>() const { return is_html_progress_element(); }
|
|
|
|
}
|