2023-04-20 18:31:00 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2023, MacDue <macdue@dueutil.tech>
|
2025-04-29 15:32:46 +01:00
|
|
|
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
|
2023-04-20 18:31:00 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-08-14 11:10:54 +01:00
|
|
|
#include <LibWeb/CSS/CSSStyleValue.h>
|
2025-04-29 15:32:46 +01:00
|
|
|
#include <LibWeb/CSS/URL.h>
|
2023-04-20 18:31:00 +01:00
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
|
|
|
class URLStyleValue final : public StyleValueWithDefaultOperators<URLStyleValue> {
|
|
|
|
public:
|
2025-04-29 15:32:46 +01:00
|
|
|
static ValueComparingNonnullRefPtr<URLStyleValue const> create(URL const& url)
|
2023-04-20 18:31:00 +01:00
|
|
|
{
|
2023-08-19 14:00:10 +01:00
|
|
|
return adopt_ref(*new (nothrow) URLStyleValue(url));
|
2023-04-20 18:31:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~URLStyleValue() override = default;
|
|
|
|
|
2025-04-29 15:32:46 +01:00
|
|
|
URL const& url() const { return m_url; }
|
2023-04-20 18:31:00 +01:00
|
|
|
|
|
|
|
bool properties_equal(URLStyleValue const& other) const { return m_url == other.m_url; }
|
|
|
|
|
2024-12-07 00:59:49 +01:00
|
|
|
virtual String to_string(SerializationMode) const override
|
2023-04-20 18:31:00 +01:00
|
|
|
{
|
2025-04-29 15:32:46 +01:00
|
|
|
return m_url.to_string();
|
2023-04-20 18:31:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2025-04-29 15:32:46 +01:00
|
|
|
URLStyleValue(URL const& url)
|
2023-08-20 13:37:12 +01:00
|
|
|
: StyleValueWithDefaultOperators(Type::URL)
|
2023-04-20 18:31:00 +01:00
|
|
|
, m_url(url)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2025-04-29 15:32:46 +01:00
|
|
|
URL m_url;
|
2023-04-20 18:31:00 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|