Truly independent web browser
LibWeb: Send the visual context tree only where its update may change it
Zaggy1024a78927eec758
diff --git a/Libraries/LibWeb/Painting/DocumentPaintState.cpp b/Libraries/LibWeb/Painting/DocumentPaintState.cppindex 62bd23acb7d..e5bb0343493 100644--- a/Libraries/LibWeb/Painting/DocumentPaintState.cpp+++ b/Libraries/LibWeb/Painting/DocumentPaintState.cpp@@ -89,7 +89,8 @@ void DocumentPaintState::update_accumulated_visual_contexts(Layout::BegunRead co++m_accumulated_visual_context_tree_incremental_update_count;if (result.requires_display_list_recording || svg_paint_resources_changed)document.set_needs_to_record_display_list();- m_visual_context_tree_needs_compositor_update = true;+ if (result.values_may_have_changed)+ m_visual_context_tree_needs_compositor_update = true;}void DocumentPaintState::update_visual_viewport_accumulated_visual_context(Layout::BegunRead const& read, DOM::Document& document)diff --git a/Libraries/LibWeb/Rust/src/painting/host/visual_context.rs b/Libraries/LibWeb/Rust/src/painting/host/visual_context.rsindex d407b4eff64..065e30505be 100644--- a/Libraries/LibWeb/Rust/src/painting/host/visual_context.rs+++ b/Libraries/LibWeb/Rust/src/painting/host/visual_context.rs@@ -46,6 +46,8 @@ pub struct FfiVisualContextUpdateOutcome {pub performed_full_build: bool,pub structural_epoch_changed: bool,pub requires_display_list_recording: bool,+ /// Whether the update may have given a node of the tree other values: it visited a dirty box, or every box.+ pub values_may_have_changed: bool,pub structural_epoch: u64,}diff --git a/Libraries/LibWeb/Rust/src/painting/paint_passes.rs b/Libraries/LibWeb/Rust/src/painting/paint_passes.rsindex 03e61c5c87a..8a597852d57 100644--- a/Libraries/LibWeb/Rust/src/painting/paint_passes.rs+++ b/Libraries/LibWeb/Rust/src/painting/paint_passes.rs@@ -422,6 +422,7 @@ pub(crate) fn update_accumulated_visual_contexts(if state.tree.as_deref().is_some_and(|tree| tree.should_compact()) {scope = VisualContextUpdateScope::FreshTree;}+ let values_may_have_changed = scope != VisualContextUpdateScope::DirtyPath || !state.dirty_boxes.is_empty();while scope != VisualContextUpdateScope::FreshTree {let result = update_visual_context_tree(&mut arena.paintable_rows_mut(), viewport, inputs, scope, &mut state);@@ -444,6 +445,7 @@ pub(crate) fn update_accumulated_visual_contexts(performed_full_build,structural_epoch_changed: outcome.delta.structural_epoch_changed,requires_display_list_recording: outcome.delta.requires_display_list_recording,+ values_may_have_changed,structural_epoch: state.structural_epoch(),};arena.paint_state_mut().visual_context = state;@@ -509,6 +511,7 @@ fn fresh_visual_context_tree_build(performed_full_build: true,structural_epoch_changed: true,requires_display_list_recording: true,+ values_may_have_changed: true,structural_epoch: state.structural_epoch(),}}diff --git a/Libraries/LibWeb/Rust/src/painting/visual_context/dirty.rs b/Libraries/LibWeb/Rust/src/painting/visual_context/dirty.rsindex 627930fcd2f..eca93b0b3f1 100644--- a/Libraries/LibWeb/Rust/src/painting/visual_context/dirty.rs+++ b/Libraries/LibWeb/Rust/src/painting/visual_context/dirty.rs@@ -104,7 +104,6 @@ impl VisualContextDirtySet {self.boxes.clear();}- #[cfg(test)]pub fn is_empty(&self) -> bool {self.boxes.is_empty() && self.removed.is_empty() && self.scope == VisualContextUpdateScope::DirtyPath}