LibGC+Everywhere: Factor out a LibGC from LibJS

Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:

 * JS::NonnullGCPtr -> GC::Ref
 * JS::GCPtr -> GC::Ptr
 * JS::HeapFunction -> GC::Function
 * JS::CellImpl -> GC::Cell
 * JS::Handle -> GC::Root
This commit is contained in:
Shannon Booth 2024-11-15 04:01:23 +13:00 committed by Andreas Kling
parent ce23efc5f6
commit f87041bf3a
Notes: github-actions[bot] 2024-11-15 13:50:17 +00:00
1722 changed files with 9939 additions and 9906 deletions

View file

@ -10,7 +10,7 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(AudioBox);
GC_DEFINE_ALLOCATOR(AudioBox);
AudioBox::AudioBox(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
: ReplacedBox(document, element, move(style))
@ -29,7 +29,7 @@ HTML::HTMLAudioElement const& AudioBox::dom_node() const
return static_cast<HTML::HTMLAudioElement const&>(ReplacedBox::dom_node());
}
JS::GCPtr<Painting::Paintable> AudioBox::create_paintable() const
GC::Ptr<Painting::Paintable> AudioBox::create_paintable() const
{
return Painting::AudioPaintable::create(*this);
}

View file

@ -13,14 +13,14 @@
namespace Web::Layout {
class AudioBox final : public ReplacedBox {
JS_CELL(AudioBox, ReplacedBox);
JS_DECLARE_ALLOCATOR(AudioBox);
GC_CELL(AudioBox, ReplacedBox);
GC_DECLARE_ALLOCATOR(AudioBox);
public:
HTML::HTMLAudioElement& dom_node();
HTML::HTMLAudioElement const& dom_node() const;
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
private:
AudioBox(DOM::Document&, DOM::Element&, CSS::StyleProperties);

View file

@ -26,7 +26,7 @@ Painting::PaintableWithLines const* BlockContainer::paintable_with_lines() const
return static_cast<Painting::PaintableWithLines const*>(Box::paintable_box());
}
JS::GCPtr<Painting::Paintable> BlockContainer::create_paintable() const
GC::Ptr<Painting::Paintable> BlockContainer::create_paintable() const
{
return Painting::PaintableWithLines::create(*this);
}

View file

@ -13,7 +13,7 @@ namespace Web::Layout {
// https://www.w3.org/TR/css-display/#block-container
class BlockContainer : public Box {
JS_CELL(BlockContainer, Box);
GC_CELL(BlockContainer, Box);
public:
BlockContainer(DOM::Document&, DOM::Node*, CSS::StyleProperties);
@ -22,7 +22,7 @@ public:
Painting::PaintableWithLines const* paintable_with_lines() const;
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
private:
virtual bool is_block_container() const final { return true; }

View file

@ -87,7 +87,7 @@ private:
};
struct FloatingBox {
JS::NonnullGCPtr<Box const> box;
GC::Ref<Box const> box;
LayoutState::UsedValues& used_values;

View file

@ -34,7 +34,7 @@ void Box::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_contained_abspos_children);
}
JS::GCPtr<Painting::Paintable> Box::create_paintable() const
GC::Ptr<Painting::Paintable> Box::create_paintable() const
{
return Painting::PaintableBox::create(*this);
}

View file

@ -19,7 +19,7 @@ struct LineBoxFragmentCoordinate {
};
class Box : public NodeWithStyleAndBoxModelMetrics {
JS_CELL(Box, NodeWithStyleAndBoxModelMetrics);
GC_CELL(Box, NodeWithStyleAndBoxModelMetrics);
public:
Painting::PaintableBox const* paintable_box() const;
@ -46,11 +46,11 @@ public:
virtual void did_set_content_size() { }
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
void add_contained_abspos_child(JS::NonnullGCPtr<Node> child) { m_contained_abspos_children.append(child); }
void add_contained_abspos_child(GC::Ref<Node> child) { m_contained_abspos_children.append(child); }
void clear_contained_abspos_children() { m_contained_abspos_children.clear(); }
Vector<JS::NonnullGCPtr<Node>> const& contained_abspos_children() const { return m_contained_abspos_children; }
Vector<GC::Ref<Node>> const& contained_abspos_children() const { return m_contained_abspos_children; }
virtual void visit_edges(Cell::Visitor&) override;
@ -65,7 +65,7 @@ private:
Optional<CSSPixels> m_natural_height;
Optional<CSSPixelFraction> m_natural_aspect_ratio;
Vector<JS::NonnullGCPtr<Node>> m_contained_abspos_children;
Vector<GC::Ref<Node>> m_contained_abspos_children;
};
template<>

View file

@ -10,7 +10,7 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(BreakNode);
GC_DEFINE_ALLOCATOR(BreakNode);
BreakNode::BreakNode(DOM::Document& document, HTML::HTMLBRElement& element, CSS::StyleProperties style)
: Layout::NodeWithStyleAndBoxModelMetrics(document, &element, move(style))

View file

@ -12,8 +12,8 @@
namespace Web::Layout {
class BreakNode final : public NodeWithStyleAndBoxModelMetrics {
JS_CELL(BreakNode, NodeWithStyleAndBoxModelMetrics);
JS_DECLARE_ALLOCATOR(BreakNode);
GC_CELL(BreakNode, NodeWithStyleAndBoxModelMetrics);
GC_DECLARE_ALLOCATOR(BreakNode);
public:
BreakNode(DOM::Document&, HTML::HTMLBRElement&, CSS::StyleProperties);

View file

@ -9,7 +9,7 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(CanvasBox);
GC_DEFINE_ALLOCATOR(CanvasBox);
CanvasBox::CanvasBox(DOM::Document& document, HTML::HTMLCanvasElement& element, CSS::StyleProperties style)
: ReplacedBox(document, element, move(style))
@ -24,7 +24,7 @@ void CanvasBox::prepare_for_replaced_layout()
set_natural_height(dom_node().height());
}
JS::GCPtr<Painting::Paintable> CanvasBox::create_paintable() const
GC::Ptr<Painting::Paintable> CanvasBox::create_paintable() const
{
return Painting::CanvasPaintable::create(*this);
}

View file

@ -12,8 +12,8 @@
namespace Web::Layout {
class CanvasBox final : public ReplacedBox {
JS_CELL(CanvasBox, ReplacedBox);
JS_DECLARE_ALLOCATOR(CanvasBox);
GC_CELL(CanvasBox, ReplacedBox);
GC_DECLARE_ALLOCATOR(CanvasBox);
public:
CanvasBox(DOM::Document&, HTML::HTMLCanvasElement&, CSS::StyleProperties);
@ -23,7 +23,7 @@ public:
const HTML::HTMLCanvasElement& dom_node() const { return static_cast<const HTML::HTMLCanvasElement&>(ReplacedBox::dom_node()); }
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
};
}

View file

@ -11,7 +11,7 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(CheckBox);
GC_DEFINE_ALLOCATOR(CheckBox);
CheckBox::CheckBox(DOM::Document& document, HTML::HTMLInputElement& element, CSS::StyleProperties style)
: FormAssociatedLabelableNode(document, element, move(style))
@ -22,7 +22,7 @@ CheckBox::CheckBox(DOM::Document& document, HTML::HTMLInputElement& element, CSS
CheckBox::~CheckBox() = default;
JS::GCPtr<Painting::Paintable> CheckBox::create_paintable() const
GC::Ptr<Painting::Paintable> CheckBox::create_paintable() const
{
return Painting::CheckBoxPaintable::create(*this);
}

View file

@ -12,15 +12,15 @@
namespace Web::Layout {
class CheckBox final : public FormAssociatedLabelableNode {
JS_CELL(CheckBox, FormAssociatedLabelableNode);
JS_DECLARE_ALLOCATOR(CheckBox);
GC_CELL(CheckBox, FormAssociatedLabelableNode);
GC_DECLARE_ALLOCATOR(CheckBox);
public:
CheckBox(DOM::Document&, HTML::HTMLInputElement&, CSS::StyleProperties);
virtual ~CheckBox() override;
private:
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
};
}

View file

@ -54,7 +54,7 @@ private:
};
struct FlexItem {
JS::NonnullGCPtr<Box> box;
GC::Ref<Box> box;
LayoutState::UsedValues& used_values;
Optional<CSS::FlexBasis> used_flex_basis {};
bool used_flex_basis_is_definite { false };

View file

@ -14,7 +14,7 @@
namespace Web::Layout {
class FormAssociatedLabelableNode : public LabelableNode {
JS_CELL(FormAssociatedLabelableNode, LabelableNode);
GC_CELL(FormAssociatedLabelableNode, LabelableNode);
public:
const HTML::FormAssociatedElement& dom_node() const { return dynamic_cast<const HTML::FormAssociatedElement&>(LabelableNode::dom_node()); }

View file

@ -123,7 +123,7 @@ protected:
// Each block in the containing chain adds its own margin and we store the total here.
CSSPixels left_total_containing_margin;
CSSPixels right_total_containing_margin;
JS::GCPtr<Box const> matching_left_float_box;
GC::Ptr<Box const> matching_left_float_box;
};
struct ShrinkToFitResult {
@ -160,7 +160,7 @@ protected:
LayoutMode m_layout_mode;
FormattingContext* m_parent { nullptr };
JS::NonnullGCPtr<Box const> m_context_box;
GC::Ref<Box const> m_context_box;
LayoutState& m_state;
};

View file

@ -11,7 +11,7 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(FrameBox);
GC_DEFINE_ALLOCATOR(FrameBox);
FrameBox::FrameBox(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
: ReplacedBox(document, element, move(style))
@ -35,7 +35,7 @@ void FrameBox::did_set_content_size()
dom_node().content_navigable()->set_viewport_size(paintable_box()->content_size());
}
JS::GCPtr<Painting::Paintable> FrameBox::create_paintable() const
GC::Ptr<Painting::Paintable> FrameBox::create_paintable() const
{
return Painting::NestedBrowsingContextPaintable::create(*this);
}

View file

@ -12,8 +12,8 @@
namespace Web::Layout {
class FrameBox final : public ReplacedBox {
JS_CELL(FrameBox, ReplacedBox);
JS_DECLARE_ALLOCATOR(FrameBox);
GC_CELL(FrameBox, ReplacedBox);
GC_DECLARE_ALLOCATOR(FrameBox);
public:
FrameBox(DOM::Document&, DOM::Element&, CSS::StyleProperties);
@ -24,7 +24,7 @@ public:
const HTML::HTMLIFrameElement& dom_node() const { return verify_cast<HTML::HTMLIFrameElement>(ReplacedBox::dom_node()); }
HTML::HTMLIFrameElement& dom_node() { return verify_cast<HTML::HTMLIFrameElement>(ReplacedBox::dom_node()); }
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
private:
virtual void did_set_content_size() override;

View file

@ -1335,7 +1335,7 @@ void GridFormattingContext::place_grid_items()
// flex items), which are then assigned to predefined areas in the grid. They can be explicitly
// placed using coordinates through the grid-placement properties or implicitly placed into
// empty areas using auto-placement.
HashMap<int, Vector<JS::NonnullGCPtr<Box const>>> order_item_bucket;
HashMap<int, Vector<GC::Ref<Box const>>> order_item_bucket;
grid_container().for_each_child_of_type<Box>([&](Box& child_box) {
if (can_skip_is_anonymous_text_run(child_box))
return IterationDecision::Continue;

View file

@ -35,7 +35,7 @@ struct GridPosition {
};
struct GridItem {
JS::NonnullGCPtr<Box const> box;
GC::Ref<Box const> box;
// Position and span are empty if the item is auto-placed which could only be the case for abspos items
Optional<int> row;

View file

@ -13,7 +13,7 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(ImageBox);
GC_DEFINE_ALLOCATOR(ImageBox);
ImageBox::ImageBox(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style, ImageProvider const& image_provider)
: ReplacedBox(document, element, move(style))
@ -71,7 +71,7 @@ bool ImageBox::renders_as_alt_text() const
return false;
}
JS::GCPtr<Painting::Paintable> ImageBox::create_paintable() const
GC::Ptr<Painting::Paintable> ImageBox::create_paintable() const
{
return Painting::ImagePaintable::create(*this);
}

View file

@ -12,8 +12,8 @@
namespace Web::Layout {
class ImageBox final : public ReplacedBox {
JS_CELL(ImageBox, ReplacedBox);
JS_DECLARE_ALLOCATOR(ImageBox);
GC_CELL(ImageBox, ReplacedBox);
GC_DECLARE_ALLOCATOR(ImageBox);
public:
ImageBox(DOM::Document&, DOM::Element&, CSS::StyleProperties, ImageProvider const&);
@ -25,7 +25,7 @@ public:
bool renders_as_alt_text() const;
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
auto const& image_provider() const { return m_image_provider; }
auto& image_provider() { return m_image_provider; }

View file

@ -25,7 +25,7 @@ public:
virtual RefPtr<Gfx::ImmutableBitmap> current_image_bitmap(Gfx::IntSize) const = 0;
virtual void set_visible_in_viewport(bool) = 0;
virtual JS::NonnullGCPtr<DOM::Element const> to_html_element() const = 0;
virtual GC::Ref<DOM::Element const> to_html_element() const = 0;
protected:
static void did_update_alt_text(ImageBox&);

View file

@ -31,7 +31,7 @@ public:
FloatingElement,
};
Type type {};
JS::GCPtr<Layout::Node const> node {};
GC::Ptr<Layout::Node const> node {};
RefPtr<Gfx::GlyphRun> glyph_run {};
size_t offset_in_node { 0 };
size_t length_in_node { 0 };
@ -72,10 +72,10 @@ private:
Layout::InlineFormattingContext& m_inline_formatting_context;
Layout::LayoutState& m_layout_state;
JS::NonnullGCPtr<BlockContainer const> m_containing_block;
GC::Ref<BlockContainer const> m_containing_block;
LayoutState::UsedValues const& m_containing_block_used_values;
JS::GCPtr<Layout::Node const> m_current_node;
JS::GCPtr<Layout::Node const> m_next_node;
GC::Ptr<Layout::Node const> m_current_node;
GC::Ptr<Layout::Node const> m_next_node;
LayoutMode const m_layout_mode;
struct TextNodeContext {
@ -99,7 +99,7 @@ private:
Optional<ExtraBoxMetrics> m_extra_leading_metrics;
Optional<ExtraBoxMetrics> m_extra_trailing_metrics;
Vector<JS::NonnullGCPtr<NodeWithStyleAndBoxModelMetrics const>> m_box_model_node_stack;
Vector<GC::Ref<NodeWithStyleAndBoxModelMetrics const>> m_box_model_node_stack;
Queue<InlineLevelIterator::Item> m_lookahead_items;
};

View file

@ -14,7 +14,7 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(InlineNode);
GC_DEFINE_ALLOCATOR(InlineNode);
InlineNode::InlineNode(DOM::Document& document, DOM::Element* element, CSS::StyleProperties style)
: Layout::NodeWithStyleAndBoxModelMetrics(document, element, move(style))
@ -23,7 +23,7 @@ InlineNode::InlineNode(DOM::Document& document, DOM::Element* element, CSS::Styl
InlineNode::~InlineNode() = default;
JS::GCPtr<Painting::PaintableWithLines> InlineNode::create_paintable_for_line_with_index(size_t line_index) const
GC::Ptr<Painting::PaintableWithLines> InlineNode::create_paintable_for_line_with_index(size_t line_index) const
{
for (auto const& paintable : paintables()) {
if (is<Painting::PaintableWithLines>(paintable)) {

View file

@ -11,14 +11,14 @@
namespace Web::Layout {
class InlineNode final : public NodeWithStyleAndBoxModelMetrics {
JS_CELL(InlineNode, NodeWithStyleAndBoxModelMetrics);
JS_DECLARE_ALLOCATOR(InlineNode);
GC_CELL(InlineNode, NodeWithStyleAndBoxModelMetrics);
GC_DECLARE_ALLOCATOR(InlineNode);
public:
InlineNode(DOM::Document&, DOM::Element*, CSS::StyleProperties);
virtual ~InlineNode() override;
JS::GCPtr<Painting::PaintableWithLines> create_paintable_for_line_with_index(size_t line_index) const;
GC::Ptr<Painting::PaintableWithLines> create_paintable_for_line_with_index(size_t line_index) const;
};
}

View file

@ -15,7 +15,7 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(Label);
GC_DEFINE_ALLOCATOR(Label);
Label::Label(DOM::Document& document, HTML::HTMLLabelElement* element, CSS::StyleProperties style)
: BlockContainer(document, element, move(style))

View file

@ -12,8 +12,8 @@
namespace Web::Layout {
class Label final : public BlockContainer {
JS_CELL(Label, BlockContainer);
JS_DECLARE_ALLOCATOR(Label);
GC_CELL(Label, BlockContainer);
GC_DECLARE_ALLOCATOR(Label);
public:
Label(DOM::Document&, HTML::HTMLLabelElement*, CSS::StyleProperties);

View file

@ -12,7 +12,7 @@
namespace Web::Layout {
class LabelableNode : public ReplacedBox {
JS_CELL(LabelableNode, ReplacedBox);
GC_CELL(LabelableNode, ReplacedBox);
public:
Painting::LabelablePaintable* paintable();

View file

@ -191,7 +191,7 @@ struct LayoutState {
CSSPixels border_top_collapsed() const { return use_collapsing_borders_model() ? round(border_top / 2) : border_top; }
CSSPixels border_bottom_collapsed() const { return use_collapsing_borders_model() ? round(border_bottom / 2) : border_bottom; }
JS::GCPtr<Layout::NodeWithStyle> m_node { nullptr };
GC::Ptr<Layout::NodeWithStyle> m_node { nullptr };
UsedValues const* m_containing_block_used_values { nullptr };
CSSPixels m_content_width { 0 };
@ -200,7 +200,7 @@ struct LayoutState {
bool m_has_definite_width { false };
bool m_has_definite_height { false };
HashTable<JS::GCPtr<Box const>> m_floating_descendants;
HashTable<GC::Ptr<Box const>> m_floating_descendants;
Optional<Painting::PaintableBox::BordersDataWithElementKind> m_override_borders_data;
Optional<Painting::PaintableBox::TableCellCoordinates> m_table_cell_coordinates;
@ -223,7 +223,7 @@ struct LayoutState {
// NOTE: get() will not CoW the UsedValues.
UsedValues const& get(NodeWithStyle const&) const;
HashMap<JS::NonnullGCPtr<Layout::Node const>, NonnullOwnPtr<UsedValues>> used_values_per_layout_node;
HashMap<GC::Ref<Layout::Node const>, NonnullOwnPtr<UsedValues>> used_values_per_layout_node;
// We cache intrinsic sizes once determined, as they will not change over the course of a full layout.
// This avoids computing them several times while performing flex layout.
@ -235,7 +235,7 @@ struct LayoutState {
HashMap<CSSPixels, Optional<CSSPixels>> max_content_height;
};
HashMap<JS::GCPtr<NodeWithStyle const>, NonnullOwnPtr<IntrinsicSizes>> mutable intrinsic_sizes;
HashMap<GC::Ptr<NodeWithStyle const>, NonnullOwnPtr<IntrinsicSizes>> mutable intrinsic_sizes;
LayoutState const* m_parent { nullptr };
LayoutState const& m_root;

View file

@ -6,9 +6,9 @@
#pragma once
#include <LibGC/Ptr.h>
#include <LibGfx/Rect.h>
#include <LibGfx/TextLayout.h>
#include <LibJS/Heap/GCPtr.h>
#include <LibWeb/Forward.h>
#include <LibWeb/Painting/BorderRadiiData.h>
#include <LibWeb/PixelUnits.h>
@ -60,7 +60,7 @@ private:
void append_glyph_run_ltr(RefPtr<Gfx::GlyphRun> const&, CSSPixels run_width);
void append_glyph_run_rtl(RefPtr<Gfx::GlyphRun> const&, CSSPixels run_width);
JS::NonnullGCPtr<Node const> m_layout_node;
GC::Ref<Node const> m_layout_node;
int m_start { 0 };
int m_length { 0 };
CSSPixels m_inline_offset;

View file

@ -10,7 +10,7 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(ListItemBox);
GC_DEFINE_ALLOCATOR(ListItemBox);
ListItemBox::ListItemBox(DOM::Document& document, DOM::Element* element, CSS::StyleProperties style)
: Layout::BlockContainer(document, element, move(style))
@ -25,7 +25,7 @@ void ListItemBox::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_marker);
}
void ListItemBox::set_marker(JS::GCPtr<ListItemMarkerBox> marker)
void ListItemBox::set_marker(GC::Ptr<ListItemMarkerBox> marker)
{
m_marker = move(marker);
}

View file

@ -12,8 +12,8 @@
namespace Web::Layout {
class ListItemBox final : public BlockContainer {
JS_CELL(ListItemBox, BlockContainer);
JS_DECLARE_ALLOCATOR(ListItemBox);
GC_CELL(ListItemBox, BlockContainer);
GC_DECLARE_ALLOCATOR(ListItemBox);
public:
ListItemBox(DOM::Document&, DOM::Element*, CSS::StyleProperties);
@ -23,14 +23,14 @@ public:
DOM::Element const& dom_node() const { return static_cast<DOM::Element const&>(*BlockContainer::dom_node()); }
ListItemMarkerBox const* marker() const { return m_marker; }
void set_marker(JS::GCPtr<ListItemMarkerBox>);
void set_marker(GC::Ptr<ListItemMarkerBox>);
private:
virtual bool is_list_item_box() const override { return true; }
virtual void visit_edges(Cell::Visitor&) override;
JS::GCPtr<ListItemMarkerBox> m_marker;
GC::Ptr<ListItemMarkerBox> m_marker;
};
template<>

View file

@ -10,7 +10,7 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(ListItemMarkerBox);
GC_DEFINE_ALLOCATOR(ListItemMarkerBox);
ListItemMarkerBox::ListItemMarkerBox(DOM::Document& document, CSS::ListStyleType style_type, CSS::ListStylePosition style_position, size_t index, CSS::StyleProperties style)
: Box(document, nullptr, move(style))
@ -56,7 +56,7 @@ ListItemMarkerBox::ListItemMarkerBox(DOM::Document& document, CSS::ListStyleType
ListItemMarkerBox::~ListItemMarkerBox() = default;
JS::GCPtr<Painting::Paintable> ListItemMarkerBox::create_paintable() const
GC::Ptr<Painting::Paintable> ListItemMarkerBox::create_paintable() const
{
return Painting::MarkerPaintable::create(*this);
}

View file

@ -12,8 +12,8 @@
namespace Web::Layout {
class ListItemMarkerBox final : public Box {
JS_CELL(ListItemMarkerBox, Box);
JS_DECLARE_ALLOCATOR(ListItemMarkerBox);
GC_CELL(ListItemMarkerBox, Box);
GC_DECLARE_ALLOCATOR(ListItemMarkerBox);
public:
explicit ListItemMarkerBox(DOM::Document&, CSS::ListStyleType, CSS::ListStylePosition, size_t index, CSS::StyleProperties);
@ -21,7 +21,7 @@ public:
Optional<ByteString> const& text() const { return m_text; }
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
CSS::ListStyleType list_style_type() const { return m_list_style_type; }
CSS::ListStylePosition list_style_position() const { return m_list_style_position; }

View file

@ -48,7 +48,7 @@ void Node::visit_edges(Cell::Visitor& visitor)
Base::visit_edges(visitor);
visitor.visit(m_dom_node);
for (auto const& paintable : m_paintable) {
visitor.visit(JS::GCPtr { &paintable });
visitor.visit(GC::Ptr { &paintable });
}
visitor.visit(m_pseudo_element_generator);
TreeNode::visit_edges(visitor);
@ -205,7 +205,7 @@ bool Node::establishes_stacking_context() const
return computed_values().opacity() < 1.0f;
}
JS::GCPtr<HTML::Navigable> Node::navigable() const
GC::Ptr<HTML::Navigable> Node::navigable() const
{
return document().navigable();
}
@ -1008,7 +1008,7 @@ bool Node::is_inline_table() const
return display.is_inline_outside() && display.is_table_inside();
}
JS::NonnullGCPtr<NodeWithStyle> NodeWithStyle::create_anonymous_wrapper() const
GC::Ref<NodeWithStyle> NodeWithStyle::create_anonymous_wrapper() const
{
auto wrapper = heap().allocate<BlockContainer>(const_cast<DOM::Document&>(document()), nullptr, computed_values().clone_inherited_values());
wrapper->mutable_computed_values().set_display(CSS::Display(CSS::DisplayOutside::Block, CSS::DisplayInside::Flow));
@ -1080,7 +1080,7 @@ bool NodeWithStyle::is_scroll_container() const
|| overflow_value_makes_box_a_scroll_container(computed_values().overflow_y());
}
void Node::add_paintable(JS::GCPtr<Painting::Paintable> paintable)
void Node::add_paintable(GC::Ptr<Painting::Paintable> paintable)
{
if (!paintable)
return;
@ -1092,7 +1092,7 @@ void Node::clear_paintables()
m_paintable.clear();
}
JS::GCPtr<Painting::Paintable> Node::create_paintable() const
GC::Ptr<Painting::Paintable> Node::create_paintable() const
{
return nullptr;
}

View file

@ -9,9 +9,9 @@
#include <AK/NonnullRefPtr.h>
#include <AK/TypeCasts.h>
#include <AK/Vector.h>
#include <LibGC/Root.h>
#include <LibGfx/Rect.h>
#include <LibJS/Heap/Cell.h>
#include <LibJS/Heap/Handle.h>
#include <LibWeb/CSS/ComputedValues.h>
#include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/CSS/StyleProperties.h>
@ -39,7 +39,7 @@ enum class LayoutMode {
class Node
: public JS::Cell
, public TreeNode<Node> {
JS_CELL(Node, JS::Cell);
GC_CELL(Node, JS::Cell);
public:
virtual ~Node();
@ -71,15 +71,15 @@ public:
Painting::Paintable const* first_paintable() const { return m_paintable.first(); }
PaintableList& paintables() { return m_paintable; }
PaintableList const& paintables() const { return m_paintable; }
void add_paintable(JS::GCPtr<Painting::Paintable>);
void add_paintable(GC::Ptr<Painting::Paintable>);
void clear_paintables();
virtual JS::GCPtr<Painting::Paintable> create_paintable() const;
virtual GC::Ptr<Painting::Paintable> create_paintable() const;
DOM::Document& document();
DOM::Document const& document() const;
JS::GCPtr<HTML::Navigable> navigable() const;
GC::Ptr<HTML::Navigable> navigable() const;
Viewport const& root() const;
Viewport& root();
@ -186,10 +186,10 @@ protected:
private:
friend class NodeWithStyle;
JS::NonnullGCPtr<DOM::Node> m_dom_node;
GC::Ref<DOM::Node> m_dom_node;
PaintableList m_paintable;
JS::GCPtr<DOM::Element> m_pseudo_element_generator;
GC::Ptr<DOM::Element> m_pseudo_element_generator;
bool m_anonymous { false };
bool m_has_style { false };
@ -204,7 +204,7 @@ private:
};
class NodeWithStyle : public Node {
JS_CELL(NodeWithStyle, Node);
GC_CELL(NodeWithStyle, Node);
public:
virtual ~NodeWithStyle() override = default;
@ -218,7 +218,7 @@ public:
Vector<CSS::BackgroundLayerData> const& background_layers() const { return computed_values().background_layers(); }
const CSS::AbstractImageStyleValue* list_style_image() const { return m_list_style_image; }
JS::NonnullGCPtr<NodeWithStyle> create_anonymous_wrapper() const;
GC::Ref<NodeWithStyle> create_anonymous_wrapper() const;
void transfer_table_box_computed_values_to_wrapper_computed_values(CSS::ComputedValues& wrapper_computed_values);
@ -240,7 +240,7 @@ private:
};
class NodeWithStyleAndBoxModelMetrics : public NodeWithStyle {
JS_CELL(NodeWithStyleAndBoxModelMetrics, NodeWithStyle);
GC_CELL(NodeWithStyleAndBoxModelMetrics, NodeWithStyle);
public:
BoxModelMetrics& box_model() { return m_box_model; }

View file

@ -12,7 +12,7 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(RadioButton);
GC_DEFINE_ALLOCATOR(RadioButton);
RadioButton::RadioButton(DOM::Document& document, HTML::HTMLInputElement& element, CSS::StyleProperties style)
: FormAssociatedLabelableNode(document, element, move(style))
@ -24,7 +24,7 @@ RadioButton::RadioButton(DOM::Document& document, HTML::HTMLInputElement& elemen
RadioButton::~RadioButton() = default;
JS::GCPtr<Painting::Paintable> RadioButton::create_paintable() const
GC::Ptr<Painting::Paintable> RadioButton::create_paintable() const
{
return Painting::RadioButtonPaintable::create(*this);
}

View file

@ -12,15 +12,15 @@
namespace Web::Layout {
class RadioButton final : public FormAssociatedLabelableNode {
JS_CELL(RadioButton, FormAssociatedLabelableNode);
JS_DECLARE_ALLOCATOR(RadioButton);
GC_CELL(RadioButton, FormAssociatedLabelableNode);
GC_DECLARE_ALLOCATOR(RadioButton);
public:
RadioButton(DOM::Document&, HTML::HTMLInputElement&, CSS::StyleProperties);
virtual ~RadioButton() override;
private:
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
};
}

View file

@ -12,7 +12,7 @@
namespace Web::Layout {
class ReplacedBox : public Box {
JS_CELL(ReplacedBox, Box);
GC_CELL(ReplacedBox, Box);
public:
ReplacedBox(DOM::Document&, DOM::Element&, CSS::StyleProperties);

View file

@ -13,7 +13,7 @@
namespace Web::Layout {
class SVGBox : public Box {
JS_CELL(SVGBox, Box);
GC_CELL(SVGBox, Box);
public:
SVGBox(DOM::Document&, SVG::SVGElement&, CSS::StyleProperties);

View file

@ -10,14 +10,14 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(SVGClipBox);
GC_DEFINE_ALLOCATOR(SVGClipBox);
SVGClipBox::SVGClipBox(DOM::Document& document, SVG::SVGClipPathElement& element, CSS::StyleProperties properties)
: SVGBox(document, element, properties)
{
}
JS::GCPtr<Painting::Paintable> SVGClipBox::create_paintable() const
GC::Ptr<Painting::Paintable> SVGClipBox::create_paintable() const
{
return Painting::SVGClipPaintable::create(*this);
}

View file

@ -13,8 +13,8 @@
namespace Web::Layout {
class SVGClipBox : public SVGBox {
JS_CELL(SVGClipBox, SVGBox);
JS_DECLARE_ALLOCATOR(SVGClipBox);
GC_CELL(SVGClipBox, SVGBox);
GC_DECLARE_ALLOCATOR(SVGClipBox);
public:
SVGClipBox(DOM::Document&, SVG::SVGClipPathElement&, CSS::StyleProperties);
@ -23,7 +23,7 @@ public:
SVG::SVGClipPathElement& dom_node() { return verify_cast<SVG::SVGClipPathElement>(SVGBox::dom_node()); }
SVG::SVGClipPathElement const& dom_node() const { return verify_cast<SVG::SVGClipPathElement>(SVGBox::dom_node()); }
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
};
}

View file

@ -10,14 +10,14 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(SVGForeignObjectBox);
GC_DEFINE_ALLOCATOR(SVGForeignObjectBox);
SVGForeignObjectBox::SVGForeignObjectBox(DOM::Document& document, SVG::SVGForeignObjectElement& element, CSS::StyleProperties properties)
: BlockContainer(document, &element, properties)
{
}
JS::GCPtr<Painting::Paintable> SVGForeignObjectBox::create_paintable() const
GC::Ptr<Painting::Paintable> SVGForeignObjectBox::create_paintable() const
{
return Painting::SVGForeignObjectPaintable::create(*this);
}

View file

@ -14,8 +14,8 @@
namespace Web::Layout {
class SVGForeignObjectBox final : public BlockContainer {
JS_CELL(SVGForeignObjectBox, BlockContainer);
JS_DECLARE_ALLOCATOR(SVGForeignObjectBox);
GC_CELL(SVGForeignObjectBox, BlockContainer);
GC_DECLARE_ALLOCATOR(SVGForeignObjectBox);
public:
SVGForeignObjectBox(DOM::Document&, SVG::SVGForeignObjectElement&, CSS::StyleProperties);
@ -24,7 +24,7 @@ public:
SVG::SVGForeignObjectElement& dom_node() { return static_cast<SVG::SVGForeignObjectElement&>(*BlockContainer::dom_node()); }
SVG::SVGForeignObjectElement const& dom_node() const { return static_cast<SVG::SVGForeignObjectElement const&>(*BlockContainer::dom_node()); }
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
};
}

View file

@ -12,14 +12,14 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(SVGGeometryBox);
GC_DEFINE_ALLOCATOR(SVGGeometryBox);
SVGGeometryBox::SVGGeometryBox(DOM::Document& document, SVG::SVGGeometryElement& element, CSS::StyleProperties properties)
: SVGGraphicsBox(document, element, properties)
{
}
JS::GCPtr<Painting::Paintable> SVGGeometryBox::create_paintable() const
GC::Ptr<Painting::Paintable> SVGGeometryBox::create_paintable() const
{
return Painting::SVGPathPaintable::create(*this);
}

View file

@ -13,8 +13,8 @@
namespace Web::Layout {
class SVGGeometryBox final : public SVGGraphicsBox {
JS_CELL(SVGGeometryBox, SVGGraphicsBox);
JS_DECLARE_ALLOCATOR(SVGGeometryBox);
GC_CELL(SVGGeometryBox, SVGGraphicsBox);
GC_DECLARE_ALLOCATOR(SVGGeometryBox);
public:
SVGGeometryBox(DOM::Document&, SVG::SVGGeometryElement&, CSS::StyleProperties);
@ -23,7 +23,7 @@ public:
SVG::SVGGeometryElement& dom_node() { return static_cast<SVG::SVGGeometryElement&>(SVGGraphicsBox::dom_node()); }
SVG::SVGGeometryElement const& dom_node() const { return static_cast<SVG::SVGGeometryElement const&>(SVGGraphicsBox::dom_node()); }
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
private:
virtual bool is_svg_geometry_box() const final { return true; }

View file

@ -15,7 +15,7 @@ SVGGraphicsBox::SVGGraphicsBox(DOM::Document& document, SVG::SVGGraphicsElement&
{
}
JS::GCPtr<Painting::Paintable> SVGGraphicsBox::create_paintable() const
GC::Ptr<Painting::Paintable> SVGGraphicsBox::create_paintable() const
{
return Painting::SVGGraphicsPaintable::create(*this);
}

View file

@ -13,7 +13,7 @@
namespace Web::Layout {
class SVGGraphicsBox : public SVGBox {
JS_CELL(SVGGraphicsBox, SVGBox);
GC_CELL(SVGGraphicsBox, SVGBox);
public:
SVGGraphicsBox(DOM::Document&, SVG::SVGGraphicsElement&, CSS::StyleProperties);
@ -22,7 +22,7 @@ public:
SVG::SVGGraphicsElement& dom_node() { return verify_cast<SVG::SVGGraphicsElement>(SVGBox::dom_node()); }
SVG::SVGGraphicsElement const& dom_node() const { return verify_cast<SVG::SVGGraphicsElement>(SVGBox::dom_node()); }
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
};
}

View file

@ -16,7 +16,7 @@ SVGImageBox::SVGImageBox(DOM::Document& document, SVG::SVGGraphicsElement& eleme
{
}
JS::GCPtr<Painting::Paintable> SVGImageBox::create_paintable() const
GC::Ptr<Painting::Paintable> SVGImageBox::create_paintable() const
{
return Painting::ImagePaintable::create(*this);
}

View file

@ -6,14 +6,14 @@
#pragma once
#include <LibJS/Heap/GCPtr.h>
#include <LibGC/Ptr.h>
#include <LibWeb/Layout/SVGGraphicsBox.h>
#include <LibWeb/SVG/SVGImageElement.h>
namespace Web::Layout {
class SVGImageBox : public SVGGraphicsBox {
JS_CELL(SVGImageBox, SVGGraphicsBox);
GC_CELL(SVGImageBox, SVGGraphicsBox);
public:
SVGImageBox(DOM::Document&, SVG::SVGGraphicsElement&, CSS::StyleProperties);
@ -22,7 +22,7 @@ public:
SVG::SVGImageElement& dom_node() { return static_cast<SVG::SVGImageElement&>(SVGGraphicsBox::dom_node()); }
SVG::SVGImageElement const& dom_node() const { return static_cast<SVG::SVGImageElement const&>(SVGGraphicsBox::dom_node()); }
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
};
}

View file

@ -10,14 +10,14 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(SVGMaskBox);
GC_DEFINE_ALLOCATOR(SVGMaskBox);
SVGMaskBox::SVGMaskBox(DOM::Document& document, SVG::SVGMaskElement& element, CSS::StyleProperties properties)
: SVGGraphicsBox(document, element, properties)
{
}
JS::GCPtr<Painting::Paintable> SVGMaskBox::create_paintable() const
GC::Ptr<Painting::Paintable> SVGMaskBox::create_paintable() const
{
return Painting::SVGMaskPaintable::create(*this);
}

View file

@ -13,8 +13,8 @@
namespace Web::Layout {
class SVGMaskBox : public SVGGraphicsBox {
JS_CELL(SVGMaskBox, SVGGraphicsBox);
JS_DECLARE_ALLOCATOR(SVGMaskBox);
GC_CELL(SVGMaskBox, SVGGraphicsBox);
GC_DECLARE_ALLOCATOR(SVGMaskBox);
public:
SVGMaskBox(DOM::Document&, SVG::SVGMaskElement&, CSS::StyleProperties);
@ -25,7 +25,7 @@ public:
SVG::SVGMaskElement& dom_node() { return verify_cast<SVG::SVGMaskElement>(SVGGraphicsBox::dom_node()); }
SVG::SVGMaskElement const& dom_node() const { return verify_cast<SVG::SVGMaskElement>(SVGGraphicsBox::dom_node()); }
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
};
template<>

View file

@ -13,14 +13,14 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(SVGSVGBox);
GC_DEFINE_ALLOCATOR(SVGSVGBox);
SVGSVGBox::SVGSVGBox(DOM::Document& document, SVG::SVGSVGElement& element, CSS::StyleProperties properties)
: ReplacedBox(document, element, move(properties))
{
}
JS::GCPtr<Painting::Paintable> SVGSVGBox::create_paintable() const
GC::Ptr<Painting::Paintable> SVGSVGBox::create_paintable() const
{
return Painting::SVGSVGPaintable::create(*this);
}

View file

@ -12,8 +12,8 @@
namespace Web::Layout {
class SVGSVGBox final : public ReplacedBox {
JS_CELL(SVGSVGBox, ReplacedBox);
JS_DECLARE_ALLOCATOR(SVGSVGBox);
GC_CELL(SVGSVGBox, ReplacedBox);
GC_DECLARE_ALLOCATOR(SVGSVGBox);
public:
SVGSVGBox(DOM::Document&, SVG::SVGSVGElement&, CSS::StyleProperties);
@ -24,7 +24,7 @@ public:
virtual bool can_have_children() const override { return true; }
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
virtual void prepare_for_replaced_layout() override;

View file

@ -10,14 +10,14 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(SVGTextBox);
GC_DEFINE_ALLOCATOR(SVGTextBox);
SVGTextBox::SVGTextBox(DOM::Document& document, SVG::SVGTextPositioningElement& element, CSS::StyleProperties properties)
: SVGGraphicsBox(document, element, properties)
{
}
JS::GCPtr<Painting::Paintable> SVGTextBox::create_paintable() const
GC::Ptr<Painting::Paintable> SVGTextBox::create_paintable() const
{
return Painting::SVGPathPaintable::create(*this);
}

View file

@ -13,8 +13,8 @@
namespace Web::Layout {
class SVGTextBox final : public SVGGraphicsBox {
JS_CELL(SVGTextBox, SVGGraphicsBox);
JS_DECLARE_ALLOCATOR(SVGTextBox);
GC_CELL(SVGTextBox, SVGGraphicsBox);
GC_DECLARE_ALLOCATOR(SVGTextBox);
public:
SVGTextBox(DOM::Document&, SVG::SVGTextPositioningElement&, CSS::StyleProperties);
@ -23,7 +23,7 @@ public:
SVG::SVGTextPositioningElement& dom_node() { return static_cast<SVG::SVGTextPositioningElement&>(SVGGraphicsBox::dom_node()); }
SVG::SVGTextPositioningElement const& dom_node() const { return static_cast<SVG::SVGTextPositioningElement const&>(SVGGraphicsBox::dom_node()); }
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
private:
CSSPixelPoint viewbox_origin() const;

View file

@ -9,14 +9,14 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(SVGTextPathBox);
GC_DEFINE_ALLOCATOR(SVGTextPathBox);
SVGTextPathBox::SVGTextPathBox(DOM::Document& document, SVG::SVGTextPathElement& element, CSS::StyleProperties properties)
: SVGGraphicsBox(document, element, properties)
{
}
JS::GCPtr<Painting::Paintable> SVGTextPathBox::create_paintable() const
GC::Ptr<Painting::Paintable> SVGTextPathBox::create_paintable() const
{
return Painting::SVGPathPaintable::create(*this);
}

View file

@ -12,8 +12,8 @@
namespace Web::Layout {
class SVGTextPathBox final : public SVGGraphicsBox {
JS_CELL(SVGTextPathBox, SVGGraphicsBox);
JS_DECLARE_ALLOCATOR(SVGTextPathBox);
GC_CELL(SVGTextPathBox, SVGGraphicsBox);
GC_DECLARE_ALLOCATOR(SVGTextPathBox);
public:
SVGTextPathBox(DOM::Document&, SVG::SVGTextPathElement&, CSS::StyleProperties);
@ -22,7 +22,7 @@ public:
SVG::SVGTextPathElement& dom_node() { return static_cast<SVG::SVGTextPathElement&>(SVGGraphicsBox::dom_node()); }
SVG::SVGTextPathElement const& dom_node() const { return static_cast<SVG::SVGTextPathElement const&>(SVGGraphicsBox::dom_node()); }
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
private:
CSSPixelPoint viewbox_origin() const;

View file

@ -141,7 +141,7 @@ private:
};
struct ConflictingEdge {
JS::GCPtr<Node const> element;
GC::Ptr<Node const> element;
Painting::PaintableBox::ConflictingElementKind element_kind;
ConflictingSide side;
Optional<size_t> row;
@ -168,7 +168,7 @@ private:
void collect_column_group_conflicting_edges(Vector<ConflictingEdge>&, Cell const&, ConflictingSide) const;
void collect_table_box_conflicting_edges(Vector<ConflictingEdge>&, Cell const&, ConflictingSide) const;
JS::GCPtr<Node const> get_col_element(size_t index) const
GC::Ptr<Node const> get_col_element(size_t index) const
{
if (index >= m_col_elements_by_index.size())
return {};
@ -176,12 +176,12 @@ private:
}
struct RowGroupInfo {
JS::GCPtr<Node const> row_group;
GC::Ptr<Node const> row_group;
size_t start_index;
size_t row_count;
};
Vector<JS::GCPtr<Node const>> m_col_elements_by_index;
Vector<GC::Ptr<Node const>> m_col_elements_by_index;
Vector<Optional<RowGroupInfo>> m_row_group_elements_by_index;
TableFormattingContext const* m_context;
};

View file

@ -20,7 +20,7 @@ public:
};
struct Row {
JS::NonnullGCPtr<Box const> box;
GC::Ref<Box const> box;
CSSPixels base_height { 0 };
CSSPixels reference_height { 0 };
CSSPixels final_height { 0 };
@ -34,7 +34,7 @@ public:
};
struct Cell {
JS::NonnullGCPtr<Box const> box;
GC::Ref<Box const> box;
size_t column_index;
size_t row_index;
size_t column_span;

View file

@ -8,7 +8,7 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(TableWrapper);
GC_DEFINE_ALLOCATOR(TableWrapper);
TableWrapper::TableWrapper(DOM::Document& document, DOM::Node* node, CSS::StyleProperties style)
: BlockContainer(document, node, move(style))

View file

@ -11,8 +11,8 @@
namespace Web::Layout {
class TableWrapper : public BlockContainer {
JS_CELL(TableWrapper, BlockContainer);
JS_DECLARE_ALLOCATOR(TableWrapper);
GC_CELL(TableWrapper, BlockContainer);
GC_DECLARE_ALLOCATOR(TableWrapper);
public:
TableWrapper(DOM::Document&, DOM::Node*, CSS::StyleProperties);

View file

@ -17,7 +17,7 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(TextNode);
GC_DEFINE_ALLOCATOR(TextNode);
TextNode::TextNode(DOM::Document& document, DOM::Text& text)
: Node(document, &text)
@ -585,7 +585,7 @@ Optional<TextNode::Chunk> TextNode::ChunkIterator::try_commit_chunk(size_t start
return {};
}
JS::GCPtr<Painting::Paintable> TextNode::create_paintable() const
GC::Ptr<Painting::Paintable> TextNode::create_paintable() const
{
return Painting::TextPaintable::create(*this, text_for_rendering());
}

View file

@ -16,8 +16,8 @@ namespace Web::Layout {
class LineBoxFragment;
class TextNode final : public Node {
JS_CELL(TextNode, Node);
JS_DECLARE_ALLOCATOR(TextNode);
GC_CELL(TextNode, Node);
GC_DECLARE_ALLOCATOR(TextNode);
public:
TextNode(DOM::Document&, DOM::Text&);
@ -65,7 +65,7 @@ public:
Unicode::Segmenter& grapheme_segmenter() const;
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
private:
virtual bool is_text_node() const final { return true; }

View file

@ -119,10 +119,10 @@ static Layout::Node& insertion_parent_for_block_node(Layout::NodeWithStyle& layo
// Parent block has inline-level children (our siblings).
// First move these siblings into an anonymous wrapper block.
Vector<JS::Handle<Layout::Node>> children;
Vector<GC::Root<Layout::Node>> children;
{
JS::GCPtr<Layout::Node> next;
for (JS::GCPtr<Layout::Node> child = layout_parent.first_child(); child; child = next) {
GC::Ptr<Layout::Node> next;
for (GC::Ptr<Layout::Node> child = layout_parent.first_child(); child; child = next) {
next = child->next_sibling();
// NOTE: We let out-of-flow children stay in the parent, to preserve tree structure.
if (child->is_out_of_flow())
@ -317,7 +317,7 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::Context&
dom_node.document().style_computer().pop_ancestor(static_cast<DOM::Element const&>(dom_node));
};
JS::GCPtr<Layout::Node> layout_node;
GC::Ptr<Layout::Node> layout_node;
Optional<TemporaryChange<bool>> has_svg_root_change;
ScopeGuard remove_stale_layout_node_guard = [&] {
@ -457,7 +457,7 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::Context&
// Note: This will create a new subtree for each use of the mask (so there's not a 1-to-1 mapping
// from DOM node to mask layout node). Each use of a mask may be laid out differently so this
// duplication is necessary.
auto layout_mask_or_clip_path = [&](JS::GCPtr<SVG::SVGElement const> mask_or_clip_path) {
auto layout_mask_or_clip_path = [&](GC::Ptr<SVG::SVGElement const> mask_or_clip_path) {
TemporaryChange<bool> layout_mask(context.layout_svg_mask_or_clip_path, true);
push_parent(verify_cast<NodeWithStyle>(*layout_node));
create_layout_tree(const_cast<SVG::SVGElement&>(*mask_or_clip_path), context);
@ -511,7 +511,7 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::Context&
auto content_box_wrapper = parent.heap().template allocate<BlockContainer>(parent.document(), nullptr, move(content_box_computed_values));
content_box_wrapper->set_children_are_inline(parent.children_are_inline());
Vector<JS::Handle<Node>> sequence;
Vector<GC::Root<Node>> sequence;
for (auto child = parent.first_child(); child; child = child->next_sibling()) {
if (child->is_generated_for_before_pseudo_element())
continue;
@ -538,7 +538,7 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::Context&
}
}
JS::GCPtr<Layout::Node> TreeBuilder::build(DOM::Node& dom_node)
GC::Ptr<Layout::Node> TreeBuilder::build(DOM::Node& dom_node)
{
VERIFY(dom_node.is_document());
@ -588,7 +588,7 @@ void TreeBuilder::remove_irrelevant_boxes(NodeWithStyle& root)
{
// The following boxes are discarded as if they were display:none:
Vector<JS::Handle<Node>> to_remove;
Vector<GC::Root<Node>> to_remove;
// Children of a table-column.
for_each_in_tree_with_internal_display<CSS::DisplayInternal::TableColumn>(root, [&](Box& table_column) {
@ -673,7 +673,7 @@ static bool is_not_table_cell(Node const& node)
template<typename Matcher, typename Callback>
static void for_each_sequence_of_consecutive_children_matching(NodeWithStyle& parent, Matcher matcher, Callback callback)
{
Vector<JS::Handle<Node>> sequence;
Vector<GC::Root<Node>> sequence;
auto sequence_is_all_ignorable_whitespace = [&]() -> bool {
for (auto& node : sequence) {
@ -699,7 +699,7 @@ static void for_each_sequence_of_consecutive_children_matching(NodeWithStyle& pa
}
template<typename WrapperBoxType>
static void wrap_in_anonymous(Vector<JS::Handle<Node>>& sequence, Node* nearest_sibling, CSS::Display display)
static void wrap_in_anonymous(Vector<GC::Root<Node>>& sequence, Node* nearest_sibling, CSS::Display display)
{
VERIFY(!sequence.is_empty());
auto& parent = *sequence.first()->parent();
@ -753,9 +753,9 @@ void TreeBuilder::generate_missing_child_wrappers(NodeWithStyle& root)
});
}
Vector<JS::Handle<Box>> TreeBuilder::generate_missing_parents(NodeWithStyle& root)
Vector<GC::Root<Box>> TreeBuilder::generate_missing_parents(NodeWithStyle& root)
{
Vector<JS::Handle<Box>> table_roots_to_wrap;
Vector<GC::Root<Box>> table_roots_to_wrap;
root.for_each_in_inclusive_subtree_of_type<Box>([&](auto& parent) {
// An anonymous table-row box must be generated around each sequence of consecutive table-cell boxes whose parent is not a table-row.
if (is_not_table_row(parent)) {
@ -833,7 +833,7 @@ static void fixup_row(Box& row_box, TableGrid const& table_grid, size_t row_inde
}
}
void TreeBuilder::missing_cells_fixup(Vector<JS::Handle<Box>> const& table_root_boxes)
void TreeBuilder::missing_cells_fixup(Vector<GC::Root<Box>> const& table_root_boxes)
{
// Implements https://www.w3.org/TR/css-tables-3/#missing-cells-fixup.
for (auto& table_box : table_root_boxes) {

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/RefPtr.h>
#include <LibJS/Heap/GCPtr.h>
#include <LibGC/Ptr.h>
#include <LibWeb/CSS/Display.h>
#include <LibWeb/CSS/Selector.h>
#include <LibWeb/Forward.h>
@ -18,7 +18,7 @@ class TreeBuilder {
public:
TreeBuilder();
JS::GCPtr<Layout::Node> build(DOM::Node&);
GC::Ptr<Layout::Node> build(DOM::Node&);
private:
struct Context {
@ -43,8 +43,8 @@ private:
void fixup_tables(NodeWithStyle& root);
void remove_irrelevant_boxes(NodeWithStyle& root);
void generate_missing_child_wrappers(NodeWithStyle& root);
Vector<JS::Handle<Box>> generate_missing_parents(NodeWithStyle& root);
void missing_cells_fixup(Vector<JS::Handle<Box>> const&);
Vector<GC::Root<Box>> generate_missing_parents(NodeWithStyle& root);
void missing_cells_fixup(Vector<GC::Root<Box>> const&);
enum class AppendOrPrepend {
Append,
@ -53,8 +53,8 @@ private:
void insert_node_into_inline_or_block_ancestor(Layout::Node&, CSS::Display, AppendOrPrepend);
void create_pseudo_element_if_needed(DOM::Element&, CSS::Selector::PseudoElement::Type, AppendOrPrepend);
JS::GCPtr<Layout::Node> m_layout_root;
Vector<JS::NonnullGCPtr<Layout::NodeWithStyle>> m_ancestor_stack;
GC::Ptr<Layout::Node> m_layout_root;
Vector<GC::Ref<Layout::NodeWithStyle>> m_ancestor_stack;
u32 m_quote_nesting_level { 0 };
};

View file

@ -10,7 +10,7 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(VideoBox);
GC_DEFINE_ALLOCATOR(VideoBox);
VideoBox::VideoBox(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
: ReplacedBox(document, element, move(style))
@ -57,7 +57,7 @@ void VideoBox::did_set_viewport_rect(CSSPixelRect const&)
// is in view. Implement those steps.
}
JS::GCPtr<Painting::Paintable> VideoBox::create_paintable() const
GC::Ptr<Painting::Paintable> VideoBox::create_paintable() const
{
return Painting::VideoPaintable::create(*this);
}

View file

@ -15,8 +15,8 @@ namespace Web::Layout {
class VideoBox final
: public ReplacedBox
, public DOM::Document::ViewportClient {
JS_CELL(VideoBox, ReplacedBox);
JS_DECLARE_ALLOCATOR(VideoBox);
GC_CELL(VideoBox, ReplacedBox);
GC_DECLARE_ALLOCATOR(VideoBox);
public:
virtual void prepare_for_replaced_layout() override;
@ -24,7 +24,7 @@ public:
HTML::HTMLVideoElement& dom_node();
HTML::HTMLVideoElement const& dom_node() const;
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
private:
VideoBox(DOM::Document&, DOM::Element&, CSS::StyleProperties);

View file

@ -14,7 +14,7 @@
namespace Web::Layout {
JS_DEFINE_ALLOCATOR(Viewport);
GC_DEFINE_ALLOCATOR(Viewport);
Viewport::Viewport(DOM::Document& document, CSS::StyleProperties style)
: BlockContainer(document, &document, move(style))
@ -23,7 +23,7 @@ Viewport::Viewport(DOM::Document& document, CSS::StyleProperties style)
Viewport::~Viewport() = default;
JS::GCPtr<Painting::Paintable> Viewport::create_paintable() const
GC::Ptr<Painting::Paintable> Viewport::create_paintable() const
{
return Painting::ViewportPaintable::create(*this);
}

View file

@ -12,15 +12,15 @@
namespace Web::Layout {
class Viewport final : public BlockContainer {
JS_CELL(Viewport, BlockContainer);
JS_DECLARE_ALLOCATOR(Viewport);
GC_CELL(Viewport, BlockContainer);
GC_DECLARE_ALLOCATOR(Viewport);
public:
explicit Viewport(DOM::Document&, CSS::StyleProperties);
virtual ~Viewport() override;
struct TextPosition {
JS::NonnullGCPtr<DOM::Text> dom_node;
GC::Ref<DOM::Text> dom_node;
size_t start_offset { 0 };
};
struct TextBlock {
@ -34,7 +34,7 @@ public:
virtual void visit_edges(Visitor&) override;
private:
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
void update_text_blocks();