mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +00:00
LibWeb: Use FlyString for local font sources
The next commit will make it so we always have a FlyString, so this lets us keep using it instead of turning it into a String.
This commit is contained in:
parent
f8536fc48a
commit
93a2c9946f
Notes:
github-actions[bot]
2025-03-25 07:55:01 +00:00
Author: https://github.com/AtkinsSJ
Commit: 93a2c9946f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4073
4 changed files with 4 additions and 4 deletions
|
@ -68,7 +68,7 @@ String CSSFontFaceRule::serialized() const
|
||||||
if (source.local_or_url.has<URL::URL>()) {
|
if (source.local_or_url.has<URL::URL>()) {
|
||||||
serialize_a_url(builder, source.local_or_url.get<URL::URL>().to_string());
|
serialize_a_url(builder, source.local_or_url.get<URL::URL>().to_string());
|
||||||
} else {
|
} else {
|
||||||
builder.appendff("local({})", source.local_or_url.get<String>());
|
builder.appendff("local({})", source.local_or_url.get<FlyString>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: No spec currently exists for format()
|
// NOTE: No spec currently exists for format()
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace Web::CSS {
|
||||||
class ParsedFontFace {
|
class ParsedFontFace {
|
||||||
public:
|
public:
|
||||||
struct Source {
|
struct Source {
|
||||||
Variant<String, URL::URL> local_or_url;
|
Variant<FlyString, URL::URL> local_or_url;
|
||||||
// FIXME: Do we need to keep this around, or is it only needed to discard unwanted formats during parsing?
|
// FIXME: Do we need to keep this around, or is it only needed to discard unwanted formats during parsing?
|
||||||
Optional<FlyString> format;
|
Optional<FlyString> format;
|
||||||
};
|
};
|
||||||
|
|
|
@ -672,7 +672,7 @@ Vector<ParsedFontFace::Source> Parser::parse_font_face_src(TokenStream<T>& compo
|
||||||
if (first.function().value.is_empty()) {
|
if (first.function().value.is_empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
supported_sources.empend(first.function().value.first().to_string(), Optional<FlyString> {});
|
supported_sources.empend(FlyString { first.function().value.first().to_string() }, Optional<FlyString> {});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -715,7 +715,7 @@ void dump_font_face_rule(StringBuilder& builder, CSS::CSSFontFaceRule const& rul
|
||||||
if (source.local_or_url.has<URL::URL>())
|
if (source.local_or_url.has<URL::URL>())
|
||||||
builder.appendff("url={}, format={}\n", source.local_or_url.get<URL::URL>(), source.format.value_or("???"_string));
|
builder.appendff("url={}, format={}\n", source.local_or_url.get<URL::URL>(), source.format.value_or("???"_string));
|
||||||
else
|
else
|
||||||
builder.appendff("local={}\n", source.local_or_url.get<AK::String>());
|
builder.appendff("local={}\n", source.local_or_url.get<FlyString>());
|
||||||
}
|
}
|
||||||
|
|
||||||
indent(builder, indent_levels + 1);
|
indent(builder, indent_levels + 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue