mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-16 04:59:23 +00:00
When setting style to a CSSStyleValue we need to convert it to a StyleValue. If we already have one, we might as well use it avoid the work of serialization and re-parsing. I realised I misunderstood what "constructed from a USVString" means, so I've adjusted based on that. It does raise a question on what the source USVString is if that string resulted in multiple CSSStyleValues being created - see the linked issue.
31 lines
786 B
C++
31 lines
786 B
C++
/*
|
|
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/CSS/CSSStyleValue.h>
|
|
|
|
namespace Web::CSS {
|
|
|
|
// https://drafts.css-houdini.org/css-typed-om-1/#cssimagevalue
|
|
class CSSImageValue final : public CSSStyleValue {
|
|
WEB_PLATFORM_OBJECT(CSSImageValue, CSSStyleValue);
|
|
GC_DECLARE_ALLOCATOR(CSSImageValue);
|
|
|
|
public:
|
|
[[nodiscard]] static GC::Ref<CSSImageValue> create(JS::Realm&, NonnullRefPtr<StyleValue const> source_value);
|
|
|
|
virtual ~CSSImageValue() override = default;
|
|
|
|
virtual WebIDL::ExceptionOr<String> to_string() const override;
|
|
|
|
private:
|
|
explicit CSSImageValue(JS::Realm&, NonnullRefPtr<StyleValue const> source_value);
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
};
|
|
|
|
}
|