SVGClipPathElement.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Bindings/Intrinsics.h>
  7. #include <LibWeb/Bindings/SVGClipPathElementPrototype.h>
  8. #include <LibWeb/SVG/AttributeNames.h>
  9. #include <LibWeb/SVG/SVGClipPathElement.h>
  10. namespace Web::SVG {
  11. GC_DEFINE_ALLOCATOR(SVGClipPathElement);
  12. SVGClipPathElement::SVGClipPathElement(DOM::Document& document, DOM::QualifiedName qualified_name)
  13. : SVGElement(document, move(qualified_name))
  14. {
  15. }
  16. SVGClipPathElement::~SVGClipPathElement()
  17. {
  18. }
  19. void SVGClipPathElement::initialize(JS::Realm& realm)
  20. {
  21. Base::initialize(realm);
  22. WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGClipPathElement);
  23. }
  24. void SVGClipPathElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
  25. {
  26. Base::attribute_changed(name, old_value, value, namespace_);
  27. if (name == AttributeNames::clipPathUnits)
  28. m_clip_path_units = AttributeParser::parse_units(value.value_or(String {}));
  29. }
  30. GC::Ptr<Layout::Node> SVGClipPathElement::create_layout_node(CSS::StyleProperties)
  31. {
  32. // Clip paths are handled as a special case in the TreeBuilder.
  33. return nullptr;
  34. }
  35. }