ResolutionStyleValue.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2022-2023, Sam Atkins <atkinssj@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/CSS/Resolution.h>
  8. #include <LibWeb/CSS/StyleValue.h>
  9. namespace Web::CSS {
  10. class ResolutionStyleValue : public StyleValueWithDefaultOperators<ResolutionStyleValue> {
  11. public:
  12. static ValueComparingNonnullRefPtr<ResolutionStyleValue> create(Resolution resolution)
  13. {
  14. return adopt_ref(*new ResolutionStyleValue(move(resolution)));
  15. }
  16. virtual ~ResolutionStyleValue() override = default;
  17. Resolution const& resolution() const { return m_resolution; }
  18. virtual ErrorOr<String> to_string() const override { return m_resolution.to_string(); }
  19. bool properties_equal(ResolutionStyleValue const& other) const { return m_resolution == other.m_resolution; }
  20. private:
  21. explicit ResolutionStyleValue(Resolution resolution)
  22. : StyleValueWithDefaultOperators(Type::Resolution)
  23. , m_resolution(move(resolution))
  24. {
  25. }
  26. Resolution m_resolution;
  27. };
  28. }