mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 18:32:28 -05: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);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@ public:
|
|||
JS::NonnullGCPtr<DOM::Document> document;
|
||||
};
|
||||
|
||||
static WebIDL::ExceptionOr<BrowsingContextAndDocument> create_a_new_browsing_context_and_document(Page& page, JS::GCPtr<DOM::Document> creator, JS::GCPtr<DOM::Element> embedder, JS::NonnullGCPtr<BrowsingContextGroup> group);
|
||||
static WebIDL::ExceptionOr<BrowsingContextAndDocument> create_a_new_auxiliary_browsing_context_and_document(Page& page, JS::NonnullGCPtr<HTML::BrowsingContext> opener);
|
||||
static WebIDL::ExceptionOr<BrowsingContextAndDocument> 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);
|
||||
static WebIDL::ExceptionOr<BrowsingContextAndDocument> create_a_new_auxiliary_browsing_context_and_document(JS::NonnullGCPtr<Page> page, JS::NonnullGCPtr<HTML::BrowsingContext> opener);
|
||||
|
||||
virtual ~BrowsingContext() override;
|
||||
|
||||
|
@ -183,13 +183,13 @@ public:
|
|||
virtual void set_window_handle(String handle) override { m_window_handle = move(handle); }
|
||||
|
||||
private:
|
||||
explicit BrowsingContext(Page&, HTML::NavigableContainer*);
|
||||
explicit BrowsingContext(JS::NonnullGCPtr<Page>, HTML::NavigableContainer*);
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
void reset_cursor_blink_cycle();
|
||||
|
||||
WeakPtr<Page> m_page;
|
||||
JS::NonnullGCPtr<Page> m_page;
|
||||
|
||||
Web::EventHandler m_event_handler;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue