SVGTextElement.cpp 821 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (c) 2023, MacDue <macdue@dueutil.tech>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Layout/SVGTextBox.h>
  7. #include <LibWeb/SVG/SVGTextElement.h>
  8. namespace Web::SVG {
  9. SVGTextElement::SVGTextElement(DOM::Document& document, DOM::QualifiedName qualified_name)
  10. : SVGTextPositioningElement(document, move(qualified_name))
  11. {
  12. }
  13. JS::ThrowCompletionOr<void> SVGTextElement::initialize(JS::Realm& realm)
  14. {
  15. MUST_OR_THROW_OOM(Base::initialize(realm));
  16. set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGTextElementPrototype>(realm, "SVGTextElement"));
  17. return {};
  18. }
  19. JS::GCPtr<Layout::Node> SVGTextElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
  20. {
  21. return heap().allocate_without_realm<Layout::SVGTextBox>(document(), *this, move(style));
  22. }
  23. }