mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 23:59:49 +00:00
LibWeb/CSS: Use CSS::URL for <url>
and <paint>
types
This commit is contained in:
parent
d301510ab2
commit
326933cd93
Notes:
github-actions[bot]
2025-04-30 16:39:41 +00:00
Author: https://github.com/AtkinsSJ
Commit: 326933cd93
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4531
7 changed files with 40 additions and 26 deletions
|
@ -32,6 +32,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/CursorStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
|
||||
#include <LibWeb/CSS/Transformation.h>
|
||||
#include <LibWeb/CSS/URL.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
@ -225,40 +226,40 @@ public:
|
|||
: m_value(color)
|
||||
{
|
||||
}
|
||||
SVGPaint(::URL::URL const& url)
|
||||
SVGPaint(URL const& url)
|
||||
: m_value(url)
|
||||
{
|
||||
}
|
||||
|
||||
bool is_color() const { return m_value.has<Color>(); }
|
||||
bool is_url() const { return m_value.has<::URL::URL>(); }
|
||||
bool is_url() const { return m_value.has<URL>(); }
|
||||
Color as_color() const { return m_value.get<Color>(); }
|
||||
::URL::URL const& as_url() const { return m_value.get<::URL::URL>(); }
|
||||
URL const& as_url() const { return m_value.get<URL>(); }
|
||||
|
||||
private:
|
||||
Variant<::URL::URL, Color> m_value;
|
||||
Variant<URL, Color> m_value;
|
||||
};
|
||||
|
||||
// https://drafts.fxtf.org/css-masking-1/#typedef-mask-reference
|
||||
class MaskReference {
|
||||
public:
|
||||
// TODO: Support other mask types.
|
||||
MaskReference(::URL::URL const& url)
|
||||
MaskReference(URL const& url)
|
||||
: m_url(url)
|
||||
{
|
||||
}
|
||||
|
||||
::URL::URL const& url() const { return m_url; }
|
||||
URL const& url() const { return m_url; }
|
||||
|
||||
private:
|
||||
::URL::URL m_url;
|
||||
URL m_url;
|
||||
};
|
||||
|
||||
// https://drafts.fxtf.org/css-masking/#the-clip-path
|
||||
// TODO: Support clip sources.
|
||||
class ClipPathReference {
|
||||
public:
|
||||
ClipPathReference(::URL::URL const& url)
|
||||
ClipPathReference(URL const& url)
|
||||
: m_clip_source(url)
|
||||
{
|
||||
}
|
||||
|
@ -270,16 +271,16 @@ public:
|
|||
|
||||
bool is_basic_shape() const { return m_clip_source.has<BasicShape>(); }
|
||||
|
||||
bool is_url() const { return m_clip_source.has<::URL::URL>(); }
|
||||
bool is_url() const { return m_clip_source.has<URL>(); }
|
||||
|
||||
::URL::URL const& url() const { return m_clip_source.get<::URL::URL>(); }
|
||||
URL const& url() const { return m_clip_source.get<URL>(); }
|
||||
|
||||
BasicShapeStyleValue const& basic_shape() const { return *m_clip_source.get<BasicShape>(); }
|
||||
|
||||
private:
|
||||
using BasicShape = NonnullRefPtr<BasicShapeStyleValue const>;
|
||||
|
||||
Variant<::URL::URL, BasicShape> m_clip_source;
|
||||
Variant<URL, BasicShape> m_clip_source;
|
||||
};
|
||||
|
||||
struct BackgroundLayerData {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue