Skip to content

Truly independent web browser

LibWeb: Stop resetting the visual context update counts

Aliaksandr Kalenik502a8613bb4e
diff --git a/Libraries/LibWeb/Internals/Internals.cpp b/Libraries/LibWeb/Internals/Internals.cpp
index 710070f7354..9625991281c 100644
--- a/Libraries/LibWeb/Internals/Internals.cpp
+++ b/Libraries/LibWeb/Internals/Internals.cpp
@@ -223,7 +223,7 @@ u64 Internals::accumulated_visual_context_incremental_update_count()
auto& document = window().associated_document();
if (!document.has_committed_viewport_box())
return 0;
- return document.paint_state().accumulated_visual_context_tree_incremental_update_count();
+ return Layout::RustFFI::document_host_visual_context_tree_incremental_update_count(document.layout_node_arena().host());
}
u64 Internals::layout_tree_pre_order_label_violation_count()
@@ -1604,7 +1604,7 @@ WebIDL::UnsignedLongLong Internals::accumulated_visual_context_tree_build_count(
auto& document = window().associated_document();
if (!document.has_committed_viewport_box())
return 0;
- return document.paint_state().accumulated_visual_context_tree_build_count();
+ return Layout::RustFFI::document_host_visual_context_tree_build_count(document.layout_node_arena().host());
}
void Internals::begin_display_list_trace()
diff --git a/Libraries/LibWeb/Painting/DocumentPaintState.cpp b/Libraries/LibWeb/Painting/DocumentPaintState.cpp
index 822ac150605..d4feeb13bf9 100644
--- a/Libraries/LibWeb/Painting/DocumentPaintState.cpp
+++ b/Libraries/LibWeb/Painting/DocumentPaintState.cpp
@@ -27,7 +27,7 @@ DocumentPaintState::DocumentPaintState(Layout::NodeArena& layout_node_arena)
{
// The render state keeps the scroll state and what paint preparation left for frames, and outlives the layout tree
// this paint state is for.
- Layout::RustFFI::document_host_paint_state_was_created(m_layout_node_arena->host());
+ Layout::RustFFI::document_host_viewport_row_was_reset(m_layout_node_arena->host());
}
bool DocumentPaintState::has_visual_context_tree(Layout::BegunRead const& read) const
@@ -56,16 +56,6 @@ void DocumentPaintState::did_update_visual_context_values()
Layout::RustFFI::document_host_note_visual_context_tree_needs_compositor_update(m_layout_node_arena->host());
}
-u64 DocumentPaintState::accumulated_visual_context_tree_build_count() const
-{
- return Layout::RustFFI::document_host_visual_context_tree_build_count(m_layout_node_arena->host());
-}
-
-u64 DocumentPaintState::accumulated_visual_context_tree_incremental_update_count() const
-{
- return Layout::RustFFI::document_host_visual_context_tree_incremental_update_count(m_layout_node_arena->host());
-}
-
BlockingWheelEventRegionState DocumentPaintState::collect_root_blocking_wheel_event_regions(DOM::Document& document)
{
GC::Ptr<DOM::EventTarget> roots[] = {
diff --git a/Libraries/LibWeb/Painting/DocumentPaintState.h b/Libraries/LibWeb/Painting/DocumentPaintState.h
index 54874d15210..83a87321357 100644
--- a/Libraries/LibWeb/Painting/DocumentPaintState.h
+++ b/Libraries/LibWeb/Painting/DocumentPaintState.h
@@ -54,8 +54,6 @@ public:
// does.
bool take_visual_context_tree_compositor_update(Layout::BegunRead const& read);
bool has_visual_context_tree(Layout::BegunRead const& read) const;
- u64 accumulated_visual_context_tree_build_count() const;
- u64 accumulated_visual_context_tree_incremental_update_count() const;
void append_recording_trace(String trace) { m_recording_traces.append(move(trace)); }
Vector<String> take_recording_traces() { return exchange(m_recording_traces, {}); }
diff --git a/Libraries/LibWeb/Rust/src/painting/ffi.rs b/Libraries/LibWeb/Rust/src/painting/ffi.rs
index ba9c0d34dc4..e7ba503cbb4 100644
--- a/Libraries/LibWeb/Rust/src/painting/ffi.rs
+++ b/Libraries/LibWeb/Rust/src/painting/ffi.rs
@@ -189,13 +189,13 @@ pub extern "C" fn document_host_note_visual_context_tree_needs_compositor_update
.set(true);
}
-/// How many times the visual context tree of `host`'s document was built anew since its paint state started.
+/// How many times the visual context tree of `host`'s document was built anew.
#[unsafe(no_mangle)]
pub extern "C" fn document_host_visual_context_tree_build_count(host: &DocumentHost) -> u64 {
host.paint_preparation().visual_context_tree_build_count.get()
}
-/// How many times the visual context tree of `host`'s document was updated in place since its paint state started.
+/// How many times the visual context tree of `host`'s document was updated in place.
#[unsafe(no_mangle)]
pub extern "C" fn document_host_visual_context_tree_incremental_update_count(host: &DocumentHost) -> u64 {
host.paint_preparation()
@@ -203,16 +203,8 @@ pub extern "C" fn document_host_visual_context_tree_incremental_update_count(hos
.get()
}
-/// Has `host` forget its document's scroll state and what paint preparation left for frames, as the document's paint
-/// state starts over.
-#[unsafe(no_mangle)]
-pub extern "C" fn document_host_paint_state_was_created(host: &DocumentHost) {
- host.forget_scroll_state();
- host.paint_preparation().reset();
-}
-
/// Has `host` forget its document's scroll state and the visual context tree changes left for the compositor, as the
-/// viewport's row starts over.
+/// viewport's row or the document's paint state starts over.
#[unsafe(no_mangle)]
pub extern "C" fn document_host_viewport_row_was_reset(host: &DocumentHost) {
host.forget_scroll_state();
diff --git a/Libraries/LibWeb/Rust/src/painting/paint_passes.rs b/Libraries/LibWeb/Rust/src/painting/paint_passes.rs
index 951538f5cb0..0c553f4209c 100644
--- a/Libraries/LibWeb/Rust/src/painting/paint_passes.rs
+++ b/Libraries/LibWeb/Rust/src/painting/paint_passes.rs
@@ -346,19 +346,12 @@ pub(crate) struct PaintPreparationNotes {
pub(crate) visual_contexts_need_update: Cell<bool>,
/// Whether the visual context tree changed since a frame last took it to the compositor.
pub(crate) visual_context_tree_needs_compositor_update: Cell<bool>,
+ /// How many times the preparations built the visual context tree anew, and updated it in place, which tests read
+ /// through Internals as differences.
pub(crate) visual_context_tree_build_count: Cell<u64>,
pub(crate) visual_context_tree_incremental_update_count: Cell<u64>,
}
-impl PaintPreparationNotes {
- /// Forgets what the preparations left for frames, as the document's paint state starts over.
- pub(crate) fn reset(&self) {
- self.visual_context_tree_needs_compositor_update.set(false);
- self.visual_context_tree_build_count.set(0);
- self.visual_context_tree_incremental_update_count.set(0);
- }
-}
-
/// The document's viewport row, where its box is committed.
fn committed_viewport(arena: &LayoutNodeArena) -> Option<NodeSlotId> {
let viewport = arena.bound_viewport_row();