ladybird/Userland/Libraries/LibWeb/CSS/StyleSheetIdentifier.h
Andreas Kling 4fdb266077 LibWeb: Make DOM Node unique IDs strongly typed (and 64 bit)
This is strictly nicer than passing them around as i32 everywhere,
and by switching to i64 as the underlying type, ID allocation becomes as
simple as incrementing an integer.
2024-10-20 13:42:33 +02:00

39 lines
821 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>
#include <LibWeb/Forward.h>
namespace Web::CSS {
struct StyleSheetIdentifier {
enum class Type : u8 {
StyleElement,
LinkElement,
ImportRule,
UserAgent,
UserStyle,
} type;
Optional<UniqueNodeID> 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&);
}