SVGClipPathElement.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. JS_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)
  25. {
  26. SVGElement::attribute_changed(name, old_value, value);
  27. if (name == AttributeNames::clipPathUnits)
  28. m_clip_path_units = AttributeParser::parse_units(value.value_or(String {}));
  29. }
  30. JS::GCPtr<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. }