Function.cpp 717 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2020-2021, the SerenityOS developers.
  3. * Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #include <LibWeb/CSS/Parser/Function.h>
  8. #include <LibWeb/CSS/Serialize.h>
  9. namespace Web::CSS::Parser {
  10. Function::Function(FlyString name, Vector<ComponentValue>&& values)
  11. : m_name(move(name))
  12. , m_values(move(values))
  13. {
  14. }
  15. Function::~Function() = default;
  16. String Function::to_string() const
  17. {
  18. StringBuilder builder;
  19. serialize_an_identifier(builder, m_name);
  20. builder.append('(');
  21. for (auto& item : m_values)
  22. builder.append(item.to_string());
  23. builder.append(')');
  24. return MUST(builder.to_string());
  25. }
  26. }