mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 10:09:14 +00:00
Inspector: Add a basic style sheet inspector
Choosing options from the `<select>` will load and display that style sheet's source text, with some checks to make sure that the text that just loaded is the one we currently want. The UI is a little goofy when scrolling, as it uses `position: sticky` which we don't implement yet. But that's just more motivation to implement it! :^)
This commit is contained in:
parent
49b2eb5f51
commit
da171c3230
Notes:
github-actions[bot]
2024-09-03 09:12:56 +00:00
Author: https://github.com/AtkinsSJ
Commit: da171c3230
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1168
Reviewed-by: https://github.com/trflynn89
18 changed files with 270 additions and 2 deletions
|
@ -711,6 +711,30 @@ Messages::WebContentClient::RequestWorkerAgentResponse WebContentClient::request
|
|||
return IPC::File {};
|
||||
}
|
||||
|
||||
void WebContentClient::inspector_did_list_style_sheets(u64 page_id, Vector<Web::CSS::StyleSheetIdentifier> const& stylesheets)
|
||||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_received_style_sheet_list)
|
||||
view->on_received_style_sheet_list(stylesheets);
|
||||
}
|
||||
}
|
||||
|
||||
void WebContentClient::inspector_did_request_style_sheet_source(u64 page_id, Web::CSS::StyleSheetIdentifier const& identifier)
|
||||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_inspector_requested_style_sheet_source)
|
||||
view->on_inspector_requested_style_sheet_source(identifier);
|
||||
}
|
||||
}
|
||||
|
||||
void WebContentClient::did_request_style_sheet_source(u64 page_id, Web::CSS::StyleSheetIdentifier const& identifier, String const& source)
|
||||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_received_style_sheet_source)
|
||||
view->on_received_style_sheet_source(identifier, source);
|
||||
}
|
||||
}
|
||||
|
||||
Optional<ViewImplementation&> WebContentClient::view_for_page_id(u64 page_id, SourceLocation location)
|
||||
{
|
||||
if (auto view = m_views.get(page_id); view.has_value())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue