Truly independent web browser
LibWeb: Let read-only recordings copy from the published recording
Aliaksandr Kalenik9029d4c1ef4d
diff --git a/Libraries/LibWeb/Rust/src/painting/record/assemble.rs b/Libraries/LibWeb/Rust/src/painting/record/assemble.rsindex ba24a9f7eb7..09a3af09556 100644--- a/Libraries/LibWeb/Rust/src/painting/record/assemble.rs+++ b/Libraries/LibWeb/Rust/src/painting/record/assemble.rs@@ -140,22 +140,32 @@ pub(crate) struct Assembler<'a, H: AssemblyHost> {tree: &'a mut PaintOrderTree,// The byte offset of the published root scope, when a published recording can be copied from.source_prologue_bytes: Option<u32>,+ // Off for a frame that publishes nothing: it still marks damaged paths, but the tree's+ // structure keeps describing the published recording.+ rewrites_tree: bool,pending_copy: Option<PendingCopy>,}impl<'a, H: AssemblyHost> Assembler<'a, H> {- pub(crate) fn new(host: &'a mut H, tree: &'a mut PaintOrderTree, source_prologue_bytes: Option<u32>) -> Self {+ pub(crate) fn new(+ host: &'a mut H,+ tree: &'a mut PaintOrderTree,+ source_prologue_bytes: Option<u32>,+ rewrites_tree: bool,+ ) -> Self {Self {host,tree,source_prologue_bytes,+ rewrites_tree,pending_copy: None,}}- /// Records the frame's root scope after the prologue and returns its entry. The tree holds- /// the assembled structure as pending changes for the caller to publish or discard.- pub(crate) fn assemble_root(mut self, root_scope: PaintScope) -> ChildEntry {+ /// Records the frame's root scope after the prologue and returns its output. A frame that+ /// rewrites the tree leaves the assembled structure there as pending changes for the caller+ /// to publish or discard.+ pub(crate) fn assemble_root(mut self, root_scope: PaintScope) -> OutputSize {self.tree.begin_recording();// Damage only steers what a frame copies; a frame without a published recording to copy// from records everything and never consults it.@@ -167,7 +177,7 @@ impl<'a, H: AssemblyHost> Assembler<'a, H> {}}let published_root = self.tree.root();- let entry = match self.source_prologue_bytes {+ let output = match self.source_prologue_bytes {Some(prologue_bytes) if !published_root.is_none() && self.tree.scope_of(published_root) == root_scope => {let cursor = SourceCursor {bytes: prologue_bytes,@@ -175,21 +185,24 @@ impl<'a, H: AssemblyHost> Assembler<'a, H> {};let entry = self.assemble_scope(published_root, cursor);self.flush_pending_copy();- self.tree.finish_recording(published_root, entry);- entry+ if self.rewrites_tree {+ self.tree.finish_recording(published_root, entry);+ }+ entry.output()}- _ => {+ _ if self.rewrites_tree => {if !published_root.is_none() {self.tree.detach_scope(published_root);}let root = self.tree.allocate_scope(root_scope, ScopeId::NONE);let entry = self.record_scope_fresh(root);self.tree.finish_recording(root, entry);- entry+ entry.output()}+ _ => self.record_scope_outside_tree(root_scope),};debug_assert!(self.pending_copy.is_none());- entry+ output}fn assemble_scope(&mut self, id: ScopeId, cursor: SourceCursor) -> ChildEntry {@@ -237,7 +250,9 @@ impl<'a, H: AssemblyHost> Assembler<'a, H> {total.add(assembled.output());entries.push(assembled);}- self.tree.set_children(id, &entries);+ if self.rewrites_tree {+ self.tree.set_children(id, &entries);+ }self.host.observe(AssemblyEvent::ScopeEnd(scope));ChildEntry::scope(id, total)}@@ -283,8 +298,7 @@ impl<'a, H: AssemblyHost> Assembler<'a, H> {if !plan.active {self.host.observe(AssemblyEvent::ScopeBegin(scope, ScopeAction::Inactive));- self.detach_unmatched(&published, &matched);- self.tree.set_children(id, &[]);+ self.install_replanned_children(id, &published, &matched, &[]);self.host.observe(AssemblyEvent::ScopeEnd(scope));return ChildEntry::scope(id, OutputSize::default());}@@ -329,31 +343,45 @@ impl<'a, H: AssemblyHost> Assembler<'a, H> {published[index]}}- None => {+ None if self.rewrites_tree => {let child = self.tree.allocate_scope(child_scope, id);self.record_scope_fresh(child)}+ None => {+ total.add(self.record_scope_outside_tree(child_scope));+ continue;+ }};total.add(assembled.output());entries.push(assembled);}}}- self.detach_unmatched(&published, &matched);- self.tree.set_children(id, &entries);+ self.install_replanned_children(id, &published, &matched, &entries);self.host.observe(AssemblyEvent::ScopeEnd(scope));ChildEntry::scope(id, total)}- fn detach_unmatched(&mut self, published: &[ChildEntry], matched: &[bool]) {+ fn install_replanned_children(+ &mut self,+ id: ScopeId,+ published: &[ChildEntry],+ matched: &[bool],+ entries: &[ChildEntry],+ ) {+ if !self.rewrites_tree {+ return;+ }for (entry, matched) in published.iter().zip(matched) {if let (ChildKey::Scope(child), false) = (entry.key(), *matched) {self.tree.detach_scope(child);}}+ self.tree.set_children(id, entries);}fn record_scope_fresh(&mut self, id: ScopeId) -> ChildEntry {+ debug_assert!(self.rewrites_tree);let scope = self.tree.scope_of(id);let plan = self.host.plan_scope(scope);if !plan.active {@@ -389,6 +417,31 @@ impl<'a, H: AssemblyHost> Assembler<'a, H> {ChildEntry::scope(id, total)}+ fn record_scope_outside_tree(&mut self, scope: PaintScope) -> OutputSize {+ let plan = self.host.plan_scope(scope);+ let mut total = OutputSize::default();+ if !plan.active {+ self.host+ .observe(AssemblyEvent::ScopeBegin(scope, ScopeAction::Inactive));+ self.host.observe(AssemblyEvent::ScopeEnd(scope));+ return total;+ }+ self.host+ .observe(AssemblyEvent::ScopeBegin(scope, ScopeAction::Recorded));+ for item in plan.items {+ match item {+ PaintOrderItem::Producer(producer) => {+ for kind in producer_kinds(producer) {+ total.add(self.record_producer(scope.owner, kind).output());+ }+ }+ PaintOrderItem::Scope(child_scope) => total.add(self.record_scope_outside_tree(child_scope)),+ }+ }+ self.host.observe(AssemblyEvent::ScopeEnd(scope));+ total+ }+fn record_producer(&mut self, owner: NodeSlotId, kind: ProducerKind) -> ChildEntry {self.flush_pending_copy();let before = self.host.output_position();@@ -502,7 +555,7 @@ mod tests {display_list: RecordedDisplayList,hit_test_items: Vec<HitTestItem>,prologue_bytes: u32,- root_entry: ChildEntry,+ root_output: OutputSize,}struct Output {@@ -680,6 +733,10 @@ mod tests {// Records the canvas prologue and assembles the viewport context from the host's source// frame.fn record_frame(host: &mut TestHost, tree: &mut PaintOrderTree) -> Frame {+ record_frame_rewriting_tree(host, tree, true)+ }++ fn record_frame_rewriting_tree(host: &mut TestHost, tree: &mut PaintOrderTree, rewrites_tree: bool) -> Frame {host.output = new_output();host.output.recorder.fill_rect(IntRect {@@ -693,14 +750,15 @@ mod tests {);let prologue_bytes = host.output.recorder.byte_size() as u32;let source_prologue_bytes = host.source.as_ref().map(|frame| frame.prologue_bytes);- let root_entry = Assembler::new(host, tree, source_prologue_bytes).assemble_root(context(row(0)));+ let root_output =+ Assembler::new(host, tree, source_prologue_bytes, rewrites_tree).assemble_root(context(row(0)));let output = std::mem::replace(&mut host.output, new_output());let hit_test_items = std::sync::Arc::try_unwrap(output.hit_test_list.items).expect("items are unshared");Frame {display_list: output.recorder.into_builder().finish(),hit_test_items,prologue_bytes,- root_entry,+ root_output,}}@@ -711,7 +769,7 @@ mod tests {display_list: frame.display_list.clone(),hit_test_items: frame.hit_test_items.clone(),prologue_bytes: frame.prologue_bytes,- root_entry: frame.root_entry,+ root_output: frame.root_output,});assert!(previous.is_some(), "a next frame copies from a first frame");frame@@ -742,7 +800,7 @@ mod tests {item_identities(&assembled.hit_test_items),item_identities(&fresh.hit_test_items));- assert_eq!(assembled.root_entry.output(), fresh.root_entry.output());+ assert_eq!(assembled.root_output, fresh.root_output);}// A viewport context (row 0) with a background and a foreground scope listing three@@ -786,10 +844,10 @@ mod tests {let frame = record_frame(&mut host, &mut tree);assert_eq!(host.recorded.len(), 1 + 3 * 3);- assert_eq!(frame.root_entry.output().hits, 6);+ assert_eq!(frame.root_output.hits, 6);assert_eq!(frame.hit_test_items.len(), 6);assert_eq!(- frame.root_entry.output().bytes as usize,+ frame.root_output.bytes as usize,frame.display_list.bytes.len() - frame.prologue_bytes as usize);assert!(frame_is_unchanged(&tree, false));@@ -926,6 +984,91 @@ mod tests {assert_eq!(tree.scope_count(), 6);}+ #[test]+ fn a_frame_that_publishes_nothing_copies_clean_output_and_leaves_the_tree_as_published() {+ let mut host = cards_host();+ let mut tree = PaintOrderTree::default();+ let first = record_frame(&mut host, &mut tree);+ host.source = Some(first);+ host.clear_damage();+ let published_structure = tree.structure();+ let published_root_entry = tree.root_entry();++ host.produce(row(2), ProducerKind::DrawForeground, content(3, 0));+ host.push(row(2), PaintDamage::DRAW_FOREGROUND);+ let unpublished = record_frame_rewriting_tree(&mut host, &mut tree, false);++ assert_eq!(host.recorded, vec![(row(2), ProducerKind::DrawForeground)]);+ assert_matches_from_scratch(&mut host, &unpublished);+ assert_eq!(tree.structure(), published_structure);+ assert_eq!(tree.root_entry(), published_root_entry);++ // The damage it read is still pending for the frame that publishes next.+ host.recorded.clear();+ let published = record_next_frame(&mut host, &mut tree);+ assert_eq!(host.recorded, vec![(row(2), ProducerKind::DrawForeground)]);+ assert_matches_from_scratch(&mut host, &published);+ assert_eq!(published.display_list.bytes, unpublished.display_list.bytes);+ }++ #[test]+ fn a_frame_that_publishes_nothing_records_a_new_child_outside_the_tree() {+ let mut host = cards_host();+ let mut tree = PaintOrderTree::default();+ let first = record_frame(&mut host, &mut tree);+ host.source = Some(first);+ host.clear_damage();+ let published_structure = tree.structure();+ let published_scope_count = tree.scope_count();++ // Card 4 takes card 2's place.+ host.plan(+ foreground(row(0)),+ true,+ &[+ child(foreground(row(1))),+ child(foreground(row(4))),+ child(foreground(row(3))),+ ],+ );+ host.plan(+ foreground(row(4)),+ true,+ &[phase(PaintPhase::Background), phase(PaintPhase::Foreground)],+ );+ host.produce(row(4), ProducerKind::DrawBackground, content(2, 0));+ host.produce(row(4), ProducerKind::HitForeground, content(0, 1));+ host.push(row(4), PaintDamage::ORDER | PaintDamage::ALL_PRODUCERS);+ host.push(row(0), PaintDamage::ORDER | PaintDamage::DESCENDANT_READERS);+ let unpublished = record_frame_rewriting_tree(&mut host, &mut tree, false);++ assert_eq!(+ host.recorded,+ vec![+ (row(4), ProducerKind::DrawBackground),+ (row(4), ProducerKind::HitForeground)+ ]+ );+ assert_matches_from_scratch(&mut host, &unpublished);+ assert_eq!(tree.structure(), published_structure);+ assert_eq!(tree.scope_count(), published_scope_count);++ let published = record_next_frame(&mut host, &mut tree);+ assert_matches_from_scratch(&mut host, &published);+ }++ #[test]+ fn a_first_frame_that_publishes_nothing_leaves_the_tree_empty() {+ let mut host = cards_host();+ let mut tree = PaintOrderTree::default();++ let frame = record_frame_rewriting_tree(&mut host, &mut tree, false);++ assert!(tree.root().is_none());+ assert_eq!(tree.scope_count(), 0);+ assert_matches_from_scratch(&mut host, &frame);+ }+#[test]fn nested_damage_walks_only_the_damaged_path() {let mut host = cards_host();@@ -1065,7 +1208,7 @@ mod tests {let second = record_next_frame(&mut host, &mut tree);assert!(host.recorded.is_empty());- assert_eq!(second.root_entry.output(), OutputSize::default());+ assert_eq!(second.root_output, OutputSize::default());assert_eq!(second.display_list.bytes.len(), second.prologue_bytes as usize);assert_eq!(tree.scope_count(), 1);assert_matches_from_scratch(&mut host, &second);@@ -1084,7 +1227,7 @@ mod tests {);let mut tree = PaintOrderTree::default();let first = record_frame(&mut host, &mut tree);- assert_eq!(first.root_entry.output().blocking_wheel_event_regions, 1);+ assert_eq!(first.root_output.blocking_wheel_event_regions, 1);assert_eq!(tree.root_entry().output().blocking_wheel_event_regions, 1);host.source = Some(first);host.clear_damage();@@ -1094,7 +1237,7 @@ mod tests {let second = record_next_frame(&mut host, &mut tree);assert_eq!(host.recorded, vec![(row(3), ProducerKind::DrawForeground)]);- assert_eq!(second.root_entry.output().blocking_wheel_event_regions, 1);+ assert_eq!(second.root_output.blocking_wheel_event_regions, 1);assert_eq!(tree.root_entry().output().blocking_wheel_event_regions, 1);}@@ -1229,7 +1372,7 @@ mod tests {let mut inactive: HashSet<u32> = HashSet::new();let rows_with_content = [1, 2, 3, 4, 5, 6, 12, 13, 15];- for _ in 0..400 {+ for step in 0..400 {for _ in 0..=random.next(3) {match random.next(7) {0 | 1 => {@@ -1286,6 +1429,14 @@ mod tests {}}+ // Hit tests between two published frames record frames that publish nothing.+ let published_structure = tree.structure();+ for _ in 0..step % 3 {+ let unpublished = record_frame_rewriting_tree(&mut host, &mut tree, false);+ assert_matches_from_scratch(&mut host, &unpublished);+ assert_eq!(tree.structure(), published_structure);+ }+let frame = record_next_frame(&mut host, &mut tree);assert_matches_from_scratch(&mut host, &frame);host.clear_damage();diff --git a/Libraries/LibWeb/Rust/src/painting/record/order_tree.rs b/Libraries/LibWeb/Rust/src/painting/record/order_tree.rsindex 5ffd3709711..3bf4f8329a8 100644--- a/Libraries/LibWeb/Rust/src/painting/record/order_tree.rs+++ b/Libraries/LibWeb/Rust/src/painting/record/order_tree.rs@@ -311,6 +311,26 @@ impl PaintOrderTree {self.children.len()}+ /// Every scope reachable from the root, in tree order, with its child list.+ #[cfg(test)]+ pub(crate) fn structure(&self) -> Vec<(ScopeId, PaintScope, Vec<ChildEntry>)> {+ let mut structure = Vec::new();+ let mut stack = vec![self.root];+ while let Some(id) = stack.pop() {+ if id.is_none() {+ continue;+ }+ let children = self.children(id).to_vec();+ for entry in children.iter().rev() {+ if let ChildKey::Scope(child) = entry.key() {+ stack.push(child);+ }+ }+ structure.push((id, self.scope_of(id), children));+ }+ structure+ }+fn node(&self, id: ScopeId) -> &ScopeNode {let node = &self.nodes[id.index()];assert_eq!(node.generation, id.generation(), "stale paint scope id {id:?}");diff --git a/Libraries/LibWeb/Rust/src/painting/record/publish.rs b/Libraries/LibWeb/Rust/src/painting/record/publish.rsindex 2a17141aac7..81520c71923 100644--- a/Libraries/LibWeb/Rust/src/painting/record/publish.rs+++ b/Libraries/LibWeb/Rust/src/painting/record/publish.rs@@ -276,7 +276,8 @@ fn publish_resources(sink.add_video_sink(resource_id, sink_handle);}let resolved_ids = resolve_vector_images(&mut output, &vector_image_render_requests);- // A recording that publishes copies clean output from the one published last, with the SVG images it draws.+ // Only a recording that publishes becomes the one the next recording copies from, so only it keeps the SVG images+ // it carried over from the one published last.let published = recorder.published_recording.as_deref().filter(|_| publishes_recording);output.vector_image_display_lists =drawn_vector_image_display_lists(&output, &vector_image_render_requests, &resolved_ids, published);diff --git a/Libraries/LibWeb/Rust/src/painting/record/recorder_state.rs b/Libraries/LibWeb/Rust/src/painting/record/recorder_state.rsindex 5b4074bdef8..1d267387b3f 100644--- a/Libraries/LibWeb/Rust/src/painting/record/recorder_state.rs+++ b/Libraries/LibWeb/Rust/src/painting/record/recorder_state.rs@@ -21,8 +21,8 @@ pub(crate) struct RecorderState {/// The last recording that published, which the next one copies clean output from.pub(crate) published_recording: Option<Arc<RecordingOutput>>,pub(crate) published_hit_test_items: Option<Arc<PublishedHitTestItems>>,- /// The paint-order tree describing the published recording; a recording appends to it and- /// publication or discarding decides what stays.+ /// The paint-order tree describing the published recording; a recording that publishes+ /// appends to it and publication or discarding decides what stays.pub(crate) paint_order_tree: PaintOrderTree,/// The recording's workspace, whose tables one recording leaves for the next to reuse.pub(crate) scratch: RecordingScratch,diff --git a/Libraries/LibWeb/Rust/src/painting/record/traversal.rs b/Libraries/LibWeb/Rust/src/painting/record/traversal.rsindex c0715bfb5d9..a4dacbcda39 100644--- a/Libraries/LibWeb/Rust/src/painting/record/traversal.rs+++ b/Libraries/LibWeb/Rust/src/painting/record/traversal.rs@@ -73,10 +73,6 @@ fn record_display_list_impl<O: Observer>(source_recording: Option<Arc<RecordingOutput>>,source_items: Option<Arc<PublishedHitTestItems>>,) -> RecordingResult {- debug_assert!(- inputs.publishes_recording || source_recording.is_none(),- "a recording that publishes nothing has no published recording to copy from"- );let paint_state = source.frame().paint_state();let structural_epoch = paint_state.structural_epoch();let frame_inputs = FrameInputs::from_recording_inputs(inputs, paint_state);@@ -154,7 +150,8 @@ fn record_display_list_impl<O: Observer>(}None => {let source_prologue_bytes = recorder.source_recording.as_ref().map(|frame| frame.prologue_bytes);- Assembler::new(&mut recorder, tree, source_prologue_bytes).assemble_root(root_scope);+ Assembler::new(&mut recorder, tree, source_prologue_bytes, inputs.publishes_recording)+ .assemble_root(root_scope);if has_inspector_overlays {recorder.trace_paint(Operation::Named(None, "inspector-overlays"),diff --git a/Libraries/LibWeb/Rust/src/painting/recording_slot.rs b/Libraries/LibWeb/Rust/src/painting/recording_slot.rsindex bfdb34db89a..9466dffbda2 100644--- a/Libraries/LibWeb/Rust/src/painting/recording_slot.rs+++ b/Libraries/LibWeb/Rust/src/painting/recording_slot.rs@@ -409,27 +409,14 @@ pub(crate) fn record_frame(published_inputs,} = recorder;let source = PaintSource::new(&frame, absolute_rects);- // The retained tree describes the published tape and is written in place while a frame- // is assembled, so only a recording that publishes may copy from that frame or touch- // the tree; any other recording records from scratch into a tree of its own.- let mut throwaway_tree = crate::painting::record::order_tree::PaintOrderTree::default();- let (tree, source_recording, source_items) = if inputs.publishes_recording {- (- paint_order_tree,- published_recording.clone(),- published_hit_test_items.clone(),- )- } else {- (&mut throwaway_tree, None, None)- };let recording = crate::painting::record::traversal::record_display_list(&source,scratch,- tree,+ paint_order_tree,viewport,&inputs,- source_recording,- source_items,+ published_recording.clone(),+ published_hit_test_items.clone(),trace_recordings,);let trace = trace_recordings.then_some(PendingRecordingTrace {diff --git a/Tests/LibWeb/Text/expected/display_list/hit-test-recording-copies-from-published-recording.txt b/Tests/LibWeb/Text/expected/display_list/hit-test-recording-copies-from-published-recording.txtnew file mode 100644index 00000000000..1c7810df22d--- /dev/null+++ b/Tests/LibWeb/Text/expected/display_list/hit-test-recording-copies-from-published-recording.txt@@ -0,0 +1,2 @@+PASS: paint with overlays (work)+PASS: hit test after a move, then the next frame (work + checks)diff --git a/Tests/LibWeb/Text/input/display_list/hit-test-recording-copies-from-published-recording.html b/Tests/LibWeb/Text/input/display_list/hit-test-recording-copies-from-published-recording.htmlnew file mode 100644index 00000000000..09707c77bb6--- /dev/null+++ b/Tests/LibWeb/Text/input/display_list/hit-test-recording-copies-from-published-recording.html@@ -0,0 +1,203 @@+<!doctype html>+<html id="html">+<script src="../include.js"></script>+<script src="recording-test.js"></script>+<style>+ body { margin: 0; font: 16px/20px monospace; }+ #static { width: 200px; height: 40px; background: silver; }+ #box { position: absolute; left: 10px; top: 60px; width: 50px; height: 50px; background: green; }+</style>+<body id="body">+<div id="static">static text</div>+<div id="box"></div>+<script>+// A hit test that finds its hit-test list stale records a frame that publishes nothing. It copies the clean output+// of the published recording and records only what was damaged since, and leaves that damage for the frame that+// publishes next.+let hitTarget = null;+displayListTest({+ setup: removeBodyWhitespace,+ steps: [+ {+ name: "paint with overlays",+ paintOverlay: true,+ expect: `+ damage: rows=0 moved=0 order=0 eligibility=0 all=false+ @canvas RECORD (empty)+ @viewport RECORD+ @viewport/preamble RECORD (empty)+ @viewport/background/hit-test RECORD+ @viewport/scroll-metadata RECORD (empty)+ @viewport/background SKIP+ @viewport/border SKIP+ BlockContainer<HTML>#html/descendants(background-and-borders) RECORD+ @viewport/foreground/hit-test RECORD (empty)+ @viewport/foreground RECORD (empty)+ BlockContainer<HTML>#html/descendants(foreground) RECORD+ BlockContainer<HTML>#html RECORD+ BlockContainer<HTML>#html/preamble RECORD (empty)+ BlockContainer<HTML>#html/background/hit-test RECORD+ BlockContainer<HTML>#html/scroll-metadata RECORD (empty)+ BlockContainer<HTML>#html/background RECORD (empty)+ BlockContainer<HTML>#html/border SKIP+ BlockContainer<BODY>#body/descendants(background-and-borders) RECORD+ BlockContainer<BODY>#body/background/hit-test RECORD+ BlockContainer<BODY>#body/scroll-metadata RECORD (empty)+ BlockContainer<BODY>#body/background SKIP+ BlockContainer<BODY>#body/border SKIP+ BlockContainer<DIV>#static/descendants(background-and-borders) RECORD+ BlockContainer<DIV>#static/background/hit-test RECORD+ BlockContainer<DIV>#static/scroll-metadata RECORD (empty)+ BlockContainer<DIV>#static/background RECORD+ BlockContainer<DIV>#static/border SKIP+ BlockContainer<DIV>#box/descendants(background-and-borders) RECORD+ BlockContainer<HTML>#html/foreground/hit-test RECORD (empty)+ BlockContainer<HTML>#html/foreground RECORD (empty)+ BlockContainer<BODY>#body/descendants(foreground) RECORD+ BlockContainer<BODY>#body/foreground/hit-test RECORD (empty)+ BlockContainer<BODY>#body/foreground RECORD (empty)+ BlockContainer<DIV>#static/descendants(foreground) RECORD+ BlockContainer<DIV>#static/foreground/hit-test RECORD+ BlockContainer<DIV>#static/foreground RECORD+ BlockContainer<DIV>#static/outline SKIP+ BlockContainer<DIV>#static/overlay/hit-test RECORD (empty)+ BlockContainer<DIV>#static/overlay SKIP+ BlockContainer<DIV>#box/descendants(foreground) RECORD+ BlockContainer<BODY>#body/outline SKIP+ BlockContainer<BODY>#body/overlay/hit-test RECORD (empty)+ BlockContainer<BODY>#body/overlay SKIP+ BlockContainer<DIV>#box RECORD+ BlockContainer<DIV>#box/background/hit-test RECORD+ BlockContainer<DIV>#box/scroll-metadata RECORD (empty)+ BlockContainer<DIV>#box/background RECORD+ BlockContainer<DIV>#box/border SKIP+ BlockContainer<DIV>#box/foreground/hit-test RECORD (empty)+ BlockContainer<DIV>#box/foreground RECORD (empty)+ BlockContainer<DIV>#box/outline SKIP+ BlockContainer<DIV>#box/overlay/hit-test RECORD (empty)+ BlockContainer<DIV>#box/overlay SKIP+ BlockContainer<HTML>#html/outline SKIP+ BlockContainer<HTML>#html/overlay/hit-test RECORD (empty)+ BlockContainer<HTML>#html/overlay SKIP+ @viewport/outline SKIP+ @viewport/overlay/hit-test RECORD (empty)+ @viewport/overlay RECORD (empty)+ `+ },+ {+ name: "hit test after a move, then the next frame",+ paintOverlay: true,+ mutate: () => {+ box.style.left = "100px";+ hitTarget = document.elementFromPoint(120, 80);+ },+ check: equal => { equal(hitTarget?.id, "box", "hit target"); },+ expect: `+ damage: rows=4 moved=1 order=0 eligibility=0 all=false+ @canvas RECORD (empty)+ @viewport ASSEMBLE+ @viewport/preamble COPY+ @viewport/background/hit-test COPY+ @viewport/scroll-metadata COPY+ @viewport/background COPY+ @viewport/border COPY+ BlockContainer<HTML>#html/descendants(background-and-borders) ASSEMBLE+ @viewport/foreground/hit-test COPY+ @viewport/foreground COPY+ BlockContainer<HTML>#html/descendants(foreground) ASSEMBLE+ BlockContainer<HTML>#html ASSEMBLE+ BlockContainer<HTML>#html/preamble COPY+ BlockContainer<HTML>#html/background/hit-test COPY+ BlockContainer<HTML>#html/scroll-metadata COPY+ BlockContainer<HTML>#html/background COPY+ BlockContainer<HTML>#html/border COPY+ BlockContainer<BODY>#body/descendants(background-and-borders) ASSEMBLE+ BlockContainer<BODY>#body/background/hit-test COPY+ BlockContainer<BODY>#body/scroll-metadata COPY+ BlockContainer<BODY>#body/background COPY+ BlockContainer<BODY>#body/border COPY+ BlockContainer<DIV>#static/descendants(background-and-borders) COPY+ BlockContainer<DIV>#box/descendants(background-and-borders) ASSEMBLE+ BlockContainer<HTML>#html/foreground/hit-test COPY+ BlockContainer<HTML>#html/foreground COPY+ BlockContainer<BODY>#body/descendants(foreground) ASSEMBLE+ BlockContainer<BODY>#body/foreground/hit-test COPY+ BlockContainer<BODY>#body/foreground COPY+ BlockContainer<DIV>#static/descendants(foreground) COPY+ BlockContainer<DIV>#box/descendants(foreground) ASSEMBLE+ BlockContainer<BODY>#body/outline COPY+ BlockContainer<BODY>#body/overlay/hit-test COPY+ BlockContainer<BODY>#body/overlay COPY+ BlockContainer<DIV>#box ASSEMBLE+ BlockContainer<DIV>#box/background/hit-test RECORD+ BlockContainer<DIV>#box/scroll-metadata RECORD (empty)+ BlockContainer<DIV>#box/background RECORD+ BlockContainer<DIV>#box/border SKIP+ BlockContainer<DIV>#box/foreground/hit-test RECORD (empty)+ BlockContainer<DIV>#box/foreground RECORD (empty)+ BlockContainer<DIV>#box/outline SKIP+ BlockContainer<DIV>#box/overlay/hit-test RECORD (empty)+ BlockContainer<DIV>#box/overlay SKIP+ BlockContainer<HTML>#html/outline COPY+ BlockContainer<HTML>#html/overlay/hit-test COPY+ BlockContainer<HTML>#html/overlay COPY+ @viewport/outline COPY+ @viewport/overlay/hit-test COPY+ @viewport/overlay COPY+ recording (overlay=true)+ damage: rows=4 moved=1 order=0 eligibility=0 all=false+ @canvas RECORD (empty)+ @viewport ASSEMBLE+ @viewport/preamble COPY+ @viewport/background/hit-test COPY+ @viewport/scroll-metadata COPY+ @viewport/background COPY+ @viewport/border COPY+ BlockContainer<HTML>#html/descendants(background-and-borders) ASSEMBLE+ @viewport/foreground/hit-test COPY+ @viewport/foreground COPY+ BlockContainer<HTML>#html/descendants(foreground) ASSEMBLE+ BlockContainer<HTML>#html ASSEMBLE+ BlockContainer<HTML>#html/preamble COPY+ BlockContainer<HTML>#html/background/hit-test COPY+ BlockContainer<HTML>#html/scroll-metadata COPY+ BlockContainer<HTML>#html/background COPY+ BlockContainer<HTML>#html/border COPY+ BlockContainer<BODY>#body/descendants(background-and-borders) ASSEMBLE+ BlockContainer<BODY>#body/background/hit-test COPY+ BlockContainer<BODY>#body/scroll-metadata COPY+ BlockContainer<BODY>#body/background COPY+ BlockContainer<BODY>#body/border COPY+ BlockContainer<DIV>#static/descendants(background-and-borders) COPY+ BlockContainer<DIV>#box/descendants(background-and-borders) ASSEMBLE+ BlockContainer<HTML>#html/foreground/hit-test COPY+ BlockContainer<HTML>#html/foreground COPY+ BlockContainer<BODY>#body/descendants(foreground) ASSEMBLE+ BlockContainer<BODY>#body/foreground/hit-test COPY+ BlockContainer<BODY>#body/foreground COPY+ BlockContainer<DIV>#static/descendants(foreground) COPY+ BlockContainer<DIV>#box/descendants(foreground) ASSEMBLE+ BlockContainer<BODY>#body/outline COPY+ BlockContainer<BODY>#body/overlay/hit-test COPY+ BlockContainer<BODY>#body/overlay COPY+ BlockContainer<DIV>#box ASSEMBLE+ BlockContainer<DIV>#box/background/hit-test RECORD+ BlockContainer<DIV>#box/scroll-metadata RECORD (empty)+ BlockContainer<DIV>#box/background RECORD+ BlockContainer<DIV>#box/border SKIP+ BlockContainer<DIV>#box/foreground/hit-test RECORD (empty)+ BlockContainer<DIV>#box/foreground RECORD (empty)+ BlockContainer<DIV>#box/outline SKIP+ BlockContainer<DIV>#box/overlay/hit-test RECORD (empty)+ BlockContainer<DIV>#box/overlay SKIP+ BlockContainer<HTML>#html/outline COPY+ BlockContainer<HTML>#html/overlay/hit-test COPY+ BlockContainer<HTML>#html/overlay COPY+ @viewport/outline COPY+ @viewport/overlay/hit-test COPY+ @viewport/overlay COPY+ `+ }+ ]+});+</script>