BackgroundSizeStyleValue.cpp 838 B

1234567891011121314151617181920212223242526
  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. #include "BackgroundSizeStyleValue.h"
  10. namespace Web::CSS {
  11. BackgroundSizeStyleValue::BackgroundSizeStyleValue(LengthPercentage size_x, LengthPercentage size_y)
  12. : StyleValueWithDefaultOperators(Type::BackgroundSize)
  13. , m_properties { .size_x = size_x, .size_y = size_y }
  14. {
  15. }
  16. BackgroundSizeStyleValue::~BackgroundSizeStyleValue() = default;
  17. ErrorOr<String> BackgroundSizeStyleValue::to_string() const
  18. {
  19. return String::formatted("{} {}", TRY(m_properties.size_x.to_string()), TRY(m_properties.size_y.to_string()));
  20. }
  21. }