Skip to content

Truly independent web browser

Everywhere: Use RootVector for vectors of values that hold cells

Andreas Kling46a084cef2b3
diff --git a/Libraries/LibJS/Debugger.cpp b/Libraries/LibJS/Debugger.cpp
index 37f35a6d5cf..ff0b976d686 100644
--- a/Libraries/LibJS/Debugger.cpp
+++ b/Libraries/LibJS/Debugger.cpp
@@ -133,7 +133,7 @@ bool Debugger::is_paused() const
static void append_frame_binding(void* context, JSDebuggerFrameBinding const* binding)
{
VERIFY(binding);
- auto& bindings = *static_cast<GC::ConservativeVector<Debugger::FrameBinding>*>(context);
+ auto& bindings = *static_cast<GC::RootVector<Debugger::FrameBinding>*>(context);
bindings.append({
.name = Utf16FlyString::from_utf16(utf16_view_from_abi(binding->name)),
.value = value_from_abi(binding->value),
@@ -141,9 +141,9 @@ static void append_frame_binding(void* context, JSDebuggerFrameBinding const* bi
});
}
-GC::ConservativeVector<Debugger::FrameBinding> Debugger::bindings_for_frame(ExecutionContext const& execution_context) const
+GC::RootVector<Debugger::FrameBinding> Debugger::bindings_for_frame(ExecutionContext const& execution_context) const
{
- GC::ConservativeVector<FrameBinding> bindings;
+ GC::RootVector<FrameBinding> bindings;
JSDebuggerFrameBindingSink sink { .context = &bindings, .append = append_frame_binding };
js_debugger_bindings_for_frame(vm_to_abi(vm()), execution_context_to_abi(execution_context), &sink);
return bindings;
diff --git a/Libraries/LibJS/Debugger.h b/Libraries/LibJS/Debugger.h
index 58b08fa074a..879d184c328 100644
--- a/Libraries/LibJS/Debugger.h
+++ b/Libraries/LibJS/Debugger.h
@@ -10,9 +10,9 @@
#include <AK/HashMap.h>
#include <AK/Utf16View.h>
#include <AK/Vector.h>
-#include <LibGC/ConservativeVector.h>
#include <LibGC/Function.h>
#include <LibGC/Root.h>
+#include <LibGC/RootVector.h>
#include <LibGC/WeakHashSet.h>
#include <LibJS/Breakpoint.h>
#include <LibJS/Export.h>
@@ -71,6 +71,8 @@ public:
Utf16FlyString name;
Value value;
bool is_mutable { true };
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(value); }
};
// The callback must call continue_execution() before it returns. It may evaluate JavaScript,
@@ -81,7 +83,7 @@ public:
// Continue after the host filters out a pause without cancelling an active step operation.
void continue_execution_preserving_step_state();
bool is_paused() const;
- GC::ConservativeVector<FrameBinding> bindings_for_frame(ExecutionContext const&) const;
+ GC::RootVector<FrameBinding> bindings_for_frame(ExecutionContext const&) const;
ThrowCompletionOr<Value> evaluate_in_frame(ExecutionContext&, Utf16View source_text, UpdateOriginalBindings = UpdateOriginalBindings::Yes);
void request_pause_on_next_bytecode_execution();
diff --git a/Libraries/LibWeb/Animations/AnimationEffect.cpp b/Libraries/LibWeb/Animations/AnimationEffect.cpp
index e483d48f499..448740e43d4 100644
--- a/Libraries/LibWeb/Animations/AnimationEffect.cpp
+++ b/Libraries/LibWeb/Animations/AnimationEffect.cpp
@@ -5,7 +5,6 @@
*/
#include <AK/ScopeGuard.h>
-#include <LibGC/ConservativeVector.h>
#include <LibGC/RootVector.h>
#include <LibJS/Runtime/VM.h>
#include <LibWeb/Animations/Animation.h>
@@ -871,9 +870,15 @@ void AnimationUpdateContext::publish()
struct Sample {
DOM::AbstractElement element;
ElementData const& data;
- GC::RootVector<GC::Ref<KeyframeEffect>> effects;
+ Vector<GC::Ref<KeyframeEffect>> effects;
+
+ void visit_edges(GC::Cell::Visitor& visitor)
+ {
+ element.visit_edges(visitor);
+ visitor.visit(effects);
+ }
};
- GC::ConservativeVector<Sample> samples;
+ GC::RootVector<Sample> samples;
for (auto& it : elements) {
if (!it.value.target_style)
continue;
@@ -915,7 +920,7 @@ void AnimationUpdateContext::publish()
bool may_record_baseline { false };
};
Vector<Publication> publications;
- GC::ConservativeVector<CSS::StyleComputer::SampledAnimationOverlay> overlays;
+ GC::RootVector<CSS::StyleComputer::SampledAnimationOverlay> overlays;
Vector<CSS::StyleEngineFFI::FfiAnimationOverlayPublication> published;
// The render owner samples every element of a document in one call, and publishes what it sampled in another,
@@ -924,7 +929,7 @@ void AnimationUpdateContext::publish()
auto& document = samples[first].element.document();
auto& style_computer = document.style_computer();
Layout::ForcedReadScope read { document };
- GC::ConservativeVector<CSS::StyleComputer::AnimationRefreshRequest> requests;
+ GC::RootVector<CSS::StyleComputer::AnimationRefreshRequest> requests;
size_t end = first;
for (; end < samples.size() && &samples[end].element.document() == &document; ++end) {
auto& sample = samples[end];
diff --git a/Libraries/LibWeb/CSS/CSSStyleProperties.cpp b/Libraries/LibWeb/CSS/CSSStyleProperties.cpp
index a385682edec..4f8a620fb01 100644
--- a/Libraries/LibWeb/CSS/CSSStyleProperties.cpp
+++ b/Libraries/LibWeb/CSS/CSSStyleProperties.cpp
@@ -524,7 +524,7 @@ static void ensure_pseudo_element_style_for_cssom(Layout::BegunRead const& read,
// A highlight pseudo-element inherits from its parent element's, which is only kept current near an active
// highlight, so the chain is computed outermost first.
if (is_highlight_pseudo_element(*pseudo_element)) {
- GC::ConservativeVector<DOM::AbstractElement> ancestors;
+ GC::RootVector<DOM::AbstractElement> ancestors;
for (auto ancestor = abstract_element.element().element_to_inherit_style_from({}); ancestor; ancestor = ancestor->element_to_inherit_style_from({}))
ancestors.append({ *ancestor, pseudo_element });
for (auto& ancestor : ancestors.in_reverse())
diff --git a/Libraries/LibWeb/CSS/StyleComputer.cpp b/Libraries/LibWeb/CSS/StyleComputer.cpp
index 90f658ecfe7..6eba1b510eb 100644
--- a/Libraries/LibWeb/CSS/StyleComputer.cpp
+++ b/Libraries/LibWeb/CSS/StyleComputer.cpp
@@ -106,6 +106,17 @@
namespace Web::CSS {
+void StyleComputer::AnimationRefreshRequest::visit_edges(GC::Cell::Visitor& visitor) const
+{
+ abstract_element.visit_edges(visitor);
+ visitor.visit(effects);
+}
+
+void StyleComputer::SampledAnimationOverlay::visit_edges(GC::Cell::Visitor& visitor) const
+{
+ element.visit_edges(visitor);
+}
+
GC_DEFINE_ALLOCATOR(StyleComputer);
StyleComputer::StyleComputer(DOM::Document& document)
@@ -1627,8 +1638,10 @@ void StyleComputer::publish_sampled_animation_overlays(Layout::BegunRead const&
ComputedStyleWorkingSet const& style;
GC::Ref<DOM::Document const> document;
TreeScopeID tree_scope;
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(document); }
};
- GC::ConservativeVector<OverlayFont, 1> fonts;
+ GC::RootVector<OverlayFont, 1> fonts;
Vector<StyleEngineFFI::FfiAnimationOverlayPublicationInput, 1> inputs;
fonts.ensure_capacity(overlays.size());
inputs.ensure_capacity(overlays.size());
diff --git a/Libraries/LibWeb/CSS/StyleComputer.h b/Libraries/LibWeb/CSS/StyleComputer.h
index 40e71e3df44..9f3d989d1bb 100644
--- a/Libraries/LibWeb/CSS/StyleComputer.h
+++ b/Libraries/LibWeb/CSS/StyleComputer.h
@@ -96,6 +96,8 @@ public:
struct SampledAnimationOverlay {
DOM::AbstractElement element;
ComputedStyleWorkingSet const& style;
+
+ void visit_edges(GC::Cell::Visitor&) const;
};
void publish_sampled_animation_overlays(Layout::BegunRead const& read, ReadonlySpan<SampledAnimationOverlay>, Span<StyleEngineFFI::FfiAnimationOverlayPublication> publications) const;
// Give a layout-only variant of an element or pseudo-element style an authoritative record
@@ -138,6 +140,8 @@ public:
DOM::AbstractElement abstract_element;
ReadonlySpan<GC::Ref<Animations::KeyframeEffect>> effects;
ComputedStyleWorkingSet& computed_properties;
+
+ void visit_edges(GC::Cell::Visitor&) const;
};
// Refreshes the animations of elements of this document, sampling them all in one call of the style engine.
void refresh_animations_into_each(Layout::BegunRead const& read, ReadonlySpan<AnimationRefreshRequest>) const;
diff --git a/Libraries/LibWeb/CSS/StyleEngineInput.cpp b/Libraries/LibWeb/CSS/StyleEngineInput.cpp
index 6eebdb61965..0ce8560182c 100644
--- a/Libraries/LibWeb/CSS/StyleEngineInput.cpp
+++ b/Libraries/LibWeb/CSS/StyleEngineInput.cpp
@@ -7,8 +7,8 @@
#include <AK/HashTable.h>
#include <AK/QuickSort.h>
#include <AK/SetUnion.h>
-#include <LibGC/ConservativeVector.h>
#include <LibGC/RootHashTable.h>
+#include <LibGC/RootVector.h>
#include <LibWeb/Animations/KeyframeEffect.h>
#include <LibWeb/CSS/CSSAnimation.h>
#include <LibWeb/CSS/CSSStyleRule.h>
@@ -820,6 +820,8 @@ private:
struct AncestorRow {
GC::Ptr<DOM::Element const> element;
Inherited inherited;
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(element); }
};
StyleEngine& m_style_engine;
@@ -829,7 +831,7 @@ private:
StyleAtomID m_rtl_atom;
TableByName<ElementKind, 64> m_kinds;
TableByName<PublishedAttributeName, 32> m_attribute_names;
- GC::ConservativeVector<AncestorRow, 32> m_elements_to_parent;
+ GC::RootVector<AncestorRow, 32> m_elements_to_parent;
GC::RootVector<GC::Ref<DOM::Element>> m_elements_asked_their_language;
Vector<StyleEngineFFI::FfiElementArrivalRow> m_rows;
Vector<u32, 512> m_atoms;
@@ -847,6 +849,8 @@ static void learn_what_the_engine_reads(StyleEngine& style_engine, Layout::Begun
struct PendingArrivalRoot {
GC::Ref<DOM::Node> node;
bool children_wait { false };
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(node); }
};
// Every node in the subtrees waiting to arrive, in tree order, takes its identity, and every element records its
@@ -862,8 +866,10 @@ static void record_subtree_arrivals(DOM::Document& document, ReadonlySpan<Pendin
struct Arrival {
GC::Ref<DOM::Node> node;
TreeScopeID tree_scope;
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(node); }
};
- GC::ConservativeVector<Arrival, 64> arrivals;
+ GC::RootVector<Arrival, 64> arrivals;
GC::RootVector<GC::Ref<DOM::Text>, 64> text_arrivals;
// Elements and text nodes in tree order, which is the order their places in the DOM child sequence can be taken
// in: each node's previous sibling has taken its place first.
@@ -1154,7 +1160,7 @@ static bool collect_pending_style_arrival_roots(DOM::Node& node, Vector<PendingA
// OPTIMIZATION: The subtrees waiting to arrive, found among the nodes marked since the last take-in rather than along the
// marks, which reach every child of each node on the path to one. Answers false, having found nothing,
// where the marks have to be walked: a node is in a shadow tree, whose tree order the walk follows.
-static bool take_listed_arrival_roots(DOM::Document& document, GC::RootVector<GC::Ref<DOM::Node>> const& listed, GC::ConservativeVector<PendingArrivalRoot, 16>& roots, HiddenChildArrivalDecision& decision)
+static bool take_listed_arrival_roots(DOM::Document& document, GC::RootVector<GC::Ref<DOM::Node>> const& listed, GC::RootVector<PendingArrivalRoot, 16>& roots, HiddenChildArrivalDecision& decision)
{
GC::RootVector<GC::Ref<DOM::Node>> found;
GC::RootHashTable<GC::Ref<DOM::Node>> seen;
@@ -1219,7 +1225,7 @@ static void take_in_pending_style_arrivals(DOM::Document& document, HiddenChildA
// NB: Publication can bring another document up to date, as an SVG image's for its natural size, whose own take-in
// this says nothing about.
auto taking_in = style_engine.begin_taking_in_pending_arrivals();
- GC::ConservativeVector<PendingArrivalRoot, 16> roots;
+ GC::RootVector<PendingArrivalRoot, 16> roots;
{
HiddenChildArrivalDecision decision { document, hidden_child_arrivals };
auto listed = style_engine.take_listed_arrivals();
diff --git a/Libraries/LibWeb/CSS/StyleValues/UnresolvedStyleValue.cpp b/Libraries/LibWeb/CSS/StyleValues/UnresolvedStyleValue.cpp
index a8ed107e85b..24a83228092 100644
--- a/Libraries/LibWeb/CSS/StyleValues/UnresolvedStyleValue.cpp
+++ b/Libraries/LibWeb/CSS/StyleValues/UnresolvedStyleValue.cpp
@@ -7,7 +7,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <LibGC/ConservativeVector.h>
+#include <LibGC/RootVector.h>
#include <LibWeb/CSS/StyleValues/UnresolvedStyleValue.h>
namespace Web::CSS {
diff --git a/Libraries/LibWeb/Clipboard/Clipboard.cpp b/Libraries/LibWeb/Clipboard/Clipboard.cpp
index 67788fea76b..18acd7fb5d3 100644
--- a/Libraries/LibWeb/Clipboard/Clipboard.cpp
+++ b/Libraries/LibWeb/Clipboard/Clipboard.cpp
@@ -242,7 +242,7 @@ void Clipboard::read(JS::Realm& realm, ClipboardReadOptions formats, GC::Ref<Web
void visit_edges(GC::Cell::Visitor& visitor) const { visitor.visit(item); }
};
- GC::ConservativeVector<ReadItem> items;
+ GC::RootVector<ReadItem> items;
// 6. For each systemClipboardItem in data:
for (auto const& system_clipboard_item : data) {
diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp
index 864c43c4524..d9572a7c019 100644
--- a/Libraries/LibWeb/DOM/Document.cpp
+++ b/Libraries/LibWeb/DOM/Document.cpp
@@ -27,7 +27,6 @@
#include <LibCompositing/DisplayList/AccumulatedVisualContext.h>
#include <LibCompositing/DisplayList/DisplayList.h>
#include <LibCore/Timer.h>
-#include <LibGC/ConservativeVector.h>
#include <LibGC/Heap.h>
#include <LibGC/HeapVector.h>
#include <LibGC/RootHashMap.h>
@@ -303,6 +302,23 @@
namespace Web::DOM {
+void PendingFullscreenEvent::visit_edges(GC::Cell::Visitor& visitor) const
+{
+ visitor.visit(element);
+}
+
+void Document::PendingScrollEvent::visit_edges(GC::Cell::Visitor& visitor) const
+{
+ visitor.visit(event_target);
+}
+
+void Document::PendingAnimationEvent::visit_edges(GC::Cell::Visitor& visitor) const
+{
+ visitor.visit(event);
+ visitor.visit(animation);
+ visitor.visit(target);
+}
+
struct Document::AccessibilityRecordCache {
AK_ALLOC_WITH_KMALLOC;
struct Record {
@@ -3560,6 +3576,8 @@ void Document::dispatch_boundary_events(GC::Ptr<Node> old_hovered_node, GC::Ptr<
struct HoverEventTarget {
GC::Ref<Node> node;
CSSPixelPoint offset;
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(node); }
};
auto make_hover_event_target = [&](Node& target) {
@@ -3576,11 +3594,11 @@ void Document::dispatch_boundary_events(GC::Ptr<Node> old_hovered_node, GC::Ptr<
if (node)
hovered_node_offset = hover_event_offset_for_target(read, hover_event_data, *node);
- GC::ConservativeVector<HoverEventTarget> left_ancestors;
+ GC::RootVector<HoverEventTarget> left_ancestors;
for (auto* target = old_hovered_node.ptr(); target && target != common_ancestor; target = target->flat_tree_parent())
left_ancestors.append(make_hover_event_target(*target));
- GC::ConservativeVector<HoverEventTarget> entered_ancestors;
+ GC::RootVector<HoverEventTarget> entered_ancestors;
for (auto* target = node.ptr(); target && target != common_ancestor; target = target->flat_tree_parent())
entered_ancestors.append(make_hover_event_target(*target));
@@ -5918,7 +5936,7 @@ void Document::run_the_scroll_steps()
// 2. For each item (target, type) in doc’s pending scroll events, in the order they were added to the list, run
// these substeps:
// NB: Firing an event allocates, and a target removed from its document may be referenced only by this list.
- GC::ConservativeVector<PendingScrollEvent> pending_scroll_events { exchange(m_pending_scroll_events, {}) };
+ GC::RootVector<PendingScrollEvent> pending_scroll_events { exchange(m_pending_scroll_events, {}) };
for (auto const& [target, type] : pending_scroll_events) {
// 1. If target is a Document, and type is "scroll" or "scrollend", fire an event named type that bubbles at target.
if (is<Document>(*target) && (type == HTML::EventNames::scroll || type == HTML::EventNames::scrollend)) {
@@ -10114,7 +10132,7 @@ void Document::update_animations_and_send_events(double timestamp)
}
// 4. Let events to dispatch be a copy of doc’s pending animation event queue.
- GC::ConservativeVector<PendingAnimationEvent> events_to_dispatch;
+ GC::RootVector<PendingAnimationEvent> events_to_dispatch;
events_to_dispatch.extend(m_pending_animation_event_queue);
// 5. Clear doc’s pending animation event queue.
@@ -10152,7 +10170,7 @@ void Document::update_animations_and_send_events(double timestamp)
return order < 0;
return a < b;
});
- GC::ConservativeVector<PendingAnimationEvent> sorted_events;
+ GC::RootVector<PendingAnimationEvent> sorted_events;
sorted_events.ensure_capacity(events_to_dispatch.size());
for (auto index : event_order)
sorted_events.unchecked_append(events_to_dispatch[index]);
@@ -10540,8 +10558,10 @@ void Document::set_design_mode_enabled_state(bool design_mode_enabled)
struct PreviousReadWriteState {
GC::Ptr<Element> element;
bool value;
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(element); }
};
- GC::ConservativeVector<PreviousReadWriteState> previous_read_write_states;
+ GC::RootVector<PreviousReadWriteState> previous_read_write_states;
for_each_in_inclusive_subtree_of_type<Element>([&](Element& element) {
previous_read_write_states.append({ element, SelectorMatching::element_matches_state(element, CSS::PseudoClass::ReadWrite) });
return TraversalDecision::Continue;
@@ -11403,7 +11423,7 @@ void Document::remove_render_blocking_element(GC::Ref<Element> element)
void Document::run_fullscreen_steps()
{
// 1. Let pendingEvents be document’s list of pending fullscreen events.
- GC::ConservativeVector<PendingFullscreenEvent> pending_events;
+ GC::RootVector<PendingFullscreenEvent> pending_events;
pending_events.extend(m_pending_fullscreen_events);
// 2. Empty document’s list of pending fullscreen events.
diff --git a/Libraries/LibWeb/DOM/Document.h b/Libraries/LibWeb/DOM/Document.h
index 7d666306f10..b70de3695de 100644
--- a/Libraries/LibWeb/DOM/Document.h
+++ b/Libraries/LibWeb/DOM/Document.h
@@ -302,6 +302,8 @@ struct PendingFullscreenEvent {
} type;
GC::Ref<Element> element;
Fullscreen::RequestType request_type;
+
+ void visit_edges(GC::Cell::Visitor&) const;
};
class WEB_API Document
@@ -1169,6 +1171,8 @@ public:
GC::Ref<EventTarget> event_target;
Utf16FlyString event_type;
bool operator==(PendingScrollEvent const&) const = default;
+
+ void visit_edges(GC::Cell::Visitor&) const;
};
bool append_pending_scroll_event(PendingScrollEvent);
Vector<PendingScrollEvent>& pending_scroll_events() { return m_pending_scroll_events; }
@@ -1413,6 +1417,8 @@ public:
GC::Ref<Animations::Animation> animation;
GC::Ref<DOM::EventTarget> target;
Optional<double> scheduled_event_time;
+
+ void visit_edges(GC::Cell::Visitor&) const;
};
void append_pending_animation_event(PendingAnimationEvent const&);
void update_animations_and_send_events(double timestamp);
diff --git a/Libraries/LibWeb/DOM/DocumentHighlightStyles.cpp b/Libraries/LibWeb/DOM/DocumentHighlightStyles.cpp
index 82d36488167..a1028bc6c69 100644
--- a/Libraries/LibWeb/DOM/DocumentHighlightStyles.cpp
+++ b/Libraries/LibWeb/DOM/DocumentHighlightStyles.cpp
@@ -103,11 +103,17 @@ static void collect_highlight_observing_elements(Vector<CSS::StyleNodeID>& style
struct HighlightStyleInput {
GC::Ref<Node> root;
GC::Ptr<AbstractRange> range;
+
+ void visit_edges(GC::Cell::Visitor& visitor)
+ {
+ visitor.visit(root);
+ visitor.visit(range);
+ }
};
-static GC::ConservativeVector<HighlightStyleInput, 2> selection_style_inputs(Document& document)
+static GC::RootVector<HighlightStyleInput, 2> selection_style_inputs(Document& document)
{
- GC::ConservativeVector<HighlightStyleInput, 2> inputs;
+ GC::RootVector<HighlightStyleInput, 2> inputs;
if (auto selection = document.get_selection(); selection && !selection->is_collapsed()) {
auto range = selection->range();
inputs.append({ range->common_ancestor_container(), range });
@@ -117,9 +123,9 @@ static GC::ConservativeVector<HighlightStyleInput, 2> selection_style_inputs(Doc
return inputs;
}
-static GC::ConservativeVector<HighlightStyleInput, 2> search_text_style_inputs(Document& document)
+static GC::RootVector<HighlightStyleInput, 2> search_text_style_inputs(Document& document)
{
- GC::ConservativeVector<HighlightStyleInput, 2> inputs;
+ GC::RootVector<HighlightStyleInput, 2> inputs;
if (auto active_match = document.find_in_page_active_match(); active_match && !active_match->collapsed())
inputs.append({ active_match->common_ancestor_container(), active_match });
GC::RootHashTable<Node*> highlighted_roots;
@@ -133,9 +139,9 @@ static GC::ConservativeVector<HighlightStyleInput, 2> search_text_style_inputs(D
return inputs;
}
-static GC::ConservativeVector<HighlightStyleInput, 2> spelling_error_style_inputs(Document& document)
+static GC::RootVector<HighlightStyleInput, 2> spelling_error_style_inputs(Document& document)
{
- GC::ConservativeVector<HighlightStyleInput, 2> inputs;
+ GC::RootVector<HighlightStyleInput, 2> inputs;
if (!document.has_spelling_markers())
return inputs;
GC::RootHashTable<Node*> roots;
@@ -173,7 +179,7 @@ static bool collect_custom_highlight_observing_elements(Document& document, Vect
bool read_static_ranges = false;
auto& style_engine = document.style_computer().style_engine();
registry->for_each_highlight_in_stacking_order([&](Utf16String const& name, ReadonlySpan<GC::Ref<AbstractRange>> ranges) {
- GC::ConservativeVector<HighlightStyleInput, 2> inputs;
+ GC::RootVector<HighlightStyleInput, 2> inputs;
GC::RootHashMap<Node const*, size_t> input_index_by_root;
for (auto const& range : ranges) {
read_static_ranges |= is<StaticRange>(*range);
diff --git a/Libraries/LibWeb/DOM/Node.cpp b/Libraries/LibWeb/DOM/Node.cpp
index e82d63683f9..42e82b66d3e 100644
--- a/Libraries/LibWeb/DOM/Node.cpp
+++ b/Libraries/LibWeb/DOM/Node.cpp
@@ -14,7 +14,6 @@
#include <AK/NeverDestroyed.h>
#include <AK/Utf16StringBuilder.h>
#include <AK/Vector.h>
-#include <LibGC/ConservativeVector.h>
#include <LibGC/DeferGC.h>
#include <LibGC/Heap.h>
#include <LibGC/RootVector.h>
@@ -1968,8 +1967,10 @@ WebIDL::ExceptionOr<void> Node::move_node(Node& new_parent, Node* child)
struct PreviousReadWriteState {
GC::Ptr<Element> element;
bool value;
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(element); }
};
- GC::ConservativeVector<PreviousReadWriteState> previous_read_write_states;
+ GC::RootVector<PreviousReadWriteState> previous_read_write_states;
if (old_parent->in_editable_subtree() != new_parent.in_editable_subtree()) {
for_each_in_inclusive_subtree_of_type<Element>([&](Element& element) {
previous_read_write_states.append({ element, SelectorMatching::element_matches_state(element, CSS::PseudoClass::ReadWrite) });
diff --git a/Libraries/LibWeb/DOM/Slottable.cpp b/Libraries/LibWeb/DOM/Slottable.cpp
index 6847a837cce..3a762fc51c0 100644
--- a/Libraries/LibWeb/DOM/Slottable.cpp
+++ b/Libraries/LibWeb/DOM/Slottable.cpp
@@ -158,10 +158,10 @@ GC::Ptr<HTML::HTMLSlotElement> find_a_slot(Slottable const& slottable, OpenFlag
}
// https://dom.spec.whatwg.org/#find-slotables
-GC::ConservativeVector<Slottable> find_slottables(GC::Ref<HTML::HTMLSlotElement> slot)
+GC::RootVector<Slottable> find_slottables(GC::Ref<HTML::HTMLSlotElement> slot)
{
// 1. Let result be an empty list.
- GC::ConservativeVector<Slottable> result;
+ GC::RootVector<Slottable> result;
// 2. Let root be slot’s root.
auto& root = slot->root();
@@ -209,10 +209,10 @@ GC::ConservativeVector<Slottable> find_slottables(GC::Ref<HTML::HTMLSlotElement>
}
// https://dom.spec.whatwg.org/#find-flattened-slotables
-GC::ConservativeVector<Slottable> find_flattened_slottables(GC::Ref<HTML::HTMLSlotElement> slot)
+GC::RootVector<Slottable> find_flattened_slottables(GC::Ref<HTML::HTMLSlotElement> slot)
{
// 1. Let result be « ».
- GC::ConservativeVector<Slottable> result;
+ GC::RootVector<Slottable> result;
// 2. If slot’s root is not a shadow root, then return result.
if (!slot->root().is_shadow_root())
diff --git a/Libraries/LibWeb/DOM/Slottable.h b/Libraries/LibWeb/DOM/Slottable.h
index 461577404c6..662f970f8bd 100644
--- a/Libraries/LibWeb/DOM/Slottable.h
+++ b/Libraries/LibWeb/DOM/Slottable.h
@@ -8,8 +8,8 @@
#include <AK/Utf16FlyString.h>
#include <AK/Variant.h>
-#include <LibGC/ConservativeVector.h>
#include <LibGC/Ptr.h>
+#include <LibGC/RootVector.h>
#include <LibJS/Heap/Cell.h>
#include <LibWeb/Export.h>
#include <LibWeb/Forward.h>
@@ -70,8 +70,8 @@ GC::Ptr<HTML::HTMLSlotElement> assigned_slot_for_node(GC::Ref<Node>);
bool is_an_assigned_slottable(GC::Ref<Node>);
GC::Ptr<HTML::HTMLSlotElement> find_a_slot(Slottable const&, OpenFlag = OpenFlag::Unset);
-GC::ConservativeVector<Slottable> find_slottables(GC::Ref<HTML::HTMLSlotElement>);
-GC::ConservativeVector<Slottable> find_flattened_slottables(GC::Ref<HTML::HTMLSlotElement>);
+GC::RootVector<Slottable> find_slottables(GC::Ref<HTML::HTMLSlotElement>);
+GC::RootVector<Slottable> find_flattened_slottables(GC::Ref<HTML::HTMLSlotElement>);
void assign_slottables(GC::Ref<HTML::HTMLSlotElement>, SignalSlotChange = SignalSlotChange::Yes);
void assign_slottables_for_a_tree(GC::Ref<Node>);
void assign_a_slot(Slottable const&);
diff --git a/Libraries/LibWeb/Editing/Commands.cpp b/Libraries/LibWeb/Editing/Commands.cpp
index 5f041d7e1e8..12f7dff9d3d 100644
--- a/Libraries/LibWeb/Editing/Commands.cpp
+++ b/Libraries/LibWeb/Editing/Commands.cpp
@@ -5,7 +5,6 @@
*/
#include <AK/ScopeGuard.h>
-#include <LibGC/ConservativeVector.h>
#include <LibGC/RootVector.h>
#include <LibUnicode/CharacterTypes.h>
#include <LibUnicode/Segmenter.h>
@@ -1500,8 +1499,10 @@ static Utf16String plain_text_of_fragment(DOM::DocumentFragment& fragment)
GC::Ref<DOM::Node> node;
bool preserves_white_space;
bool is_block_end;
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(node); }
};
- GC::ConservativeVector<PendingNode> pending_nodes;
+ GC::RootVector<PendingNode> pending_nodes;
pending_nodes.append({ fragment, false, false });
while (!pending_nodes.is_empty()) {
auto [node, preserves_white_space, is_block_end] = pending_nodes.take_last();
diff --git a/Libraries/LibWeb/Editing/Internal/Algorithms.cpp b/Libraries/LibWeb/Editing/Internal/Algorithms.cpp
index 6446020acf2..889354d3deb 100644
--- a/Libraries/LibWeb/Editing/Internal/Algorithms.cpp
+++ b/Libraries/LibWeb/Editing/Internal/Algorithms.cpp
@@ -1022,6 +1022,8 @@ struct ResolvedWhiteSpace {
struct RecordedWhiteSpace {
GC::Ref<DOM::Node> node;
ResolvedWhiteSpace white_space;
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(node); }
};
}
@@ -1174,9 +1176,9 @@ bool element_changes_formatting(DOM::Element& element)
}
// Record the white-space style of nodes, which are about to be joined into another block.
-static GC::ConservativeVector<RecordedWhiteSpace> record_white_space_of_nodes(GC::RootVector<GC::Ref<DOM::Node>>& nodes)
+static GC::RootVector<RecordedWhiteSpace> record_white_space_of_nodes(GC::RootVector<GC::Ref<DOM::Node>>& nodes)
{
- GC::ConservativeVector<RecordedWhiteSpace> recorded;
+ GC::RootVector<RecordedWhiteSpace> recorded;
GC::RootVector<GC::Ref<DOM::Node>> new_nodes;
for (auto node : nodes) {
auto white_space = resolved_white_space(node);
@@ -1586,8 +1588,8 @@ void delete_the_selection(Selection& selection, bool block_merging, bool strip_w
remove_node(*start_block->first_child());
// 32. If start block is an ancestor of end block:
- GC::ConservativeVector<RecordedNodeValue> values;
- GC::ConservativeVector<RecordedWhiteSpace> recorded_white_space;
+ GC::RootVector<RecordedNodeValue> values;
+ GC::RootVector<RecordedWhiteSpace> recorded_white_space;
if (start_block->is_ancestor_of(*end_block)) {
// 1. Let reference node be end block.
auto reference_node = end_block;
@@ -4126,10 +4128,10 @@ Vector<RecordedOverride> record_current_states_and_values(DOM::Document const& d
}
// https://w3c.github.io/editing/docs/execCommand/#record-the-values
-GC::ConservativeVector<RecordedNodeValue> record_the_values_of_nodes(Vector<GC::Ref<DOM::Node>> const& node_list)
+GC::RootVector<RecordedNodeValue> record_the_values_of_nodes(Vector<GC::Ref<DOM::Node>> const& node_list)
{
// 1. Let values be a list of (node, command, specified command value) triples, initially empty.
- GC::ConservativeVector<RecordedNodeValue> values;
+ GC::RootVector<RecordedNodeValue> values;
// 2. For each node in node list, for each command in the list "subscript", "bold", "fontName",
// "fontSize", "foreColor", "hiliteColor", "italic", "strikethrough", and "underline" in that
diff --git a/Libraries/LibWeb/Editing/Internal/Algorithms.h b/Libraries/LibWeb/Editing/Internal/Algorithms.h
index 9df8a50b7e7..695bdd66ecb 100644
--- a/Libraries/LibWeb/Editing/Internal/Algorithms.h
+++ b/Libraries/LibWeb/Editing/Internal/Algorithms.h
@@ -20,6 +20,8 @@ struct RecordedNodeValue {
GC::Ref<DOM::Node> node;
Utf16FlyString command;
Optional<Utf16String> specified_command_value;
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(node); }
};
// https://w3c.github.io/editing/docs/execCommand/#record-current-states-and-values
@@ -135,7 +137,7 @@ void push_down_values(Utf16FlyString const&, GC::Ref<DOM::Node>, Optional<Utf16V
Vector<RecordedOverride> record_current_overrides(DOM::Document const&);
void restore_overrides_that_add_formatting(DOM::Document&, Vector<RecordedOverride> const&);
Vector<RecordedOverride> record_current_states_and_values(DOM::Document const&);
-GC::ConservativeVector<RecordedNodeValue> record_the_values_of_nodes(Vector<GC::Ref<DOM::Node>> const&);
+GC::RootVector<RecordedNodeValue> record_the_values_of_nodes(Vector<GC::Ref<DOM::Node>> const&);
void remove_extraneous_line_breaks_at_the_end_of_node(GC::Ref<DOM::Node>);
void remove_extraneous_line_breaks_before_node(GC::Ref<DOM::Node>);
void remove_extraneous_line_breaks_from_a_node(GC::Ref<DOM::Node>);
diff --git a/Libraries/LibWeb/Editing/SpellCheckController.cpp b/Libraries/LibWeb/Editing/SpellCheckController.cpp
index 15c4aac3ca4..fbbb2187116 100644
--- a/Libraries/LibWeb/Editing/SpellCheckController.cpp
+++ b/Libraries/LibWeb/Editing/SpellCheckController.cpp
@@ -22,6 +22,11 @@
namespace Web::Editing {
+void SpellCheckController::ParagraphPiece::visit_edges(GC::Cell::Visitor& visitor) const
+{
+ visitor.visit(text);
+}
+
// https://html.spec.whatwg.org/multipage/interaction.html#spelling-and-grammar-checking
static bool is_checkable_text_control(HTML::HTMLElement& element)
{
diff --git a/Libraries/LibWeb/Editing/SpellCheckController.h b/Libraries/LibWeb/Editing/SpellCheckController.h
index b2331ae4a40..ce3331d1d6c 100644
--- a/Libraries/LibWeb/Editing/SpellCheckController.h
+++ b/Libraries/LibWeb/Editing/SpellCheckController.h
@@ -10,8 +10,8 @@
#include <AK/Optional.h>
#include <AK/Utf16String.h>
#include <AK/Vector.h>
-#include <LibGC/ConservativeVector.h>
#include <LibGC/Ptr.h>
+#include <LibGC/RootVector.h>
#include <LibGC/Weak.h>
#include <LibWeb/Forward.h>
#include <LibWebCommon/Page/SpellingError.h>
@@ -55,8 +55,10 @@ private:
size_t node_start { 0 };
size_t node_end { 0 };
bool checked { false };
+
+ void visit_edges(GC::Cell::Visitor&) const;
};
- using Paragraph = GC::ConservativeVector<ParagraphPiece>;
+ using Paragraph = GC::RootVector<ParagraphPiece>;
struct RequestPiece {
GC::Weak<DOM::Text> text;
diff --git a/Libraries/LibWeb/Fetch/Body.cpp b/Libraries/LibWeb/Fetch/Body.cpp
index 83d80f9818a..e561a681acc 100644
--- a/Libraries/LibWeb/Fetch/Body.cpp
+++ b/Libraries/LibWeb/Fetch/Body.cpp
@@ -367,7 +367,7 @@ static MultipartParsingErrorOr<MultiPartFormDataHeader> parse_multipart_form_dat
}
// https://andreubotella.github.io/multipart-form-data/#multipart-form-data-parser
-MultipartParsingErrorOr<GC::ConservativeVector<XHR::FormDataEntry>> parse_multipart_form_data(StringView input, MimeSniff::MimeType const& mime_type)
+MultipartParsingErrorOr<GC::RootVector<XHR::FormDataEntry>> parse_multipart_form_data(StringView input, MimeSniff::MimeType const& mime_type)
{
// 1. Assert: mimeType’s essence is "multipart/form-data".
VERIFY(mime_type.essence() == "multipart/form-data"sv);
@@ -379,7 +379,7 @@ MultipartParsingErrorOr<GC::ConservativeVector<XHR::FormDataEntry>> parse_multip
auto boundary = maybe_boundary.release_value();
// 3. Let entry list be an empty entry list.
- GC::ConservativeVector<XHR::FormDataEntry> entry_list;
+ GC::RootVector<XHR::FormDataEntry> entry_list;
// 4. Let position be a pointer to a byte in input, initially pointing at the first byte.
GenericLexer lexer(input);
diff --git a/Libraries/LibWeb/Fetch/Body.h b/Libraries/LibWeb/Fetch/Body.h
index 08c81b9dfea..d8323040a4a 100644
--- a/Libraries/LibWeb/Fetch/Body.h
+++ b/Libraries/LibWeb/Fetch/Body.h
@@ -57,6 +57,6 @@ public:
WebIDL::ExceptionOr<GC::Ref<Streams::ReadableStream>> text_stream(JS::Realm&) const;
};
-[[nodiscard]] MultipartParsingErrorOr<GC::ConservativeVector<XHR::FormDataEntry>> parse_multipart_form_data(StringView input, MimeSniff::MimeType const& mime_type);
+[[nodiscard]] MultipartParsingErrorOr<GC::RootVector<XHR::FormDataEntry>> parse_multipart_form_data(StringView input, MimeSniff::MimeType const& mime_type);
}
diff --git a/Libraries/LibWeb/HTML/Focus.cpp b/Libraries/LibWeb/HTML/Focus.cpp
index 4ca7ccc7ce0..11c54841ba0 100644
--- a/Libraries/LibWeb/HTML/Focus.cpp
+++ b/Libraries/LibWeb/HTML/Focus.cpp
@@ -9,7 +9,6 @@
#include <AK/QuickSort.h>
#include <AK/TypeCasts.h>
#include <AK/Vector.h>
-#include <LibGC/ConservativeVector.h>
#include <LibGC/Root.h>
#include <LibGC/RootVector.h>
#include <LibWeb/Bindings/CSS.h>
@@ -1103,8 +1102,10 @@ static GC::RootVector<GC::Ref<DOM::Element>> tabindex_ordered_focus_navigation_s
GC::Ref<DOM::Element> element;
i32 tabindex;
size_t tree_index;
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(element); }
};
- GC::ConservativeVector<Item> positive_items;
+ GC::RootVector<Item> positive_items;
GC::RootVector<GC::Ref<DOM::Element>> result;
for (auto const& element : focus_navigation_scope(owner)) {
diff --git a/Libraries/LibWeb/HTML/FormAssociatedElement.h b/Libraries/LibWeb/HTML/FormAssociatedElement.h
index a25382e26b0..5f99431682a 100644
--- a/Libraries/LibWeb/HTML/FormAssociatedElement.h
+++ b/Libraries/LibWeb/HTML/FormAssociatedElement.h
@@ -11,7 +11,7 @@
#include <AK/Utf16FlyString.h>
#include <AK/Utf16String.h>
#include <AK/Utf16View.h>
-#include <LibGC/ConservativeVector.h>
+#include <LibGC/RootVector.h>
#include <LibGC/Weak.h>
#include <LibWeb/Bindings/ElementInternals.h>
#include <LibWeb/Bindings/HTMLFormElement.h>
@@ -38,7 +38,7 @@ using ValidityStateFlags = Bindings::ValidityStateFlags;
class WEB_API FormAssociatedElement {
public:
// NB: FACE stands for form-associated custom element.
- using FACESubmissionValue = Variant<GC::Ref<FileAPI::File>, Utf16String, GC::ConservativeVector<XHR::FormDataEntry>, Empty>;
+ using FACESubmissionValue = Variant<GC::Ref<FileAPI::File>, Utf16String, GC::RootVector<XHR::FormDataEntry>, Empty>;
virtual bool is_form_associated_element() const;
diff --git a/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp b/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp
index de8be2ef16a..3f2df5bebd2 100644
--- a/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp
+++ b/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp
@@ -39,7 +39,7 @@ XHR::FormDataEntry create_entry(Utf16View name, Variant<GC::Ref<FileAPI::Blob>,
}
// https://html.spec.whatwg.org/multipage/custom-elements.html#face-entry-construction
-static void construct_face_entry(GC::Ref<HTMLElement const> form_associated_custom_element, GC::ConservativeVector<XHR::FormDataEntry>& entry_list)
+static void construct_face_entry(GC::Ref<HTMLElement const> form_associated_custom_element, GC::RootVector<XHR::FormDataEntry>& entry_list)
{
// 1. If element's submission value is a list of entries, then append each item of element's submission value to
// entry list, and return.
@@ -48,7 +48,7 @@ static void construct_face_entry(GC::Ref<HTMLElement const> form_associated_cust
// content attribute value, they can be strings based on the name content attribute value, or they
// can be unrelated to the name content attribute.
auto const& submission_value = form_associated_custom_element->face_submission_value();
- if (auto const* form_data_entries = submission_value.get_pointer<GC::ConservativeVector<XHR::FormDataEntry>>()) {
+ if (auto const* form_data_entries = submission_value.get_pointer<GC::RootVector<XHR::FormDataEntry>>()) {
entry_list.extend(*form_data_entries);
return;
}
@@ -79,7 +79,7 @@ static void construct_face_entry(GC::Ref<HTMLElement const> form_associated_cust
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set
-Optional<GC::ConservativeVector<XHR::FormDataEntry>> construct_entry_list(HTMLFormElement& form, GC::Ptr<HTMLElement> submitter, Optional<Utf16String> encoding)
+Optional<GC::RootVector<XHR::FormDataEntry>> construct_entry_list(HTMLFormElement& form, GC::Ptr<HTMLElement> submitter, Optional<Utf16String> encoding)
{
// 1. If form's constructing entry list is true, then return null.
if (form.constructing_entry_list())
@@ -92,7 +92,7 @@ Optional<GC::ConservativeVector<XHR::FormDataEntry>> construct_entry_list(HTMLFo
auto controls = form.get_submittable_elements();
// 4. Let entry list be a new empty entry list.
- GC::ConservativeVector<XHR::FormDataEntry> entry_list;
+ GC::RootVector<XHR::FormDataEntry> entry_list;
// 5. For each element field in controls, in tree order:
for (auto const& control : controls) {
@@ -277,7 +277,7 @@ ErrorOr<ByteBuffer> encode(Utf16View input, StringView encoding)
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart/form-data-encoding-algorithm
-ErrorOr<SerializedFormData> serialize_to_multipart_form_data(GC::ConservativeVector<XHR::FormDataEntry> const& entry_list, StringView encoding)
+ErrorOr<SerializedFormData> serialize_to_multipart_form_data(GC::RootVector<XHR::FormDataEntry> const& entry_list, StringView encoding)
{
// For field names and filenames for file fields, the result of the encoding in the previous bullet point must be
// escaped by replacing any 0x0A (LF) bytes with the byte sequence `%0A`, 0x0D (CR) with `%0D` and 0x22 (") with `%22`.
diff --git a/Libraries/LibWeb/HTML/FormControlInfrastructure.h b/Libraries/LibWeb/HTML/FormControlInfrastructure.h
index 4c95726ec2d..4cc9c2e8924 100644
--- a/Libraries/LibWeb/HTML/FormControlInfrastructure.h
+++ b/Libraries/LibWeb/HTML/FormControlInfrastructure.h
@@ -18,9 +18,9 @@ struct SerializedFormData {
};
XHR::FormDataEntry create_entry(Utf16View name, Variant<GC::Ref<FileAPI::Blob>, Utf16String> const& value);
-Optional<GC::ConservativeVector<XHR::FormDataEntry>> construct_entry_list(HTMLFormElement&, GC::Ptr<HTMLElement> submitter = nullptr, Optional<Utf16String> encoding = {});
+Optional<GC::RootVector<XHR::FormDataEntry>> construct_entry_list(HTMLFormElement&, GC::Ptr<HTMLElement> submitter = nullptr, Optional<Utf16String> encoding = {});
ErrorOr<Utf16String> normalize_line_breaks(Utf16View value);
ErrorOr<ByteBuffer> encode(Utf16View input, StringView encoding);
-ErrorOr<SerializedFormData> serialize_to_multipart_form_data(GC::ConservativeVector<XHR::FormDataEntry> const& entry_list, StringView encoding = "UTF-8"sv);
+ErrorOr<SerializedFormData> serialize_to_multipart_form_data(GC::RootVector<XHR::FormDataEntry> const& entry_list, StringView encoding = "UTF-8"sv);
}
diff --git a/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp b/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp
index 68b7ed449e1..88e1dba1af9 100644
--- a/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp
@@ -276,8 +276,8 @@ void HTMLDetailsElement::update_shadow_tree_slots()
if (!shadow_root())
return;
- GC::ConservativeVector<HTMLSlotElement::SlottableHandle> summary_assignment;
- GC::ConservativeVector<HTMLSlotElement::SlottableHandle> descendants_assignment;
+ GC::RootVector<HTMLSlotElement::SlottableHandle> summary_assignment;
+ GC::RootVector<HTMLSlotElement::SlottableHandle> descendants_assignment;
auto* summary = first_child_of_type<HTMLSummaryElement>();
if (summary != nullptr)
diff --git a/Libraries/LibWeb/HTML/HTMLElement.cpp b/Libraries/LibWeb/HTML/HTMLElement.cpp
index e831c7b7f70..403b9236fd0 100644
--- a/Libraries/LibWeb/HTML/HTMLElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLElement.cpp
@@ -6,7 +6,7 @@
*/
#include <AK/Utf16StringBuilder.h>
-#include <LibGC/ConservativeVector.h>
+#include <LibGC/RootVector.h>
#include <LibJS/Runtime/NativeFunction.h>
#include <LibWeb/ARIA/Roles.h>
#include <LibWeb/CSS/ComputedValues.h>
@@ -1065,8 +1065,10 @@ void HTMLElement::attribute_changed(Utf16FlyString const& name, Optional<Utf16St
struct PreviousReadWriteState {
GC::Ptr<DOM::Element> element;
bool value;
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(element); }
};
- GC::ConservativeVector<PreviousReadWriteState> previous_read_write_states;
+ GC::RootVector<PreviousReadWriteState> previous_read_write_states;
if (name == HTML::AttributeNames::contenteditable && old_value != value) {
for_each_in_inclusive_subtree_of_type<DOM::Element>([&](DOM::Element& element) {
previous_read_write_states.append({ element, SelectorMatching::element_matches_state(element, CSS::PseudoClass::ReadWrite) });
@@ -1165,8 +1167,10 @@ void HTMLElement::set_subtree_inertness(bool is_inert)
struct PreviousReadWriteState {
GC::Ptr<DOM::Element> element;
bool value;
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(element); }
};
- GC::ConservativeVector<PreviousReadWriteState> previous_read_write_states;
+ GC::RootVector<PreviousReadWriteState> previous_read_write_states;
for_each_shadow_including_inclusive_descendant([&](DOM::Node& node) {
if (auto* element = as_if<DOM::Element>(node))
previous_read_write_states.append({ *element, SelectorMatching::element_matches_state(*element, CSS::PseudoClass::ReadWrite) });
diff --git a/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Libraries/LibWeb/HTML/HTMLFormElement.cpp
index e0ed2c5dfaf..cc5ada1c135 100644
--- a/Libraries/LibWeb/HTML/HTMLFormElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLFormElement.cpp
@@ -845,7 +845,7 @@ ErrorOr<Utf16String> HTMLFormElement::pick_an_encoding() const
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#convert-to-a-list-of-name-value-pairs
-static ErrorOr<Vector<DOMURL::QueryParam>> convert_to_list_of_name_value_pairs(GC::ConservativeVector<XHR::FormDataEntry> const& entry_list)
+static ErrorOr<Vector<DOMURL::QueryParam>> convert_to_list_of_name_value_pairs(GC::RootVector<XHR::FormDataEntry> const& entry_list)
{
// 1. Let list be an empty list of name-value pairs.
Vector<DOMURL::QueryParam> list;
@@ -906,7 +906,7 @@ static ErrorOr<Utf16String> plain_text_encode(Vector<DOMURL::QueryParam> const&
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-mutate-action
-ErrorOr<void> HTMLFormElement::mutate_action_url(URL::URL parsed_action, GC::ConservativeVector<XHR::FormDataEntry> entry_list, Utf16String encoding, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter)
+ErrorOr<void> HTMLFormElement::mutate_action_url(URL::URL parsed_action, GC::RootVector<XHR::FormDataEntry> entry_list, Utf16String encoding, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter)
{
// 1. Let pairs be the result of converting to a list of name-value pairs with entry list.
auto pairs = TRY(convert_to_list_of_name_value_pairs(entry_list));
@@ -923,7 +923,7 @@ ErrorOr<void> HTMLFormElement::mutate_action_url(URL::URL parsed_action, GC::Con
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-body
-ErrorOr<void> HTMLFormElement::submit_as_entity_body(URL::URL parsed_action, GC::ConservativeVector<XHR::FormDataEntry> entry_list, EncodingTypeAttributeState encoding_type, Utf16String encoding, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter)
+ErrorOr<void> HTMLFormElement::submit_as_entity_body(URL::URL parsed_action, GC::RootVector<XHR::FormDataEntry> entry_list, EncodingTypeAttributeState encoding_type, Utf16String encoding, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter)
{
// 1. Assert: method is POST.
@@ -986,7 +986,7 @@ ErrorOr<void> HTMLFormElement::submit_as_entity_body(URL::URL parsed_action, GC:
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-get-action
-void HTMLFormElement::get_action_url(URL::URL parsed_action, GC::ConservativeVector<XHR::FormDataEntry> entry_list, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter)
+void HTMLFormElement::get_action_url(URL::URL parsed_action, GC::RootVector<XHR::FormDataEntry> entry_list, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter)
{
// 1. Plan to navigate to parsed action.
// Spec Note: entry list is discarded.
@@ -994,7 +994,7 @@ void HTMLFormElement::get_action_url(URL::URL parsed_action, GC::ConservativeVec
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-mailto-headers
-ErrorOr<void> HTMLFormElement::mail_with_headers(URL::URL parsed_action, GC::ConservativeVector<XHR::FormDataEntry> entry_list, [[maybe_unused]] Utf16String encoding, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter)
+ErrorOr<void> HTMLFormElement::mail_with_headers(URL::URL parsed_action, GC::RootVector<XHR::FormDataEntry> entry_list, [[maybe_unused]] Utf16String encoding, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter)
{
// 1. Let pairs be the result of converting to a list of name-value pairs with entry list.
auto pairs = TRY(convert_to_list_of_name_value_pairs(entry_list));
@@ -1013,7 +1013,7 @@ ErrorOr<void> HTMLFormElement::mail_with_headers(URL::URL parsed_action, GC::Con
return {};
}
-ErrorOr<void> HTMLFormElement::mail_as_body(URL::URL parsed_action, GC::ConservativeVector<XHR::FormDataEntry> entry_list, EncodingTypeAttributeState encoding_type, [[maybe_unused]] Utf16String encoding, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter)
+ErrorOr<void> HTMLFormElement::mail_as_body(URL::URL parsed_action, GC::RootVector<XHR::FormDataEntry> entry_list, EncodingTypeAttributeState encoding_type, [[maybe_unused]] Utf16String encoding, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter)
{
// 1. Let pairs be the result of converting to a list of name-value pairs with entry list.
auto pairs = TRY(convert_to_list_of_name_value_pairs(entry_list));
@@ -1066,7 +1066,7 @@ ErrorOr<void> HTMLFormElement::mail_as_body(URL::URL parsed_action, GC::Conserva
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plan-to-navigate
-void HTMLFormElement::plan_to_navigate_to(URL::URL url, DocumentResource post_resource, GC::ConservativeVector<XHR::FormDataEntry> entry_list, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter)
+void HTMLFormElement::plan_to_navigate_to(URL::URL url, DocumentResource post_resource, GC::RootVector<XHR::FormDataEntry> entry_list, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter)
{
// 1. Let referrerPolicy be the empty string.
ReferrerPolicy::ReferrerPolicy referrer_policy = ReferrerPolicy::ReferrerPolicy::EmptyString;
@@ -1090,7 +1090,7 @@ void HTMLFormElement::plan_to_navigate_to(URL::URL url, DocumentResource post_re
// 2. Navigate targetNavigable to url using the form element's node document, with historyHandling set to historyHandling,
// userInvolvement set to userInvolvement, sourceElement set to submitter, referrerPolicy set to referrerPolicy,
// documentResource set to postResource, and formDataEntryList set to entry list.
- MUST(target_navigable->navigate({ .url = url, .source_document = self.document(), .document_resource = post_resource, .response = nullptr, .exceptions_enabled = false, .history_handling = history_handling, .form_data_entry_list = GC::ConservativeVector<XHR::FormDataEntry> { move(entry_list) }, .referrer_policy = referrer_policy, .user_involvement = user_involvement, .source_element = submitter }));
+ MUST(target_navigable->navigate({ .url = url, .source_document = self.document(), .document_resource = post_resource, .response = nullptr, .exceptions_enabled = false, .history_handling = history_handling, .form_data_entry_list = GC::RootVector<XHR::FormDataEntry> { move(entry_list) }, .referrer_policy = referrer_policy, .user_involvement = user_involvement, .source_element = submitter }));
}));
// 5. Set the form's planned navigation to the just-queued task.
diff --git a/Libraries/LibWeb/HTML/HTMLFormElement.h b/Libraries/LibWeb/HTML/HTMLFormElement.h
index fb284a3f522..89b3a9e7510 100644
--- a/Libraries/LibWeb/HTML/HTMLFormElement.h
+++ b/Libraries/LibWeb/HTML/HTMLFormElement.h
@@ -135,12 +135,12 @@ private:
ErrorOr<Utf16String> pick_an_encoding() const;
- ErrorOr<void> mutate_action_url(URL::URL parsed_action, GC::ConservativeVector<XHR::FormDataEntry> entry_list, Utf16String encoding, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter);
- ErrorOr<void> submit_as_entity_body(URL::URL parsed_action, GC::ConservativeVector<XHR::FormDataEntry> entry_list, EncodingTypeAttributeState encoding_type, Utf16String encoding, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter);
- void get_action_url(URL::URL parsed_action, GC::ConservativeVector<XHR::FormDataEntry> entry_list, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter);
- ErrorOr<void> mail_with_headers(URL::URL parsed_action, GC::ConservativeVector<XHR::FormDataEntry> entry_list, Utf16String encoding, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter);
- ErrorOr<void> mail_as_body(URL::URL parsed_action, GC::ConservativeVector<XHR::FormDataEntry> entry_list, EncodingTypeAttributeState encoding_type, Utf16String encoding, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter);
- void plan_to_navigate_to(URL::URL url, DocumentResource post_resource, GC::ConservativeVector<XHR::FormDataEntry> entry_list, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter);
+ ErrorOr<void> mutate_action_url(URL::URL parsed_action, GC::RootVector<XHR::FormDataEntry> entry_list, Utf16String encoding, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter);
+ ErrorOr<void> submit_as_entity_body(URL::URL parsed_action, GC::RootVector<XHR::FormDataEntry> entry_list, EncodingTypeAttributeState encoding_type, Utf16String encoding, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter);
+ void get_action_url(URL::URL parsed_action, GC::RootVector<XHR::FormDataEntry> entry_list, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter);
+ ErrorOr<void> mail_with_headers(URL::URL parsed_action, GC::RootVector<XHR::FormDataEntry> entry_list, Utf16String encoding, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter);
+ ErrorOr<void> mail_as_body(URL::URL parsed_action, GC::RootVector<XHR::FormDataEntry> entry_list, EncodingTypeAttributeState encoding_type, Utf16String encoding, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter);
+ void plan_to_navigate_to(URL::URL url, DocumentResource post_resource, GC::RootVector<XHR::FormDataEntry> entry_list, GC::Ref<Navigable> target_navigable, NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement, GC::Ref<HTMLElement> submitter);
size_t tree_order_insertion_index(HTMLElement const&) const;
void recompute_default_button(size_t start_index = 0);
diff --git a/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Libraries/LibWeb/HTML/HTMLMediaElement.cpp
index 5a2e5bd313e..b4822837732 100644
--- a/Libraries/LibWeb/HTML/HTMLMediaElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLMediaElement.cpp
@@ -10,8 +10,8 @@
#include <AK/AnyOf.h>
#include <AK/QuickSort.h>
#include <LibCore/Timer.h>
-#include <LibGC/ConservativeVector.h>
#include <LibGC/Heap.h>
+#include <LibGC/RootVector.h>
#include <LibJS/Runtime/Date.h>
#include <LibJS/Runtime/Promise.h>
#include <LibMedia/MediaSupport.h>
@@ -3859,8 +3859,10 @@ void HTMLMediaElement::time_marches_on(TimeMarchesOnReason reason)
Utf16FlyString name;
GC::Ref<TextTrackCue> target;
double time { 0 };
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(target); }
};
- GC::ConservativeVector<CueEvent> events;
+ GC::RootVector<CueEvent> events;
GC::RootVector<GC::Ref<TextTrack>> affected_tracks;
// When the steps below say to prepare an event named event for a text track cue target with a time time, the user
diff --git a/Libraries/LibWeb/HTML/HTMLSlotElement.cpp b/Libraries/LibWeb/HTML/HTMLSlotElement.cpp
index 64b1930fe0f..55cb5aaf83e 100644
--- a/Libraries/LibWeb/HTML/HTMLSlotElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLSlotElement.cpp
@@ -113,7 +113,7 @@ void HTMLSlotElement::assign_slottables_if_needed() const
}
// https://html.spec.whatwg.org/multipage/scripting.html#dom-slot-assign
-void HTMLSlotElement::assign(GC::ConservativeVector<SlottableHandle> nodes)
+void HTMLSlotElement::assign(GC::RootVector<SlottableHandle> nodes)
{
// AD-HOC: Assigned nodes are recomputed lazily.
assign_slottables_if_needed();
diff --git a/Libraries/LibWeb/HTML/HTMLSlotElement.h b/Libraries/LibWeb/HTML/HTMLSlotElement.h
index e3776560d9c..32c71e8090e 100644
--- a/Libraries/LibWeb/HTML/HTMLSlotElement.h
+++ b/Libraries/LibWeb/HTML/HTMLSlotElement.h
@@ -9,8 +9,8 @@
#include <AK/Variant.h>
#include <AK/Vector.h>
-#include <LibGC/ConservativeVector.h>
#include <LibGC/Root.h>
+#include <LibGC/RootVector.h>
#include <LibWeb/DOM/Slot.h>
#include <LibWeb/DOM/Slottable.h>
#include <LibWeb/HTML/HTMLElement.h>
@@ -43,7 +43,7 @@ public:
Vector<GC::Root<DOM::Element>> assigned_elements(Bindings::AssignedNodesOptions const&) const;
using SlottableHandle = Variant<GC::Ref<DOM::Element>, GC::Ref<DOM::Text>>;
- void assign(GC::ConservativeVector<SlottableHandle> nodes);
+ void assign(GC::RootVector<SlottableHandle> nodes);
ReadonlySpan<DOM::Slottable> manually_assigned_nodes() const { return m_manually_assigned_nodes; }
diff --git a/Libraries/LibWeb/HTML/LocalNavigable.cpp b/Libraries/LibWeb/HTML/LocalNavigable.cpp
index e05c666eda2..ec9b2a99503 100644
--- a/Libraries/LibWeb/HTML/LocalNavigable.cpp
+++ b/Libraries/LibWeb/HTML/LocalNavigable.cpp
@@ -3763,9 +3763,9 @@ void LocalNavigable::begin_navigation(PreparedNavigation navigation)
auto navigation = active_window()->navigation();
// 2. Let entryListForFiring be formDataEntryList if documentResource is a POST resource; otherwise, null.
- auto entry_list_for_firing = [&]() -> Optional<GC::ConservativeVector<XHR::FormDataEntry>> {
+ auto entry_list_for_firing = [&]() -> Optional<GC::RootVector<XHR::FormDataEntry>> {
if (document_resource.has<POSTResource>())
- return GC::ConservativeVector { form_data_entry_list.value() };
+ return GC::RootVector { form_data_entry_list.value() };
return {};
}();
diff --git a/Libraries/LibWeb/HTML/NavigateParams.h b/Libraries/LibWeb/HTML/NavigateParams.h
index ad3aa0c55e5..50cf1fad602 100644
--- a/Libraries/LibWeb/HTML/NavigateParams.h
+++ b/Libraries/LibWeb/HTML/NavigateParams.h
@@ -10,8 +10,8 @@
#include <AK/Utf16String.h>
#include <AK/Vector.h>
#include <LibGC/Cell.h>
-#include <LibGC/ConservativeVector.h>
#include <LibGC/Ptr.h>
+#include <LibGC/RootVector.h>
#include <LibURL/Origin.h>
#include <LibURL/URL.h>
#include <LibWeb/Bindings/Navigation.h>
@@ -36,7 +36,7 @@ struct NavigateParams {
bool exceptions_enabled = false;
Bindings::NavigationHistoryBehavior history_handling = Bindings::NavigationHistoryBehavior::Auto;
Optional<StorageSerializationRecord> navigation_api_state = {};
- Optional<GC::ConservativeVector<XHR::FormDataEntry>> form_data_entry_list = {};
+ Optional<GC::RootVector<XHR::FormDataEntry>> form_data_entry_list = {};
ReferrerPolicy::ReferrerPolicy referrer_policy = ReferrerPolicy::ReferrerPolicy::EmptyString;
UserNavigationInvolvement user_involvement = UserNavigationInvolvement::None;
GC::Ptr<DOM::Element> source_element = nullptr;
@@ -52,7 +52,7 @@ struct PreparedNavigation {
GC::Ptr<Fetch::Infrastructure::ResponseView> response;
Bindings::NavigationHistoryBehavior history_handling;
Optional<StorageSerializationRecord> navigation_api_state;
- Optional<GC::ConservativeVector<XHR::FormDataEntry>> form_data_entry_list;
+ Optional<GC::RootVector<XHR::FormDataEntry>> form_data_entry_list;
ReferrerPolicy::ReferrerPolicy referrer_policy;
UserNavigationInvolvement user_involvement;
Utf16String navigation_id;
diff --git a/Libraries/LibWeb/HTML/Navigation.cpp b/Libraries/LibWeb/HTML/Navigation.cpp
index e08e5201ad0..d201a275795 100644
--- a/Libraries/LibWeb/HTML/Navigation.cpp
+++ b/Libraries/LibWeb/HTML/Navigation.cpp
@@ -1030,7 +1030,7 @@ bool Navigation::inner_navigate_event_firing_algorithm(
GC::Ref<NavigationDestination> destination,
UserNavigationInvolvement user_involvement,
GC::Ptr<DOM::Element> source_element,
- Optional<GC::ConservativeVector<XHR::FormDataEntry>&> form_data_entry_list,
+ Optional<GC::RootVector<XHR::FormDataEntry>&> form_data_entry_list,
Optional<Utf16String> download_request_filename,
Optional<StorageSerializationRecord> classic_history_api_state,
GC::Ptr<NavigationAPIMethodTracker> api_method_tracker)
@@ -1483,7 +1483,7 @@ bool Navigation::fire_a_push_replace_reload_navigate_event(
bool is_same_document,
UserNavigationInvolvement user_involvement,
GC::Ptr<DOM::Element> source_element,
- Optional<GC::ConservativeVector<XHR::FormDataEntry>&> form_data_entry_list,
+ Optional<GC::RootVector<XHR::FormDataEntry>&> form_data_entry_list,
Optional<StorageSerializationRecord> navigation_api_state,
Optional<StorageSerializationRecord> classic_history_api_state,
GC::Ptr<NavigationAPIMethodTracker> api_method_tracker)
diff --git a/Libraries/LibWeb/HTML/Navigation.h b/Libraries/LibWeb/HTML/Navigation.h
index 05875d12be8..673e2189224 100644
--- a/Libraries/LibWeb/HTML/Navigation.h
+++ b/Libraries/LibWeb/HTML/Navigation.h
@@ -138,7 +138,7 @@ public:
bool is_same_document,
UserNavigationInvolvement = UserNavigationInvolvement::None,
GC::Ptr<DOM::Element> source_element = {},
- Optional<GC::ConservativeVector<XHR::FormDataEntry>&> form_data_entry_list = {},
+ Optional<GC::RootVector<XHR::FormDataEntry>&> form_data_entry_list = {},
Optional<StorageSerializationRecord> navigation_api_state = {},
Optional<StorageSerializationRecord> classic_history_api_state = {},
GC::Ptr<NavigationAPIMethodTracker> api_method_tracker = {});
@@ -195,7 +195,7 @@ private:
GC::Ref<NavigationDestination>,
UserNavigationInvolvement,
GC::Ptr<DOM::Element> source_element,
- Optional<GC::ConservativeVector<XHR::FormDataEntry>&> form_data_entry_list,
+ Optional<GC::RootVector<XHR::FormDataEntry>&> form_data_entry_list,
Optional<Utf16String> download_request_filename,
Optional<StorageSerializationRecord> classic_history_api_state,
GC::Ptr<NavigationAPIMethodTracker> api_method_tracker = {});
diff --git a/Libraries/LibWeb/IndexedDB/Inspection.cpp b/Libraries/LibWeb/IndexedDB/Inspection.cpp
index 8136ea5fc47..6fec6247f00 100644
--- a/Libraries/LibWeb/IndexedDB/Inspection.cpp
+++ b/Libraries/LibWeb/IndexedDB/Inspection.cpp
@@ -49,6 +49,8 @@ struct IndexedDatabaseDocument {
String url;
GC::Ref<DOM::Document> document;
StorageAPI::StorageKey storage_key;
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(document); }
};
static JSVM* vm()
@@ -83,9 +85,9 @@ static String serialize_record_value(JS::Realm& realm, ReadonlyBytes bytes)
return serialized.release_value();
}
-static GC::ConservativeVector<IndexedDatabaseDocument> indexed_database_documents_for_inspection(DOM::Document& root_document)
+static GC::RootVector<IndexedDatabaseDocument> indexed_database_documents_for_inspection(DOM::Document& root_document)
{
- GC::ConservativeVector<IndexedDatabaseDocument> documents;
+ GC::RootVector<IndexedDatabaseDocument> documents;
auto append_document = [&](DOM::Document& document) {
auto storage_key = StorageAPI::obtain_a_storage_key(document.relevant_settings_object());
diff --git a/Libraries/LibWeb/MediaCapture/MediaDevices.cpp b/Libraries/LibWeb/MediaCapture/MediaDevices.cpp
index 3a2dda4cc55..038d5b367fa 100644
--- a/Libraries/LibWeb/MediaCapture/MediaDevices.cpp
+++ b/Libraries/LibWeb/MediaCapture/MediaDevices.cpp
@@ -8,6 +8,7 @@
#include <LibAudio/AudioDevices.h>
#include <LibGC/Heap.h>
#include <LibGC/Root.h>
+#include <LibGC/RootVector.h>
#include <LibJS/Runtime/Array.h>
#include <LibJS/Runtime/Error.h>
#include <LibJS/Runtime/NativeFunction.h>
@@ -34,6 +35,16 @@
namespace Web::MediaCapture {
+void MediaDevices::PendingEnumerateDevicesRequest::visit_edges(GC::Cell::Visitor& visitor) const
+{
+ visitor.visit(promise);
+}
+
+void MediaDevices::PendingGetUserMediaRequest::visit_edges(GC::Cell::Visitor& visitor) const
+{
+ visitor.visit(promise);
+}
+
static Utf16FlyString const& AUDIO_INPUT_KIND = *new Utf16FlyString("audioinput"_utf16_fly_string);
static Utf16FlyString const& AUDIO_OUTPUT_KIND = *new Utf16FlyString("audiooutput"_utf16_fly_string);
static Utf16FlyString const& VIDEO_INPUT_KIND = *new Utf16FlyString("videoinput"_utf16_fly_string);
@@ -644,7 +655,7 @@ void MediaDevices::process_pending_enumerate_devices_requests()
run_device_change_notification_steps(current_audio_device_snapshot());
- GC::ConservativeVector pending_requests { move(m_pending_enumerate_devices_requests) };
+ GC::RootVector pending_requests { move(m_pending_enumerate_devices_requests) };
for (auto& request : pending_requests)
queue_enumerate_devices_task(request.promise);
}
@@ -656,7 +667,7 @@ void MediaDevices::process_pending_get_user_media_requests()
if (!Audio::AudioDevices::the().has_device_list())
return;
- GC::ConservativeVector pending_requests { move(m_pending_get_user_media_requests) };
+ GC::RootVector pending_requests { move(m_pending_get_user_media_requests) };
for (auto& request : pending_requests)
queue_get_user_media_task(request.promise, move(request.device_id_constraint));
}
diff --git a/Libraries/LibWeb/MediaCapture/MediaDevices.h b/Libraries/LibWeb/MediaCapture/MediaDevices.h
index ebe32460268..80823f20ac3 100644
--- a/Libraries/LibWeb/MediaCapture/MediaDevices.h
+++ b/Libraries/LibWeb/MediaCapture/MediaDevices.h
@@ -73,10 +73,14 @@ private:
struct PendingGetUserMediaRequest final {
GC::Ref<WebIDL::Promise> promise;
Optional<DeviceIdConstraint> device_id_constraint;
+
+ void visit_edges(GC::Cell::Visitor&) const;
};
struct PendingEnumerateDevicesRequest final {
GC::Ref<WebIDL::Promise> promise;
+
+ void visit_edges(GC::Cell::Visitor&) const;
};
explicit MediaDevices(HTML::Window&);
diff --git a/Libraries/LibWeb/Page/EventHandler.cpp b/Libraries/LibWeb/Page/EventHandler.cpp
index 9f700e10e98..d32cf1e9d0c 100644
--- a/Libraries/LibWeb/Page/EventHandler.cpp
+++ b/Libraries/LibWeb/Page/EventHandler.cpp
@@ -4873,6 +4873,8 @@ void EventHandler::update_pointer_hover(Layout::BegunRead const& read, PointerSt
struct BoundaryTarget {
GC::Ref<DOM::Node> node;
MouseEventCoordinates coordinates;
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(node); }
};
auto make_target = [&](DOM::Node& node) {
auto target_coordinates = coordinates;
@@ -4880,8 +4882,8 @@ void EventHandler::update_pointer_hover(Layout::BegunRead const& read, PointerSt
target_coordinates = compute_mouse_event_coordinates(coordinates.visual_viewport_position, coordinates.viewport_position, *layout_node);
return BoundaryTarget { node, target_coordinates };
};
- GC::ConservativeVector<BoundaryTarget> left;
- GC::ConservativeVector<BoundaryTarget> entered;
+ GC::RootVector<BoundaryTarget> left;
+ GC::RootVector<BoundaryTarget> entered;
for (auto* node = previous.ptr(); node && node != common_ancestor; node = node->flat_tree_parent())
left.append(make_target(*node));
for (auto* node = target.ptr(); node && node != common_ancestor; node = node->flat_tree_parent())
diff --git a/Libraries/LibWeb/PaintTiming/DocumentPaintTimingState.h b/Libraries/LibWeb/PaintTiming/DocumentPaintTimingState.h
index 5265c6f9fb6..ff1c6717b63 100644
--- a/Libraries/LibWeb/PaintTiming/DocumentPaintTimingState.h
+++ b/Libraries/LibWeb/PaintTiming/DocumentPaintTimingState.h
@@ -40,6 +40,8 @@ struct PendingImageRecord {
// loadTime, a DOMHighResTimeStamp
HighResolutionTime::DOMHighResTimeStamp load_time { 0 };
+
+ void visit_edges(GC::Cell::Visitor&) const;
};
// https://w3c.github.io/largest-contentful-paint/#largest-contentful-paint-candidate
diff --git a/Libraries/LibWeb/PaintTiming/PaintTiming.cpp b/Libraries/LibWeb/PaintTiming/PaintTiming.cpp
index 8bd09deb879..91e89c43e3b 100644
--- a/Libraries/LibWeb/PaintTiming/PaintTiming.cpp
+++ b/Libraries/LibWeb/PaintTiming/PaintTiming.cpp
@@ -5,7 +5,6 @@
*/
#include <AK/NeverDestroyed.h>
-#include <LibGC/ConservativeVector.h>
#include <LibGC/RootVector.h>
#include <LibWeb/CSS/ComputedValues.h>
#include <LibWeb/CSS/FontComputer.h>
@@ -34,6 +33,11 @@
namespace Web::PaintTiming {
+void PendingImageRecord::visit_edges(GC::Cell::Visitor& visitor) const
+{
+ visitor.visit(element);
+}
+
static Utf16String const& first_paint_name()
{
static NeverDestroyed<Utf16String> name { "first-paint"_utf16 };
@@ -475,7 +479,7 @@ void mark_paint_timing(DOM::Document& document)
};
// 3. Let paintedImages be a new ordered set
- GC::ConservativeVector<PendingImageRecord> painted_images;
+ GC::RootVector<PendingImageRecord> painted_images;
// 4. Let paintedTextNodes be a new ordered set
PaintedTextNodes painted_text_nodes;
diff --git a/Libraries/LibWeb/Translation/DocumentTranslator.cpp b/Libraries/LibWeb/Translation/DocumentTranslator.cpp
index a1c490b0a06..3690d19e471 100644
--- a/Libraries/LibWeb/Translation/DocumentTranslator.cpp
+++ b/Libraries/LibWeb/Translation/DocumentTranslator.cpp
@@ -9,7 +9,6 @@
#include <AK/ScopeGuard.h>
#include <AK/TemporaryChange.h>
#include <AK/Utf16StringBuilder.h>
-#include <LibGC/ConservativeVector.h>
#include <LibGC/RootHashMap.h>
#include <LibGC/RootHashTable.h>
#include <LibGC/RootVector.h>
@@ -37,6 +36,12 @@
namespace Web::Translation {
+void DocumentTranslator::AnchoredNode::visit_edges(GC::Cell::Visitor& visitor) const
+{
+ visitor.visit(node);
+ visitor.visit(owner);
+}
+
// Lower is more urgent: The title first, then the text the user can see, then the rest of the rendered text, and the
// text that isn't rendered last, so a menu shown later is still translated.
enum class PriorityClass : u64 {
@@ -957,8 +962,10 @@ void DocumentTranslator::apply_paragraph(Unit& unit, Vector<Web::TranslationRun>
struct OpenElement {
size_t index { 0 };
GC::Ref<DOM::Node> output;
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(output); }
};
- GC::ConservativeVector<OpenElement> open_elements;
+ GC::RootVector<OpenElement> open_elements;
Vector<bool> is_opened;
is_opened.resize(unit.inline_elements.size());
Vector<bool> is_placed;
@@ -1018,7 +1025,7 @@ void DocumentTranslator::apply_paragraph(Unit& unit, Vector<Web::TranslationRun>
// Put back the nodes that aren't translated: the anchored ones, the kept text the translation left out, and the
// inline elements it put no text into.
- GC::ConservativeVector<AnchoredNode> nodes_to_place;
+ GC::RootVector<AnchoredNode> nodes_to_place;
for (auto const& anchored_node : unit.anchored_nodes)
nodes_to_place.append(anchored_node);
for (size_t index = 0; index < unit.pieces.size(); ++index) {
diff --git a/Libraries/LibWeb/Translation/DocumentTranslator.h b/Libraries/LibWeb/Translation/DocumentTranslator.h
index 89b68672b7c..0b41fa1f3d9 100644
--- a/Libraries/LibWeb/Translation/DocumentTranslator.h
+++ b/Libraries/LibWeb/Translation/DocumentTranslator.h
@@ -105,6 +105,8 @@ private:
// Whether the text was set apart from the node by white space, which a translation drops at the ends of runs.
bool space_before { false };
bool space_after { false };
+
+ void visit_edges(GC::Cell::Visitor&) const;
};
struct Unit {
diff --git a/Libraries/LibWeb/WebDriver/BiDi/RemoteValue.cpp b/Libraries/LibWeb/WebDriver/BiDi/RemoteValue.cpp
index 77adae179b9..dff1353407c 100644
--- a/Libraries/LibWeb/WebDriver/BiDi/RemoteValue.cpp
+++ b/Libraries/LibWeb/WebDriver/BiDi/RemoteValue.cpp
@@ -10,7 +10,7 @@
#include <AK/Random.h>
#include <AK/TemporaryChange.h>
#include <LibCrypto/BigInt/SignedBigInteger.h>
-#include <LibGC/ConservativeVector.h>
+#include <LibGC/RootVector.h>
#include <LibJS/Runtime/AbstractOperations.h>
#include <LibJS/Runtime/Array.h>
#include <LibJS/Runtime/BigInt.h>
@@ -251,7 +251,7 @@ struct Serializer {
JsonValue serialize_as_a_remote_value(JS::Value, SerializationOptions const&, ResultOwnership);
JsonArray serialize_as_a_list(GC::RootVector<JS::Value> const&, SerializationOptions const&, ResultOwnership);
- JsonArray serialize_as_a_mapping(GC::ConservativeVector<Array<JS::Value, 2>> const&, SerializationOptions const&, ResultOwnership);
+ JsonArray serialize_as_a_mapping(GC::RootVector<Array<JS::Value, 2>> const&, SerializationOptions const&, ResultOwnership);
JsonObject serialize_an_array_like(StringView type, Optional<String> handle_id, bool known_object, JS::Object const& value, GC::RootVector<JS::Value> const& items, SerializationOptions const&, ResultOwnership);
Optional<String> handle_for_an_object(ResultOwnership, JS::Value);
void set_internal_ids_if_needed(JsonObject& remote_value, JS::Object const&);
@@ -401,7 +401,7 @@ JsonArray Serializer::serialize_as_a_list(GC::RootVector<JS::Value> const& value
}
// https://w3c.github.io/webdriver-bidi/#serialize-as-a-mapping
-JsonArray Serializer::serialize_as_a_mapping(GC::ConservativeVector<Array<JS::Value, 2>> const& items, SerializationOptions const& serialization_options, ResultOwnership ownership_type)
+JsonArray Serializer::serialize_as_a_mapping(GC::RootVector<Array<JS::Value, 2>> const& items, SerializationOptions const& serialization_options, ResultOwnership ownership_type)
{
// 1. If serialization options["maxObjectDepth"] is not null, assert: serialization options["maxObjectDepth"] is
// greater than 0.
@@ -635,7 +635,7 @@ JsonValue Serializer::serialize_as_a_remote_value(JS::Value value, Serialization
if (!known_object && serialization_options.max_object_depth != 0u) {
// 1. Let serialized be the result of serialize as a mapping with CreateMapIterator(value, key+value),
// serialization options, ownership type, serialization internal map, realm, and session.
- GC::ConservativeVector<Array<JS::Value, 2>> entries;
+ GC::RootVector<Array<JS::Value, 2>> entries;
GC::RootVector<JS::Value> roots;
(void)map->for_each_entry([&](JS::Value key, JS::Value entry_value) -> JS::ThrowCompletionOr<void> {
roots.append(key);
@@ -903,7 +903,7 @@ JsonValue Serializer::serialize_as_a_remote_value(JS::Value value, Serialization
if (!known_object && serialization_options.max_object_depth != 0u) {
// 1. Let serialized be the result of serialize as a mapping with EnumerableOwnPropertyNames(value, key+value),
// serialization options, ownership type, serialization internal map, realm, and session.
- GC::ConservativeVector<Array<JS::Value, 2>> entries;
+ GC::RootVector<Array<JS::Value, 2>> entries;
GC::RootVector<JS::Value> roots;
if (auto properties = object.enumerable_own_property_names(JS::Object::PropertyKind::KeyAndValue); !properties.is_error()) {
for (auto property : properties.value()) {
@@ -1172,7 +1172,7 @@ static ErrorOr<GC::RootVector<JS::Value>, Error> deserialize_value_list(JsonValu
}
// https://w3c.github.io/webdriver-bidi/#deserialize-key-value-list
-static ErrorOr<GC::ConservativeVector<Array<JS::Value, 2>>, Error> deserialize_key_value_list(JsonValue const* serialized_key_value_list, HTML::EnvironmentSettingsObject& settings, GC::RootVector<JS::Value>& roots)
+static ErrorOr<GC::RootVector<Array<JS::Value, 2>>, Error> deserialize_key_value_list(JsonValue const* serialized_key_value_list, HTML::EnvironmentSettingsObject& settings, GC::RootVector<JS::Value>& roots)
{
if (!serialized_key_value_list || !serialized_key_value_list->is_array())
return invalid_argument("Expected a list of key-value pairs"sv);
@@ -1180,7 +1180,7 @@ static ErrorOr<GC::ConservativeVector<Array<JS::Value, 2>>, Error> deserialize_k
auto& vm = settings.global_object().vm();
// 1. Let deserialized key-value list be a new list.
- GC::ConservativeVector<Array<JS::Value, 2>> deserialized_key_value_list;
+ GC::RootVector<Array<JS::Value, 2>> deserialized_key_value_list;
// 2. For each serialized key-value in the serialized key-value list:
for (auto const& serialized_key_value : serialized_key_value_list->as_array().values()) {
diff --git a/Libraries/LibWeb/WebDriver/BiDi/Script.cpp b/Libraries/LibWeb/WebDriver/BiDi/Script.cpp
index 00a5beb01f4..7e49c8026f2 100644
--- a/Libraries/LibWeb/WebDriver/BiDi/Script.cpp
+++ b/Libraries/LibWeb/WebDriver/BiDi/Script.cpp
@@ -7,10 +7,10 @@
#include <AK/HashMap.h>
#include <AK/JsonArray.h>
#include <AK/RefCounted.h>
-#include <LibGC/ConservativeVector.h>
#include <LibGC/Function.h>
#include <LibGC/Heap.h>
#include <LibGC/Root.h>
+#include <LibGC/RootVector.h>
#include <LibJS/Runtime/AbstractOperations.h>
#include <LibJS/Runtime/Error.h>
#include <LibJS/Runtime/NativeFunction.h>
@@ -711,7 +711,7 @@ Response get_realms(HTML::Navigable& navigable, JsonObject const& params)
// NB: The browser process asks the process hosting each navigable's active document for the realms of that
// document.
// FIXME: Include the realms of workers.
- GC::ConservativeVector<HTML::EnvironmentSettingsObject*> environment_settings;
+ GC::RootVector<HTML::EnvironmentSettingsObject*> environment_settings;
if (auto* local_navigable = as_if<HTML::LocalNavigable>(navigable)) {
if (auto document = local_navigable->active_document()) {
auto& settings = document->relevant_settings_object();
diff --git a/Libraries/LibWeb/WebIDL/OverloadResolution.cpp b/Libraries/LibWeb/WebIDL/OverloadResolution.cpp
index 181d4206665..4ef64065efe 100644
--- a/Libraries/LibWeb/WebIDL/OverloadResolution.cpp
+++ b/Libraries/LibWeb/WebIDL/OverloadResolution.cpp
@@ -109,7 +109,7 @@ JS::ThrowCompletionOr<ResolvedOverload> resolve_overload(JS::VM& vm, EffectiveOv
distinguishing_argument_index = overloads.distinguishing_argument_index();
// 9. Initialize values to be an empty list, where each entry will be either an IDL value or the special value “missing”.
- GC::ConservativeVector<ResolvedOverload::Argument> values;
+ GC::RootVector<ResolvedOverload::Argument> values;
// 10. Initialize i to 0.
auto i = 0;
diff --git a/Libraries/LibWeb/WebIDL/OverloadResolution.h b/Libraries/LibWeb/WebIDL/OverloadResolution.h
index 9db8f9d3af7..6cadcdcfacb 100644
--- a/Libraries/LibWeb/WebIDL/OverloadResolution.h
+++ b/Libraries/LibWeb/WebIDL/OverloadResolution.h
@@ -9,7 +9,7 @@
#include <AK/Optional.h>
#include <AK/Span.h>
#include <AK/Vector.h>
-#include <LibGC/ConservativeVector.h>
+#include <LibGC/RootVector.h>
#include <LibJS/Runtime/VM.h>
#include <LibWeb/Export.h>
#include <LibWeb/WebIDL/OverloadTypes.h>
@@ -18,11 +18,13 @@ namespace Web::WebIDL {
struct ResolvedOverload {
// Corresponds to "the special value “missing”" in the overload resolution algorithm.
- struct Missing { };
+ struct Missing {
+ GC_HOLDS_NO_CELL_EDGES;
+ };
using Argument = Variant<JS::Value, Missing>;
int callable_id;
- GC::ConservativeVector<Argument> arguments;
+ GC::RootVector<Argument> arguments;
};
// https://webidl.spec.whatwg.org/#es-overloads
diff --git a/Libraries/LibWeb/WebRTC/RTCPeerConnection.cpp b/Libraries/LibWeb/WebRTC/RTCPeerConnection.cpp
index cd72415ba04..93f76461e5f 100644
--- a/Libraries/LibWeb/WebRTC/RTCPeerConnection.cpp
+++ b/Libraries/LibWeb/WebRTC/RTCPeerConnection.cpp
@@ -1016,14 +1016,28 @@ namespace {
struct TrackEventInit {
GC::Ref<RTCRtpReceiver> receiver;
GC::Ref<MediaCapture::MediaStreamTrack> track;
- GC::RootVector<GC::Ref<MediaCapture::MediaStream>> streams;
+ Vector<GC::Ref<MediaCapture::MediaStream>> streams;
GC::Ref<RTCRtpTransceiver> transceiver;
+
+ void visit_edges(GC::Cell::Visitor& visitor)
+ {
+ visitor.visit(receiver);
+ visitor.visit(track);
+ visitor.visit(streams);
+ visitor.visit(transceiver);
+ }
};
// Spec uses "(stream, track) pairs" in addList/removeList; alias for clarity.
struct StreamTrackPair {
GC::Ref<MediaCapture::MediaStream> stream;
GC::Ref<MediaCapture::MediaStreamTrack> track;
+
+ void visit_edges(GC::Cell::Visitor& visitor)
+ {
+ visitor.visit(stream);
+ visitor.visit(track);
+ }
};
constexpr bool direction_is_receive(Bindings::RTCRtpTransceiverDirection d)
@@ -1043,8 +1057,8 @@ constexpr bool direction_is_send_only_or_inactive(Bindings::RTCRtpTransceiverDir
// https://www.w3.org/TR/webrtc/#set-associated-remote-streams
static void set_the_associated_remote_streams(RTCPeerConnection& pc, RTCRtpReceiver& receiver,
Vector<String> const& msids,
- GC::ConservativeVector<StreamTrackPair>& add_list,
- GC::ConservativeVector<StreamTrackPair>& remove_list)
+ GC::RootVector<StreamTrackPair>& add_list,
+ GC::RootVector<StreamTrackPair>& remove_list)
{
// 1. Let connection be the RTCPeerConnection object associated with receiver.
auto& connection = pc;
@@ -1098,7 +1112,7 @@ static void set_the_associated_remote_streams(RTCPeerConnection& pc, RTCRtpRecei
}
// https://www.w3.org/TR/webrtc/#process-the-addition-of-a-remote-track
-static void process_addition_of_remote_track(RTCRtpTransceiver& transceiver, GC::ConservativeVector<TrackEventInit>& track_event_inits)
+static void process_addition_of_remote_track(RTCRtpTransceiver& transceiver, GC::RootVector<TrackEventInit>& track_event_inits)
{
// 1. Let receiver be transceiver.[[Receiver]].
auto receiver = transceiver.receiver();
@@ -1126,9 +1140,9 @@ static void process_removal_of_remote_track(RTCRtpTransceiver& transceiver, GC::
// https://www.w3.org/TR/webrtc/#process-remote-tracks
static void process_remote_tracks(RTCPeerConnection& pc, RTCRtpTransceiver& transceiver,
Bindings::RTCRtpTransceiverDirection direction, Vector<String> const& msids,
- GC::ConservativeVector<StreamTrackPair>& add_list,
- GC::ConservativeVector<StreamTrackPair>& remove_list,
- GC::ConservativeVector<TrackEventInit>& track_event_inits,
+ GC::RootVector<StreamTrackPair>& add_list,
+ GC::RootVector<StreamTrackPair>& remove_list,
+ GC::RootVector<TrackEventInit>& track_event_inits,
GC::RootVector<GC::Ref<MediaCapture::MediaStreamTrack>>& mute_tracks)
{
auto add_list_size_before = add_list.size();
@@ -1206,9 +1220,9 @@ void RTCPeerConnection::on_remote_track_added(u64 receiver_id, u64 transceiver_i
// Drive the spec's "process remote tracks" algorithm. The IPC only signals new
// tracks today (no removals), so direction is recvonly.
- GC::ConservativeVector<StreamTrackPair> add_list;
- GC::ConservativeVector<StreamTrackPair> remove_list;
- GC::ConservativeVector<TrackEventInit> track_event_inits;
+ GC::RootVector<StreamTrackPair> add_list;
+ GC::RootVector<StreamTrackPair> remove_list;
+ GC::RootVector<TrackEventInit> track_event_inits;
GC::RootVector<GC::Ref<MediaCapture::MediaStreamTrack>> mute_tracks;
process_remote_tracks(*this, *transceiver, Bindings::RTCRtpTransceiverDirection::Recvonly,
stream_ids, add_list, remove_list, track_event_inits, mute_tracks);
diff --git a/Libraries/LibWeb/XHR/FormData.cpp b/Libraries/LibWeb/XHR/FormData.cpp
index 870b1a9218d..1f2cba4df82 100644
--- a/Libraries/LibWeb/XHR/FormData.cpp
+++ b/Libraries/LibWeb/XHR/FormData.cpp
@@ -31,6 +31,11 @@ bool web_form_data_value_named(void* form_data, FlatPtr name, FormDataEntryValue
JSCompletion web_form_data_create_from_form(void* realm, JSObject* form, JSObject* submitter, void** out_form_data);
}
+void FormDataEntry::visit_edges(GC::Cell::Visitor& visitor) const
+{
+ visitor.visit(value);
+}
+
FormDataEntryABI form_data_entry_to_abi(FormDataEntry const& entry)
{
FormDataEntryABI abi { .name = Utf16String { entry.name }.into_raw(), .value = { .file = nullptr, .string = 0 } };
@@ -52,7 +57,7 @@ FormDataEntry form_data_entry_from_abi(FormDataEntryABI entry)
return { .name = Utf16String::adopt_raw(entry.name), .value = form_data_entry_value_from_abi(entry.value) };
}
-GC::Ref<FormData> FormData::create(GC::ConservativeVector<FormDataEntry> const& entry_list)
+GC::Ref<FormData> FormData::create(GC::RootVector<FormDataEntry> const& entry_list)
{
Vector<FormDataEntryABI> entries;
entries.ensure_capacity(entry_list.size());
@@ -63,7 +68,7 @@ GC::Ref<FormData> FormData::create(GC::ConservativeVector<FormDataEntry> const&
GC::Ref<FormData> FormData::create(Vector<DOMURL::QueryParam> const& entry_list)
{
- GC::ConservativeVector<FormDataEntry> list;
+ GC::RootVector<FormDataEntry> list;
list.ensure_capacity(entry_list.size());
for (auto const& entry : entry_list)
list.unchecked_append({ .name = entry.name, .value = entry.value });
@@ -71,7 +76,7 @@ GC::Ref<FormData> FormData::create(Vector<DOMURL::QueryParam> const& entry_list)
}
// https://xhr.spec.whatwg.org/#dom-formdata
-static WebIDL::ExceptionOr<GC::ConservativeVector<FormDataEntry>> entry_list_for_form(GC::Ref<HTML::HTMLFormElement> form, GC::Ptr<HTML::HTMLElement> submitter)
+static WebIDL::ExceptionOr<GC::RootVector<FormDataEntry>> entry_list_for_form(GC::Ref<HTML::HTMLFormElement> form, GC::Ptr<HTML::HTMLElement> submitter)
{
// 1. If form is given, then:
// 1. If submitter is non-null, then:
@@ -134,10 +139,10 @@ bool FormData::has(Utf16String const& name) const
return !get(name).has<Empty>();
}
-GC::ConservativeVector<FormDataEntry> FormData::entry_list() const
+GC::RootVector<FormDataEntry> FormData::entry_list() const
{
auto count = web_form_data_entry_count(const_cast<FormData*>(this));
- GC::ConservativeVector<FormDataEntry> entry_list;
+ GC::RootVector<FormDataEntry> entry_list;
entry_list.ensure_capacity(count);
for (size_t index = 0; index < count; ++index)
entry_list.unchecked_append(form_data_entry_from_abi(web_form_data_entry(const_cast<FormData*>(this), index)));
diff --git a/Libraries/LibWeb/XHR/FormData.h b/Libraries/LibWeb/XHR/FormData.h
index a781e6fba81..0b387699421 100644
--- a/Libraries/LibWeb/XHR/FormData.h
+++ b/Libraries/LibWeb/XHR/FormData.h
@@ -6,7 +6,7 @@
#pragma once
-#include <LibGC/ConservativeVector.h>
+#include <LibGC/RootVector.h>
#include <LibWeb/Bindings/FormData.h>
#include <LibWeb/Bindings/RustInterface.h>
#include <LibWeb/DOMURL/URLSearchParams.h>
@@ -24,7 +24,7 @@ class WEB_API FormData final : public Bindings::RustInterfaceCell {
WEB_RUST_INTERFACE(FormData, form_data)
public:
- static GC::Ref<FormData> create(GC::ConservativeVector<FormDataEntry> const& entry_list);
+ static GC::Ref<FormData> create(GC::RootVector<FormDataEntry> const& entry_list);
static GC::Ref<FormData> create(Vector<DOMURL::QueryParam> const& entry_list);
static WebIDL::ExceptionOr<GC::Ref<FormData>> create_from_form(GC::Ref<HTML::HTMLFormElement> form, GC::Ptr<HTML::HTMLElement> submitter = nullptr);
@@ -33,7 +33,7 @@ public:
// https://xhr.spec.whatwg.org/#dom-formdata-has
bool has(Utf16String const& name) const;
- GC::ConservativeVector<FormDataEntry> entry_list() const;
+ GC::RootVector<FormDataEntry> entry_list() const;
};
}
diff --git a/Libraries/LibWeb/XHR/FormDataEntry.h b/Libraries/LibWeb/XHR/FormDataEntry.h
index a500a8ec869..40c06ce4aca 100644
--- a/Libraries/LibWeb/XHR/FormDataEntry.h
+++ b/Libraries/LibWeb/XHR/FormDataEntry.h
@@ -24,7 +24,7 @@ struct FormDataEntry {
Utf16String name;
Value value;
- void visit_edges(auto& visitor) const { visitor.visit(value); }
+ void visit_edges(GC::Cell::Visitor&) const;
};
struct FormDataEntryValueABI {
diff --git a/Meta/Generators/libweb_bindings/cpp_types.py b/Meta/Generators/libweb_bindings/cpp_types.py
index 9fe8bc14882..7612b502037 100644
--- a/Meta/Generators/libweb_bindings/cpp_types.py
+++ b/Meta/Generators/libweb_bindings/cpp_types.py
@@ -27,7 +27,6 @@ from Utils.webidl_parser import OperationParameter
class ContainedStorageType(Enum):
Vector = "Vector"
- ConservativeVector = "GC::ConservativeVector"
RootVector = "GC::RootVector"
@@ -189,9 +188,7 @@ def add_include_for_contained_storage_type(
contained_storage_type: ContainedStorageType,
includes: GeneratedIncludes,
) -> None:
- if contained_storage_type is ContainedStorageType.ConservativeVector:
- includes.add("LibGC/ConservativeVector.h")
- elif contained_storage_type is ContainedStorageType.RootVector:
+ if contained_storage_type is ContainedStorageType.RootVector:
includes.add("LibGC/RootVector.h")
else:
includes.add("AK/Vector.h")
@@ -232,7 +229,7 @@ def type_contains_gc_like_value(context: GenerationContext, idl_type: IDLType) -
def contained_storage_type_for_aggregate_type(context: GenerationContext, idl_type: IDLType) -> ContainedStorageType:
if type_contains_gc_like_value(context, idl_type):
- return ContainedStorageType.ConservativeVector
+ return ContainedStorageType.RootVector
return ContainedStorageType.Vector
@@ -325,14 +322,6 @@ def cpp_type_for_non_nullable_idl_type(
if type_name == "record":
key_cpp_type = cpp_type_for_idl_type_details(idl_type.parameters[0], context)
value_cpp_type = cpp_type_for_idl_type_details(idl_type.parameters[1], context)
- if (
- key_cpp_type.contained_storage_type == ContainedStorageType.ConservativeVector
- or value_cpp_type.contained_storage_type == ContainedStorageType.ConservativeVector
- ):
- return CppType(
- f"GC::ConservativeHashMap<{key_cpp_type.name}, {value_cpp_type.name}>",
- ContainedStorageType.ConservativeVector,
- )
if (
key_cpp_type.contained_storage_type == ContainedStorageType.RootVector
or value_cpp_type.contained_storage_type == ContainedStorageType.RootVector
@@ -471,9 +460,7 @@ def add_header_includes_for_idl_type(
return
if idl_type.name == "record":
cpp_type = cpp_type_for_idl_type_details(idl_type, context)
- if cpp_type.contained_storage_type is ContainedStorageType.ConservativeVector:
- includes.add("LibGC/ConservativeHashMap.h")
- elif cpp_type.contained_storage_type is ContainedStorageType.RootVector:
+ if cpp_type.contained_storage_type is ContainedStorageType.RootVector:
includes.add("LibGC/RootHashMap.h")
else:
includes.add("AK/HashMap.h")