Function.cpp 729 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2020-2021, the SerenityOS developers.
  3. * Copyright (c) 2021-2022, 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(String name)
  11. : m_name(move(name))
  12. {
  13. }
  14. Function::Function(String name, Vector<ComponentValue>&& values)
  15. : m_name(move(name))
  16. , m_values(move(values))
  17. {
  18. }
  19. Function::~Function() = default;
  20. String Function::to_string() const
  21. {
  22. StringBuilder builder;
  23. serialize_an_identifier(builder, m_name);
  24. builder.append("(");
  25. builder.join(" ", m_values);
  26. builder.append(")");
  27. return builder.to_string();
  28. }
  29. }