TimeStyleValue.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
  4. * Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.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/StyleValue.h>
  11. #include <LibWeb/CSS/Time.h>
  12. namespace Web::CSS {
  13. class TimeStyleValue : public StyleValueWithDefaultOperators<TimeStyleValue> {
  14. public:
  15. static ValueComparingNonnullRefPtr<TimeStyleValue> create(Time time)
  16. {
  17. return adopt_ref(*new TimeStyleValue(move(time)));
  18. }
  19. virtual ~TimeStyleValue() override = default;
  20. Time const& time() const { return m_time; }
  21. virtual ErrorOr<String> to_string() const override { return m_time.to_string(); }
  22. bool properties_equal(TimeStyleValue const& other) const { return m_time == other.m_time; }
  23. private:
  24. explicit TimeStyleValue(Time time)
  25. : StyleValueWithDefaultOperators(Type::Time)
  26. , m_time(move(time))
  27. {
  28. }
  29. Time m_time;
  30. };
  31. }