mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb/CSS: Store the style sheet's source text on the CSSStyleSheet
This is to enable the inspector to show this source. There's a fairly hefty FIXME here because duplicating the source text is a significant waste of memory. But I don't want to get too sidetracked.
This commit is contained in:
parent
8cbc211616
commit
b00137df38
Notes:
github-actions[bot]
2024-09-03 09:13:23 +00:00
Author: https://github.com/AtkinsSJ
Commit: b00137df38
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1168
Reviewed-by: https://github.com/trflynn89
3 changed files with 22 additions and 2 deletions
|
@ -20,9 +20,14 @@ CSS::CSSStyleSheet* parse_css_stylesheet(CSS::Parser::ParsingContext const& cont
|
|||
if (css.is_empty()) {
|
||||
auto rule_list = CSS::CSSRuleList::create_empty(context.realm());
|
||||
auto media_list = CSS::MediaList::create(context.realm(), {});
|
||||
return CSS::CSSStyleSheet::create(context.realm(), rule_list, media_list, location);
|
||||
auto style_sheet = CSS::CSSStyleSheet::create(context.realm(), rule_list, media_list, location);
|
||||
style_sheet->set_source_text({});
|
||||
return style_sheet;
|
||||
}
|
||||
return CSS::Parser::Parser::create(context, css).parse_as_css_stylesheet(location);
|
||||
auto* style_sheet = CSS::Parser::Parser::create(context, css).parse_as_css_stylesheet(location);
|
||||
// FIXME: Avoid this copy
|
||||
style_sheet->set_source_text(MUST(String::from_utf8(css)));
|
||||
return style_sheet;
|
||||
}
|
||||
|
||||
CSS::ElementInlineCSSStyleDeclaration* parse_css_style_attribute(CSS::Parser::ParsingContext const& context, StringView css, DOM::Element& element)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue