Skip to content

Truly independent web browser

LibWeb: Skip invalidation walks of subtrees that carry no wanted key

Andreas Klingde99af2216da
diff --git a/Documentation/Style/StyleEngine.md b/Documentation/Style/StyleEngine.md
index 54faf139176..49e14a65978 100644
--- a/Documentation/Style/StyleEngine.md
+++ b/Documentation/Style/StyleEngine.md
@@ -16,6 +16,11 @@ blocks, and its links to its parent and siblings. The main thread writes it at m
`projection_writes.rs`). Rows live in copy-on-write columns, so a generation of them is immutable plain data during a pass,
and a fork of the engine shares every chunk it does not write.
+A row also holds a 64-bit Bloom summary of the classes and attribute names its descendants carry. The writer brings the
+summaries up to date as it publishes rows: a written element hands its names up to its ancestors, as far as one that holds
+them all already. A name that left a subtree stays in the summary, so the summary can say that a name is absent, never that
+it is present.
+
Input the engine cannot use is not sent. An attribute no selector or `attr()` reads is withheld, and the elements carrying it
are noted and published if something comes to read the name. `:local-link` works the same way.
@@ -51,6 +56,7 @@ After a document's first pass, each style update restyles only what its inputs c
**Invalidation** (`invalidation.rs`) maps every fact a compound tests to where that compound stands in its selector. A changed
element restyles itself where the fact is the subject's, and otherwise follows the combinators to the elements that can match.
+A walk down the tree skips a subtree whose summary lacks the class or attribute name of each compound the walk looks for.
`:has()` compounds find their anchors through their own queries. Reads that carry no structure, such as the selectors of an
`of` or the bounds of a `@scope`, restyle coarsely.
diff --git a/Libraries/LibWeb/Rust/src/css/style/index.rs b/Libraries/LibWeb/Rust/src/css/style/index.rs
index 1e866d98577..9ba0f4aedfe 100644
--- a/Libraries/LibWeb/Rust/src/css/style/index.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/index.rs
@@ -219,6 +219,20 @@ pub fn dispatch_bloom_bit(key: DispatchKey) -> u64 {
1_u64 << (dispatch_key_hash(key) & 63)
}
+/// The bits of `key` in the Bloom summary of the keys the descendants of an element carry, for a key the summary
+/// holds: a class or an attribute name. Three bits for each key: a walk asks for many keys at once, and most
+/// subtrees hold few.
+#[must_use]
+pub fn subtree_key_bits(key: DispatchKey) -> Option<u64> {
+ match key {
+ DispatchKey::Class(_) | DispatchKey::AttributeName(_) => {
+ let hash = dispatch_key_hash(key);
+ Some(1_u64 << ((hash >> 8) & 63) | 1_u64 << ((hash >> 16) & 63) | 1_u64 << ((hash >> 24) & 63))
+ }
+ _ => None,
+ }
+}
+
/// One well-mixed hash of a dispatch key, which both Bloom summaries take their bit positions from.
#[must_use]
fn dispatch_key_hash(key: DispatchKey) -> u64 {
diff --git a/Libraries/LibWeb/Rust/src/css/style/pipeline/live.rs b/Libraries/LibWeb/Rust/src/css/style/pipeline/live.rs
index ebf6fd2e1e9..8fc9a2fdf21 100644
--- a/Libraries/LibWeb/Rust/src/css/style/pipeline/live.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/pipeline/live.rs
@@ -10,6 +10,7 @@
use super::super::component_matching::DocumentMatching;
use super::super::index::dispatch_bloom_bit;
+use super::super::index::subtree_key_bits;
use super::super::input_types::TransactionFactSide;
use super::super::input_types::{
STYLE_REACTION_FONT_INPUTS_CHANGED, STYLE_REACTION_PUBLISHED_STYLE, STYLE_REACTION_RECOMPUTE_DESCENDANT_STYLES,
@@ -3064,19 +3065,42 @@ struct Level {
/// Whether every link is a descendant combinator's, which reaches the children's descendants
/// too.
all_descendant: bool,
+ /// The bits of the key each link's compound requires in the summary of a subtree's keys, for the links with
+ /// such a key.
+ subtree_keys: SmallVec<[u64; 8]>,
+ /// Whether a link's compound requires no key the summary of a subtree's keys holds.
+ reaches_every_subtree: bool,
}
impl Level {
fn of(map: &InvalidationMap, links: Links) -> Self {
debug_assert!(links.is_sorted());
+ let mut subtree_keys: SmallVec<[u64; 8]> = SmallVec::new();
+ let mut reaches_every_subtree = false;
+ for &link in &links {
+ match map.step(link).required_key.and_then(subtree_key_bits) {
+ Some(keys) => subtree_keys.push(keys),
+ None => reaches_every_subtree = true,
+ }
+ }
+ subtree_keys.sort_unstable();
+ subtree_keys.dedup();
Self {
filter: LinkFilter::of(map, &links),
all_descendant: links
.iter()
.all(|&link| map.step(link).combinator == ReachCombinator::Descendant),
links,
+ subtree_keys,
+ reaches_every_subtree,
}
}
+
+ /// Whether a link may reach an element of a subtree whose keys `summary` summarizes: an element is tested only
+ /// against the links whose key it carries.
+ fn reaches_subtree(&self, summary: u64) -> bool {
+ self.reaches_every_subtree || self.subtree_keys.iter().any(|&keys| keys & !summary == 0)
+ }
}
impl<'a> Follower<'a> {
@@ -3754,7 +3778,29 @@ impl<'a> Follower<'a> {
/// Test the children of `parent` against the links in `down`, and their descendants against
/// the descendant combinators' among them.
fn descend(&mut self, parent: StyleNodeID, down: &[Dependency]) {
- let level = Level::of(self.map, down.iter().copied().collect());
+ // NB: A link whose key no element below the parent carries is tested against none of them.
+ let summary = self.projection.subtree_keys(parent);
+ let (map, mut dropped) = (self.map, Links::new());
+ let mut links: Links = down.iter().copied().collect();
+ links.retain(|link| {
+ let reaches = map
+ .step(*link)
+ .required_key
+ .and_then(subtree_key_bits)
+ .is_none_or(|keys| summary & keys == keys);
+ if !reaches && cfg!(debug_assertions) {
+ dropped.push(*link);
+ }
+ reaches
+ });
+ debug_assert!(
+ dropped.is_empty() || self.no_element_below_carries_a_key(parent, &Level::of(map, dropped)),
+ "the summary of the keys below an element lacks a key one of them carries"
+ );
+ if links.is_empty() {
+ return;
+ }
+ let level = Level::of(map, links);
let first = self.projection.first_element_child(parent);
self.walk_siblings(first, &level, Links::new());
}
@@ -3803,6 +3849,7 @@ impl<'a> Follower<'a> {
if candidates.is_empty() && across.is_empty() {
if !continuing.links.is_empty()
&& let first_child @ Some(_) = tree.first_element_child(current)
+ && self.reaches_below(current, continuing)
{
self.walk_siblings(first_child, continuing, Links::new());
}
@@ -3844,7 +3891,7 @@ impl<'a> Follower<'a> {
continue;
}
if added.is_empty() {
- if !continuing.links.is_empty() {
+ if !continuing.links.is_empty() && self.reaches_below(current, continuing) {
self.walk_siblings(first_child, continuing, Links::new());
}
} else {
@@ -3852,9 +3899,35 @@ impl<'a> Follower<'a> {
links.extend(added);
links.sort_unstable();
links.dedup();
- self.walk_siblings(first_child, &Level::of(map, links), Links::new());
+ let level = Level::of(map, links);
+ if self.reaches_below(current, &level) {
+ self.walk_siblings(first_child, &level, Links::new());
+ }
+ }
+ }
+ }
+
+ /// Whether a link of `level` may reach an element below `parent`, as the summary of the keys of its subtree tells.
+ fn reaches_below(&self, parent: StyleNodeID, level: &Level) -> bool {
+ let reaches = level.reaches_subtree(self.projection.subtree_keys(parent));
+ debug_assert!(
+ reaches || self.no_element_below_carries_a_key(parent, level),
+ "the summary of the keys below an element lacks a key one of them carries"
+ );
+ reaches
+ }
+
+ /// Whether no element below `parent` carries the key of a link of `level`, by reading every one of them.
+ fn no_element_below_carries_a_key(&self, parent: StyleNodeID, level: &Level) -> bool {
+ let mut carried: SmallVec<[Dependency; 8]> = SmallVec::new();
+ let mut below: Vec<StyleNodeID> = self.projection.children(parent).collect();
+ while let Some(element) = below.pop() {
+ below.extend(self.projection.children(element));
+ if let Some(row) = self.projection.row_of(element) {
+ level.filter.carried_keys(row, &mut carried);
}
}
+ carried.is_empty()
}
/// Whether `element` matches the compound right of `link` on its own.
diff --git a/Libraries/LibWeb/Rust/src/css/style/pipeline/projection.rs b/Libraries/LibWeb/Rust/src/css/style/pipeline/projection.rs
index 66be619849d..fe779232b64 100644
--- a/Libraries/LibWeb/Rust/src/css/style/pipeline/projection.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/pipeline/projection.rs
@@ -44,6 +44,7 @@ use super::super::index::LocalFeatureKey;
use super::super::index::StateSet;
use super::super::index::StyleAtomID;
use super::super::index::dispatch_bloom_bit;
+use super::super::index::subtree_key_bits;
use super::super::input_types::StateFact;
use super::super::input_types::TransactionFactSide;
use super::super::input_types::TreeRelations;
@@ -452,7 +453,7 @@ impl ElementFacts {
}
/// How one element stands in the tree. Its tree scope and assigned slot are held in its fact lists,
-/// and whether it is live and connected in its facts' flags, so that a row is 48 bytes.
+/// and whether it is live and connected in its facts' flags, so that a row is 56 bytes.
#[derive(Clone, Default, PartialEq)]
struct Links {
parent: Option<StyleNodeID>,
@@ -481,9 +482,14 @@ struct ShadowLinks {
struct Row {
facts: ElementFacts,
links: Links,
+ /// A Bloom summary of the classes and attribute names the element's descendants in its tree carry, by
+ /// [`subtree_key_bits`]: a walk down the tree for a key the summary lacks finds no element below the element. The
+ /// writer brings it up to date as it publishes the rows. A key that left the subtree stays until the identity is
+ /// minted again.
+ subtree_keys: u64,
}
-const _: () = assert!(size_of::<Row>() == 48);
+const _: () = assert!(size_of::<Row>() == 56);
/// The shadow relations of the elements by slot, in a column of their own that is made only as far as the last element
/// holding any: most documents have none, and most elements of those that do hold none either.
@@ -1790,6 +1796,15 @@ impl Projection {
self.links(node)?.first_element_child
}
+ /// The Bloom summary of the classes and attribute names the descendants of `node` in its tree carry, by
+ /// [`subtree_key_bits`], as the last transaction committed them.
+ #[must_use]
+ pub(in crate::css::style) fn subtree_keys(&self, node: StyleNodeID) -> u64 {
+ self.committed
+ .get(node.element_slot())
+ .map_or(u64::MAX, |row| row.subtree_keys)
+ }
+
#[must_use]
pub(in crate::css::style) fn previous_element_sibling(&self, node: StyleNodeID) -> Option<StyleNodeID> {
self.links(node)?.previous_element_sibling
@@ -2253,6 +2268,22 @@ fn list_bloom_of(lists: &FactListsEdit, name_forms: &Catalog<AttributeNameForms>
bloom
}
+/// The bits of the keys the lists `lists` carry in the summary of a subtree's keys.
+fn subtree_keys_of(lists: &FactLists, name_forms: &Catalog<AttributeNameForms>) -> u64 {
+ let mut keys = 0;
+ for &class in lists.classes() {
+ keys |= subtree_key_bits(DispatchKey::Class(class)).unwrap_or(0);
+ }
+ for attribute in lists.attributes() {
+ for name in attribute_name_keys(name_forms, attribute.name) {
+ if !name.is_none() {
+ keys |= subtree_key_bits(DispatchKey::AttributeName(name)).unwrap_or(0);
+ }
+ }
+ }
+ keys
+}
+
/// See [`Projection::for_each_dispatch_probe`].
fn for_each_dispatch_probe(
facts: &ElementFacts,
diff --git a/Libraries/LibWeb/Rust/src/css/style/pipeline/projection/writer.rs b/Libraries/LibWeb/Rust/src/css/style/pipeline/projection/writer.rs
index 6f6016b60af..302840560e1 100644
--- a/Libraries/LibWeb/Rust/src/css/style/pipeline/projection/writer.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/pipeline/projection/writer.rs
@@ -43,6 +43,7 @@ use super::fact_lists::RecentFactLists;
use super::fact_lists::{EditedList, FactListsEdit};
use super::list_bloom_of;
use super::relations_of;
+use super::subtree_keys_of;
use crate::cow_column::ColumnSnapshot;
use crate::cow_column::CowColumn;
use crate::css::declaration_block::SharedDeclarationBlock;
@@ -200,6 +201,7 @@ impl ProjectionWriter {
row.facts = row.facts.forgotten();
}
}
+ self.summarize_written_subtrees();
let rows = self.rows.publish();
self.catalogs_written = false;
self.host_facts_written = false;
@@ -230,6 +232,34 @@ impl ProjectionWriter {
publication
}
+ /// Bring the summaries of the keys below each element up to date with the rows written. A summary changes only as
+ /// the keys or the parent of a descendant do, both of which write the descendant's row. Each written element
+ /// hands its keys and its summary up to its ancestors, as far as one that holds them all already: that one's
+ /// ancestors hold them too.
+ fn summarize_written_subtrees(&mut self) {
+ for index in 0..self.written.nodes.len() {
+ let node = self.written.nodes[index];
+ let Some(row) = self.row(node).filter(|row| row.live()) else {
+ continue;
+ };
+ let keys = row.subtree_keys | subtree_keys_of(&row.facts.lists, &self.catalogs.name_forms);
+ let mut ancestor = row.links.parent;
+ while let Some(current) = ancestor {
+ let slot = current.element_slot();
+ let Some((held, parent)) = self.rows.get(slot).map(|row| (row.subtree_keys, row.links.parent)) else {
+ break;
+ };
+ if held & keys == keys {
+ break;
+ }
+ if let Some(mut row) = self.rows.row_mut(slot) {
+ row.subtree_keys = held | keys;
+ }
+ ancestor = parent;
+ }
+ }
+ }
+
/// How many times the rows were written where an edit changed them, which a test reads to see that an edit that
/// changes nothing copies no chunk.
#[cfg(test)]
@@ -402,6 +432,7 @@ impl ProjectionWriter {
self.edit(node, |row| {
assert!(!row.live(), "minting an element identity that is live");
row.links = Links::default();
+ row.subtree_keys = 0;
row.facts.set_flag(ElementFacts::LIVE, true);
row.facts.set_flag(ElementFacts::CONNECTED, false);
// NB: A departed element keeps its host facts until its identity is minted again, which may hand it to a
diff --git a/Tests/LibWeb/Text/expected/css/combinator-invalidation-reaches-keys-that-arrive-late.txt b/Tests/LibWeb/Text/expected/css/combinator-invalidation-reaches-keys-that-arrive-late.txt
index fb73e3f67cf..ba44fbb6b3f 100644
--- a/Tests/LibWeb/Text/expected/css/combinator-invalidation-reaches-keys-that-arrive-late.txt
+++ b/Tests/LibWeb/Text/expected/css/combinator-invalidation-reaches-keys-that-arrive-late.txt
@@ -6,6 +6,7 @@ No element carries a key, ancestor off
byWhere: rgb(0, 0, 0)
inserted: not connected
together: rgb(0, 0, 0)
+ moved: rgb(0, 0, 0)
next: rgb(0, 0, 0)
later: rgb(0, 0, 0)
No element carries a key, ancestor on
@@ -16,6 +17,7 @@ No element carries a key, ancestor on
byWhere: rgb(0, 0, 0)
inserted: not connected
together: rgb(0, 0, 0)
+ moved: rgb(0, 0, 0)
next: rgb(0, 0, 0)
later: rgb(0, 0, 0)
No element carries a key, ancestor off again
@@ -26,6 +28,7 @@ No element carries a key, ancestor off again
byWhere: rgb(0, 0, 0)
inserted: not connected
together: rgb(0, 0, 0)
+ moved: rgb(0, 0, 0)
next: rgb(0, 0, 0)
later: rgb(0, 0, 0)
The keys arrived, ancestor off
@@ -36,6 +39,7 @@ The keys arrived, ancestor off
byWhere: rgb(0, 0, 0)
inserted: rgb(0, 0, 0)
together: rgb(0, 0, 0)
+ moved: rgb(0, 0, 0)
next: rgb(0, 0, 0)
later: rgb(0, 0, 0)
The keys arrived, ancestor on
@@ -46,6 +50,7 @@ The keys arrived, ancestor on
byWhere: rgb(0, 128, 0)
inserted: rgb(0, 128, 0)
together: rgb(0, 0, 0)
+ moved: rgb(0, 0, 0)
next: rgb(0, 128, 0)
later: rgb(0, 128, 0)
The keys arrived, ancestor off again
@@ -56,6 +61,7 @@ The keys arrived, ancestor off again
byWhere: rgb(0, 0, 0)
inserted: rgb(0, 0, 0)
together: rgb(0, 0, 0)
+ moved: rgb(0, 0, 0)
next: rgb(0, 0, 0)
later: rgb(0, 0, 0)
A key arrived together with the change of the ancestor
@@ -66,5 +72,50 @@ A key arrived together with the change of the ancestor
byWhere: rgb(0, 128, 0)
inserted: rgb(0, 128, 0)
together: rgb(0, 128, 0)
+ moved: rgb(0, 0, 0)
+ next: rgb(0, 128, 0)
+ later: rgb(0, 128, 0)
+A key arrived in a subtree outside the ancestor, ancestor off
+ byClass: rgb(0, 0, 0)
+ byId: rgb(0, 0, 0)
+ byAttribute: rgb(0, 0, 0)
+ byChild: rgb(0, 0, 0)
+ byWhere: rgb(0, 0, 0)
+ inserted: rgb(0, 0, 0)
+ together: rgb(0, 0, 0)
+ moved: rgb(0, 0, 0)
+ next: rgb(0, 0, 0)
+ later: rgb(0, 0, 0)
+The subtree moved below the ancestor, ancestor off
+ byClass: rgb(0, 0, 0)
+ byId: rgb(0, 0, 0)
+ byAttribute: rgb(0, 0, 0)
+ byChild: rgb(0, 0, 0)
+ byWhere: rgb(0, 0, 0)
+ inserted: rgb(0, 0, 0)
+ together: rgb(0, 0, 0)
+ moved: rgb(0, 0, 0)
+ next: rgb(0, 0, 0)
+ later: rgb(0, 0, 0)
+The subtree moved below the ancestor, ancestor on
+ byClass: rgb(0, 128, 0)
+ byId: rgb(0, 128, 0)
+ byAttribute: rgb(0, 128, 0)
+ byChild: rgb(0, 128, 0)
+ byWhere: rgb(0, 128, 0)
+ inserted: rgb(0, 128, 0)
+ together: rgb(0, 128, 0)
+ moved: rgb(0, 128, 0)
+ next: rgb(0, 128, 0)
+ later: rgb(0, 128, 0)
+The subtree moved out again, ancestor on
+ byClass: rgb(0, 128, 0)
+ byId: rgb(0, 128, 0)
+ byAttribute: rgb(0, 128, 0)
+ byChild: rgb(0, 128, 0)
+ byWhere: rgb(0, 128, 0)
+ inserted: rgb(0, 128, 0)
+ together: rgb(0, 128, 0)
+ moved: rgb(0, 0, 0)
next: rgb(0, 128, 0)
later: rgb(0, 128, 0)
diff --git a/Tests/LibWeb/Text/expected/css/style-memory/bytes-per-animated-element.txt b/Tests/LibWeb/Text/expected/css/style-memory/bytes-per-animated-element.txt
index 18a8ed64051..6b710eab4c5 100644
--- a/Tests/LibWeb/Text/expected/css/style-memory/bytes-per-animated-element.txt
+++ b/Tests/LibWeb/Text/expected/css/style-memory/bytes-per-animated-element.txt
@@ -13,7 +13,7 @@ animation: 500 elements
retainedSlots: within 36
recordCells: within 4
installed: within 124
- projection: within 52
+ projection: within 60
hostTree: within 24
elementDeclarations: within 0
heldRecordMaps: within 12
@@ -41,7 +41,7 @@ transition: 500 elements
retainedSlots: within 36
recordCells: within 4
installed: within 92
- projection: within 52
+ projection: within 60
hostTree: within 24
elementDeclarations: within 0
heldRecordMaps: within 12
diff --git a/Tests/LibWeb/Text/expected/css/style-memory/bytes-per-element-by-owner.txt b/Tests/LibWeb/Text/expected/css/style-memory/bytes-per-element-by-owner.txt
index 871377c8349..79fefd221af 100644
--- a/Tests/LibWeb/Text/expected/css/style-memory/bytes-per-element-by-owner.txt
+++ b/Tests/LibWeb/Text/expected/css/style-memory/bytes-per-element-by-owner.txt
@@ -13,7 +13,7 @@ shared: 500 elements, 500 styled
retainedSlots: within 36
recordCells: within 4
installed: within 20
- projection: within 52
+ projection: within 60
hostTree: within 24
elementDeclarations: within 0
heldRecordMaps: within 12
@@ -41,7 +41,7 @@ custom: 500 elements, 500 styled
retainedSlots: within 36
recordCells: within 0
installed: within 48
- projection: within 52
+ projection: within 60
hostTree: within 24
elementDeclarations: within 88
heldRecordMaps: within 12
@@ -69,7 +69,7 @@ unique: 500 elements, 500 styled
retainedSlots: within 36
recordCells: within 0
installed: within 40
- projection: within 52
+ projection: within 60
hostTree: within 24
elementDeclarations: within 40
heldRecordMaps: within 12
@@ -97,7 +97,7 @@ uniqueFont: 500 elements, 500 styled
retainedSlots: within 36
recordCells: within 0
installed: within 38
- projection: within 52
+ projection: within 60
hostTree: within 24
elementDeclarations: within 40
heldRecordMaps: within 12
@@ -125,7 +125,7 @@ uniqueVisual: 500 elements, 500 styled
retainedSlots: within 36
recordCells: within 0
installed: within 60
- projection: within 52
+ projection: within 60
hostTree: within 24
elementDeclarations: within 40
heldRecordMaps: within 12
@@ -153,7 +153,7 @@ substituted: 500 elements, 500 styled
retainedSlots: within 36
recordCells: within 0
installed: within 36
- projection: within 44
+ projection: within 52
hostTree: within 24
elementDeclarations: within 84
heldRecordMaps: within 12
diff --git a/Tests/LibWeb/Text/expected/css/style-memory/bytes-per-element-reading-style-text.txt b/Tests/LibWeb/Text/expected/css/style-memory/bytes-per-element-reading-style-text.txt
index 975c42013f2..774c8c96474 100644
--- a/Tests/LibWeb/Text/expected/css/style-memory/bytes-per-element-reading-style-text.txt
+++ b/Tests/LibWeb/Text/expected/css/style-memory/bytes-per-element-reading-style-text.txt
@@ -1,2 +1,2 @@
-projection: within 148
+projection: within 156
hostMemo: within 52
diff --git a/Tests/LibWeb/Text/input/css/combinator-invalidation-reaches-keys-that-arrive-late.html b/Tests/LibWeb/Text/input/css/combinator-invalidation-reaches-keys-that-arrive-late.html
index 2bc61675b84..1801fb07f32 100644
--- a/Tests/LibWeb/Text/input/css/combinator-invalidation-reaches-keys-that-arrive-late.html
+++ b/Tests/LibWeb/Text/input/css/combinator-invalidation-reaches-keys-that-arrive-late.html
@@ -11,6 +11,7 @@
.on :where(.late-where),
.on .late-inserted,
.on .late-together,
+ .on .late-moved,
.on + .late-next,
.on ~ .late-later {
color: rgb(0, 128, 0);
@@ -26,7 +27,11 @@
const next = ancestor.nextElementSibling;
const later = next.nextElementSibling;
const inserted = document.createElement("div");
- const elements = { byClass, byId, byAttribute, byChild, byWhere, inserted, together, next, later };
+ const subtree = document.createElement("div");
+ subtree.innerHTML = "<div><div></div></div>";
+ const moved = subtree.firstChild.firstChild;
+ document.body.appendChild(subtree);
+ const elements = { byClass, byId, byAttribute, byChild, byWhere, inserted, together, moved, next, later };
const report = step => {
println(step);
@@ -58,5 +63,15 @@
together.className = "late-together";
ancestor.classList.add("on");
report("A key arrived together with the change of the ancestor");
+
+ ancestor.classList.remove("on");
+ moved.className = "late-moved";
+ report("A key arrived in a subtree outside the ancestor, ancestor off");
+ ancestor.appendChild(subtree);
+ report("The subtree moved below the ancestor, ancestor off");
+ ancestor.classList.add("on");
+ report("The subtree moved below the ancestor, ancestor on");
+ document.body.appendChild(subtree);
+ report("The subtree moved out again, ancestor on");
});
</script>
diff --git a/Tests/LibWeb/Text/input/css/style-memory/bytes-per-animated-element.html b/Tests/LibWeb/Text/input/css/style-memory/bytes-per-animated-element.html
index e0d935ca426..3f8f611c00b 100644
--- a/Tests/LibWeb/Text/input/css/style-memory/bytes-per-animated-element.html
+++ b/Tests/LibWeb/Text/input/css/style-memory/bytes-per-animated-element.html
@@ -54,7 +54,7 @@
retainedSlots: 36,
recordCells: 4,
installed: 124,
- projection: 52,
+ projection: 60,
hostTree: 24,
heldRecordMaps: 12,
layoutStyleColumns: 28,
@@ -70,7 +70,7 @@
retainedSlots: 36,
recordCells: 4,
installed: 92,
- projection: 52,
+ projection: 60,
hostTree: 24,
heldRecordMaps: 12,
layoutStyleColumns: 28,
diff --git a/Tests/LibWeb/Text/input/css/style-memory/bytes-per-element-by-owner.html b/Tests/LibWeb/Text/input/css/style-memory/bytes-per-element-by-owner.html
index 5ad3f74335d..716c82a1c62 100644
--- a/Tests/LibWeb/Text/input/css/style-memory/bytes-per-element-by-owner.html
+++ b/Tests/LibWeb/Text/input/css/style-memory/bytes-per-element-by-owner.html
@@ -43,8 +43,8 @@
// - layoutStyleColumns: the layout object's style pointer.
// - styleValues, elementDeclarations: the inline style property set.
// - customProperties: the inherited variables map.
- // - projection: a row per element: tag, flags, host facts, states, interned fact lists pointer, dispatch bloom and
- // element links.
+ // - projection: a row per element: tag, flags, host facts, states, interned fact lists pointer, dispatch bloom,
+ // the summary of the names its descendants carry and element links.
// - hostTree: the DOM child sequence (text nodes included) and unique node id of each node.
// - hostMemo: the atoms of the names the host interned, here each element's style attribute text, and the
// environments the engine holds.
@@ -55,7 +55,7 @@
retainedSlots: 36,
recordCells: 4,
installed: 20,
- projection: 52,
+ projection: 60,
hostTree: 24,
heldRecordMaps: 12,
layoutStyleColumns: 28,
@@ -69,7 +69,7 @@
customProperties: 280,
retainedSlots: 36,
installed: 48,
- projection: 52,
+ projection: 60,
hostTree: 24,
elementDeclarations: 88,
layoutStyleColumns: 28,
@@ -85,7 +85,7 @@
customProperties: 448,
retainedSlots: 36,
installed: 36,
- projection: 44,
+ projection: 52,
hostTree: 24,
elementDeclarations: 84,
layoutStyleColumns: 28,
@@ -100,7 +100,7 @@
groupValueFacts: 4,
retainedSlots: 36,
installed: 40,
- projection: 52,
+ projection: 60,
hostTree: 24,
elementDeclarations: 40,
layoutStyleColumns: 28,
@@ -114,7 +114,7 @@
groupValueFacts: 4,
retainedSlots: 36,
installed: 38,
- projection: 52,
+ projection: 60,
hostTree: 24,
elementDeclarations: 40,
heldRecordMaps: 12,
@@ -133,7 +133,7 @@
groupValueFacts: 4,
retainedSlots: 36,
installed: 60,
- projection: 52,
+ projection: 60,
hostTree: 24,
elementDeclarations: 40,
layoutStyleColumns: 28,
diff --git a/Tests/LibWeb/Text/input/css/style-memory/bytes-per-element-reading-style-text.html b/Tests/LibWeb/Text/input/css/style-memory/bytes-per-element-reading-style-text.html
index a31fe646598..1d74811b4f7 100644
--- a/Tests/LibWeb/Text/input/css/style-memory/bytes-per-element-reading-style-text.html
+++ b/Tests/LibWeb/Text/input/css/style-memory/bytes-per-element-reading-style-text.html
@@ -16,7 +16,7 @@
}
const budgets = {
- projection: 148,
+ projection: 156,
hostMemo: 52,
};