CSSStyleDeclaration.cpp 830 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/CSS/CSSStyleDeclaration.h>
  7. #include <LibWeb/DOM/Element.h>
  8. namespace Web::CSS {
  9. CSSStyleDeclaration::CSSStyleDeclaration(Vector<StyleProperty>&& properties)
  10. : m_properties(move(properties))
  11. {
  12. }
  13. CSSStyleDeclaration::~CSSStyleDeclaration()
  14. {
  15. }
  16. String CSSStyleDeclaration::item(size_t index) const
  17. {
  18. if (index >= m_properties.size())
  19. return {};
  20. return CSS::string_from_property_id(m_properties[index].property_id);
  21. }
  22. ElementInlineCSSStyleDeclaration::ElementInlineCSSStyleDeclaration(DOM::Element& element)
  23. : CSSStyleDeclaration({})
  24. , m_element(element.make_weak_ptr<DOM::Element>())
  25. {
  26. }
  27. ElementInlineCSSStyleDeclaration::~ElementInlineCSSStyleDeclaration()
  28. {
  29. }
  30. }