ladybird/Libraries/LibWeb/CSS/CSSImageValue.h
Sam Atkins 5178d1ebe3 LibWeb/CSS: Add flag to disable create-internal-rep type checking
CSSTransformComponents hold other CSSStyleValues as their parameters. We
want to be able to create internal representations from those parameters
without them caring if they would be valid when directly assigned to the
property.

This is a temporary solution to make transform functions work. To be
completely correct, we need to know what is allowed in that context,
along with value ranges - a combination of the contexts we create when
parsing, and when computing calculations. For transform functions, this
doesn't matter, as there's no limit to the range of allowed values.
2025-10-14 13:41:47 +01:00

32 lines
945 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;
virtual WebIDL::ExceptionOr<NonnullRefPtr<StyleValue const>> create_an_internal_representation(PropertyNameAndID const&, PerformTypeCheck) const override;
private:
explicit CSSImageValue(JS::Realm&, NonnullRefPtr<StyleValue const> source_value);
virtual void initialize(JS::Realm&) override;
};
}