mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb/CSS: Add alternative src() syntax for URLs
url() has some limitations because of allowing unquoted URLs as its contents. For example, it can't use `var()`. To get around this, there's an alternative `src()` function which behaves the same as `url()` except that it is parsed as a regular function, which makes `var()` and friends work properly. There's no WPT test for this as far as I can tell, so I added our own.
This commit is contained in:
committed by
Andreas Kling
parent
ea0bfda1b9
commit
00f76ccbf4
Notes:
github-actions[bot]
2025-06-11 14:27:18 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/00f76ccbf4f Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5041
@@ -44,7 +44,12 @@ private:
|
||||
// https://drafts.csswg.org/css-values-4/#urls
|
||||
class URL {
|
||||
public:
|
||||
URL(String url, Vector<RequestURLModifier> = {});
|
||||
enum class Type : u8 {
|
||||
Url,
|
||||
Src,
|
||||
};
|
||||
|
||||
URL(String url, Type = Type::Url, Vector<RequestURLModifier> = {});
|
||||
|
||||
String const& url() const { return m_url; }
|
||||
Vector<RequestURLModifier> const& request_url_modifiers() const { return m_request_url_modifiers; }
|
||||
@@ -53,6 +58,7 @@ public:
|
||||
bool operator==(URL const&) const;
|
||||
|
||||
private:
|
||||
Type m_type;
|
||||
String m_url;
|
||||
Vector<RequestURLModifier> m_request_url_modifiers;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user