mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibDevTools: Annotate style sheets how Firefox expects
Mark UA style sheets as "system", which makes them read-only in the Firefox dev tools. Also give them an href with a fake resource:// URL so that they don't appear as "<inline style sheet>", and don't set the href for actual inline style sheets, for the opposite reason. I've kept the title for UA style sheets, because that means we see `Thing/Default.css` instead of just `Default.css` for all of them.
This commit is contained in:
parent
086ef9e339
commit
f17317b7fc
Notes:
github-actions[bot]
2025-09-26 20:32:12 +00:00
Author: https://github.com/AtkinsSJ
Commit: f17317b7fc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6315
1 changed files with 5 additions and 2 deletions
|
|
@ -161,10 +161,13 @@ void FrameActor::style_sheets_available(JsonObject& response, Vector<Web::CSS::S
|
|||
JsonValue title;
|
||||
|
||||
if (style_sheet.url.has_value()) {
|
||||
// LibWeb sets the URL to a style sheet name for UA style sheets. DevTools would reject these invalid URLs.
|
||||
if (style_sheet.type == Web::CSS::StyleSheetIdentifier::Type::UserAgent) {
|
||||
// LibWeb sets the URL to a style sheet name for UA style sheets. DevTools would reject these invalid URLs.
|
||||
href = MUST(String::formatted("resource://{}", style_sheet.url.value()));
|
||||
title = *style_sheet.url;
|
||||
source_map_base_url = tab_url;
|
||||
} else if (style_sheet.type == Web::CSS::StyleSheetIdentifier::Type::StyleElement) {
|
||||
source_map_base_url = *style_sheet.url;
|
||||
} else {
|
||||
href = *style_sheet.url;
|
||||
source_map_base_url = *style_sheet.url;
|
||||
|
|
@ -186,7 +189,7 @@ void FrameActor::style_sheets_available(JsonObject& response, Vector<Web::CSS::S
|
|||
sheet.set("sourceMapBaseURL"sv, move(source_map_base_url));
|
||||
sheet.set("sourceMapURL"sv, ""sv);
|
||||
sheet.set("styleSheetIndex"sv, i);
|
||||
sheet.set("system"sv, false);
|
||||
sheet.set("system"sv, style_sheet.type == Web::CSS::StyleSheetIdentifier::Type::UserAgent);
|
||||
sheet.set("title"sv, move(title));
|
||||
|
||||
sheets.must_append(move(sheet));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue