mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:38:11 +00:00
LibWeb: Make BrowsingContext store Page member as NonnullGCPtr
No need to use WeakPtr anymore. Co-Authored-By: Andreas Kling <kling@serenityos.org>
This commit is contained in:
parent
7c926d04b7
commit
bf4c8f4a09
2 changed files with 10 additions and 9 deletions
|
@ -79,7 +79,7 @@ HTML::Origin determine_the_origin(AK::URL const& url, SandboxingFlagSet sandbox_
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#creating-a-new-auxiliary-browsing-context
|
||||
WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext::create_a_new_auxiliary_browsing_context_and_document(Page& page, JS::NonnullGCPtr<HTML::BrowsingContext> opener)
|
||||
WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext::create_a_new_auxiliary_browsing_context_and_document(JS::NonnullGCPtr<Page> page, JS::NonnullGCPtr<HTML::BrowsingContext> opener)
|
||||
{
|
||||
// 1. Let openerTopLevelBrowsingContext be opener's top-level traversable's active browsing context.
|
||||
auto opener_top_level_browsing_context = opener->top_level_traversable()->active_browsing_context();
|
||||
|
@ -110,7 +110,7 @@ WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#creating-a-new-browsing-context
|
||||
WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext::create_a_new_browsing_context_and_document(Page& page, JS::GCPtr<DOM::Document> creator, JS::GCPtr<DOM::Element> embedder, JS::NonnullGCPtr<BrowsingContextGroup> group)
|
||||
WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext::create_a_new_browsing_context_and_document(JS::NonnullGCPtr<Page> page, JS::GCPtr<DOM::Document> creator, JS::GCPtr<DOM::Element> embedder, JS::NonnullGCPtr<BrowsingContextGroup> group)
|
||||
{
|
||||
auto& vm = group->vm();
|
||||
|
||||
|
@ -263,7 +263,7 @@ WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext
|
|||
return BrowsingContext::BrowsingContextAndDocument { browsing_context, document };
|
||||
}
|
||||
|
||||
BrowsingContext::BrowsingContext(Page& page, HTML::NavigableContainer* container)
|
||||
BrowsingContext::BrowsingContext(JS::NonnullGCPtr<Page> page, HTML::NavigableContainer* container)
|
||||
: m_page(page)
|
||||
, m_event_handler({}, *this)
|
||||
, m_container(container)
|
||||
|
@ -284,6 +284,7 @@ void BrowsingContext::visit_edges(Cell::Visitor& visitor)
|
|||
{
|
||||
Base::visit_edges(visitor);
|
||||
|
||||
visitor.visit(m_page);
|
||||
for (auto& entry : m_session_history)
|
||||
visitor.visit(entry);
|
||||
visitor.visit(m_container);
|
||||
|
@ -335,7 +336,7 @@ bool BrowsingContext::is_top_level() const
|
|||
|
||||
bool BrowsingContext::is_focused_context() const
|
||||
{
|
||||
return m_page && &m_page->focused_context() == this;
|
||||
return &m_page->focused_context() == this;
|
||||
}
|
||||
|
||||
void BrowsingContext::scroll_to(CSSPixelPoint position)
|
||||
|
@ -347,7 +348,7 @@ void BrowsingContext::scroll_to(CSSPixelPoint position)
|
|||
active_document()->update_layout();
|
||||
}
|
||||
|
||||
if (m_page && this == &m_page->top_level_browsing_context())
|
||||
if (this == &m_page->top_level_browsing_context())
|
||||
m_page->client().page_did_request_scroll_to(position);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue