DocumentState.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2023, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #include <LibWeb/DOM/Document.h>
  8. #include <LibWeb/HTML/DocumentState.h>
  9. namespace Web::HTML {
  10. JS_DEFINE_ALLOCATOR(DocumentState);
  11. DocumentState::DocumentState() = default;
  12. DocumentState::~DocumentState() = default;
  13. void DocumentState::visit_edges(Cell::Visitor& visitor)
  14. {
  15. Base::visit_edges(visitor);
  16. visitor.visit(m_document);
  17. for (auto& nested_history : m_nested_histories) {
  18. for (auto& entry : nested_history.entries) {
  19. visitor.visit(entry);
  20. }
  21. }
  22. }
  23. JS::NonnullGCPtr<DocumentState> DocumentState::clone() const
  24. {
  25. JS::NonnullGCPtr<DocumentState> cloned = *heap().allocate_without_realm<DocumentState>();
  26. cloned->m_document = m_document;
  27. cloned->m_history_policy_container = m_history_policy_container;
  28. cloned->m_request_referrer = m_request_referrer;
  29. cloned->m_request_referrer_policy = m_request_referrer_policy;
  30. cloned->m_initiator_origin = m_initiator_origin;
  31. cloned->m_origin = m_origin;
  32. cloned->m_about_base_url = m_about_base_url;
  33. cloned->m_nested_histories = m_nested_histories;
  34. cloned->m_resource = m_resource;
  35. cloned->m_reload_pending = m_reload_pending;
  36. cloned->m_ever_populated = m_ever_populated;
  37. cloned->m_navigable_target_name = m_navigable_target_name;
  38. return cloned;
  39. }
  40. }