ladybird/Libraries/LibWeb/CSS/StyleValues/EmptyOptionalStyleValue.h
Andreas Kling 164ed80244 Meta: Enable exit-time destructor warnings for libraries
Enable -Wexit-time-destructors for all in-tree library targets and
update process-lifetime library statics so they no longer register
exit-time destructors. Long-lived caches, lookup tables, singleton
registries, and generated constants now use NeverDestroyed or leaked
references where the data is intended to live until process exit.

Update LibWeb, LibLine, and the binding generators so regenerated
sources follow the same rule instead of reintroducing destructed
statics.
2026-06-04 19:20:49 +02:00

39 lines
1.3 KiB
C++

/*
* Copyright (c) 2026, Callum Law <callumlaw1709@outlook.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/CSS/StyleValues/StyleValue.h>
namespace Web::CSS {
class EmptyOptionalStyleValue final : public StyleValueWithDefaultOperators<EmptyOptionalStyleValue> {
public:
static ValueComparingNonnullRefPtr<EmptyOptionalStyleValue> create()
{
static auto& instance = adopt_ref(*new (nothrow) EmptyOptionalStyleValue()).leak_ref();
return instance;
}
virtual ~EmptyOptionalStyleValue() override = default;
// NB: This style is used to represent a missing optional value, it should only appear within a StyleValueList which
// will skip serializing/tokenizing it and the relevant separator so it should never be serialized/tokenized.
virtual void serialize(StringBuilder&, SerializationMode) const override { VERIFY_NOT_REACHED(); }
virtual Vector<Parser::ComponentValue> tokenize() const override { VERIFY_NOT_REACHED(); }
bool properties_equal(EmptyOptionalStyleValue const&) const { return true; }
virtual bool is_computationally_independent() const override { return true; }
private:
EmptyOptionalStyleValue()
: StyleValueWithDefaultOperators(Type::EmptyOptional)
{
}
};
}