Skip to content

Truly independent web browser

LibWeb: Remove unused internal helpers and declarations

Shannon Booth54a4bcb8346c
diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp
index 5f35fcd4966..7926414db51 100644
--- a/Libraries/LibWeb/DOM/Document.cpp
+++ b/Libraries/LibWeb/DOM/Document.cpp
@@ -931,11 +931,6 @@ void Document::bump_style_environment_version()
HTML::note_rendering_trace_event("style environment changed"sv);
}
-bool Document::needs_full_layout_tree_update(Layout::BegunRead const& read) const
-{
- return m_layout_node_arena && Layout::RustFFI::render_state_needs_full_layout_tree_update(m_layout_node_arena->host(), &read);
-}
-
// A document without an arena has no layout nodes, so its next build creates every box anyway.
void Document::set_needs_full_layout_tree_update()
{
@@ -7438,14 +7433,6 @@ void Document::cache_accessible_text(Element const& element, CachedAccessibleTex
m_cached_accessible_text_depending_on_any_node.set(id);
}
-WebView::AccessibilityNodeData const* Document::cached_accessibility_record(Node const& node) const
-{
- if (!m_accessibility_record_cache || m_accessibility_caches_bypassed)
- return nullptr;
- auto it = m_accessibility_record_cache->records.find(node.unique_id());
- return it == m_accessibility_record_cache->records.end() ? nullptr : &it->value.data;
-}
-
Document::KeptAccessibilityRecord Document::kept_accessibility_record(Node const& node) const
{
if (!m_accessibility_record_cache || m_accessibility_caches_bypassed)
@@ -8915,14 +8902,6 @@ void Document::disassociate_with_animation(GC::Ref<Animations::Animation> animat
m_associated_animations.remove(animation);
}
-size_t Document::associated_animation_count() const
-{
- size_t count = 0;
- for ([[maybe_unused]] auto& animation : m_associated_animations)
- ++count;
- return count;
-}
-
static bool is_transform_family_property(CSS::PropertyID property_id)
{
return first_is_one_of(property_id,
diff --git a/Libraries/LibWeb/DOM/Document.h b/Libraries/LibWeb/DOM/Document.h
index a6d846cc871..04eeb4ad7e9 100644
--- a/Libraries/LibWeb/DOM/Document.h
+++ b/Libraries/LibWeb/DOM/Document.h
@@ -1120,7 +1120,6 @@ public:
void set_needs_container_query_evaluation_after_layout(Element const& query_container);
[[nodiscard]] bool has_size_containers_needing_evaluation_after_layout(Layout::BegunRead const& read) const;
- [[nodiscard]] bool needs_full_layout_tree_update(Layout::BegunRead const& read) const;
void set_needs_full_layout_tree_update();
CSS::ScrollStateQueryContainers& scroll_state_query_containers() { return m_scroll_state_query_containers; }
@@ -1284,9 +1283,6 @@ public:
void cache_accessible_text(Element const&, CachedAccessibleText) const;
void invalidate_cached_accessibility_data(Node const&, Optional<Utf16FlyString> const& attribute_name = {}, ReadonlySpan<GC::Ref<Node>> added_nodes = {}, ReadonlySpan<GC::Ref<Node>> removed_nodes = {});
- // What a build of the accessibility tree keeps of each node's data for the next build, while an assistive
- // technology consumes the tree; see AccessibilityTreeNode::serialize_tree_as_node_data().
- WebView::AccessibilityNodeData const* cached_accessibility_record(Node const&) const;
// A kept record, with the version it got when it was kept: Every record and geometry kept gets a new version, so
// the same version means the same data.
struct KeptAccessibilityRecord {
@@ -1415,7 +1411,6 @@ public:
void disassociate_with_timeline(GC::Ref<Animations::AnimationTimeline>);
void associate_with_animation(GC::Ref<Animations::Animation>);
void disassociate_with_animation(GC::Ref<Animations::Animation>);
- size_t associated_animation_count() const;
bool has_associated_animations() const { return !m_associated_animations.is_empty(); }
// Negative where `first` comes before `second` in tree order and positive where it comes after, for sorting
// animations by composite order. Two distinct elements of this document take no walk of their siblings once a tree
diff --git a/Libraries/LibWeb/DOM/Node.cpp b/Libraries/LibWeb/DOM/Node.cpp
index 60bcf2a18a8..936aef57d95 100644
--- a/Libraries/LibWeb/DOM/Node.cpp
+++ b/Libraries/LibWeb/DOM/Node.cpp
@@ -4855,17 +4855,6 @@ bool Node::has_inclusive_ancestor_with_display_none_ignoring_animations() const
return false;
}
-bool Node::has_inclusive_ancestor_with_event_listener(Utf16FlyString const& type) const
-{
- for (auto const* ancestor = this; ancestor; ancestor = ancestor->parent_or_shadow_host()) {
- if (ancestor->has_event_listener(type))
- return true;
- }
- if (auto window = document().window())
- return window->has_event_listener(type);
- return false;
-}
-
GC::Ptr<ShadowRoot> Node::containing_shadow_root()
{
if (auto* shadow_root = as_if<ShadowRoot>(*this))
diff --git a/Libraries/LibWeb/DOM/Node.h b/Libraries/LibWeb/DOM/Node.h
index ad172791c7d..af7c63f1cd1 100644
--- a/Libraries/LibWeb/DOM/Node.h
+++ b/Libraries/LibWeb/DOM/Node.h
@@ -625,8 +625,6 @@ public:
bool is_inert() const;
bool has_inclusive_ancestor_with_display_none_ignoring_animations() const;
- bool has_inclusive_ancestor_with_event_listener(Utf16FlyString const& type) const;
-
GC::Ptr<ShadowRoot> containing_shadow_root();
GC::Ptr<ShadowRoot const> containing_shadow_root() const
{
diff --git a/Libraries/LibWeb/Editing/Internal/Algorithms.cpp b/Libraries/LibWeb/Editing/Internal/Algorithms.cpp
index 889354d3deb..bff39135880 100644
--- a/Libraries/LibWeb/Editing/Internal/Algorithms.cpp
+++ b/Libraries/LibWeb/Editing/Internal/Algorithms.cpp
@@ -4222,15 +4222,6 @@ void remove_extraneous_line_breaks_before_node(GC::Ref<DOM::Node> node)
remove_node(*ref);
}
-// https://w3c.github.io/editing/docs/execCommand/#remove-extraneous-line-breaks-from
-void remove_extraneous_line_breaks_from_a_node(GC::Ref<DOM::Node> node)
-{
- // To remove extraneous line breaks from a node, first remove extraneous line breaks before it,
- // then remove extraneous line breaks at the end of it.
- remove_extraneous_line_breaks_before_node(node);
- remove_extraneous_line_breaks_at_the_end_of_node(node);
-}
-
// https://w3c.github.io/editing/docs/execCommand/#preserving-its-descendants
void remove_node_preserving_its_descendants(GC::Ref<DOM::Node> node)
{
diff --git a/Libraries/LibWeb/Editing/Internal/Algorithms.h b/Libraries/LibWeb/Editing/Internal/Algorithms.h
index 695bdd66ecb..6c66412e4cb 100644
--- a/Libraries/LibWeb/Editing/Internal/Algorithms.h
+++ b/Libraries/LibWeb/Editing/Internal/Algorithms.h
@@ -140,7 +140,6 @@ Vector<RecordedOverride> record_current_states_and_values(DOM::Document 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>);
void remove_node_preserving_its_descendants(GC::Ref<DOM::Node>);
void reorder_modifiable_descendants(GC::Ref<DOM::Node>, Utf16FlyString const&, Optional<Utf16View>);
void restore_states_and_values(DOM::Document&, Vector<RecordedOverride> const&);
diff --git a/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp b/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp
index 17217dfe3c4..4e1a1328db3 100644
--- a/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp
+++ b/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp
@@ -194,14 +194,6 @@ public:
});
}
- HTTP::MemoryCache* get_if_exists(Utf16String const& key)
- {
- auto it = m_cache.find(key);
- if (it == m_cache.end())
- return nullptr;
- return it->value.ptr();
- }
-
// NB: Each agent has one, as a cache entry can only be used on one thread.
static HTTPCache& the()
{
diff --git a/Libraries/LibWeb/Fetch/Infrastructure/FetchController.h b/Libraries/LibWeb/Fetch/Infrastructure/FetchController.h
index 82be6106b2e..7b6c0d52648 100644
--- a/Libraries/LibWeb/Fetch/Infrastructure/FetchController.h
+++ b/Libraries/LibWeb/Fetch/Infrastructure/FetchController.h
@@ -100,8 +100,6 @@ public:
bool requires_network() const { return m_control_block->requires_network(); }
bool has_started_request() const { return m_control_block->has_started_request(); }
- void set_inner_fetch_controller(GC::Ref<FetchController>);
-
// The fetch this controller's fetch params started last, and the executor its start was posted to. The controller's
// stops are posted there, for that fetch.
void set_started_fetch(Engine::FetchId, Engine::FetchExecutor&);
diff --git a/Libraries/LibWeb/Fetch/Infrastructure/PreflightCache.cpp b/Libraries/LibWeb/Fetch/Infrastructure/PreflightCache.cpp
index 2fa261de301..b4e4f5b0a7a 100644
--- a/Libraries/LibWeb/Fetch/Infrastructure/PreflightCache.cpp
+++ b/Libraries/LibWeb/Fetch/Infrastructure/PreflightCache.cpp
@@ -179,12 +179,6 @@ bool PreflightCache::is_cache_entry_match(Entry const& entry, Request const& req
return entry.credentials || request.credentials_mode() != Request::CredentialsMode::Include;
}
-void PreflightCache::evict_expired_entries()
-{
- MutexLocker locker(m_mutex);
- remove_expired_entries();
-}
-
void PreflightCache::remove_expired_entries()
{
m_entries.remove_all_matching([](Entry const& entry) {
diff --git a/Libraries/LibWeb/Fetch/Infrastructure/PreflightCache.h b/Libraries/LibWeb/Fetch/Infrastructure/PreflightCache.h
index ff3ff8c46a3..333a76be0eb 100644
--- a/Libraries/LibWeb/Fetch/Infrastructure/PreflightCache.h
+++ b/Libraries/LibWeb/Fetch/Infrastructure/PreflightCache.h
@@ -27,8 +27,6 @@ public:
void clear_cache_entries(Request const&);
- void evict_expired_entries();
-
private:
// https://fetch.spec.whatwg.org/#cache-entry
struct Entry {
diff --git a/Libraries/LibWeb/HTML/HTMLAnchorElement.h b/Libraries/LibWeb/HTML/HTMLAnchorElement.h
index 5ea13ba6dfd..af04c2ddcb5 100644
--- a/Libraries/LibWeb/HTML/HTMLAnchorElement.h
+++ b/Libraries/LibWeb/HTML/HTMLAnchorElement.h
@@ -47,7 +47,6 @@ public:
private:
HTMLAnchorElement(DOM::Document&, DOM::QualifiedName);
- bool has_download_preference() const;
virtual void visit_edges(Cell::Visitor&) override;
// ^DOM::EventTarget
diff --git a/Libraries/LibWeb/HTML/HTMLCanvasElement.h b/Libraries/LibWeb/HTML/HTMLCanvasElement.h
index 56932c0379b..71a3205bfa4 100644
--- a/Libraries/LibWeb/HTML/HTMLCanvasElement.h
+++ b/Libraries/LibWeb/HTML/HTMLCanvasElement.h
@@ -54,7 +54,6 @@ public:
};
HasOrCreatedContext create_2d_context(CanvasRenderingContext2DSettings);
HasOrCreatedContext create_webgl_context(WebGL::WebGLContextAttributes);
- HasOrCreatedContext create_webgl2_context(WebGL::WebGLContextAttributes);
RenderingContext const& context() const { return m_context; }
WebIDL::UnsignedLong width() const;
diff --git a/Libraries/LibWeb/HTML/LocalNavigable.cpp b/Libraries/LibWeb/HTML/LocalNavigable.cpp
index 78757a661df..e857f818b04 100644
--- a/Libraries/LibWeb/HTML/LocalNavigable.cpp
+++ b/Libraries/LibWeb/HTML/LocalNavigable.cpp
@@ -5270,15 +5270,6 @@ static Layout::Node* layout_node_for_async_scroll_node(Layout::BegunRead const&
return element->layout_node(read);
}
-Layout::Node* LocalNavigable::layout_node_for_async_scroll_node_stable_id(Web::AsyncScrollNodeStableID stable_node_id)
-{
- auto document = active_document();
- if (!document)
- return nullptr;
- Layout::ForcedReadScope read { *document };
- return layout_node_for_async_scroll_node(read, *document, stable_node_id);
-}
-
bool LocalNavigable::set_scroll_offset_for(Web::AsyncScrollNodeStableID stable_node_id, CSSPixelPoint scroll_offset)
{
auto document = active_document();
diff --git a/Libraries/LibWeb/HTML/LocalNavigable.h b/Libraries/LibWeb/HTML/LocalNavigable.h
index e3e302c66ad..8f50cb664ae 100644
--- a/Libraries/LibWeb/HTML/LocalNavigable.h
+++ b/Libraries/LibWeb/HTML/LocalNavigable.h
@@ -418,7 +418,6 @@ public:
GC::Ref<WebIDL::Promise> perform_a_scroll_of_an_element(DOM::Element&, CSSPixelPoint position, Bindings::ScrollBehavior, Optional<CSSPixelPoint> relative_displacement = {});
bool perform_a_snapped_relative_user_scroll(Layout::Node&, CSSPixelPoint delta, Compositing::SnapSelectionStrategy::Type, Painting::ScrollKind = Painting::ScrollKind::Relative);
bool perform_a_scroll_step_for_key_input(Layout::Node&, CSSPixelPoint delta, Compositing::SnapSelectionStrategy::Type);
- Layout::Node* layout_node_for_async_scroll_node_stable_id(Web::AsyncScrollNodeStableID);
void re_snap_scroll_containers_after_layout_change(Layout::BegunRead const& read);
void abort_in_flight_smooth_scrolls(Web::AsyncScrollNodeStableID);
void abort_in_flight_smooth_scrolls_taken_over_by_user_input(Web::AsyncScrollNodeStableID, CSSPixelPoint scroll_offset_at_gesture_start);
diff --git a/Libraries/LibWeb/HTML/WorkerAgentParent.cpp b/Libraries/LibWeb/HTML/WorkerAgentParent.cpp
index 5d978631dca..ed6e2b85c00 100644
--- a/Libraries/LibWeb/HTML/WorkerAgentParent.cpp
+++ b/Libraries/LibWeb/HTML/WorkerAgentParent.cpp
@@ -340,11 +340,6 @@ void WorkerAgentParent::register_transform_frame_callback(u64 transform_id, Tran
m_transform_frame_callbacks.set(transform_id, move(callback));
}
-void WorkerAgentParent::unregister_transform_frame_callback(u64 transform_id)
-{
- m_transform_frame_callbacks.remove(transform_id);
-}
-
void WorkerAgentParent::did_write_rtc_transform_encoded_audio_frame(WorkerAgentOwnerToken owner_token, u64 transform_id, ByteBuffer payload, u32 ssrc, u8 payload_type, u32 rtp_timestamp, u16 sequence_number)
{
auto parent = worker_agent_parents().find(owner_token);
diff --git a/Libraries/LibWeb/HTML/WorkerAgentParent.h b/Libraries/LibWeb/HTML/WorkerAgentParent.h
index 7337fc7fe93..c0cc26763a1 100644
--- a/Libraries/LibWeb/HTML/WorkerAgentParent.h
+++ b/Libraries/LibWeb/HTML/WorkerAgentParent.h
@@ -48,7 +48,6 @@ public:
using TransformFrameWrittenCallback = AK::Function<void(ByteBuffer payload, u32 ssrc, u8 payload_type, u32 rtp_timestamp, u16 sequence_number)>;
void register_transform_frame_callback(u64 transform_id, TransformFrameWrittenCallback callback);
- void unregister_transform_frame_callback(u64 transform_id);
private:
WorkerAgentParent(URL::URL, WorkerOptions const&, bool extended_lifetime, GC::Ptr<MessagePort> outside_port,
diff --git a/Libraries/LibWeb/Page/Page.cpp b/Libraries/LibWeb/Page/Page.cpp
index 68fece5a1c8..d837707a598 100644
--- a/Libraries/LibWeb/Page/Page.cpp
+++ b/Libraries/LibWeb/Page/Page.cpp
@@ -496,17 +496,6 @@ DevicePixelRect Page::enclosing_device_rect(CSSPixelRect rect) const
ceil(rect.height().to_double() * scale));
}
-DevicePixelRect Page::rounded_device_rect(CSSPixelRect rect) const
-{
- auto scale = client().device_pixels_per_css_pixel();
- return {
- roundf(rect.x().to_double() * scale),
- roundf(rect.y().to_double() * scale),
- roundf(rect.width().to_double() * scale),
- roundf(rect.height().to_double() * scale)
- };
-}
-
ChromeMetrics Page::chrome_metrics() const
{
return ChromeMetrics { m_client->zoom_level() };
diff --git a/Libraries/LibWeb/Page/Page.h b/Libraries/LibWeb/Page/Page.h
index 53018f3369e..15360e444c5 100644
--- a/Libraries/LibWeb/Page/Page.h
+++ b/Libraries/LibWeb/Page/Page.h
@@ -200,7 +200,6 @@ public:
CSSPixelRect device_to_css_rect(DevicePixelRect) const;
CSSPixelSize device_to_css_size(DevicePixelSize) const;
DevicePixelRect enclosing_device_rect(CSSPixelRect) const;
- DevicePixelRect rounded_device_rect(CSSPixelRect) const;
ChromeMetrics chrome_metrics() const;
EventResult handle_mouseup(HTML::LocalNavigable& root, DevicePixelPoint, DevicePixelPoint screen_position, unsigned button, unsigned buttons, unsigned modifiers, Optional<RemoteInputEventTarget>* remote_target);
diff --git a/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs b/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
index fa7d81067cb..290898d0874 100644
--- a/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
+++ b/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
@@ -6828,14 +6828,6 @@ pub unsafe extern "C" fn document_host_set_style_record_host_callbacks(
host.host_tables().style_record_host.set(Some(callbacks));
}
-#[unsafe(no_mangle)]
-pub extern "C" fn render_state_needs_full_layout_tree_update(
- host: &DocumentHost,
- read: &crate::render_state::BegunRead,
-) -> bool {
- read_arena(host, read, (), |arena, ()| arena.needs_full_layout_tree_update())
-}
-
#[unsafe(no_mangle)]
pub extern "C" fn render_state_layout_root(host: &DocumentHost, read: &crate::render_state::BegunRead) -> NodeSlotId {
read_arena(host, read, (), |arena, ()| arena.layout_root())
diff --git a/Libraries/LibWeb/SVG/AttributeParsing.cpp b/Libraries/LibWeb/SVG/AttributeParsing.cpp
index ec61cc3d735..ecb4562f563 100644
--- a/Libraries/LibWeb/SVG/AttributeParsing.cpp
+++ b/Libraries/LibWeb/SVG/AttributeParsing.cpp
@@ -31,13 +31,6 @@ Optional<i32> parse_integer(Utf16View input)
return value;
}
-float NumberPercentage::resolve_relative_to(float length) const
-{
- if (!m_is_percentage)
- return m_value;
- return m_value * length;
-}
-
Optional<float> parse_number(Utf16View input)
{
float value;
diff --git a/Libraries/LibWeb/SVG/AttributeParsing.h b/Libraries/LibWeb/SVG/AttributeParsing.h
index e0f920b986e..dd1faf2d72a 100644
--- a/Libraries/LibWeb/SVG/AttributeParsing.h
+++ b/Libraries/LibWeb/SVG/AttributeParsing.h
@@ -111,8 +111,6 @@ public:
return NumberPercentage(value, false);
}
- float resolve_relative_to(float length) const;
-
float value() const { return m_value; }
bool is_percentage() const { return m_is_percentage; }
diff --git a/Libraries/LibWeb/WebIDL/AbstractOperations.h b/Libraries/LibWeb/WebIDL/AbstractOperations.h
index ddeadaec660..8848f26060c 100644
--- a/Libraries/LibWeb/WebIDL/AbstractOperations.h
+++ b/Libraries/LibWeb/WebIDL/AbstractOperations.h
@@ -24,7 +24,6 @@
namespace Web::WebIDL {
bool is_buffer_source_type(JS::Value);
-GC::Ptr<JS::ArrayBuffer> underlying_buffer_source(JS::Object& buffer_source);
WEB_API ErrorOr<ByteBuffer> get_buffer_source_copy(JS::Object const& buffer_source);
WEB_API ErrorOr<ByteBuffer> get_buffer_source_copy(BufferSource const&);
WEB_API ErrorOr<ByteBuffer> get_buffer_source_copy(ArrayBufferView const&);
diff --git a/Libraries/LibWeb/WebIDL/CachedAttribute.h b/Libraries/LibWeb/WebIDL/CachedAttribute.h
deleted file mode 100644
index 373f1a5d8be..00000000000
--- a/Libraries/LibWeb/WebIDL/CachedAttribute.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (c) 2025, Idan Horowitz <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#define DEFINE_CACHED_ATTRIBUTE(name) \
- GC::Ptr<JS::Object> cached_##name() const { return m_cached_##name; } \
- void set_cached_##name(GC::Ptr<JS::Object> cached_##name) { m_cached_##name = cached_##name; } \
- \
-private: \
- GC::Ptr<JS::Object> m_cached_##name; \
- \
-public:
-
-#define VISIT_CACHED_ATTRIBUTE(name) visitor.visit(m_cached_##name)