2023-06-08 12:07:12 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2023, Preston Taylor <PrestonLeeTaylor@proton.me>
|
2026-02-05 13:06:29 -03:00
|
|
|
* Copyright (c) 2026, Sam Atkins <sam@ladybird.org>
|
2023-06-08 12:07:12 -03:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <LibWeb/CSS/CSSStyleSheet.h>
|
2026-02-06 09:48:53 -03:00
|
|
|
#include <LibWeb/DOM/DocumentLoadEventDelayer.h>
|
2026-02-05 13:06:29 -03:00
|
|
|
#include <LibWeb/Forward.h>
|
2023-06-08 12:07:12 -03:00
|
|
|
|
|
|
|
|
namespace Web::DOM {
|
|
|
|
|
|
2026-02-05 13:06:29 -03:00
|
|
|
class StyleElementBase {
|
2023-06-08 12:07:12 -03:00
|
|
|
public:
|
2026-02-05 13:06:29 -03:00
|
|
|
virtual ~StyleElementBase() = default;
|
2023-06-08 12:07:12 -03:00
|
|
|
|
2026-02-05 13:06:29 -03:00
|
|
|
void update_a_style_block();
|
|
|
|
|
|
|
|
|
|
CSS::CSSStyleSheet* sheet();
|
|
|
|
|
CSS::CSSStyleSheet const* sheet() const;
|
2023-06-08 12:07:12 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
[[nodiscard]] GC::Ptr<CSS::StyleSheetList> style_sheet_list() { return m_style_sheet_list; }
|
|
|
|
|
[[nodiscard]] GC::Ptr<CSS::StyleSheetList const> style_sheet_list() const { return m_style_sheet_list; }
|
2024-09-21 03:11:49 -03:00
|
|
|
|
2026-02-05 14:40:15 -03:00
|
|
|
enum class AnyFailed : u8 {
|
|
|
|
|
No,
|
|
|
|
|
Yes,
|
|
|
|
|
};
|
|
|
|
|
void finished_loading_critical_subresources(AnyFailed);
|
|
|
|
|
|
2026-02-05 13:06:29 -03:00
|
|
|
void visit_style_element_edges(JS::Cell::Visitor&);
|
|
|
|
|
|
|
|
|
|
virtual Element& as_element() = 0;
|
2024-09-21 02:47:37 -03:00
|
|
|
|
2023-06-08 12:07:12 -03:00
|
|
|
private:
|
|
|
|
|
// https://www.w3.org/TR/cssom/#associated-css-style-sheet
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<CSS::CSSStyleSheet> m_associated_css_style_sheet;
|
2024-09-21 03:11:49 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<CSS::StyleSheetList> m_style_sheet_list;
|
2026-02-06 09:48:53 -03:00
|
|
|
|
|
|
|
|
Optional<DocumentLoadEventDelayer> m_document_load_event_delayer;
|
2023-06-08 12:07:12 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|