mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-15 12:39:13 +00:00
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
/*
|
|
* Copyright (c) 2025, Callum Law <callumlaw1709@outlook.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/CSS/StyleValues/CalculatedStyleValue.h>
|
|
#include <LibWeb/CSS/StyleValues/NumberStyleValue.h>
|
|
#include <LibWeb/CSS/StyleValues/StyleValue.h>
|
|
|
|
namespace Web::CSS {
|
|
|
|
class SuperellipseStyleValue final : public StyleValueWithDefaultOperators<SuperellipseStyleValue> {
|
|
public:
|
|
static ValueComparingNonnullRefPtr<SuperellipseStyleValue const> create(ValueComparingNonnullRefPtr<StyleValue const> const& parameter)
|
|
{
|
|
return adopt_ref(*new (nothrow) SuperellipseStyleValue(parameter));
|
|
}
|
|
virtual ~SuperellipseStyleValue() override = default;
|
|
|
|
// NOTE: This function can only be called after absolutization
|
|
double parameter() const
|
|
{
|
|
if (m_parameter->is_calculated())
|
|
return m_parameter->as_calculated().resolve_number({}).value();
|
|
|
|
return m_parameter->as_number().number();
|
|
}
|
|
|
|
virtual String to_string(SerializationMode serialization_mode) const override;
|
|
|
|
virtual ValueComparingNonnullRefPtr<StyleValue const> absolutized(ComputationContext const&) const override;
|
|
|
|
bool properties_equal(SuperellipseStyleValue const& other) const { return m_parameter == other.m_parameter; }
|
|
|
|
private:
|
|
explicit SuperellipseStyleValue(ValueComparingNonnullRefPtr<StyleValue const> const& parameter)
|
|
: StyleValueWithDefaultOperators(Type::Superellipse)
|
|
, m_parameter(parameter)
|
|
{
|
|
}
|
|
|
|
ValueComparingNonnullRefPtr<StyleValue const> m_parameter;
|
|
};
|
|
|
|
}
|