Resolve applied-rule stylesheet identities through StyleSheetsActor and include Firefox parentStyleSheet, line, and column fields on rule forms. Firefox can then show matched rules as stylesheet rules and open the corresponding CSS source location from the Rules panel.
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
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/Export.h>
|
|
#include <LibWeb/Forward.h>
|
|
|
|
namespace Web::CSS {
|
|
|
|
struct StyleSheetIdentifier {
|
|
enum class Type : u8 {
|
|
StyleElement,
|
|
LinkElement,
|
|
ImportRule,
|
|
UserAgent,
|
|
UserStyle,
|
|
};
|
|
|
|
Type type;
|
|
Optional<UniqueNodeID> dom_element_unique_id {};
|
|
Optional<String> url {};
|
|
size_t rule_count { 0 };
|
|
|
|
bool operator==(StyleSheetIdentifier const& other) const
|
|
{
|
|
return type == other.type && dom_element_unique_id == other.dom_element_unique_id && url == other.url;
|
|
}
|
|
};
|
|
|
|
WEB_API StringView style_sheet_identifier_type_to_string(StyleSheetIdentifier::Type);
|
|
WEB_API Optional<StyleSheetIdentifier::Type> style_sheet_identifier_type_from_string(StringView);
|
|
WEB_API Optional<StyleSheetIdentifier> style_sheet_identifier_for(CSSStyleSheet const&);
|
|
|
|
}
|
|
|
|
namespace IPC {
|
|
|
|
template<>
|
|
WEB_API ErrorOr<void> encode(Encoder&, Web::CSS::StyleSheetIdentifier const&);
|
|
|
|
template<>
|
|
WEB_API ErrorOr<Web::CSS::StyleSheetIdentifier> decode(Decoder&);
|
|
|
|
}
|