UnresolvedStyleValue.cpp 830 B

12345678910111213141516171819202122232425262728293031
  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 "UnresolvedStyleValue.h"
  10. #include <AK/StringBuilder.h>
  11. namespace Web::CSS {
  12. String UnresolvedStyleValue::to_string() const
  13. {
  14. StringBuilder builder;
  15. for (auto& value : m_values)
  16. builder.append(value.to_string());
  17. return MUST(builder.to_string());
  18. }
  19. bool UnresolvedStyleValue::equals(StyleValue const& other) const
  20. {
  21. if (type() != other.type())
  22. return false;
  23. // This is a case where comparing the strings actually makes sense.
  24. return to_string() == other.to_string();
  25. }
  26. }