From 97b9565d6345426f37767d25c5a393b1f01021c1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 15 Apr 2024 13:58:21 +0200 Subject: [PATCH] LibJS+LibWeb: Use new Cell::Visitor helpers to avoid manual iteration --- .../Libraries/LibJS/Bytecode/Executable.cpp | 3 +- .../Libraries/LibJS/Bytecode/Interpreter.h | 6 +- Userland/Libraries/LibJS/CyclicModule.cpp | 6 +- .../Libraries/LibJS/Runtime/BoundFunction.cpp | 3 +- .../Runtime/ECMAScriptFunctionObject.cpp | 3 +- .../LibJS/Runtime/ExecutionContext.cpp | 6 +- Userland/Libraries/LibJS/Runtime/Object.cpp | 4 +- Userland/Libraries/LibJS/Runtime/Promise.cpp | 6 +- .../PromiseResolvingElementFunctions.cpp | 3 +- .../LibWeb/Animations/Animatable.cpp | 3 +- .../LibWeb/Animations/AnimationTimeline.cpp | 3 +- .../LibWeb/Animations/KeyframeEffect.cpp | 3 +- .../Libraries/LibWeb/Bindings/Intrinsics.cpp | 10 +--- .../Libraries/LibWeb/CSS/CSSKeyframesRule.cpp | 3 +- Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp | 3 +- .../Libraries/LibWeb/CSS/CSSStyleSheet.cpp | 3 +- .../Libraries/LibWeb/CSS/StyleSheetList.cpp | 3 +- Userland/Libraries/LibWeb/DOM/AbortSignal.cpp | 11 +--- .../LibWeb/DOM/AccessibilityTreeNode.cpp | 3 +- Userland/Libraries/LibWeb/DOM/Document.cpp | 57 ++++++------------- Userland/Libraries/LibWeb/DOM/Element.cpp | 3 +- Userland/Libraries/LibWeb/DOM/Event.cpp | 6 +- Userland/Libraries/LibWeb/DOM/EventTarget.cpp | 7 +-- .../Libraries/LibWeb/DOM/HTMLCollection.cpp | 3 +- .../Libraries/LibWeb/DOM/MutationObserver.cpp | 3 +- .../Libraries/LibWeb/DOM/NamedNodeMap.cpp | 3 +- Userland/Libraries/LibWeb/DOM/Node.cpp | 3 +- .../Libraries/LibWeb/DOM/StaticNodeList.cpp | 3 +- .../Fetch/Infrastructure/HTTP/Requests.cpp | 3 +- .../Libraries/LibWeb/FileAPI/FileList.cpp | 3 +- .../Libraries/LibWeb/Geometry/DOMRectList.cpp | 3 +- .../Libraries/LibWeb/HTML/AudioTrackList.cpp | 3 +- .../LibWeb/HTML/BrowsingContextGroup.cpp | 3 +- .../CustomElementDefinition.cpp | 3 +- .../CustomElements/CustomElementRegistry.cpp | 6 +- .../Libraries/LibWeb/HTML/DocumentState.cpp | 4 +- .../LibWeb/HTML/EventLoop/EventLoop.cpp | 4 +- .../LibWeb/HTML/EventLoop/TaskQueue.cpp | 3 +- .../Libraries/LibWeb/HTML/HTMLFormElement.cpp | 3 +- .../LibWeb/HTML/HTMLMediaElement.cpp | 3 +- Userland/Libraries/LibWeb/HTML/Location.cpp | 3 +- .../Libraries/LibWeb/HTML/MessageEvent.cpp | 3 +- .../Libraries/LibWeb/HTML/NavigateEvent.cpp | 3 +- Userland/Libraries/LibWeb/HTML/Navigation.cpp | 6 +- .../HTML/Parser/StackOfOpenElements.cpp | 3 +- .../LibWeb/HTML/Scripting/ModuleMap.cpp | 3 +- .../HTML/SessionHistoryTraversalQueue.cpp | 4 +- .../LibWeb/HTML/TraversableNavigable.cpp | 3 +- .../Libraries/LibWeb/HTML/VideoTrackList.cpp | 3 +- Userland/Libraries/LibWeb/HTML/Window.cpp | 6 +- .../LibWeb/HTML/WindowOrWorkerGlobalScope.cpp | 6 +- .../IntersectionObserver.cpp | 6 +- .../LibWeb/Painting/ViewportPaintable.cpp | 6 +- .../PerformanceEntryTuple.h | 3 +- .../PerformanceObserver.cpp | 3 +- .../PerformanceObserverEntryList.cpp | 3 +- .../ResizeObserver/ResizeObservation.cpp | 3 +- .../LibWeb/ResizeObserver/ResizeObserver.cpp | 9 +-- .../ResizeObserver/ResizeObserverEntry.cpp | 9 +-- .../Streams/ReadableStreamBYOBReader.cpp | 3 +- .../LibWeb/WebAudio/AudioContext.cpp | 6 +- Userland/Libraries/LibWeb/WebIDL/Promise.cpp | 4 +- Userland/Services/WebContent/PageClient.cpp | 3 +- 63 files changed, 100 insertions(+), 215 deletions(-) diff --git a/Userland/Libraries/LibJS/Bytecode/Executable.cpp b/Userland/Libraries/LibJS/Bytecode/Executable.cpp index 9705ef039c6dc3b..59b9a1930d6cc44 100644 --- a/Userland/Libraries/LibJS/Bytecode/Executable.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Executable.cpp @@ -53,8 +53,7 @@ void Executable::dump() const void Executable::visit_edges(Visitor& visitor) { Base::visit_edges(visitor); - for (auto constant : constants) - visitor.visit(constant); + visitor.visit(constants); } } diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.h b/Userland/Libraries/LibJS/Bytecode/Interpreter.h index b88f86837af3e15..7e39464eb908d4b 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.h +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.h @@ -26,10 +26,8 @@ struct CallFrame { void visit_edges(Cell::Visitor& visitor) { - for (auto const& value : registers()) - visitor.visit(value); - for (auto const& environment : saved_lexical_environments) - visitor.visit(environment); + visitor.visit(registers()); + visitor.visit(saved_lexical_environments); for (auto& context : unwind_contexts) { visitor.visit(context.lexical_environment); } diff --git a/Userland/Libraries/LibJS/CyclicModule.cpp b/Userland/Libraries/LibJS/CyclicModule.cpp index d2bffac0da67f49..8bf8aa39fd2206a 100644 --- a/Userland/Libraries/LibJS/CyclicModule.cpp +++ b/Userland/Libraries/LibJS/CyclicModule.cpp @@ -29,8 +29,7 @@ void CyclicModule::visit_edges(Cell::Visitor& visitor) Base::visit_edges(visitor); visitor.visit(m_cycle_root); visitor.visit(m_top_level_capability); - for (auto const& module : m_async_parent_modules) - visitor.visit(module); + visitor.visit(m_async_parent_modules); for (auto const& loaded_module : m_loaded_modules) visitor.visit(loaded_module.module); } @@ -40,8 +39,7 @@ void GraphLoadingState::visit_edges(Cell::Visitor& visitor) Base::visit_edges(visitor); visitor.visit(promise_capability); visitor.visit(host_defined); - for (auto module : visited) - visitor.visit(module); + visitor.visit(visited); } // 16.2.1.5.1 LoadRequestedModules ( [ hostDefined ] ), https://tc39.es/ecma262/#sec-LoadRequestedModules diff --git a/Userland/Libraries/LibJS/Runtime/BoundFunction.cpp b/Userland/Libraries/LibJS/Runtime/BoundFunction.cpp index aad2b42a1c3c530..ca1c9c4b331933c 100644 --- a/Userland/Libraries/LibJS/Runtime/BoundFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/BoundFunction.cpp @@ -102,8 +102,7 @@ void BoundFunction::visit_edges(Visitor& visitor) visitor.visit(m_bound_target_function); visitor.visit(m_bound_this); - for (auto argument : m_bound_arguments) - visitor.visit(argument); + visitor.visit(m_bound_arguments); } } diff --git a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp index 3ed291316316c33..424535a734abec0 100644 --- a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp @@ -537,8 +537,7 @@ void ECMAScriptFunctionObject::visit_edges(Visitor& visitor) visitor.visit(m_name_string); visitor.visit(m_bytecode_executable); - for (auto& executable : m_default_parameter_bytecode_executables) - visitor.visit(executable); + visitor.visit(m_default_parameter_bytecode_executables); for (auto& field : m_fields) { if (auto* property_key_ptr = field.name.get_pointer(); property_key_ptr && property_key_ptr->is_symbol()) diff --git a/Userland/Libraries/LibJS/Runtime/ExecutionContext.cpp b/Userland/Libraries/LibJS/Runtime/ExecutionContext.cpp index 26feaf219cc4dee..54fe22a3603832d 100644 --- a/Userland/Libraries/LibJS/Runtime/ExecutionContext.cpp +++ b/Userland/Libraries/LibJS/Runtime/ExecutionContext.cpp @@ -59,10 +59,8 @@ void ExecutionContext::visit_edges(Cell::Visitor& visitor) if (instruction_stream_iterator.has_value()) visitor.visit(const_cast(instruction_stream_iterator.value().executable())); visitor.visit(function_name); - for (auto argument : arguments) - visitor.visit(argument); - for (auto local : locals) - visitor.visit(local); + visitor.visit(arguments); + visitor.visit(locals); script_or_module.visit( [](Empty) {}, [&](auto& script_or_module) { diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index 2d5bafd9ceaff68..583f77286674f8b 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -1394,9 +1394,7 @@ void Object::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_shape); - - for (auto& value : m_storage) - visitor.visit(value); + visitor.visit(m_storage); m_indexed_properties.for_each_value([&visitor](auto& value) { visitor.visit(value); diff --git a/Userland/Libraries/LibJS/Runtime/Promise.cpp b/Userland/Libraries/LibJS/Runtime/Promise.cpp index a339b844027eef7..979c046604a1c22 100644 --- a/Userland/Libraries/LibJS/Runtime/Promise.cpp +++ b/Userland/Libraries/LibJS/Runtime/Promise.cpp @@ -395,10 +395,8 @@ void Promise::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_result); - for (auto& reaction : m_fulfill_reactions) - visitor.visit(reaction); - for (auto& reaction : m_reject_reactions) - visitor.visit(reaction); + visitor.visit(m_fulfill_reactions); + visitor.visit(m_reject_reactions); } } diff --git a/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp b/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp index 2077b8d0e797e65..609ae8b3cb383ca 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp @@ -24,8 +24,7 @@ JS_DEFINE_ALLOCATOR(PromiseAnyRejectElementFunction); void PromiseValueList::visit_edges(Visitor& visitor) { Base::visit_edges(visitor); - for (auto& val : m_values) - visitor.visit(val); + visitor.visit(m_values); } PromiseResolvingElementFunction::PromiseResolvingElementFunction(size_t index, PromiseValueList& values, NonnullGCPtr capability, RemainingElements& remaining_elements, Object& prototype) diff --git a/Userland/Libraries/LibWeb/Animations/Animatable.cpp b/Userland/Libraries/LibWeb/Animations/Animatable.cpp index ec63978846e1f41..672f9b91454326b 100644 --- a/Userland/Libraries/LibWeb/Animations/Animatable.cpp +++ b/Userland/Libraries/LibWeb/Animations/Animatable.cpp @@ -96,8 +96,7 @@ void Animatable::disassociate_with_animation(JS::NonnullGCPtr animati void Animatable::visit_edges(JS::Cell::Visitor& visitor) { - for (auto const& animation : m_associated_animations) - visitor.visit(animation); + visitor.visit(m_associated_animations); visitor.visit(m_cached_animation_name_source); visitor.visit(m_cached_animation_name_animation); } diff --git a/Userland/Libraries/LibWeb/Animations/AnimationTimeline.cpp b/Userland/Libraries/LibWeb/Animations/AnimationTimeline.cpp index 7bf4f001f9591ca..042b3a11ffd1749 100644 --- a/Userland/Libraries/LibWeb/Animations/AnimationTimeline.cpp +++ b/Userland/Libraries/LibWeb/Animations/AnimationTimeline.cpp @@ -64,8 +64,7 @@ void AnimationTimeline::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_associated_document); - for (auto const& animation : m_associated_animations) - visitor.visit(animation); + visitor.visit(m_associated_animations); } } diff --git a/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp b/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp index d0a327571deae1b..456733051fd415d 100644 --- a/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp +++ b/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp @@ -873,8 +873,7 @@ void KeyframeEffect::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_target_element); - for (auto const& keyframe : m_keyframe_objects) - visitor.visit(keyframe); + visitor.visit(m_keyframe_objects); } static CSS::RequiredInvalidationAfterStyleChange compute_required_invalidation(HashMap> const& old_properties, HashMap> const& new_properties) diff --git a/Userland/Libraries/LibWeb/Bindings/Intrinsics.cpp b/Userland/Libraries/LibWeb/Bindings/Intrinsics.cpp index 1fe555964f068f2..abef40dab7fab0a 100644 --- a/Userland/Libraries/LibWeb/Bindings/Intrinsics.cpp +++ b/Userland/Libraries/LibWeb/Bindings/Intrinsics.cpp @@ -17,13 +17,9 @@ JS_DEFINE_ALLOCATOR(Intrinsics); void Intrinsics::visit_edges(JS::Cell::Visitor& visitor) { Base::visit_edges(visitor); - - for (auto& it : m_namespaces) - visitor.visit(it.value); - for (auto& it : m_prototypes) - visitor.visit(it.value); - for (auto& it : m_constructors) - visitor.visit(it.value); + visitor.visit(m_namespaces); + visitor.visit(m_prototypes); + visitor.visit(m_constructors); visitor.visit(m_realm); } diff --git a/Userland/Libraries/LibWeb/CSS/CSSKeyframesRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSKeyframesRule.cpp index c41dba48ae2a993..74ce66884f6b466 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSKeyframesRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSKeyframesRule.cpp @@ -20,8 +20,7 @@ JS::NonnullGCPtr CSSKeyframesRule::create(JS::Realm& realm, Fl void CSSKeyframesRule::visit_edges(Visitor& visitor) { Base::visit_edges(visitor); - for (auto& keyframe : m_keyframes) - visitor.visit(keyframe); + visitor.visit(m_keyframes); } void CSSKeyframesRule::initialize(JS::Realm& realm) diff --git a/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp b/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp index e6ddfccdfb7a1aa..b7ce073e5ade71a 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp @@ -48,8 +48,7 @@ void CSSRuleList::initialize(JS::Realm& realm) void CSSRuleList::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); - for (auto& rule : m_rules) - visitor.visit(rule); + visitor.visit(m_rules); } bool CSSRuleList::is_supported_property_index(u32 index) const diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp b/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp index 06a45f9ddfb30d9..50a4045b19f3f5d 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp @@ -122,8 +122,7 @@ void CSSStyleSheet::visit_edges(Cell::Visitor& visitor) visitor.visit(m_owner_css_rule); visitor.visit(m_default_namespace_rule); visitor.visit(m_constructor_document); - for (auto& [key, namespace_rule] : m_namespace_rules) - visitor.visit(namespace_rule); + visitor.visit(m_namespace_rules); } // https://www.w3.org/TR/cssom/#dom-cssstylesheet-insertrule diff --git a/Userland/Libraries/LibWeb/CSS/StyleSheetList.cpp b/Userland/Libraries/LibWeb/CSS/StyleSheetList.cpp index ecab95e650690ba..fe058bbc2f35bfd 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleSheetList.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleSheetList.cpp @@ -87,8 +87,7 @@ void StyleSheetList::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_document); - for (auto sheet : m_sheets) - visitor.visit(sheet); + visitor.visit(m_sheets); } // https://www.w3.org/TR/cssom/#ref-for-dfn-supported-property-indices%E2%91%A1 diff --git a/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp b/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp index fa79c32e6f5409a..e4266746f47c113 100644 --- a/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp +++ b/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp @@ -98,14 +98,9 @@ void AbortSignal::visit_edges(JS::Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_abort_reason); - for (auto& algorithm : m_abort_algorithms) - visitor.visit(algorithm); - - for (auto& source_signal : m_source_signals) - visitor.visit(source_signal); - - for (auto& dependent_signal : m_dependent_signals) - visitor.visit(dependent_signal); + visitor.visit(m_abort_algorithms); + visitor.visit(m_source_signals); + visitor.visit(m_dependent_signals); } // https://dom.spec.whatwg.org/#dom-abortsignal-abort diff --git a/Userland/Libraries/LibWeb/DOM/AccessibilityTreeNode.cpp b/Userland/Libraries/LibWeb/DOM/AccessibilityTreeNode.cpp index d36c43431fa6aaa..2d1bf80ceef452b 100644 --- a/Userland/Libraries/LibWeb/DOM/AccessibilityTreeNode.cpp +++ b/Userland/Libraries/LibWeb/DOM/AccessibilityTreeNode.cpp @@ -76,8 +76,7 @@ void AccessibilityTreeNode::visit_edges(Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_value); - for (auto const& child : m_children) - visitor.visit(child); + visitor.visit(m_children); } } diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index a864fdb1d20bb77..1885cee12a3fb5b 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -445,44 +445,25 @@ void Document::visit_edges(Cell::Visitor& visitor) visitor.visit(m_visual_viewport); visitor.visit(m_latest_entry); visitor.visit(m_default_timeline); - - for (auto& script : m_scripts_to_execute_when_parsing_has_finished) - visitor.visit(script); - for (auto& script : m_scripts_to_execute_in_order_as_soon_as_possible) - visitor.visit(script); - for (auto& script : m_scripts_to_execute_as_soon_as_possible) - visitor.visit(script); - - for (auto& node_iterator : m_node_iterators) - visitor.visit(node_iterator); - - for (auto& document_observer : m_document_observers) - visitor.visit(document_observer); - - for (auto& target : m_pending_scroll_event_targets) - visitor.visit(target); - for (auto& target : m_pending_scrollend_event_targets) - visitor.visit(target); - - for (auto& observer : m_intersection_observers) - visitor.visit(observer); - - for (auto& observer : m_resize_observers) - visitor.visit(observer); - - for (auto& image : m_shared_image_requests) - visitor.visit(image.value); - - for (auto& timeline : m_associated_animation_timelines) - visitor.visit(timeline); - + visitor.visit(m_scripts_to_execute_when_parsing_has_finished); + visitor.visit(m_scripts_to_execute_in_order_as_soon_as_possible); + visitor.visit(m_scripts_to_execute_as_soon_as_possible); + visitor.visit(m_node_iterators); + visitor.visit(m_document_observers); + visitor.visit(m_pending_scroll_event_targets); + visitor.visit(m_pending_scrollend_event_targets); + visitor.visit(m_intersection_observers); + visitor.visit(m_resize_observers); + + visitor.visit(m_shared_image_requests); + + visitor.visit(m_associated_animation_timelines); visitor.visit(m_list_of_available_images); for (auto* form_associated_element : m_form_associated_elements_with_form_attribute) visitor.visit(form_associated_element->form_associated_element_to_html_element()); - for (auto& element : m_potentially_named_elements) - visitor.visit(element); + visitor.visit(m_potentially_named_elements); for (auto& event : m_pending_animation_event_queue) { visitor.visit(event.event); @@ -491,14 +472,10 @@ void Document::visit_edges(Cell::Visitor& visitor) visitor.visit(m_adopted_style_sheets); - for (auto& shadow_root : m_shadow_roots) - visitor.visit(shadow_root); - - for (auto& element : m_top_layer_elements) - visitor.visit(element); + visitor.visit(m_shadow_roots); - for (auto& element : m_top_layer_pending_removals) - visitor.visit(element); + visitor.visit(m_top_layer_elements); + visitor.visit(m_top_layer_pending_removals); } // https://w3c.github.io/selection-api/#dom-document-getselection diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 4362a7b008d5d9a..3c1acf82e364039 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -99,8 +99,7 @@ void Element::visit_edges(Cell::Visitor& visitor) visitor.visit(m_shadow_root); visitor.visit(m_custom_element_definition); if (m_pseudo_element_nodes) { - for (auto& pseudo_element_layout_node : *m_pseudo_element_nodes) - visitor.visit(pseudo_element_layout_node); + visitor.visit(m_pseudo_element_nodes->span()); } if (m_registered_intersection_observers) { for (auto& registered_intersection_observers : *m_registered_intersection_observers) diff --git a/Userland/Libraries/LibWeb/DOM/Event.cpp b/Userland/Libraries/LibWeb/DOM/Event.cpp index 2e275c1a7c9839f..62f4088a9071a1c 100644 --- a/Userland/Libraries/LibWeb/DOM/Event.cpp +++ b/Userland/Libraries/LibWeb/DOM/Event.cpp @@ -64,11 +64,9 @@ void Event::visit_edges(Visitor& visitor) visitor.visit(it.invocation_target); visitor.visit(it.shadow_adjusted_target); visitor.visit(it.related_target); - for (auto& itit : it.touch_target_list) - visitor.visit(itit); + visitor.visit(it.touch_target_list); } - for (auto& it : m_touch_target_list) - visitor.visit(it); + visitor.visit(m_touch_target_list); } // https://dom.spec.whatwg.org/#concept-event-path-append diff --git a/Userland/Libraries/LibWeb/DOM/EventTarget.cpp b/Userland/Libraries/LibWeb/DOM/EventTarget.cpp index e82471259cc3a49..2d86e29899bf04a 100644 --- a/Userland/Libraries/LibWeb/DOM/EventTarget.cpp +++ b/Userland/Libraries/LibWeb/DOM/EventTarget.cpp @@ -69,11 +69,8 @@ void EventTarget::visit_edges(Cell::Visitor& visitor) Base::visit_edges(visitor); if (auto const* data = m_data.ptr()) { - for (auto& event_listener : data->event_listener_list) - visitor.visit(event_listener); - - for (auto& it : data->event_handler_map) - visitor.visit(it.value); + visitor.visit(data->event_listener_list); + visitor.visit(data->event_handler_map); } } diff --git a/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp b/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp index b24096011d40eab..bec858f91d47eaf 100644 --- a/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp +++ b/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp @@ -46,8 +46,7 @@ void HTMLCollection::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_root); - for (auto& element : m_cached_elements) - visitor.visit(element); + visitor.visit(m_cached_elements); } void HTMLCollection::update_cache_if_needed() const diff --git a/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp b/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp index 57dc3076161c812..ea688976a7d6362 100644 --- a/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp +++ b/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp @@ -50,8 +50,7 @@ void MutationObserver::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_callback); - for (auto& record : m_record_queue) - visitor.visit(record); + visitor.visit(m_record_queue); } // https://dom.spec.whatwg.org/#dom-mutationobserver-observe diff --git a/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp b/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp index e60a4c7b3b07632..955e8722fdce159 100644 --- a/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp +++ b/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp @@ -43,8 +43,7 @@ void NamedNodeMap::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_element); - for (auto& attribute : m_attributes) - visitor.visit(attribute); + visitor.visit(m_attributes); } // https://dom.spec.whatwg.org/#ref-for-dfn-supported-property-indices%E2%91%A3 diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index 470be4a01703eb0..208de97763a3008 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -106,8 +106,7 @@ void Node::visit_edges(Cell::Visitor& visitor) visitor.visit(m_paintable); if (m_registered_observer_list) { - for (auto& registered_observer : *m_registered_observer_list) - visitor.visit(registered_observer); + visitor.visit(*m_registered_observer_list); } } diff --git a/Userland/Libraries/LibWeb/DOM/StaticNodeList.cpp b/Userland/Libraries/LibWeb/DOM/StaticNodeList.cpp index 5d85412a1de37ea..64e15de88a41cc6 100644 --- a/Userland/Libraries/LibWeb/DOM/StaticNodeList.cpp +++ b/Userland/Libraries/LibWeb/DOM/StaticNodeList.cpp @@ -29,8 +29,7 @@ StaticNodeList::~StaticNodeList() = default; void StaticNodeList::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); - for (auto& node : m_static_nodes) - visitor.visit(node); + visitor.visit(m_static_nodes); } // https://dom.spec.whatwg.org/#dom-nodelist-length diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp index e391e4103790f8e..4293ecc147c8b1e 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp @@ -34,8 +34,7 @@ void Request::visit_edges(JS::Cell::Visitor& visitor) m_window.visit( [&](JS::GCPtr const& value) { visitor.visit(value); }, [](auto const&) {}); - for (auto const& pending_response : m_pending_responses) - visitor.visit(pending_response); + visitor.visit(m_pending_responses); } JS::NonnullGCPtr Request::create(JS::VM& vm) diff --git a/Userland/Libraries/LibWeb/FileAPI/FileList.cpp b/Userland/Libraries/LibWeb/FileAPI/FileList.cpp index 13eac9b7f119404..63644efe9a5f62b 100644 --- a/Userland/Libraries/LibWeb/FileAPI/FileList.cpp +++ b/Userland/Libraries/LibWeb/FileAPI/FileList.cpp @@ -66,8 +66,7 @@ WebIDL::ExceptionOr FileList::item_value(size_t index) const void FileList::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); - for (auto file : m_files) - visitor.visit(file); + visitor.visit(m_files); } WebIDL::ExceptionOr FileList::serialization_steps(HTML::SerializationRecord& serialized, bool for_storage, HTML::SerializationMemory& memory) diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp b/Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp index 28a46fdc6e0b199..36edc0bede6fcbe 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp @@ -40,8 +40,7 @@ void DOMRectList::initialize(JS::Realm& realm) void DOMRectList::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); - for (auto& rect : m_rects) - visitor.visit(rect); + visitor.visit(m_rects); } // https://drafts.fxtf.org/geometry-1/#dom-domrectlist-length diff --git a/Userland/Libraries/LibWeb/HTML/AudioTrackList.cpp b/Userland/Libraries/LibWeb/HTML/AudioTrackList.cpp index 4e4ca2fd9b85c87..2ac8de8c05402fe 100644 --- a/Userland/Libraries/LibWeb/HTML/AudioTrackList.cpp +++ b/Userland/Libraries/LibWeb/HTML/AudioTrackList.cpp @@ -122,8 +122,7 @@ WebIDL::CallbackType* AudioTrackList::onremovetrack() void AudioTrackList::visit_edges(JS::Cell::Visitor& visitor) { Base::visit_edges(visitor); - for (auto const& track : m_audio_tracks) - visitor.visit(track); + visitor.visit(m_audio_tracks); } } diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.cpp index 7235ec82edd21dd..2fb1802076ec45c 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.cpp +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.cpp @@ -35,8 +35,7 @@ void BrowsingContextGroup::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_page); - for (auto& context : m_browsing_context_set) - visitor.visit(context); + visitor.visit(m_browsing_context_set); } // https://html.spec.whatwg.org/multipage/document-sequences.html#creating-a-new-browsing-context-group-and-document diff --git a/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.cpp b/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.cpp index 329c55bbee447a3..066b2e677602850 100644 --- a/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.cpp +++ b/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.cpp @@ -12,8 +12,7 @@ void CustomElementDefinition::visit_edges(Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_constructor); - for (auto& callback : m_lifecycle_callbacks) - visitor.visit(callback.value); + visitor.visit(m_lifecycle_callbacks); } } diff --git a/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp b/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp index 06d232bfbe6a0f2..fcb2b28f45a790e 100644 --- a/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp +++ b/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp @@ -39,10 +39,8 @@ void CustomElementRegistry::initialize(JS::Realm& realm) void CustomElementRegistry::visit_edges(Visitor& visitor) { Base::visit_edges(visitor); - for (auto& definition : m_custom_element_definitions) - visitor.visit(definition); - for (auto& [name, promise] : m_when_defined_promise_map) - visitor.visit(promise); + visitor.visit(m_custom_element_definitions); + visitor.visit(m_when_defined_promise_map); } // https://webidl.spec.whatwg.org/#es-callback-function diff --git a/Userland/Libraries/LibWeb/HTML/DocumentState.cpp b/Userland/Libraries/LibWeb/HTML/DocumentState.cpp index ad067525f4d7c92..65dc58bfa47acaa 100644 --- a/Userland/Libraries/LibWeb/HTML/DocumentState.cpp +++ b/Userland/Libraries/LibWeb/HTML/DocumentState.cpp @@ -39,9 +39,7 @@ void DocumentState::visit_edges(Cell::Visitor& visitor) Base::visit_edges(visitor); visitor.visit(m_document); for (auto& nested_history : m_nested_histories) { - for (auto& entry : nested_history.entries) { - visitor.visit(entry); - } + visitor.visit(nested_history.entries); } } diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp index f8f99e1c938728e..f8aca72643cbb2a 100644 --- a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp +++ b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp @@ -37,9 +37,7 @@ void EventLoop::visit_edges(Visitor& visitor) visitor.visit(m_task_queue); visitor.visit(m_microtask_queue); visitor.visit(m_currently_running_task); - - for (auto& settings : m_backup_incumbent_settings_object_stack) - visitor.visit(settings); + visitor.visit(m_backup_incumbent_settings_object_stack); } void EventLoop::schedule() diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/TaskQueue.cpp b/Userland/Libraries/LibWeb/HTML/EventLoop/TaskQueue.cpp index 8cea970cc5faf64..8cff11b43193e98 100644 --- a/Userland/Libraries/LibWeb/HTML/EventLoop/TaskQueue.cpp +++ b/Userland/Libraries/LibWeb/HTML/EventLoop/TaskQueue.cpp @@ -23,8 +23,7 @@ void TaskQueue::visit_edges(Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_event_loop); - for (auto& task : m_tasks) - visitor.visit(task); + visitor.visit(m_tasks); } void TaskQueue::add(JS::NonnullGCPtr task) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp index 6fe237669b29e1d..ebe0407be1718b5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp @@ -59,8 +59,7 @@ void HTMLFormElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_elements); - for (auto& element : m_associated_elements) - visitor.visit(element); + visitor.visit(m_associated_elements); visitor.visit(m_planned_navigation); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp index 23d1efceabfeebe..a7086bdd5d65217 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp @@ -90,8 +90,7 @@ void HTMLMediaElement::visit_edges(Cell::Visitor& visitor) visitor.visit(m_document_observer); visitor.visit(m_source_element_selector); visitor.visit(m_fetch_controller); - for (auto& promise : m_pending_play_promises) - visitor.visit(promise); + visitor.visit(m_pending_play_promises); } void HTMLMediaElement::attribute_changed(FlyString const& name, Optional const& value) diff --git a/Userland/Libraries/LibWeb/HTML/Location.cpp b/Userland/Libraries/LibWeb/HTML/Location.cpp index 845a3d6d7b4ab8d..fd004eb3a68be6c 100644 --- a/Userland/Libraries/LibWeb/HTML/Location.cpp +++ b/Userland/Libraries/LibWeb/HTML/Location.cpp @@ -35,8 +35,7 @@ Location::~Location() = default; void Location::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); - for (auto& property : m_default_properties) - visitor.visit(property); + visitor.visit(m_default_properties); } void Location::initialize(JS::Realm& realm) diff --git a/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp b/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp index 1f754c62ef1c548..13826963a39c8ac 100644 --- a/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp @@ -49,8 +49,7 @@ void MessageEvent::visit_edges(Cell::Visitor& visitor) Base::visit_edges(visitor); visitor.visit(m_data); visitor.visit(m_ports_array); - for (auto& port : m_ports) - visitor.visit(port); + visitor.visit(m_ports); } Variant, JS::Handle, Empty> MessageEvent::source() const diff --git a/Userland/Libraries/LibWeb/HTML/NavigateEvent.cpp b/Userland/Libraries/LibWeb/HTML/NavigateEvent.cpp index 3a63f381a660c29..79cdc046563a162 100644 --- a/Userland/Libraries/LibWeb/HTML/NavigateEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/NavigateEvent.cpp @@ -56,8 +56,7 @@ void NavigateEvent::initialize(JS::Realm& realm) void NavigateEvent::visit_edges(JS::Cell::Visitor& visitor) { Base::visit_edges(visitor); - for (auto& handler : m_navigation_handler_list) - visitor.visit(handler); + visitor.visit(m_navigation_handler_list); visitor.visit(m_abort_controller); visitor.visit(m_destination); visitor.visit(m_signal); diff --git a/Userland/Libraries/LibWeb/HTML/Navigation.cpp b/Userland/Libraries/LibWeb/HTML/Navigation.cpp index c8b9bdc0d263dd0..74e1164278e0bd7 100644 --- a/Userland/Libraries/LibWeb/HTML/Navigation.cpp +++ b/Userland/Libraries/LibWeb/HTML/Navigation.cpp @@ -83,14 +83,12 @@ void Navigation::initialize(JS::Realm& realm) void Navigation::visit_edges(JS::Cell::Visitor& visitor) { Base::visit_edges(visitor); - for (auto& entry : m_entry_list) - visitor.visit(entry); + visitor.visit(m_entry_list); visitor.visit(m_transition); visitor.visit(m_ongoing_navigate_event); visitor.visit(m_ongoing_api_method_tracker); visitor.visit(m_upcoming_non_traverse_api_method_tracker); - for (auto& key_and_tracker : m_upcoming_traverse_api_method_trackers) - visitor.visit(key_and_tracker.value); + visitor.visit(m_upcoming_traverse_api_method_trackers); } // https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigation-entries diff --git a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp index a88d9c60ac6c12c..455588907cad31e 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp @@ -16,8 +16,7 @@ StackOfOpenElements::~StackOfOpenElements() = default; void StackOfOpenElements::visit_edges(JS::Cell::Visitor& visitor) { - for (auto& element : m_elements) - visitor.visit(element); + visitor.visit(m_elements); } bool StackOfOpenElements::has_in_scope_impl(FlyString const& tag_name, Vector const& list) const diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/ModuleMap.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/ModuleMap.cpp index 8de292bf33e03fa..1869170e47a3141 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/ModuleMap.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/ModuleMap.cpp @@ -17,8 +17,7 @@ void ModuleMap::visit_edges(Visitor& visitor) visitor.visit(it.value.module_script); for (auto const& it : m_callbacks) - for (auto const& callback : it.value) - visitor.visit(callback); + visitor.visit(it.value); } bool ModuleMap::is_fetching(URL::URL const& url, ByteString const& type) const diff --git a/Userland/Libraries/LibWeb/HTML/SessionHistoryTraversalQueue.cpp b/Userland/Libraries/LibWeb/HTML/SessionHistoryTraversalQueue.cpp index 928fb5a5f50fc21..6d3b619c21f6c66 100644 --- a/Userland/Libraries/LibWeb/HTML/SessionHistoryTraversalQueue.cpp +++ b/Userland/Libraries/LibWeb/HTML/SessionHistoryTraversalQueue.cpp @@ -43,9 +43,7 @@ SessionHistoryTraversalQueue::SessionHistoryTraversalQueue() void SessionHistoryTraversalQueue::visit_edges(JS::Cell::Visitor& visitor) { Base::visit_edges(visitor); - for (auto const& entry : m_queue) { - visitor.visit(entry); - } + visitor.visit(m_queue); } void SessionHistoryTraversalQueue::append(Function steps) diff --git a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp index 43a74a7bc04783c..01bb438e1a90371 100644 --- a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp +++ b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp @@ -34,8 +34,7 @@ void TraversableNavigable::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_page); - for (auto& entry : m_session_history_entries) - visitor.visit(entry); + visitor.visit(m_session_history_entries); visitor.visit(m_session_history_traversal_queue); } diff --git a/Userland/Libraries/LibWeb/HTML/VideoTrackList.cpp b/Userland/Libraries/LibWeb/HTML/VideoTrackList.cpp index 70299a9120b245e..4a95f6dbfd0d357 100644 --- a/Userland/Libraries/LibWeb/HTML/VideoTrackList.cpp +++ b/Userland/Libraries/LibWeb/HTML/VideoTrackList.cpp @@ -129,8 +129,7 @@ WebIDL::CallbackType* VideoTrackList::onremovetrack() void VideoTrackList::visit_edges(JS::Cell::Visitor& visitor) { Base::visit_edges(visitor); - for (auto const& track : m_video_tracks) - visitor.visit(track); + visitor.visit(m_video_tracks); } } diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index b61141c54975157..de6f3ae8f46fa46 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -126,10 +126,8 @@ void Window::visit_edges(JS::Cell::Visitor& visitor) visitor.visit(m_navigator); visitor.visit(m_navigation); visitor.visit(m_custom_element_registry); - for (auto& plugin_object : m_pdf_viewer_plugin_objects) - visitor.visit(plugin_object); - for (auto& mime_type_object : m_pdf_viewer_mime_type_objects) - visitor.visit(mime_type_object); + visitor.visit(m_pdf_viewer_plugin_objects); + visitor.visit(m_pdf_viewer_mime_type_objects); visitor.visit(m_count_queuing_strategy_size_function); visitor.visit(m_byte_length_queuing_strategy_size_function); } diff --git a/Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp b/Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp index db20a7e2211f27e..c0e32bf46ac6888 100644 --- a/Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp +++ b/Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp @@ -65,10 +65,8 @@ void WindowOrWorkerGlobalScopeMixin::visit_edges(JS::Cell::Visitor& visitor) { visitor.visit(m_performance); visitor.visit(m_supported_entry_types_array); - for (auto& it : m_timers) - visitor.visit(it.value); - for (auto& observer : m_registered_performance_observer_objects) - visitor.visit(observer); + visitor.visit(m_timers); + visitor.visit(m_registered_performance_observer_objects); for (auto& entry : m_performance_entry_buffer_map) entry.value.visit_edges(visitor); } diff --git a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp index 1cc628f40893eb9..293bd415ac55f15 100644 --- a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp +++ b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp @@ -78,10 +78,8 @@ void IntersectionObserver::visit_edges(JS::Cell::Visitor& visitor) Base::visit_edges(visitor); visitor.visit(m_root); visitor.visit(m_callback); - for (auto& entry : m_queued_entries) - visitor.visit(entry); - for (auto& target : m_observation_targets) - visitor.visit(target); + visitor.visit(m_queued_entries); + visitor.visit(m_observation_targets); } // https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-observe diff --git a/Userland/Libraries/LibWeb/Painting/ViewportPaintable.cpp b/Userland/Libraries/LibWeb/Painting/ViewportPaintable.cpp index 2e27a24d01e8275..8cce3ea837b75b3 100644 --- a/Userland/Libraries/LibWeb/Painting/ViewportPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/ViewportPaintable.cpp @@ -518,10 +518,8 @@ void ViewportPaintable::recompute_selection_states() void ViewportPaintable::visit_edges(Visitor& visitor) { Base::visit_edges(visitor); - for (auto it : scroll_state) - visitor.visit(it.key); - for (auto it : clip_state) - visitor.visit(it.key); + visitor.visit(scroll_state); + visitor.visit(clip_state); } } diff --git a/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceEntryTuple.h b/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceEntryTuple.h index 18d86fa95714a6c..e2ecaee1c62d9a1 100644 --- a/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceEntryTuple.h +++ b/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceEntryTuple.h @@ -48,8 +48,7 @@ struct PerformanceEntryTuple { void visit_edges(JS::Cell::Visitor& visitor) { - for (auto& entry : performance_entry_buffer) - visitor.visit(entry); + visitor.visit(performance_entry_buffer); } }; diff --git a/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceObserver.cpp b/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceObserver.cpp index 85b0e2ca0c4316e..d35954d58384a95 100644 --- a/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceObserver.cpp +++ b/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceObserver.cpp @@ -41,8 +41,7 @@ void PerformanceObserver::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_callback); - for (auto& entry : m_observer_buffer) - visitor.visit(entry); + visitor.visit(m_observer_buffer); } // https://w3c.github.io/performance-timeline/#dom-performanceobserver-observe diff --git a/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceObserverEntryList.cpp b/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceObserverEntryList.cpp index 9ada84eb15d47b9..21c7ea27b184846 100644 --- a/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceObserverEntryList.cpp +++ b/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceObserverEntryList.cpp @@ -32,8 +32,7 @@ void PerformanceObserverEntryList::initialize(JS::Realm& realm) void PerformanceObserverEntryList::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); - for (auto& entry : m_entry_list) - visitor.visit(entry); + visitor.visit(m_entry_list); } // https://www.w3.org/TR/performance-timeline/#dfn-filter-buffer-by-name-and-type diff --git a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObservation.cpp b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObservation.cpp index 9344e290c10ce8e..c2a4f8e844b8286 100644 --- a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObservation.cpp +++ b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObservation.cpp @@ -33,8 +33,7 @@ void ResizeObservation::visit_edges(JS::Cell::Visitor& visitor) Base::visit_edges(visitor); visitor.visit(m_realm); visitor.visit(m_target); - for (auto& size : m_last_reported_sizes) - visitor.visit(size); + visitor.visit(m_last_reported_sizes); } // https://drafts.csswg.org/resize-observer-1/#dom-resizeobservation-isactive diff --git a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp index 191867102ec41e1..d4d744d288b2bf3 100644 --- a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp +++ b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp @@ -43,12 +43,9 @@ void ResizeObserver::visit_edges(JS::Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_callback); - for (auto& observation : m_observation_targets) - visitor.visit(observation); - for (auto& observation : m_active_targets) - visitor.visit(observation); - for (auto& observation : m_skipped_targets) - visitor.visit(observation); + visitor.visit(m_observation_targets); + visitor.visit(m_active_targets); + visitor.visit(m_skipped_targets); } void ResizeObserver::finalize() diff --git a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.cpp b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.cpp index 0a6ecaa1452c33b..9e7e3ff97b4de8c 100644 --- a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.cpp +++ b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.cpp @@ -68,12 +68,9 @@ void ResizeObserverEntry::visit_edges(JS::Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_target); - for (auto& size : m_content_box_size) - visitor.visit(size); - for (auto& size : m_border_box_size) - visitor.visit(size); - for (auto& size : m_device_pixel_content_box_size) - visitor.visit(size); + visitor.visit(m_content_box_size); + visitor.visit(m_border_box_size); + visitor.visit(m_device_pixel_content_box_size); visitor.visit(m_content_rect); } diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBReader.cpp b/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBReader.cpp index c71e66d3885f406..00240e3075473ba 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBReader.cpp +++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBReader.cpp @@ -56,8 +56,7 @@ void ReadableStreamBYOBReader::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); ReadableStreamGenericReaderMixin::visit_edges(visitor); - for (auto& request : m_read_into_requests) - visitor.visit(request); + visitor.visit(m_read_into_requests); } class BYOBReaderReadIntoRequest : public ReadIntoRequest { diff --git a/Userland/Libraries/LibWeb/WebAudio/AudioContext.cpp b/Userland/Libraries/LibWeb/WebAudio/AudioContext.cpp index 943496c984c5a09..6551a41507cb9e6 100644 --- a/Userland/Libraries/LibWeb/WebAudio/AudioContext.cpp +++ b/Userland/Libraries/LibWeb/WebAudio/AudioContext.cpp @@ -90,10 +90,8 @@ void AudioContext::initialize(JS::Realm& realm) void AudioContext::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); - for (auto& promise : m_pending_promises) - visitor.visit(promise); - for (auto& promise : m_pending_resume_promises) - visitor.visit(promise); + visitor.visit(m_pending_promises); + visitor.visit(m_pending_resume_promises); } // https://www.w3.org/TR/webaudio/#dom-audiocontext-getoutputtimestamp diff --git a/Userland/Libraries/LibWeb/WebIDL/Promise.cpp b/Userland/Libraries/LibWeb/WebIDL/Promise.cpp index d382270d29985ef..f2dd79d3d997055 100644 --- a/Userland/Libraries/LibWeb/WebIDL/Promise.cpp +++ b/Userland/Libraries/LibWeb/WebIDL/Promise.cpp @@ -192,9 +192,7 @@ struct WaitForAllResults : JS::Cell { { Base::visit_edges(visitor); visitor.visit(success_steps); - for (auto& value : result) { - visitor.visit(value); - } + visitor.visit(result); } JS::NonnullGCPtr const&)>> success_steps; diff --git a/Userland/Services/WebContent/PageClient.cpp b/Userland/Services/WebContent/PageClient.cpp index dba38dfcc924e92..702a3d8b6c60efb 100644 --- a/Userland/Services/WebContent/PageClient.cpp +++ b/Userland/Services/WebContent/PageClient.cpp @@ -126,8 +126,7 @@ void PageClient::visit_edges(JS::Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_page); - for (auto document : m_console_clients.keys()) - visitor.visit(document); + visitor.visit(m_console_clients); } ConnectionFromClient& PageClient::client() const