mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Use GC::Ptr for BrowsingContext pointer saved in Document
Likely we forgot to update `WeakPtr` to `GC::Ptr` after converting `BrowsingContext` to GC-allocated object.
This commit is contained in:
parent
59a867d3e3
commit
1bf4d3391e
Notes:
github-actions[bot]
2025-07-17 14:56:57 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 1bf4d3391e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5489
Reviewed-by: https://github.com/AtkinsSJ ✅
5 changed files with 9 additions and 9 deletions
|
@ -544,6 +544,7 @@ void Document::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_inspected_node);
|
||||
visitor.visit(m_highlighted_node);
|
||||
visitor.visit(m_active_favicon);
|
||||
visitor.visit(m_browsing_context);
|
||||
visitor.visit(m_focused_element);
|
||||
visitor.visit(m_active_element);
|
||||
visitor.visit(m_target_element);
|
||||
|
@ -4239,7 +4240,7 @@ GC::Ptr<HTML::HTMLParser> Document::active_parser()
|
|||
return m_parser;
|
||||
}
|
||||
|
||||
void Document::set_browsing_context(HTML::BrowsingContext* browsing_context)
|
||||
void Document::set_browsing_context(GC::Ptr<HTML::BrowsingContext> browsing_context)
|
||||
{
|
||||
m_browsing_context = browsing_context;
|
||||
}
|
||||
|
|
|
@ -308,10 +308,10 @@ public:
|
|||
String title() const;
|
||||
WebIDL::ExceptionOr<void> set_title(String const&);
|
||||
|
||||
HTML::BrowsingContext* browsing_context() { return m_browsing_context.ptr(); }
|
||||
HTML::BrowsingContext const* browsing_context() const { return m_browsing_context.ptr(); }
|
||||
GC::Ptr<HTML::BrowsingContext> browsing_context() { return m_browsing_context; }
|
||||
GC::Ptr<HTML::BrowsingContext const> browsing_context() const { return m_browsing_context; }
|
||||
|
||||
void set_browsing_context(HTML::BrowsingContext*);
|
||||
void set_browsing_context(GC::Ptr<HTML::BrowsingContext>);
|
||||
|
||||
Page& page();
|
||||
Page const& page() const;
|
||||
|
@ -960,7 +960,7 @@ private:
|
|||
OwnPtr<CSS::StyleComputer> m_style_computer;
|
||||
GC::Ptr<CSS::StyleSheetList> m_style_sheets;
|
||||
GC::Ptr<Node> m_active_favicon;
|
||||
WeakPtr<HTML::BrowsingContext> m_browsing_context;
|
||||
GC::Ptr<HTML::BrowsingContext> m_browsing_context;
|
||||
URL::URL m_url;
|
||||
mutable OwnPtr<ElementByIdMap> m_element_by_id;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ bool BarProp::visible() const
|
|||
{
|
||||
// 1. Let browsingContext be this's relevant global object's browsing context.
|
||||
auto& global_object = HTML::relevant_global_object(*this);
|
||||
auto* browsing_context = as<HTML::Window>(global_object).associated_document().browsing_context();
|
||||
auto browsing_context = as<HTML::Window>(global_object).associated_document().browsing_context();
|
||||
|
||||
// 2. If browsingContext is null, then return true.
|
||||
if (!browsing_context) {
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
class BrowsingContext final : public JS::Cell
|
||||
, public Weakable<BrowsingContext> {
|
||||
class BrowsingContext final : public JS::Cell {
|
||||
GC_CELL(BrowsingContext, JS::Cell);
|
||||
GC_DECLARE_ALLOCATOR(BrowsingContext);
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ static CSSPixelPoint get_parent_offset(HTML::BrowsingContext const& browsing_con
|
|||
// 4. If parent navigable is not null:
|
||||
if (parent_navigable && parent_navigable->active_document() && parent_navigable->active_document()->browsing_context()) {
|
||||
// 1. Let parent context be parent navigable's document's browsing context.
|
||||
auto* parent_context = parent_navigable->active_document()->browsing_context();
|
||||
auto parent_context = parent_navigable->active_document()->browsing_context();
|
||||
|
||||
// 2. Let (parentOffsetLeft, parentOffsetTop) be result of get parent offset of parent context.
|
||||
auto parent_offset = get_parent_offset(*parent_context);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue