mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 22:38:51 +00:00
LibWeb/CSS: Serialize @font-face
closer to spec
Read the descriptor style values instead of producing a ParsedFontFace first, as this means we know if a descriptor is actually present, or has been defaulted to an initial value. This lets us correctly skip the unicode-range if it was not explicitly set. Firefox and Chromium both serialize using the "font-stretch" name, (which is an alias for font-width) which follows the outdated cssom spec, so I've done so too to match them. The one thing that we still do differently in this test is that those browsers check explicitly if `font-stretch` was set, and ignore when `font-width` is. I've also inlined the `serialize_a_local()` function to the one place it's used. The style value to_string() method was already wrapping the string in quotes, so calling serialize_a_string() on it was producing `local("\this mess\"")`. It's clearer what's happening when the code isn't split up.
This commit is contained in:
parent
a7f7c2a821
commit
ee647616b2
Notes:
github-actions[bot]
2025-04-07 09:02:33 +00:00
Author: https://github.com/AtkinsSJ
Commit: ee647616b2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4224
5 changed files with 33 additions and 114 deletions
|
@ -24,8 +24,14 @@ String FontSourceStyleValue::to_string(SerializationMode) const
|
|||
return m_source.visit(
|
||||
[](Local const& local) {
|
||||
// local(<family-name>)
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#serialize-a-local
|
||||
// To serialize a LOCAL means to create a string represented by "local(",
|
||||
// followed by the serialization of the LOCAL as a string, followed by ")".
|
||||
StringBuilder builder;
|
||||
serialize_a_local(builder, local.name->to_string(SerializationMode::Normal));
|
||||
builder.append("local("sv);
|
||||
builder.append(local.name->to_string(SerializationMode::Normal));
|
||||
builder.append(')');
|
||||
return builder.to_string_without_validation();
|
||||
},
|
||||
[this](URL::URL const& url) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue