Serenity Operating System
at master 57 lines 1.5 kB view raw
1/* 2 * Copyright (c) 2020-2022, the SerenityOS developers. 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 HTMLProgressElement final : public HTMLElement { 15 WEB_PLATFORM_OBJECT(HTMLProgressElement, HTMLElement); 16 17public: 18 virtual ~HTMLProgressElement() override; 19 20 virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override; 21 22 double value() const; 23 void set_value(double); 24 25 double max() const; 26 void set_max(double value); 27 28 double position() const; 29 30 // ^HTMLElement 31 // https://html.spec.whatwg.org/multipage/forms.html#category-label 32 virtual bool is_labelable() const override { return true; } 33 34 bool using_system_appearance() const; 35 36 // https://www.w3.org/TR/html-aria/#el-progress 37 virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::progressbar; } 38 39private: 40 HTMLProgressElement(DOM::Document&, DOM::QualifiedName); 41 42 // ^DOM::Node 43 virtual bool is_html_input_element() const final { return true; } 44 45 virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; 46 47 void progress_position_updated(); 48 49 bool is_determinate() const { return has_attribute(HTML::AttributeNames::value); } 50}; 51 52} 53 54namespace Web::DOM { 55template<> 56inline bool Node::fast_is<HTML::HTMLProgressElement>() const { return is_html_progress_element(); } 57}