ladybird/Libraries/LibWeb/CSS/StyleValues/ScaleStyleValue.h
Andreas Kling 9a7c9286c4
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, 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
Push notes / build (push) Waiting to run
LibWeb: Support individual scale CSS property
2024-11-22 20:06:44 +01:00

49 lines
1.2 KiB
C++

/*
* Copyright (c) 2024, Andreas Kling <andreas@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/CSS/CSSStyleValue.h>
#include <LibWeb/CSS/PercentageOr.h>
namespace Web::CSS {
class ScaleStyleValue : public StyleValueWithDefaultOperators<ScaleStyleValue> {
public:
static ValueComparingNonnullRefPtr<ScaleStyleValue> create(NumberPercentage x, NumberPercentage y)
{
return adopt_ref(*new (nothrow) ScaleStyleValue(move(x), move(y)));
}
virtual ~ScaleStyleValue() override = default;
NumberPercentage const& x() const { return m_properties.x; }
NumberPercentage const& y() const { return m_properties.y; }
virtual String to_string() const override;
bool properties_equal(ScaleStyleValue const& other) const { return m_properties == other.m_properties; }
private:
explicit ScaleStyleValue(
NumberPercentage x,
NumberPercentage y)
: StyleValueWithDefaultOperators(Type::Scale)
, m_properties {
.x = move(x),
.y = move(y),
}
{
}
struct Properties {
NumberPercentage x;
NumberPercentage y;
bool operator==(Properties const&) const = default;
} m_properties;
};
}