Skip to content

Truly independent web browser

LibCompositing+LibWeb+Compositor: Remove AccumulatedVisualContextTree

Aliaksandr Kalenik4955f0bca035
diff --git a/Libraries/LibCompositing/CMakeLists.txt b/Libraries/LibCompositing/CMakeLists.txt
index 8576f293dcc..603e0015de4 100644
--- a/Libraries/LibCompositing/CMakeLists.txt
+++ b/Libraries/LibCompositing/CMakeLists.txt
@@ -1,7 +1,6 @@
include(libcompositing_generators)
set(SOURCES
- DisplayList/AccumulatedVisualContext.cpp
DisplayList/Canvas2DCommandStream.cpp
DisplayList/Canvas2DTape.cpp
DisplayList/DisplayList.cpp
@@ -104,7 +103,7 @@ if(NOT BUILD_SHARED_LIBS)
# POST_BUILD steps don't track inputs, so the bridge files depend on the Rust archive: when it
# changes, LibCompositing re-archives and the merge picks up the fresh objects.
- foreach(bridge IN ITEMS DisplayList/AccumulatedVisualContext.cpp DisplayList/DisplayList.cpp DisplayList/DisplayListResourceStorage.cpp DisplayList/VisualContextTreeTestBuilder.cpp Scrolling/RecordedDisplayListScrolling.cpp Scrolling/SmoothScrollAnimation.cpp)
+ foreach(bridge IN ITEMS DisplayList/DisplayList.cpp DisplayList/DisplayListResourceStorage.cpp DisplayList/VisualContextTreeTestBuilder.cpp Scrolling/RecordedDisplayListScrolling.cpp Scrolling/SmoothScrollAnimation.cpp)
set_property(SOURCE ${bridge} APPEND PROPERTY OBJECT_DEPENDS ${_libcompositing_rust_lib})
endforeach()
endif()
diff --git a/Libraries/LibCompositing/DisplayList/AccumulatedVisualContext.cpp b/Libraries/LibCompositing/DisplayList/AccumulatedVisualContext.cpp
deleted file mode 100644
index b6446f258c2..00000000000
--- a/Libraries/LibCompositing/DisplayList/AccumulatedVisualContext.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 2026, Aliaksandr Kalenik <[email protected]>
- * Copyright (c) 2026, Jelle Raaijmakers <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <LibCompositing/DisplayList/AccumulatedVisualContext.h>
-#include <LibCompositing/RustFFI.h>
-#include <LibIPC/Decoder.h>
-#include <LibIPC/Encoder.h>
-
-namespace Compositing {
-
-AccumulatedVisualContextTree::AccumulatedVisualContextTree(void const* retained_tree)
- : m_rust_tree(retained_tree)
-{
- VERIFY(m_rust_tree);
-}
-
-AccumulatedVisualContextTree AccumulatedVisualContextTree::adopt_rust_handle(void const* retained_tree)
-{
- return AccumulatedVisualContextTree { retained_tree };
-}
-
-ErrorOr<AccumulatedVisualContextTree> AccumulatedVisualContextTree::from_serialized_bytes(ReadonlyBytes bytes)
-{
- auto const* retained_tree = Compositing::RustFFI::visual_context_tree_deserialize(bytes.data(), bytes.size());
- if (!retained_tree)
- return Error::from_string_literal("Malformed visual context tree bytes");
- return adopt_rust_handle(retained_tree);
-}
-
-AccumulatedVisualContextTree::AccumulatedVisualContextTree(AccumulatedVisualContextTree const& other)
- : m_rust_tree(other.m_rust_tree ? Compositing::RustFFI::visual_context_tree_retain(other.m_rust_tree) : nullptr)
-{
-}
-
-AccumulatedVisualContextTree& AccumulatedVisualContextTree::operator=(AccumulatedVisualContextTree const& other)
-{
- if (this == &other)
- return *this;
- auto const* retained_tree = other.m_rust_tree ? Compositing::RustFFI::visual_context_tree_retain(other.m_rust_tree) : nullptr;
- release_rust_handle();
- m_rust_tree = retained_tree;
- return *this;
-}
-
-AccumulatedVisualContextTree::AccumulatedVisualContextTree(AccumulatedVisualContextTree&& other)
- : m_rust_tree(exchange(other.m_rust_tree, nullptr))
-{
-}
-
-AccumulatedVisualContextTree& AccumulatedVisualContextTree::operator=(AccumulatedVisualContextTree&& other)
-{
- if (this == &other)
- return *this;
- release_rust_handle();
- m_rust_tree = exchange(other.m_rust_tree, nullptr);
- return *this;
-}
-
-AccumulatedVisualContextTree::~AccumulatedVisualContextTree()
-{
- release_rust_handle();
-}
-
-void AccumulatedVisualContextTree::release_rust_handle()
-{
- if (!m_rust_tree)
- return;
- Compositing::RustFFI::visual_context_tree_release(m_rust_tree);
- m_rust_tree = nullptr;
-}
-
-u64 AccumulatedVisualContextTree::structural_epoch() const
-{
- return Compositing::RustFFI::visual_context_tree_structural_epoch(m_rust_tree);
-}
-
-ByteBuffer AccumulatedVisualContextTree::serialize_to_bytes() const
-{
- ByteBuffer bytes;
- Compositing::RustFFI::visual_context_tree_serialize(m_rust_tree, &bytes, [](void* sink, u8 const* data, size_t size) {
- MUST(static_cast<ByteBuffer*>(sink)->try_append(data, size));
- });
- return bytes;
-}
-
-bool AccumulatedVisualContextTree::has_visual_animations() const
-{
- return Compositing::RustFFI::visual_context_tree_has_visual_animations(m_rust_tree);
-}
-
-VisualAnimationSummary AccumulatedVisualContextTree::visual_animation_summary() const
-{
- auto summary = Compositing::RustFFI::visual_context_tree_visual_animation_summary(m_rust_tree);
- return {
- .count = summary.count,
- .local_time_at_anchor_ms_of_first = summary.local_time_at_anchor_ms_of_first,
- .share_timing_anchor = summary.share_timing_anchor,
- .targets_are_valid = summary.targets_are_valid,
- };
-}
-
-AccumulatedVisualContextTree AccumulatedVisualContextTree::with_visual_animation_samples(i64 monotonic_time_ns) const
-{
- return adopt_rust_handle(Compositing::RustFFI::visual_context_tree_with_visual_animation_samples(m_rust_tree, monotonic_time_ns));
-}
-
-Optional<Gfx::Color> AccumulatedVisualContextTree::sampled_background_color(EffectNodeIndex effect) const
-{
- Gfx::Color color;
- if (!Compositing::RustFFI::visual_context_tree_sampled_background_color(m_rust_tree, effect, &color))
- return {};
- return color;
-}
-
-bool AccumulatedVisualContextTree::translations_snap_to_device_pixels(SpatialNodeIndex spatial_node_index) const
-{
- return Compositing::RustFFI::visual_context_tree_translations_snap_to_device_pixels(m_rust_tree, spatial_node_index);
-}
-
-void AccumulatedVisualContextTree::for_each_effects_filter_image_frame_id(Function<void(u64)> const& visit) const
-{
- struct ImageFrameIdVisitor {
- Function<void(u64)> const& visit;
- } visitor { visit };
- Compositing::RustFFI::visual_context_tree_for_each_effects_filter_image_frame_id(m_rust_tree, &visitor, [](void* context, u64 image_frame_id) {
- static_cast<ImageFrameIdVisitor*>(context)->visit(image_frame_id);
- });
-}
-
-}
-
-namespace IPC {
-
-template<>
-ErrorOr<void> encode(Encoder& encoder, Compositing::AccumulatedVisualContextTree const& tree)
-{
- TRY(encoder.encode(tree.serialize_to_bytes()));
- return {};
-}
-
-// The bytes carry the tree's animations, which the decoder validates against the nodes they name.
-template<>
-ErrorOr<Compositing::AccumulatedVisualContextTree> decode(Decoder& decoder)
-{
- auto bytes = TRY(decoder.decode<ByteBuffer>());
- return Compositing::AccumulatedVisualContextTree::from_serialized_bytes(bytes);
-}
-
-}
diff --git a/Libraries/LibCompositing/DisplayList/AccumulatedVisualContext.h b/Libraries/LibCompositing/DisplayList/AccumulatedVisualContext.h
deleted file mode 100644
index 06f75754471..00000000000
--- a/Libraries/LibCompositing/DisplayList/AccumulatedVisualContext.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2026, Aliaksandr Kalenik <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <AK/ByteBuffer.h>
-#include <AK/Error.h>
-#include <AK/Forward.h>
-#include <AK/Function.h>
-#include <AK/RefCounted.h>
-#include <AK/RefPtr.h>
-#include <LibCompositing/DisplayList/ContextRef.h>
-#include <LibCompositing/Export.h>
-#include <LibCompositing/Forward.h>
-#include <LibGfx/Forward.h>
-#include <LibGfx/Point.h>
-#include <LibGfx/Rect.h>
-#include <LibIPC/Forward.h>
-
-namespace Compositing {
-
-// What a tree reports about the animations it carries, for test introspection.
-struct VisualAnimationSummary {
- size_t count { 0 };
- double local_time_at_anchor_ms_of_first { 0 };
- bool share_timing_anchor { true };
- bool targets_are_valid { true };
-};
-
-class COMPOSITING_API AccumulatedVisualContextTree {
-public:
- static AccumulatedVisualContextTree adopt_rust_handle(void const* retained_tree);
- static ErrorOr<AccumulatedVisualContextTree> from_serialized_bytes(ReadonlyBytes);
-
- AccumulatedVisualContextTree(AccumulatedVisualContextTree const&);
- AccumulatedVisualContextTree& operator=(AccumulatedVisualContextTree const&);
- AccumulatedVisualContextTree(AccumulatedVisualContextTree&&);
- AccumulatedVisualContextTree& operator=(AccumulatedVisualContextTree&&);
- ~AccumulatedVisualContextTree();
-
- u64 structural_epoch() const;
- ByteBuffer serialize_to_bytes() const;
- void const* rust_handle() const { return m_rust_tree; }
-
- bool has_visual_animations() const;
- VisualAnimationSummary visual_animation_summary() const;
-
- // A copy whose nodes carry the values the animations take at the time.
- AccumulatedVisualContextTree with_visual_animation_samples(i64 monotonic_time_ns) const;
- // The sampled background color of a recorded fill's animation effect.
- Optional<Gfx::Color> sampled_background_color(EffectNodeIndex) const;
- // Whether the node's scroll translations and the origins drawn in its space round to whole device pixels: no
- // transform but identities lies above it.
- bool translations_snap_to_device_pixels(SpatialNodeIndex) const;
-
- void for_each_effects_filter_image_frame_id(Function<void(u64)> const&) const;
-
-private:
- explicit AccumulatedVisualContextTree(void const* retained_tree);
-
- void release_rust_handle();
-
- void const* m_rust_tree { nullptr };
-};
-
-}
-
-namespace IPC {
-
-template<>
-COMPOSITING_API ErrorOr<void> encode(Encoder&, Compositing::AccumulatedVisualContextTree const&);
-template<>
-COMPOSITING_API ErrorOr<Compositing::AccumulatedVisualContextTree> decode(Decoder&);
-
-}
diff --git a/Libraries/LibCompositing/DisplayList/DisplayListResourceStorage.cpp b/Libraries/LibCompositing/DisplayList/DisplayListResourceStorage.cpp
index 93bc0369ee4..fc949ceb58c 100644
--- a/Libraries/LibCompositing/DisplayList/DisplayListResourceStorage.cpp
+++ b/Libraries/LibCompositing/DisplayList/DisplayListResourceStorage.cpp
@@ -222,15 +222,6 @@ DisplayListResourceSet DisplayListResourceStorage::collect_resources_referenced_
return referenced_resources;
}
-void DisplayListResourceStorage::collect_referenced_resources(
- AccumulatedVisualContextTree const& visual_context_tree,
- DisplayListResourceSet& referenced_resources) const
-{
- visual_context_tree.for_each_effects_filter_image_frame_id([&](u64 image_id) {
- referenced_resources.image_frames.set(ImageFrameResourceId { image_id }, AK::HashSetExistingEntryBehavior::Keep);
- });
-}
-
DisplayListResourceSet DisplayListResourceStorage::collect_referenced_resources(DisplayList const& display_list) const
{
DisplayListResourceSet referenced_resources;
@@ -238,13 +229,6 @@ DisplayListResourceSet DisplayListResourceStorage::collect_referenced_resources(
return referenced_resources;
}
-DisplayListResourceSet DisplayListResourceStorage::collect_referenced_resources(AccumulatedVisualContextTree const& visual_context_tree) const
-{
- DisplayListResourceSet referenced_resources;
- collect_referenced_resources(visual_context_tree, referenced_resources);
- return referenced_resources;
-}
-
static ErrorOr<void> validate_resources_are_present(DisplayListResourceStorage const& storage, DisplayListResourceSet const& resources)
{
for (auto id : resources.fonts) {
diff --git a/Libraries/LibCompositing/DisplayList/DisplayListResourceStorage.h b/Libraries/LibCompositing/DisplayList/DisplayListResourceStorage.h
index 42fb20e1c6e..2eeb4cf20a8 100644
--- a/Libraries/LibCompositing/DisplayList/DisplayListResourceStorage.h
+++ b/Libraries/LibCompositing/DisplayList/DisplayListResourceStorage.h
@@ -6,6 +6,7 @@
#pragma once
+#include <AK/ByteBuffer.h>
#include <AK/Error.h>
#include <AK/Forward.h>
#include <AK/HashMap.h>
@@ -18,7 +19,6 @@
#include <AK/Time.h>
#include <AK/Variant.h>
#include <AK/Vector.h>
-#include <LibCompositing/DisplayList/AccumulatedVisualContext.h>
#include <LibCompositing/DisplayList/DisplayListResourceIds.h>
#include <LibCompositing/Export.h>
#include <LibCompositing/Forward.h>
@@ -114,7 +114,6 @@ public:
DisplayListResourceSet collect_referenced_resources(DisplayList const&) const;
// What the visual context tree a list recorded in this process was recorded against refers to.
DisplayListResourceSet collect_resources_referenced_by_visual_context_tree(DisplayList const&) const;
- DisplayListResourceSet collect_referenced_resources(AccumulatedVisualContextTree const&) const;
// Carries everything a list recorded in this process and its tree refer to, for a receiver that holds none of it
// yet.
ErrorOr<DisplayListResourceTransaction> create_self_contained_transaction(DisplayList const&) const;
@@ -144,7 +143,6 @@ private:
void set_image_frame(ImageFrameResourceId, Gfx::DecodedImageFrame);
void collect_referenced_resources(DisplayList const&, DisplayListResourceSet&) const;
void collect_resources_referenced_by_visual_context_tree(DisplayList const&, DisplayListResourceSet&) const;
- void collect_referenced_resources(AccumulatedVisualContextTree const&, DisplayListResourceSet&) const;
void add_referenced_display_list(DisplayListResourceId, DisplayListResourceSet&) const;
bool m_has_resources_added_since_last_retain { false };
diff --git a/Libraries/LibCompositing/DisplayList/RustFFIAssertions.cpp b/Libraries/LibCompositing/DisplayList/RustFFIAssertions.cpp
index e5550e5c951..76986d6a1ef 100644
--- a/Libraries/LibCompositing/DisplayList/RustFFIAssertions.cpp
+++ b/Libraries/LibCompositing/DisplayList/RustFFIAssertions.cpp
@@ -5,7 +5,6 @@
*/
#include <AK/StdLibExtras.h>
-#include <LibCompositing/DisplayList/AccumulatedVisualContext.h>
#include <LibCompositing/DisplayList/ContextRef.h>
#include <LibCompositing/DisplayList/DisplayListCommand.h>
#include <LibCompositing/DisplayList/DisplayListResourceIds.h>
diff --git a/Libraries/LibCompositing/Forward.h b/Libraries/LibCompositing/Forward.h
index 6e5e4b62ae1..b6de7200570 100644
--- a/Libraries/LibCompositing/Forward.h
+++ b/Libraries/LibCompositing/Forward.h
@@ -19,7 +19,6 @@ enum class PictureInPictureControl : u8;
struct PictureInPictureControlsState;
struct UIOverlays;
-class AccumulatedVisualContextTree;
class Canvas2DCommandStream;
struct Canvas2DCommandStreamSegment;
class DisplayList;
diff --git a/Libraries/LibCompositing/Rust/build.rs b/Libraries/LibCompositing/Rust/build.rs
index afc1b965bdb..2b65e09d8fb 100644
--- a/Libraries/LibCompositing/Rust/build.rs
+++ b/Libraries/LibCompositing/Rust/build.rs
@@ -194,7 +194,7 @@ fn expose_shared_abi_types_as_cpp_types(config: &mut cbindgen::Config) {
"LibGfx/StrokeStyle.h",
"LibGfx/Vector3.h",
"LibGfx/WindingRule.h",
- "LibCompositing/DisplayList/AccumulatedVisualContext.h",
+ "LibCompositing/DisplayList/ContextRef.h",
"LibCompositing/Forward.h",
"LibCompositing/DisplayList/DisplayListCommandsGenerated.h",
]
diff --git a/Libraries/LibCompositing/Rust/src/ffi.rs b/Libraries/LibCompositing/Rust/src/ffi.rs
index 9fb84a6385b..17614de8e4a 100644
--- a/Libraries/LibCompositing/Rust/src/ffi.rs
+++ b/Libraries/LibCompositing/Rust/src/ffi.rs
@@ -4,10 +4,9 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-//! The entry points the compositor process shares with WebContent: retaining and querying visual
-//! context trees, replaying display lists, computing their damage, and the tree builder tests use.
+//! The entry points the compositor process shares with WebContent: replaying display lists, computing
+//! their damage, the scroll queries of recorded display lists, and the tree builder tests use.
-use crate::display_list::commands::{EffectNodeIndex, SpatialNodeIndex};
use crate::display_list::storage::storage_from_handle;
use crate::scrolling::smooth_scroll_animation::SmoothScrollAnimation;
use crate::scrolling::{
@@ -20,14 +19,6 @@ use libipc_rust::cpp_connection::EncodedValue;
use std::ffi::c_void;
use std::sync::Arc;
-/// # Safety
-///
-/// `tree` must be a live retained tree handle.
-pub unsafe fn tree_from_handle<'a>(tree: *const c_void) -> &'a crate::visual_context::VisualContextTree {
- // SAFETY: The caller guarantees `tree` is a live retained handle.
- unsafe { &*tree.cast::<crate::visual_context::VisualContextTree>() }
-}
-
/// Decide if force-dark should invert an image: the caller owns the sampling, this owns the policy. Returns false
/// for an empty or null buffer, which leaves the image untouched.
///
@@ -106,157 +97,6 @@ pub unsafe extern "C" fn display_list_replay(
};
}
-/// # Safety
-///
-/// `tree` must be a retained tree handle (from `layout_arena_main_visual_context_tree_retain`,
-/// a host callback, or an earlier retain), used on the thread that owns it.
-#[unsafe(no_mangle)]
-pub unsafe extern "C" fn visual_context_tree_retain(tree: *const c_void) -> *const c_void {
- // SAFETY: The caller guarantees `tree` is a live retained handle, so the strong count is at least one.
- unsafe { std::sync::Arc::increment_strong_count(tree.cast::<crate::visual_context::VisualContextTree>()) };
- tree
-}
-
-/// # Safety
-///
-/// `tree` must be null or a retained tree handle that the caller gives up with this call.
-#[unsafe(no_mangle)]
-pub unsafe extern "C" fn visual_context_tree_release(tree: *const c_void) {
- if tree.is_null() {
- return;
- }
- // SAFETY: The caller gives up the reference it retained, and the strong count is at least one.
- unsafe { std::sync::Arc::decrement_strong_count(tree.cast::<crate::visual_context::VisualContextTree>()) };
-}
-
-/// # Safety
-///
-/// `tree` must be a live retained tree handle.
-#[unsafe(no_mangle)]
-pub unsafe extern "C" fn visual_context_tree_structural_epoch(tree: *const c_void) -> u64 {
- unsafe { tree_from_handle(tree) }.structural_epoch
-}
-
-/// # Safety
-///
-/// `tree` must be a live retained tree handle; `append` is called synchronously with `sink`.
-#[unsafe(no_mangle)]
-pub unsafe extern "C" fn visual_context_tree_serialize(
- tree: *const c_void,
- sink: *mut c_void,
- append: unsafe extern "C" fn(*mut c_void, *const u8, usize),
-) {
- let bytes = unsafe { tree_from_handle(tree) }.to_bytes();
- // SAFETY: The C++ sink copies the bytes synchronously.
- unsafe { append(sink, bytes.as_ptr(), bytes.len()) };
-}
-
-/// # Safety
-///
-/// `bytes` must address `length` readable bytes for the call. Returns a retained tree handle the
-/// caller owns, or null when the bytes do not describe a valid tree.
-#[unsafe(no_mangle)]
-pub unsafe extern "C" fn visual_context_tree_deserialize(bytes: *const u8, length: usize) -> *const c_void {
- // SAFETY: The caller guarantees `bytes` addresses `length` readable bytes.
- let bytes = unsafe { ak::slice_from_raw_parts(bytes, length) };
- match crate::visual_context::VisualContextTree::from_bytes(bytes) {
- Ok(tree) => std::sync::Arc::into_raw(std::sync::Arc::new(tree)).cast(),
- Err(_) => std::ptr::null(),
- }
-}
-
-/// # Safety
-///
-/// `tree` must be a live retained tree handle and `storage` a live storage handle.
-#[unsafe(no_mangle)]
-pub unsafe extern "C" fn display_list_references_only_live_visual_context_nodes(
- tree: *const c_void,
- storage: *const c_void,
-) -> bool {
- // SAFETY: The caller guarantees live handles for the duration of the call.
- let (tree, storage) = unsafe { (tree_from_handle(tree), storage_from_handle(storage)) };
- tree.display_list_references_only_live_nodes(storage.command_runs())
-}
-
-/// Whether the node's scroll translations and the origins drawn in its space round to whole device pixels: no
-/// transform but identities lies above it.
-///
-/// # Safety
-///
-/// `tree` must be a live retained tree handle.
-#[unsafe(no_mangle)]
-pub unsafe extern "C" fn visual_context_tree_translations_snap_to_device_pixels(
- tree: *const c_void,
- spatial: SpatialNodeIndex,
-) -> bool {
- unsafe { tree_from_handle(tree) }.translations_snap_to_device_pixels(spatial)
-}
-
-/// # Safety
-///
-/// `tree` must be a live retained tree handle. Returns a retained handle to a copy of the tree whose
-/// nodes carry the values its animations take at `sample_time_ns`; the copy keeps the structural
-/// epoch.
-#[unsafe(no_mangle)]
-pub unsafe extern "C" fn visual_context_tree_with_visual_animation_samples(
- tree: *const c_void,
- sample_time_ns: i64,
-) -> *const c_void {
- let sampled = unsafe { tree_from_handle(tree) }.with_visual_animation_samples(sample_time_ns);
- std::sync::Arc::into_raw(std::sync::Arc::new(sampled)).cast()
-}
-
-/// # Safety
-///
-/// `tree` must be a live retained tree handle.
-#[unsafe(no_mangle)]
-pub unsafe extern "C" fn visual_context_tree_has_visual_animations(tree: *const c_void) -> bool {
- unsafe { tree_from_handle(tree) }.has_visual_animations()
-}
-
-/// # Safety
-///
-/// `tree` must be a live retained tree handle.
-#[unsafe(no_mangle)]
-pub unsafe extern "C" fn visual_context_tree_visual_animation_summary(
- tree: *const c_void,
-) -> crate::host::FfiVisualAnimationSummary {
- unsafe { tree_from_handle(tree) }.visual_animation_summary()
-}
-
-/// # Safety
-///
-/// `tree` must be a live retained tree handle and `color` must point to writable storage.
-#[unsafe(no_mangle)]
-pub unsafe extern "C" fn visual_context_tree_sampled_background_color(
- tree: *const c_void,
- effect: EffectNodeIndex,
- color: *mut libgfx_rust::Color,
-) -> bool {
- let tree = unsafe { tree_from_handle(tree) };
- let Some(sampled_color) = tree.sampled_background_color(effect) else {
- return false;
- };
- // SAFETY: The caller guarantees that `color` points to writable storage.
- unsafe { *color = sampled_color };
- true
-}
-
-/// # Safety
-///
-/// `tree` must be a live retained tree handle; `visit` is called synchronously with `context` for the id
-/// of every image frame that a filter or backdrop filter of an effect node draws.
-#[unsafe(no_mangle)]
-pub unsafe extern "C" fn visual_context_tree_for_each_effects_filter_image_frame_id(
- tree: *const c_void,
- context: *mut c_void,
- visit: unsafe extern "C" fn(*mut c_void, u64),
-) {
- let tree = unsafe { tree_from_handle(tree) };
- // SAFETY: The caller guarantees `visit` accepts `context`.
- tree.for_each_effects_filter_image_frame_id(&mut |id| unsafe { visit(context, id) });
-}
-
/// A hand-built test tree: nodes are added until it is finished, and lists are recorded against it after.
pub(super) enum TestBuilderTree {
Building(Box<crate::visual_context::VisualContextTree>),
@@ -401,18 +241,6 @@ impl FfiDisplayList<'_> {
}
}
-/// # Safety
-///
-/// `visual_context_tree` must be a live retained tree handle.
-pub unsafe fn tree_sharing_handle(visual_context_tree: *const c_void) -> AccumulatedVisualContextTree {
- let tree = visual_context_tree.cast::<crate::visual_context::VisualContextTree>();
- // SAFETY: The caller lends a strong reference to the tree, of which this takes one more.
- AccumulatedVisualContextTree::from_arc(unsafe {
- Arc::increment_strong_count(tree);
- Arc::from_raw(tree)
- })
-}
-
const ENCODED_IN_THIS_PROCESS: &str = "a value this process encoded for itself decodes";
/// The list a document of this process recorded, which C++ lends, and the tree it was recorded against.
diff --git a/Libraries/LibCompositing/Rust/src/scrolling/visual_context_tree.rs b/Libraries/LibCompositing/Rust/src/scrolling/visual_context_tree.rs
index e160ce2c664..59e8e81a60d 100644
--- a/Libraries/LibCompositing/Rust/src/scrolling/visual_context_tree.rs
+++ b/Libraries/LibCompositing/Rust/src/scrolling/visual_context_tree.rs
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-//! The visual context tree as the scroll and input logic reads it, under the method names of the C++ facade.
+//! The visual context tree as the scroll and input logic reads it: a shared handle to a tree that only Rust holds.
use super::{ContextRef, DisplayList, ScrollStateSnapshot, SpatialNodeIndex};
use crate::visual_context::VisualContextTree;
diff --git a/Libraries/LibWeb/Compositor/CompositorConnection.h b/Libraries/LibWeb/Compositor/CompositorConnection.h
index f323676d34c..be8111e00e6 100644
--- a/Libraries/LibWeb/Compositor/CompositorConnection.h
+++ b/Libraries/LibWeb/Compositor/CompositorConnection.h
@@ -13,7 +13,6 @@
#include <AK/Optional.h>
#include <Compositor/CompositorWebContentClientEndpoint.h>
#include <Compositor/CompositorWebContentServerEndpoint.h>
-#include <LibCompositing/DisplayList/AccumulatedVisualContext.h>
#include <LibCompositing/DisplayList/Canvas2DCommandStream.h>
#include <LibCompositing/DisplayList/DisplayList.h>
#include <LibCompositing/DisplayList/DisplayListResourceStorage.h>
diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp
index bd0c5f05575..d6612253fca 100644
--- a/Libraries/LibWeb/DOM/Document.cpp
+++ b/Libraries/LibWeb/DOM/Document.cpp
@@ -24,7 +24,6 @@
#include <AK/Utf16StringBuilder.h>
#include <AK/Utf16View.h>
#include <AK/Utf8View.h>
-#include <LibCompositing/DisplayList/AccumulatedVisualContext.h>
#include <LibCompositing/DisplayList/DisplayList.h>
#include <LibCore/Timer.h>
#include <LibGC/Heap.h>
diff --git a/Libraries/LibWeb/DOM/Element.cpp b/Libraries/LibWeb/DOM/Element.cpp
index 0760b78ed57..b17925353d1 100644
--- a/Libraries/LibWeb/DOM/Element.cpp
+++ b/Libraries/LibWeb/DOM/Element.cpp
@@ -17,7 +17,6 @@
#include <AK/QuickSort.h>
#include <AK/SaturatingMath.h>
#include <AK/Utf16StringBuilder.h>
-#include <LibCompositing/DisplayList/AccumulatedVisualContext.h>
#include <LibGC/Heap.h>
#include <LibGC/WeakHashMap.h>
#include <LibGfx/Bitmap.h>
diff --git a/Libraries/LibWeb/HTML/LocalNavigable.h b/Libraries/LibWeb/HTML/LocalNavigable.h
index 8e05be812ab..fd00a001e09 100644
--- a/Libraries/LibWeb/HTML/LocalNavigable.h
+++ b/Libraries/LibWeb/HTML/LocalNavigable.h
@@ -16,7 +16,6 @@
#include <AK/Tuple.h>
#include <AK/Utf16String.h>
#include <AK/Utf16View.h>
-#include <LibCompositing/DisplayList/AccumulatedVisualContext.h>
#include <LibCompositing/DisplayList/DisplayListResourceStorage.h>
#include <LibCompositing/Scrolling/SmoothScrollAnimation.h>
#include <LibCore/Forward.h>
diff --git a/Libraries/LibWeb/Painting/PaintingRustBridge.cpp b/Libraries/LibWeb/Painting/PaintingRustBridge.cpp
index b420838f9d4..b89c14ffa4d 100644
--- a/Libraries/LibWeb/Painting/PaintingRustBridge.cpp
+++ b/Libraries/LibWeb/Painting/PaintingRustBridge.cpp
@@ -6,7 +6,6 @@
#include <AK/StdLibExtras.h>
#include <AK/StringBuilder.h>
-#include <LibCompositing/DisplayList/AccumulatedVisualContext.h>
#include <LibCompositing/DisplayList/DisplayList.h>
#include <LibCompositing/DisplayList/DisplayListResourceStorage.h>
#include <LibCore/ElapsedTimer.h>
diff --git a/Libraries/LibWeb/Painting/PaintingRustBridge.h b/Libraries/LibWeb/Painting/PaintingRustBridge.h
index 989a0430a5c..af423d0d22a 100644
--- a/Libraries/LibWeb/Painting/PaintingRustBridge.h
+++ b/Libraries/LibWeb/Painting/PaintingRustBridge.h
@@ -7,7 +7,6 @@
#pragma once
#include <AK/Types.h>
-#include <LibCompositing/DisplayList/AccumulatedVisualContext.h>
#include <LibCompositing/DisplayList/DisplayListResourceStorage.h>
#include <LibWeb/CSS/StyleValues/AbstractImageStyleValue.h>
#include <LibWeb/Compositor/NavigablePresenter.h>
diff --git a/Libraries/LibWeb/Rust/build.rs b/Libraries/LibWeb/Rust/build.rs
index 826a750810d..aa1f65e0a67 100644
--- a/Libraries/LibWeb/Rust/build.rs
+++ b/Libraries/LibWeb/Rust/build.rs
@@ -2414,7 +2414,7 @@ fn expose_shared_abi_types_as_cpp_types(config: &mut cbindgen::Config) {
"LibGfx/Vector3.h",
"LibGfx/WindingRule.h",
"LibWeb/Forward.h",
- "LibCompositing/DisplayList/AccumulatedVisualContext.h",
+ "LibCompositing/DisplayList/ContextRef.h",
"LibWeb/Painting/ChromeMetrics.h",
"LibCompositing/DisplayList/DisplayListCommandsGenerated.h",
]
diff --git a/Services/Compositor/CompositorWebContentServer.ipc b/Services/Compositor/CompositorWebContentServer.ipc
index 4a340a4d9fb..83455f7af32 100644
--- a/Services/Compositor/CompositorWebContentServer.ipc
+++ b/Services/Compositor/CompositorWebContentServer.ipc
@@ -1,6 +1,5 @@
#include <AK/NonnullRefPtr.h>
#include <AK/Optional.h>
-#include <LibCompositing/DisplayList/AccumulatedVisualContext.h>
#include <LibCompositing/DisplayList/Canvas2DCommandStream.h>
#include <LibCompositing/DisplayList/DisplayList.h>
#include <LibCompositing/DisplayList/DisplayListResourceStorage.h>