AngleStyleValue.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
  3. * Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
  4. * Copyright (c) 2021-2024, Sam Atkins <sam@ladybird.org>
  5. * Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
  6. *
  7. * SPDX-License-Identifier: BSD-2-Clause
  8. */
  9. #pragma once
  10. #include <LibWeb/CSS/Angle.h>
  11. #include <LibWeb/CSS/StyleValues/CSSUnitValue.h>
  12. namespace Web::CSS {
  13. class AngleStyleValue : public CSSUnitValue {
  14. public:
  15. static ValueComparingNonnullRefPtr<AngleStyleValue> create(Angle angle)
  16. {
  17. return adopt_ref(*new (nothrow) AngleStyleValue(move(angle)));
  18. }
  19. virtual ~AngleStyleValue() override;
  20. Angle const& angle() const { return m_angle; }
  21. virtual double value() const override { return m_angle.raw_value(); }
  22. virtual StringView unit() const override { return m_angle.unit_name(); }
  23. virtual String to_string() const override;
  24. bool equals(CSSStyleValue const& other) const override;
  25. private:
  26. explicit AngleStyleValue(Angle angle);
  27. Angle m_angle;
  28. };
  29. }