Text.cpp 780 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/DOM/Text.h>
  7. #include <LibWeb/HTML/HTMLInputElement.h>
  8. #include <LibWeb/HTML/Window.h>
  9. #include <LibWeb/Layout/TextNode.h>
  10. namespace Web::DOM {
  11. Text::Text(Document& document, const String& data)
  12. : CharacterData(document, NodeType::TEXT_NODE, data)
  13. {
  14. }
  15. // https://dom.spec.whatwg.org/#dom-text-text
  16. NonnullRefPtr<Text> Text::create_with_global_object(Bindings::WindowObject& window, String const& data)
  17. {
  18. return make_ref_counted<Text>(window.impl().associated_document(), data);
  19. }
  20. void Text::set_owner_input_element(Badge<HTML::HTMLInputElement>, HTML::HTMLInputElement& input_element)
  21. {
  22. m_owner_input_element = input_element;
  23. }
  24. }