ladybird/Userland/Libraries/LibWeb/CSS/StyleSheetIdentifier.h
Sam Atkins 51a426cc05 LibWeb: Add method for listing all style sheets on a page
This will be used by the inspector, for showing style sheet contents.

Identifying a specific style sheet is a bit tricky. Depending on where
it came from, a style sheet may have a URL, it might be associated with
a DOM element, both, or neither. This varied information is wrapped in
a new StyleSheetIdentifier struct.
2024-09-03 10:12:07 +01:00

38 lines
784 B
C++

/*
* Copyright (c) 2024, Sam Atkins <sam@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibIPC/Forward.h>
#include <LibURL/URL.h>
namespace Web::CSS {
struct StyleSheetIdentifier {
enum class Type : u8 {
StyleElement,
LinkElement,
ImportRule,
UserAgent,
UserStyle,
} type;
Optional<i32> dom_element_unique_id {};
Optional<String> url {};
};
StringView style_sheet_identifier_type_to_string(StyleSheetIdentifier::Type);
Optional<StyleSheetIdentifier::Type> style_sheet_identifier_type_from_string(StringView);
}
namespace IPC {
template<>
ErrorOr<void> encode(Encoder&, Web::CSS::StyleSheetIdentifier const&);
template<>
ErrorOr<Web::CSS::StyleSheetIdentifier> decode(Decoder&);
}