HTMLTitleElement.cpp 895 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Bindings/HTMLTitleElementPrototype.h>
  7. #include <LibWeb/DOM/Document.h>
  8. #include <LibWeb/HTML/HTMLTitleElement.h>
  9. #include <LibWeb/Page/Page.h>
  10. namespace Web::HTML {
  11. HTMLTitleElement::HTMLTitleElement(DOM::Document& document, DOM::QualifiedName qualified_name)
  12. : HTMLElement(document, move(qualified_name))
  13. {
  14. set_prototype(&window().ensure_web_prototype<Bindings::HTMLTitleElementPrototype>("HTMLTitleElement"));
  15. }
  16. HTMLTitleElement::~HTMLTitleElement() = default;
  17. void HTMLTitleElement::children_changed()
  18. {
  19. HTMLElement::children_changed();
  20. if (auto* page = document().page()) {
  21. if (document().browsing_context() == &page->top_level_browsing_context())
  22. page->client().page_did_change_title(document().title());
  23. }
  24. }
  25. }