mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-26 20:26:53 +00:00
LibWeb/CSS: Use CSS::URL for font-fetching
ParsedFontFace and FontLoader now both keep track of which CSSStyleSheet (if any) was the source of the font-face, so the URLs can be completed correctly.
This commit is contained in:
parent
14fb567a0f
commit
9e2e796f2d
Notes:
github-actions[bot]
2025-05-03 11:02:47 +00:00
Author: https://github.com/AtkinsSJ
Commit: 9e2e796f2d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4536
9 changed files with 38 additions and 31 deletions
|
@ -34,11 +34,11 @@ String FontSourceStyleValue::to_string(SerializationMode) const
|
|||
builder.append(')');
|
||||
return builder.to_string_without_validation();
|
||||
},
|
||||
[this](::URL::URL const& url) {
|
||||
[this](URL const& url) {
|
||||
// <url> [ format(<font-format>)]? [ tech( <font-tech>#)]?
|
||||
// FIXME: tech()
|
||||
StringBuilder builder;
|
||||
serialize_a_url(builder, url.to_string());
|
||||
builder.append(url.to_string());
|
||||
|
||||
if (m_format.has_value()) {
|
||||
builder.append(" format("sv);
|
||||
|
@ -59,8 +59,8 @@ bool FontSourceStyleValue::properties_equal(FontSourceStyleValue const& other) c
|
|||
}
|
||||
return false;
|
||||
},
|
||||
[&other](::URL::URL const& url) {
|
||||
if (auto* other_url = other.m_source.get_pointer<::URL::URL>()) {
|
||||
[&other](URL const& url) {
|
||||
if (auto* other_url = other.m_source.get_pointer<URL>()) {
|
||||
return url == *other_url;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <AK/FlyString.h>
|
||||
#include <LibWeb/CSS/CSSStyleValue.h>
|
||||
#include <LibWeb/CSS/URL.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
@ -16,7 +17,7 @@ public:
|
|||
struct Local {
|
||||
NonnullRefPtr<CSSStyleValue const> name;
|
||||
};
|
||||
using Source = Variant<Local, ::URL::URL>;
|
||||
using Source = Variant<Local, URL>;
|
||||
|
||||
static ValueComparingNonnullRefPtr<FontSourceStyleValue const> create(Source source, Optional<FlyString> format)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue