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.
42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/HashMap.h>
|
|
#include <AK/NonnullRefPtr.h>
|
|
#include <LibDevTools/Actor.h>
|
|
#include <LibDevTools/Forward.h>
|
|
#include <LibWeb/Forward.h>
|
|
|
|
namespace DevTools {
|
|
|
|
class DEVTOOLS_API StyleSheetsActor final : public Actor {
|
|
public:
|
|
static constexpr auto base_name = "style-sheets"sv;
|
|
|
|
static NonnullRefPtr<StyleSheetsActor> create(DevToolsServer&, String name, WeakPtr<TabActor>);
|
|
virtual ~StyleSheetsActor() override;
|
|
|
|
static String resource_id_for_index(StringView actor_name, size_t index);
|
|
|
|
void set_style_sheets(Vector<Web::CSS::StyleSheetIdentifier>);
|
|
Optional<String> resource_id_for(Web::CSS::StyleSheetIdentifier const&) const;
|
|
|
|
private:
|
|
StyleSheetsActor(DevToolsServer&, String name, WeakPtr<TabActor>);
|
|
|
|
virtual void handle_message(Message const&) override;
|
|
|
|
void style_sheet_source_received(Web::CSS::StyleSheetIdentifier const&, String source);
|
|
|
|
WeakPtr<TabActor> m_tab;
|
|
|
|
Vector<Web::CSS::StyleSheetIdentifier> m_style_sheets;
|
|
HashMap<size_t, Message> m_pending_style_sheet_source_requests;
|
|
};
|
|
|
|
}
|