Skip to content

Truly independent web browser

LibWeb: Read layout passes from the layout trace instead of counters

Aliaksandr Kalenik1a689e06eb4e
diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp
index 870973cbbef..63697ba4c47 100644
--- a/Libraries/LibWeb/DOM/Document.cpp
+++ b/Libraries/LibWeb/DOM/Document.cpp
@@ -956,16 +956,6 @@ bool Document::is_running_update_layout() const
return m_layout_node_arena && Layout::RustFFI::document_host_update_layout_is_running(m_layout_node_arena->host());
}
-u64 Document::partial_layout_count() const
-{
- return m_layout_node_arena ? Layout::RustFFI::render_state_layout_counts(m_layout_node_arena->host()).partial_layouts : 0;
-}
-
-u64 Document::full_layout_count() const
-{
- return m_layout_node_arena ? Layout::RustFFI::render_state_layout_counts(m_layout_node_arena->host()).full_layouts : 0;
-}
-
Layout::RustFFI::FfiLayoutCounts Document::layout_counts() const
{
return m_layout_node_arena ? Layout::RustFFI::render_state_layout_counts(m_layout_node_arena->host()) : Layout::RustFFI::FfiLayoutCounts {};
diff --git a/Libraries/LibWeb/DOM/Document.h b/Libraries/LibWeb/DOM/Document.h
index 38e27dad6d6..d45211cebaf 100644
--- a/Libraries/LibWeb/DOM/Document.h
+++ b/Libraries/LibWeb/DOM/Document.h
@@ -649,8 +649,6 @@ public:
void update_layout(UpdateLayoutReason, ThrottledAnimationSamplingScope);
void update_style_and_layout_once(Layout::BegunRead const&, UpdateLayoutReason, ThrottledAnimationSamplingScope);
void update_layout_if_needed_for_node(Node const&, UpdateLayoutReason);
- [[nodiscard]] u64 partial_layout_count() const;
- [[nodiscard]] u64 full_layout_count() const;
[[nodiscard]] bool layout_is_up_to_date() const;
[[nodiscard]] bool layout_is_known_stale() const;
void clear_devtools_layout_inspection_data();
@@ -1519,7 +1517,6 @@ public:
u64 style_update_bridge_microseconds { 0 };
u64 style_update_apply_microseconds { 0 };
u64 style_update_remainder_microseconds { 0 };
- u64 relayouts_performed { 0 };
u64 style_update_microseconds { 0 };
};
StyleInvalidationCounters& style_invalidation_counters() const { return m_style_invalidation_counters; }
diff --git a/Libraries/LibWeb/Internals/Internals.cpp b/Libraries/LibWeb/Internals/Internals.cpp
index 31e14e82b9e..9de98a5adc6 100644
--- a/Libraries/LibWeb/Internals/Internals.cpp
+++ b/Libraries/LibWeb/Internals/Internals.cpp
@@ -1546,16 +1546,6 @@ void Internals::set_content_blocking_enabled(bool enabled)
page().set_content_blocking_policy(enabled, {});
}
-WebIDL::UnsignedLongLong Internals::partial_layout_count()
-{
- return window().associated_document().partial_layout_count();
-}
-
-WebIDL::UnsignedLongLong Internals::full_layout_count()
-{
- return window().associated_document().full_layout_count();
-}
-
void Internals::begin_layout_trace()
{
// A script reads the render state, which waits for a frame in flight.
@@ -3976,7 +3966,6 @@ GC::Ref<JS::Object> Internals::style_invalidation_counters_object() const
object->define_direct_property("styleEngineTransactionSetups"_utf16_fly_string, JS::Value(counters.style_engine_transaction_setups), JS::default_attributes);
object->define_direct_property("styleEngineTransactionSetupMicroseconds"_utf16_fly_string, JS::Value(counters.style_engine_transaction_setup_microseconds), JS::default_attributes);
object->define_direct_property("styleEnginePlanningMicroseconds"_utf16_fly_string, JS::Value(counters.style_update_bridge_microseconds), JS::default_attributes);
- object->define_direct_property("relayoutsPerformed"_utf16_fly_string, JS::Value(counters.relayouts_performed), JS::default_attributes);
object->define_direct_property("styleUpdateMicroseconds"_utf16_fly_string, JS::Value(counters.style_update_microseconds), JS::default_attributes);
object->define_direct_property("styleUpdateSubmissionMicroseconds"_utf16_fly_string, JS::Value(counters.style_update_submission_microseconds), JS::default_attributes);
object->define_direct_property("styleUpdateBridgeMicroseconds"_utf16_fly_string, JS::Value(counters.style_update_bridge_microseconds), JS::default_attributes);
diff --git a/Libraries/LibWeb/Internals/Internals.h b/Libraries/LibWeb/Internals/Internals.h
index df7110a62d5..912a65087cf 100644
--- a/Libraries/LibWeb/Internals/Internals.h
+++ b/Libraries/LibWeb/Internals/Internals.h
@@ -188,8 +188,6 @@ public:
WebIDL::ExceptionOr<void> set_content_blockers(Utf16String const& patterns);
WebIDL::ExceptionOr<void> set_site_compatibility_data(Utf16String const& source);
void set_content_blocking_enabled(bool enabled);
- WebIDL::UnsignedLongLong partial_layout_count();
- WebIDL::UnsignedLongLong full_layout_count();
void begin_layout_trace();
void update_layout_for_testing();
Utf16String take_layout_trace();
diff --git a/Libraries/LibWeb/Internals/Internals.idl b/Libraries/LibWeb/Internals/Internals.idl
index 79601b13116..75c8c9f2f23 100644
--- a/Libraries/LibWeb/Internals/Internals.idl
+++ b/Libraries/LibWeb/Internals/Internals.idl
@@ -195,8 +195,6 @@ interface Internals {
undefined setContentBlockers(DOMString patterns);
undefined setSiteCompatibilityData(DOMString source);
undefined setContentBlockingEnabled(boolean enabled);
- unsigned long long partialLayoutCount();
- unsigned long long fullLayoutCount();
undefined beginLayoutTrace();
undefined updateLayoutForTesting();
DOMString takeLayoutTrace();
diff --git a/Libraries/LibWeb/Layout/UpdateLayout.cpp b/Libraries/LibWeb/Layout/UpdateLayout.cpp
index 253e915c8a8..ee07aae10af 100644
--- a/Libraries/LibWeb/Layout/UpdateLayout.cpp
+++ b/Libraries/LibWeb/Layout/UpdateLayout.cpp
@@ -84,7 +84,6 @@ Layout::RustFFI::FfiLayoutUpdateHostCallbacks Document::layout_update_host_callb
document.m_paint_state = make<Painting::DocumentPaintState>(arena); },
.reconcile_stale_list_item_counters_after_tree_build = [](void* context, Layout::RustFFI::FfiNodeIdentity const* rebuilt_roots, size_t count) -> bool { return static_cast<Document*>(context)->reconcile_stale_list_item_counters_after_tree_build({ rebuilt_roots, count }); },
.after_layout_commit = [](void* context, Layout::BegunRead const* read, bool layout_tree_changed) { static_cast<Document*>(context)->after_layout_commit(*read, layout_tree_changed ? LayoutTreeChanged::Yes : LayoutTreeChanged::No); },
- .note_full_layout_performed = [](void* context) { static_cast<Document*>(context)->style_invalidation_counters().relayouts_performed++; },
.evaluate_pending_container_queries = [](void* context, Layout::BegunRead const* read) { static_cast<Document*>(context)->style_computer().style_engine().evaluate_size_containers_needing_evaluation_after_layout(*read); },
.record_stabilization_bound_failure = [](void* context, Layout::BegunRead const* read) -> Layout::RustFFI::FfiStabilizationBoundFailureHostFacts {
auto& document = *static_cast<Document*>(context);
diff --git a/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs b/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
index c42b19c1cc3..eb8630bb0ca 100644
--- a/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
+++ b/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
@@ -1137,8 +1137,6 @@ pub(crate) struct LayoutNodeArena {
/// Every box must be recreated by the next layout tree build; set when the tree is torn down
/// or a build finds a box it cannot place among rebuilt roots, cleared by the full pass.
needs_full_layout_tree_update: bool,
- partial_layout_count: u64,
- full_layout_count: u64,
/// How many layouts were committed, full and partial.
layout_commit_count: u64,
/// Per slot, which fragment held the box's committed link when a commit last met it.
@@ -1276,8 +1274,6 @@ impl LayoutNodeArena {
pending_rebuilt_subtree_roots: Vec::new(),
pending_layout_tree_update_escaped_rebuild_roots: false,
needs_full_layout_tree_update: (false),
- partial_layout_count: (0),
- full_layout_count: (0),
layout_commit_count: 0,
committed_link_holders: ForkVec::default(),
pass_level_committed_links: Vec::new(),
@@ -3239,22 +3235,6 @@ impl LayoutNodeArena {
self.pending_layout_tree_update_escaped_rebuild_roots = false;
}
- pub(crate) fn note_partial_layout(&mut self) {
- self.partial_layout_count += 1;
- }
-
- pub(crate) fn note_full_layout(&mut self) {
- self.full_layout_count += 1;
- }
-
- pub(crate) fn partial_layout_count(&self) -> u64 {
- self.partial_layout_count
- }
-
- pub(crate) fn full_layout_count(&self) -> u64 {
- self.full_layout_count
- }
-
pub(crate) fn record_layout_tree_build(&mut self, outcome: &FfiLayoutTreeBuildOutcome) {
let stats = self.layout_tree_build_stats;
self.layout_tree_build_stats = FfiLayoutTreeBuildStats {
diff --git a/Libraries/LibWeb/Rust/src/layout/update_layout.rs b/Libraries/LibWeb/Rust/src/layout/update_layout.rs
index 7b2ab8a4918..802dbfc4de4 100644
--- a/Libraries/LibWeb/Rust/src/layout/update_layout.rs
+++ b/Libraries/LibWeb/Rust/src/layout/update_layout.rs
@@ -88,7 +88,6 @@ pub struct FfiLayoutUpdateHostCallbacks {
extern "C" fn(*mut c_void, *const FfiNodeIdentity, usize) -> bool,
/// Refreshes what derives from committed layout; the flag says whether the tree changed.
after_layout_commit: extern "C" fn(*mut c_void, &BegunRead, bool),
- note_full_layout_performed: extern "C" fn(*mut c_void),
evaluate_pending_container_queries: extern "C" fn(*mut c_void, &BegunRead),
/// Records that a layout update ran out of its exact bound, and answers what the document still has pending, for
/// the panic that reports the failure, describing the elements the last unstyled-element report and the last
@@ -230,10 +229,6 @@ impl FfiLayoutUpdateHostCallbacks {
(self.after_layout_commit)(self.context, read, layout_tree_changed);
}
- fn note_full_layout_performed(&self, _: &MainThread) {
- (self.note_full_layout_performed)(self.context);
- }
-
fn evaluate_pending_container_queries(&self, _: &MainThread, read: &BegunRead) {
(self.evaluate_pending_container_queries)(self.context, read);
}
@@ -840,7 +835,6 @@ impl LayoutRoundJob {
for boundary in planned {
answer.commits.push(lay_out_boundary(state, boundary, stage));
}
- state.arena_mut().note_partial_layout();
answer.end = LayoutRoundEnd::PartialLayout;
return answer;
}
@@ -877,7 +871,6 @@ impl LayoutRoundJob {
facts.should_collect_devtools_layout_data,
);
answer.commits.push(commit);
- state.arena_mut().note_full_layout();
answer
}
@@ -1086,7 +1079,6 @@ fn take_flown_layout_in(main_thread: &MainThread, document_host: &DocumentHost,
LayoutRoundEnd::Built { .. } | LayoutRoundEnd::NeedsDocumentStyle => return false,
LayoutRoundEnd::PartialLayout => host.after_layout_commit(main_thread, read, rebuilds_tree),
LayoutRoundEnd::FullLayout => {
- host.note_full_layout_performed(main_thread);
host.after_layout_commit(main_thread, read, true);
host.evaluate_pending_container_queries(main_thread, read);
}
@@ -1228,7 +1220,6 @@ fn update_layout(
Some(LayoutRoundEnd::FullLayout) => {}
}
- host.note_full_layout_performed(main_thread);
host.after_layout_commit(main_thread, read, true);
host.evaluate_pending_container_queries(main_thread, read);
@@ -1379,22 +1370,15 @@ mod tests {
}
#[test]
- fn the_layout_counters_start_at_zero_and_count_each_pass() {
+ fn the_layout_tree_build_stats_start_at_zero_and_count_each_build() {
let mut arena = LayoutNodeArena::new();
- assert_eq!(arena.partial_layout_count(), 0);
- assert_eq!(arena.full_layout_count(), 0);
assert_eq!(arena.layout_tree_build_stats().builds, 0);
- arena.note_partial_layout();
- arena.note_full_layout();
- arena.note_full_layout();
arena.record_layout_tree_build(&FfiLayoutTreeBuildOutcome {
viewport: NodeSlotId::INVALID,
rebuilt_subtree_root_count: 3,
layout_tree_update_escaped_rebuild_roots: true,
needs_another_build_pass: false,
});
- assert_eq!(arena.partial_layout_count(), 1);
- assert_eq!(arena.full_layout_count(), 2);
let stats = arena.layout_tree_build_stats();
assert_eq!(stats.builds, 1);
assert_eq!(stats.last_build_rebuilt_subtree_roots, 3);
diff --git a/Libraries/LibWeb/Rust/src/render_state/devtools.rs b/Libraries/LibWeb/Rust/src/render_state/devtools.rs
index fef9a52ca51..f424834f180 100644
--- a/Libraries/LibWeb/Rust/src/render_state/devtools.rs
+++ b/Libraries/LibWeb/Rust/src/render_state/devtools.rs
@@ -9,12 +9,10 @@
use super::{DocumentHost, ScriptForcedRead};
use crate::layout::LayoutNodeArena;
-/// How many layout passes and tree builds a document's layout has run.
+/// How many tree builds a document's layout has run, and what the last one rebuilt.
#[repr(C)]
#[derive(Clone, Copy, Default)]
pub struct FfiLayoutCounts {
- pub full_layouts: u64,
- pub partial_layouts: u64,
pub tree_builds: u64,
pub last_tree_build_rebuilt_subtree_roots: u64,
pub last_tree_build_escaped_rebuild_roots: bool,
@@ -48,8 +46,6 @@ pub extern "C" fn render_state_layout_counts(host: &DocumentHost) -> FfiLayoutCo
read_arena(host, |arena| {
let tree_builds = arena.layout_tree_build_stats();
FfiLayoutCounts {
- full_layouts: arena.full_layout_count(),
- partial_layouts: arena.partial_layout_count(),
tree_builds: tree_builds.builds,
last_tree_build_rebuilt_subtree_roots: tree_builds.last_build_rebuilt_subtree_roots,
last_tree_build_escaped_rebuild_roots: tree_builds.last_build_escaped_rebuild_roots,
diff --git a/Tests/LibWeb/Text/expected/Editing/execCommand-in-textarea-reveals-caret-once.txt b/Tests/LibWeb/Text/expected/Editing/execCommand-in-textarea-reveals-caret-once.txt
index eb8f8dc1d38..5cf620d2625 100644
--- a/Tests/LibWeb/Text/expected/Editing/execCommand-in-textarea-reveals-caret-once.txt
+++ b/Tests/LibWeb/Text/expected/Editing/execCommand-in-textarea-reveals-caret-once.txt
@@ -1,2 +1,2 @@
-layouts during edits: 0
+layout during edits: (no layout)
caret revealed after the next rendering update: true
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-after-escaping-descendant-removal.txt b/Tests/LibWeb/Text/expected/abspos-relayout-after-escaping-descendant-removal.txt
deleted file mode 100644
index 7b354e0538f..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-after-escaping-descendant-removal.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-one escaping descendant remains: partial=0 full=1
-last escaping descendant removed: partial=1 full=0
-escaping subtree moved away: partial=1 full=0
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-anchor-dependencies.txt b/Tests/LibWeb/Text/expected/abspos-relayout-anchor-dependencies.txt
deleted file mode 100644
index 4fba6f22514..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-anchor-dependencies.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-Move a provider inside the boundary: true
-Rebuild a boundary containing a provider: true
-Move the provider's boundary: true
-Batch unrelated and provider changes: true
-Unrelated boundary also updated: true
-Rename a provider: true
-Restore a provider name: true
-Clear a provider name: true
-Add a provider name: true
-Remove an in-flow provider: true
-Insert an abspos provider: true
-Remove a directly contained abspos provider: true
-Insert a subtree containing a provider: true
-Remove a subtree containing a provider: true
-Boundary containing an unresolved consumer: true
-Nested fallback position: true
-Boundary containing a position-area consumer: true
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-anchor-elsewhere.txt b/Tests/LibWeb/Text/expected/abspos-relayout-anchor-elsewhere.txt
deleted file mode 100644
index 12a44dae276..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-anchor-elsewhere.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-layout-passes partial=1 full=0
-tooltip-before=90,0,50,15
-tooltip-after=90,0,50,15
-child=40,120,70,50
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-anchor-inset-style-change.txt b/Tests/LibWeb/Text/expected/abspos-relayout-anchor-inset-style-change.txt
deleted file mode 100644
index 5f073137a12..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-anchor-inset-style-change.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-layout-passes partial=0 full=1
-anchor=60,40,100,30
-anchored-before=10,10,80,25
-anchored-after=160,40,80,25
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-anchor-name-inside.txt b/Tests/LibWeb/Text/expected/abspos-relayout-anchor-name-inside.txt
deleted file mode 100644
index 2d9edb71883..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-anchor-name-inside.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-layout-passes partial=0 full=1
-anchor-before=50,70,50,20
-target-before=50,90,60,25
-anchor-after=50,100,50,20
-target-after=50,120,60,25
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-anchor-name-removal.txt b/Tests/LibWeb/Text/expected/abspos-relayout-anchor-name-removal.txt
deleted file mode 100644
index ca7aa634001..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-anchor-name-removal.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-layout-passes partial=0 full=1
-consumer-before=100,70,60,25
-consumer-after=5,5,60,25
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-anchor-repaint-restyle.txt b/Tests/LibWeb/Text/expected/abspos-relayout-anchor-repaint-restyle.txt
deleted file mode 100644
index b07980a7d6f..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-anchor-repaint-restyle.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-layout-passes partial=0 full=1
-anchored=60,70,120,60
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-anchor-target-boundary.txt b/Tests/LibWeb/Text/expected/abspos-relayout-anchor-target-boundary.txt
deleted file mode 100644
index 458dd805cb0..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-anchor-target-boundary.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-layout-passes partial=0 full=1
-anchor=40,30,100,30
-anchored-before=40,60,120,20
-anchored-after=40,60,120,60
-inner=40,60,80,60
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-anchors.txt b/Tests/LibWeb/Text/expected/abspos-relayout-anchors.txt
new file mode 100644
index 00000000000..4b86d33fc2c
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/abspos-relayout-anchors.txt
@@ -0,0 +1,89 @@
+Anchor providers inside a boundary and their consumers:
+ Move a provider inside the boundary: FULL
+ consumer=80,90
+ Rebuild a boundary containing a provider: FULL
+ consumer=80,90
+ Move the provider's boundary: FULL
+ consumer=110,90
+ Batch unrelated and provider changes: FULL
+ consumer=120,90
+ Unrelated boundary also updated: true
+ Rename a provider: FULL
+ consumer=5,5
+ Restore a provider name: FULL
+ consumer=120,90
+ Clear a provider name: FULL
+ consumer=5,5
+ Add a provider name: FULL
+ consumer=120,90
+ Remove an in-flow provider: FULL
+ consumer=5,5
+ Insert an abspos provider: FULL
+ consumer=130,140
+ Remove a directly contained abspos provider: FULL
+ consumer=5,5
+ Insert a subtree containing a provider: FULL
+ consumer=110,160
+ Remove a subtree containing a provider: FULL
+ consumer=5,5
+ Boundary containing an unresolved consumer: FULL
+ consumer=5,5
+ Nested fallback position: true
+ Boundary containing a position-area consumer: FULL
+ consumer=5,5
+anchor() insets from a style change:
+ Set anchor() insets: FULL
+ anchor=60,40,100,30
+ anchored-before=10,10,80,25
+ anchored-after=160,40,80,25
+anchor-name inside a boundary:
+ Move the anchor: FULL
+ anchor-before=50,70,50,20
+ target-before=50,90,60,25
+ anchor-after=50,100,50,20
+ target-after=50,120,60,25
+Anchor provider removal:
+ Remove the anchor: FULL
+ consumer-before=100,70,60,25
+ consumer-after=5,5,60,25
+Repaint-only restyle of an anchored box:
+ Change color and grow the inner box: FULL
+ anchored=60,70,120,60
+Change inside a box with anchor() insets:
+ Grow the inner box: FULL
+ anchor=40,30,100,30
+ anchored-before=40,60,120,20
+ anchored-after=40,60,120,60
+ inner=40,60,80,60
+Boundaries unrelated to anchors:
+ Change unrelated subtree: PARTIAL BlockContainer<DIV>#boundary
+ Boundary resizes: true
+ Move unrelated boundary: PARTIAL BlockContainer<DIV>#boundary
+ Boundary position: true
+ Rebuild unrelated boundary: PARTIAL BlockContainer<DIV>#boundary
+ Consumer stays anchored: true
+ Insert unrelated abspos: PARTIAL BlockContainer<DIV>.control
+ Inserted position: true
+ Move unrelated abspos between parents: PARTIAL BlockContainer<DIV>.control
+ Moved position: true
+ Remove unrelated abspos without layout: (no layout)
+ Consumer survives unrelated removal: true
+ Unresolved consumer outside boundary: PARTIAL BlockContainer<DIV>#boundary
+ Consumer keeps fallback: true
+ Position-area consumer outside boundary: PARTIAL BlockContainer<DIV>#boundary
+ Boundary inside an anchor provider: PARTIAL BlockContainer<DIV>#boundary
+ Anchor size unchanged: true
+ Remove last contained consumer without layout: (no layout)
+Anchor names without consumers:
+ Move control with unused header anchor: PARTIAL BlockContainer<DIV>.control
+ Control position: 30,80
+ Insert anchor consumer: FULL
+ Consumer position: 130,40
+ Move control with active consumer: PARTIAL BlockContainer<DIV>.control
+ Remove last consumer: PARTIAL BlockContainer<DIV>.control
+ Hidden consumer: PARTIAL BlockContainer<DIV>.control
+ Show consumer: FULL
+ Static consumer: PARTIAL BlockContainer<DIV>.control
+ Make consumer positioned again: FULL
+ position-area consumer: PARTIAL BlockContainer<DIV>.control
+ Remove position-area dependency: PARTIAL BlockContainer<DIV>.control
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-append-direct-many.txt b/Tests/LibWeb/Text/expected/abspos-relayout-append-direct-many.txt
deleted file mode 100644
index d82ccfb0fe6..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-append-direct-many.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-one=45,40,20,15
-two=75,55,25,10
-three=95,80,30,12
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-aspect-ratio.txt b/Tests/LibWeb/Text/expected/abspos-relayout-aspect-ratio.txt
deleted file mode 100644
index 2618d92a0aa..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-aspect-ratio.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-boundary=20,10,150,100
-content=20,10,80,30
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-backdrop-style-change.txt b/Tests/LibWeb/Text/expected/abspos-relayout-backdrop-style-change.txt
deleted file mode 100644
index 30c3bf84a19..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-backdrop-style-change.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-layout-passes partial=0 full=1
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-basic.txt b/Tests/LibWeb/Text/expected/abspos-relayout-basic.txt
deleted file mode 100644
index 7bb47d088f6..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-basic.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-child=40,30,70,60
-outside-before=0,120,200,25
-outside-after=0,120,200,25
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-boundary-style-change.txt b/Tests/LibWeb/Text/expected/abspos-relayout-boundary-style-change.txt
deleted file mode 100644
index 290d4955c40..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-boundary-style-change.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-boundary=40,30,180,90
-child=180,45,30,20
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-confined-containing-blocks.txt b/Tests/LibWeb/Text/expected/abspos-relayout-confined-containing-blocks.txt
new file mode 100644
index 00000000000..e464fa5ef30
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/abspos-relayout-confined-containing-blocks.txt
@@ -0,0 +1,30 @@
+fixed-cb: PARTIAL BlockContainer<DIV>#boundary
+ boundary=60,70,180,110
+ fixed=75,80,40,20
+ sibling=60,70,80,65
+inline-containing-block: PARTIAL BlockContainer<DIV>#boundary
+ boundary-before=57.53125,32,120,40
+ boundary-after=57.53125,32,120,40
+ content-width=60
+rtl-static-position: PARTIAL BlockContainer<DIV>#live.boundary
+ live=180,10,120,40
+ reference=180,10,120,40
+static-position: PARTIAL BlockContainer<DIV>#boundary
+ boundary-before=0,70,120,70
+ boundary-after=0,70,120,70
+ child=0,70,80,55
+container-query: PARTIAL BlockContainer<DIV>#boundary
+ color-before=rgb(0, 0, 0)
+ container=10,10,200,60
+ color-after=rgb(0, 128, 0)
+scroller: PARTIAL BlockContainer<DIV>#boundary
+ scrollTop=150
+ hit=probe
+shadow-dom: PARTIAL BlockContainer<DIV>#boundary
+ shadow-child=55,35,30,20
+svg-inside: PARTIAL SVGSVGBox<svg>#svg
+ boundary=40,50,220,160
+ svg=40,50,100,80
+ sibling-before=40,130,70,20
+ sibling-after=40,130,70,20
+ page-sibling=0,220,120,30
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-confined-insertions-and-removals.txt b/Tests/LibWeb/Text/expected/abspos-relayout-confined-insertions-and-removals.txt
new file mode 100644
index 00000000000..a60aca64c8f
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/abspos-relayout-confined-insertions-and-removals.txt
@@ -0,0 +1,49 @@
+append-direct-many: PARTIAL BlockContainer<DIV>#boundary
+ one=45,40,20,15
+ two=75,55,25,10
+ three=95,80,30,12
+continuation: PARTIAL BlockContainer<DIV>#live-boundary.boundary
+ rects-match=true
+direct-child-geometry: PARTIAL BlockContainer<DIV>#live-boundary.boundary
+ live=50,0,14,16
+ reference=50,0,14,16
+insert-direct-child: PARTIAL BlockContainer<DIV>#boundary
+ inserted=50,45,30,20
+insert-flex-anonymous-item flex: PARTIAL BlockContainer<DIV>#flex-boundary.boundary
+ flex-before=20,10,40,100
+ flex-after=20,10,160,100
+insert-flex-anonymous-item grid: PARTIAL BlockContainer<DIV>#grid-boundary.boundary
+ grid-before=20,130,40,100
+ grid-after=20,130,160,100
+insert-flex-anonymous-item nested: PARTIAL BlockContainer<DIV>#nested-boundary.boundary
+ nested-before=260,10,40,100
+ nested-after=260,10,190,100
+insert-flex-anonymous-item text: PARTIAL BlockContainer<DIV>#text-boundary.boundary
+ text-before=260,130,40,100
+ text-width-grew=true
+insert-static-position: PARTIAL BlockContainer<DIV>#live-boundary.boundary
+ live=0,25,40,15
+ reference=0,25,40,15
+insert-table-row: PARTIAL BlockContainer<DIV>#boundary
+ live-new=0,20,50,20
+ outside-before=0,20,50,20
+ outside-after=0,20,50,20
+insert-under-descendant: PARTIAL BlockContainer<DIV>#boundary
+ inserted=55,40,35,20
+ outside-before=0,130,120,25
+ outside-after=0,130,120,25
+move-before: PARTIAL BlockContainer<DIV>#live-boundary.boundary
+ live=80,0,10,10
+ reference=80,0,10,10
+ paint-count=1
+ old-hit-is-moved=false
+remove-reinsert: PARTIAL BlockContainer<DIV>#boundary
+ moving=55,40,35,20
+remove-under-descendant: PARTIAL BlockContainer<DIV>#boundary
+ hit-removed=false
+ paint-count=0
+ outside-before=0,130,120,25
+ outside-after=0,130,120,25
+text-into-boundary: PARTIAL BlockContainer<DIV>#boundary
+ boundary-before=40,30,150,90
+ boundary-after=40,30,150,90
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-confined-moves.txt b/Tests/LibWeb/Text/expected/abspos-relayout-confined-moves.txt
new file mode 100644
index 00000000000..05c63a14d1f
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/abspos-relayout-confined-moves.txt
@@ -0,0 +1,57 @@
+basic: PARTIAL BlockContainer<DIV>#boundary
+ child=40,30,70,60
+ outside-before=0,120,200,25
+ outside-after=0,120,200,25
+anchor-elsewhere: PARTIAL BlockContainer<DIV>#boundary
+ tooltip-before=90,0,50,15
+ tooltip-after=90,0,50,15
+ child=40,120,70,50
+aspect-ratio: PARTIAL BlockContainer<DIV>#boundary
+ boundary=20,10,150,100
+ content=20,10,80,30
+boundary-style-change: PARTIAL BlockContainer<DIV>#boundary
+ boundary=40,30,180,90
+ child=180,45,30,20
+content-growth-updates-scroller: PARTIAL BlockContainer<DIV>#boundary
+ boundary-height=400
+ scroll-height-before=150 after=420
+inset-stretch: PARTIAL BlockContainer<DIV>#boundary
+ boundary=0,0,320,180
+ child=0,0,100,70
+min-content-width: PARTIAL BlockContainer<DIV>#boundary
+ boundary-before=20,10,60,80
+ boundary-after=20,10,110,80
+move-inset-only: PARTIAL BlockContainer<DIV>#boundary
+ boundary=70,80,100,50
+move-margin-change: PARTIAL BlockContainer<DIV>#boundary
+ boundary=35,25,100,50
+move-multiple-boxes: PARTIAL BlockContainer<DIV>#a.boundary | PARTIAL BlockContainer<DIV>#b.boundary | PARTIAL BlockContainer<DIV>#c.boundary
+ a=0,100,40,30
+ b=50,150,40,30
+ c=200,0,40,30
+move-percentage-insets: PARTIAL BlockContainer<DIV>#boundary
+ boundary=200,150,100,50
+move-static-position: PARTIAL BlockContainer<DIV>#boundary
+ boundary=0,60,150,60
+move-updates-ancestor-overflow: PARTIAL BlockContainer<DIV>#boundary
+ scrollHeight-before=200
+ scrollHeight-after=550
+nested-boundaries: PARTIAL BlockContainer<DIV>#inner
+ outer=20,30,260,160
+ inner=70,70,100,50
+ between-before=30,40,90,25
+ between-after=30,40,90,25
+ child=70,70,60,40
+overflow-visible: PARTIAL BlockContainer<DIV>#abspos
+ scrollHeight-before=100
+ scrollHeight-after=190
+percentage-size: PARTIAL BlockContainer<DIV>#boundary
+ boundary=30,20,200,150
+ child=30,20,75,90
+shrink-to-fit: PARTIAL BlockContainer<DIV>#boundary
+ boundary-before=25,20,80,50
+ boundary-after=25,20,180,50
+ content=25,20,180,20
+sibling-paint-order: PARTIAL BlockContainer<DIV>#first
+ hit-before=second
+ hit-after=second
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-contain-toggle.txt b/Tests/LibWeb/Text/expected/abspos-relayout-contain-toggle.txt
deleted file mode 100644
index f50f6402725..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-contain-toggle.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-before-toggle partial=1 full=0
-after-toggle partial=0 full=1
-fixed-before-toggle=80,100,50,20
-fixed-after-toggle=30,40,50,20
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-contained-child-in-table-cell.txt b/Tests/LibWeb/Text/expected/abspos-relayout-contained-child-in-table-cell.txt
index 10529bdfc6d..81f6c2ab429 100644
--- a/Tests/LibWeb/Text/expected/abspos-relayout-contained-child-in-table-cell.txt
+++ b/Tests/LibWeb/Text/expected/abspos-relayout-contained-child-in-table-cell.txt
@@ -1,7 +1,7 @@
-remove: partial=0 full=0 roots=[]
-insert: partial=1 full=0 roots=[layout PARTIAL Box<DIV>.bar]
+remove: roots=[]
+insert: roots=[layout PARTIAL Box<DIV>.bar]
insert: bar=560,114,40,24 cell=0,116,600,20
-move: partial=1 full=0 roots=[layout PARTIAL Box<DIV>.bar]
+move: roots=[layout PARTIAL Box<DIV>.bar]
move: bar=560,194,40,24 cell=0,196,600,20
-move and resize cell: partial=1 full=0 roots=[layout PARTIAL BlockContainer<DIV>#file]
+move and resize cell: roots=[layout PARTIAL BlockContainer<DIV>#file]
move and resize cell: bar=560,254,40,44 cell=0,256,600,40
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-contained-child-writing-modes.txt b/Tests/LibWeb/Text/expected/abspos-relayout-contained-child-writing-modes.txt
index 38d1b2bba0a..740fd241511 100644
--- a/Tests/LibWeb/Text/expected/abspos-relayout-contained-child-writing-modes.txt
+++ b/Tests/LibWeb/Text/expected/abspos-relayout-contained-child-writing-modes.txt
@@ -1,4 +1,4 @@
-a: roots=[layout PARTIAL BlockContainer<DIV>.child] full-layouts=true matches-full-layout=false
-b: roots=[layout PARTIAL BlockContainer<DIV>.child] full-layouts=true matches-full-layout=false
-c: roots=[layout PARTIAL BlockContainer<DIV>.child] full-layouts=true matches-full-layout=false
-d: roots=[layout PARTIAL BlockContainer<DIV>.child] full-layouts=true matches-full-layout=true
+a: roots=[PARTIAL BlockContainer<DIV>.child] reference=[FULL | FULL] matches-full-layout=false
+b: roots=[PARTIAL BlockContainer<DIV>.child] reference=[FULL | FULL] matches-full-layout=false
+c: roots=[PARTIAL BlockContainer<DIV>.child] reference=[FULL | FULL] matches-full-layout=false
+d: roots=[PARTIAL BlockContainer<DIV>.child] reference=[FULL | FULL] matches-full-layout=true
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-container-query.txt b/Tests/LibWeb/Text/expected/abspos-relayout-container-query.txt
deleted file mode 100644
index 555af3638ff..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-container-query.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-color-before=rgb(0, 0, 0)
-container=10,10,200,60
-color-after=rgb(0, 128, 0)
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-content-growth-updates-scroller.txt b/Tests/LibWeb/Text/expected/abspos-relayout-content-growth-updates-scroller.txt
deleted file mode 100644
index 38452fe77b2..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-content-growth-updates-scroller.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-boundary-height=400
-scroll-height-before=150 after=420
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-continuation.txt b/Tests/LibWeb/Text/expected/abspos-relayout-continuation.txt
deleted file mode 100644
index 15653c416dc..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-continuation.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-rects-match=true
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-direct-child-geometry.txt b/Tests/LibWeb/Text/expected/abspos-relayout-direct-child-geometry.txt
deleted file mode 100644
index b137a0889ab..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-direct-child-geometry.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-live=50,0,14,16
-reference=50,0,14,16
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-document-element-excluded.txt b/Tests/LibWeb/Text/expected/abspos-relayout-document-element-excluded.txt
deleted file mode 100644
index fc6fb1b82fe..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-document-element-excluded.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-child=10,10,70,60
-partial-layouts=0 full-layouts=1
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-escaping-fixed-removal.txt b/Tests/LibWeb/Text/expected/abspos-relayout-escaping-fixed-removal.txt
deleted file mode 100644
index 09ce0f164ba..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-escaping-fixed-removal.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-while-escaping partial=0 full=1
-after-removal partial=1 full=0
-child=50,60,60,60
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-fixed-cb-toggle.txt b/Tests/LibWeb/Text/expected/abspos-relayout-fixed-cb-toggle.txt
deleted file mode 100644
index 700c8d923b7..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-fixed-cb-toggle.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-before-toggle partial=1 full=0
-after-toggle partial=0 full=1
-fixed-before-toggle=90,120,50,20
-fixed-after-toggle=30,40,50,20
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-fixed-cb.txt b/Tests/LibWeb/Text/expected/abspos-relayout-fixed-cb.txt
deleted file mode 100644
index ea518b9791d..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-fixed-cb.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-boundary=60,70,180,110
-fixed=75,80,40,20
-sibling=60,70,80,65
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-fixed-descendant-fallback.txt b/Tests/LibWeb/Text/expected/abspos-relayout-fixed-descendant-fallback.txt
deleted file mode 100644
index d1dc9e0c637..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-fixed-descendant-fallback.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-fixed-before=30,20,40,25
-fixed-after=30,20,40,25
-sibling=100,100,80,70
-partial-layouts=0 full-layouts=1
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-full-layout-fallbacks.txt b/Tests/LibWeb/Text/expected/abspos-relayout-full-layout-fallbacks.txt
new file mode 100644
index 00000000000..1308bd68adb
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/abspos-relayout-full-layout-fallbacks.txt
@@ -0,0 +1,29 @@
+Fixed descendant of a boundary:
+ Grow the sibling: FULL
+ fixed-before=30,20,40,25
+ fixed-after=30,20,40,25
+ sibling=100,100,80,70
+Insertion into a display: none element:
+ Insert into the hidden element: FULL
+ inserted-rects=0
+ sibling-before=40,30,70,25
+ sibling-after=40,30,70,25
+Insertion of a fixed box into a boundary:
+ Insert the fixed box: FULL
+ fixed=25,18,35,20
+Insertion of an abspos box under body:
+ Append to body: FULL
+ inserted=70,45,30,20
+Shadow root child revealed:
+ Reveal the shadow child and grow the boundary child: FULL
+ revealed=0,0,120,50
+ child=40,30,60,40
+::backdrop style change:
+ Change the backdrop insets: FULL
+Dialog moved to the top layer from inside a boundary:
+ Show the dialog as a modal: FULL
+ open=true
+ dialog=70,40,80,50
+Absolutely positioned document element:
+ Grow a child of body: FULL
+ child=10,10,70,60
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-grid-area-boundary.txt b/Tests/LibWeb/Text/expected/abspos-relayout-grid-area-boundary.txt
deleted file mode 100644
index 4d3fdd9b52b..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-grid-area-boundary.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-subtree=110,90,180,100 partial-layouts=1 full-layouts=0
-self=110,90,180,100 partial-layouts=0 full-layouts=1
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-inline-containing-block.txt b/Tests/LibWeb/Text/expected/abspos-relayout-inline-containing-block.txt
deleted file mode 100644
index 02b246bd14c..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-inline-containing-block.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-boundary-before=57.53125,32,120,40
-boundary-after=57.53125,32,120,40
-content-width=60
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-insert-direct-child.txt b/Tests/LibWeb/Text/expected/abspos-relayout-insert-direct-child.txt
deleted file mode 100644
index 4d2f22588b8..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-insert-direct-child.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-inserted=50,45,30,20
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-insert-display-none.txt b/Tests/LibWeb/Text/expected/abspos-relayout-insert-display-none.txt
deleted file mode 100644
index 6f382af357d..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-insert-display-none.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-inserted-rects=0
-sibling-before=40,30,70,25
-sibling-after=40,30,70,25
-partial-layouts=0 full-layouts=1
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-insert-fixed-fallback.txt b/Tests/LibWeb/Text/expected/abspos-relayout-insert-fixed-fallback.txt
deleted file mode 100644
index 86343d48534..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-insert-fixed-fallback.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-fixed=25,18,35,20
-partial-layouts=0 full-layouts=1
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-insert-flex-anonymous-item.txt b/Tests/LibWeb/Text/expected/abspos-relayout-insert-flex-anonymous-item.txt
deleted file mode 100644
index 7e7395fb1fd..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-insert-flex-anonymous-item.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-flex-before=20,10,40,100
-flex-after=20,10,160,100
-flex-partial-layouts=1 full-layouts=0
-grid-before=20,130,40,100
-grid-after=20,130,160,100
-grid-partial-layouts=1 full-layouts=0
-nested-before=260,10,40,100
-nested-after=260,10,190,100
-nested-partial-layouts=1 full-layouts=0
-text-before=260,130,40,100
-text-width-grew=true
-text-partial-layouts=1 full-layouts=0
-PASS
-PASS
-PASS
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-insert-static-position.txt b/Tests/LibWeb/Text/expected/abspos-relayout-insert-static-position.txt
deleted file mode 100644
index 890b512d807..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-insert-static-position.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-live=0,25,40,15
-reference=0,25,40,15
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-insert-table-row.txt b/Tests/LibWeb/Text/expected/abspos-relayout-insert-table-row.txt
deleted file mode 100644
index 1742fe4945f..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-insert-table-row.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-live-new=0,20,50,20
-outside-before=0,20,50,20
-outside-after=0,20,50,20
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-insert-under-body.txt b/Tests/LibWeb/Text/expected/abspos-relayout-insert-under-body.txt
deleted file mode 100644
index 765966863c1..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-insert-under-body.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-inserted=70,45,30,20
-partial-layouts=0 full-layouts=1
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-insert-under-descendant.txt b/Tests/LibWeb/Text/expected/abspos-relayout-insert-under-descendant.txt
deleted file mode 100644
index 6189e3f7cc2..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-insert-under-descendant.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-inserted=55,40,35,20
-outside-before=0,130,120,25
-outside-after=0,130,120,25
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-inset-stretch.txt b/Tests/LibWeb/Text/expected/abspos-relayout-inset-stretch.txt
deleted file mode 100644
index f2940a6ea52..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-inset-stretch.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-boundary=0,0,320,180
-child=0,0,100,70
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-min-content-width.txt b/Tests/LibWeb/Text/expected/abspos-relayout-min-content-width.txt
deleted file mode 100644
index 261cf9e6adf..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-min-content-width.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-boundary-before=20,10,60,80
-boundary-after=20,10,110,80
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-move-before.txt b/Tests/LibWeb/Text/expected/abspos-relayout-move-before.txt
deleted file mode 100644
index 86287a520e0..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-move-before.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-live=80,0,10,10
-reference=80,0,10,10
-paint-count=1
-old-hit-is-moved=false
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-move-inset-only.txt b/Tests/LibWeb/Text/expected/abspos-relayout-move-inset-only.txt
deleted file mode 100644
index 1351dc12965..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-move-inset-only.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-boundary=70,80,100,50
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-move-margin-change.txt b/Tests/LibWeb/Text/expected/abspos-relayout-move-margin-change.txt
deleted file mode 100644
index 2ac675adab0..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-move-margin-change.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-boundary=35,25,100,50
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-move-multiple-boxes.txt b/Tests/LibWeb/Text/expected/abspos-relayout-move-multiple-boxes.txt
deleted file mode 100644
index b86276dc212..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-move-multiple-boxes.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-a=0,100,40,30
-b=50,150,40,30
-c=200,0,40,30
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-move-percentage-insets.txt b/Tests/LibWeb/Text/expected/abspos-relayout-move-percentage-insets.txt
deleted file mode 100644
index b66fc705d79..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-move-percentage-insets.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-boundary=200,150,100,50
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-move-static-position.txt b/Tests/LibWeb/Text/expected/abspos-relayout-move-static-position.txt
deleted file mode 100644
index 6a78ed572f8..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-move-static-position.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-boundary=0,60,150,60
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-move-updates-ancestor-overflow.txt b/Tests/LibWeb/Text/expected/abspos-relayout-move-updates-ancestor-overflow.txt
deleted file mode 100644
index 28f8a62536f..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-move-updates-ancestor-overflow.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-scrollHeight-before=200
-scrollHeight-after=550
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-nested-boundaries.txt b/Tests/LibWeb/Text/expected/abspos-relayout-nested-boundaries.txt
deleted file mode 100644
index a722a13a9bd..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-nested-boundaries.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-outer=20,30,260,160
-inner=70,70,100,50
-between-before=30,40,90,25
-between-after=30,40,90,25
-child=70,70,60,40
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-overflow-visible.txt b/Tests/LibWeb/Text/expected/abspos-relayout-overflow-visible.txt
deleted file mode 100644
index ab390806eb1..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-overflow-visible.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-scrollHeight-before=100
-scrollHeight-after=190
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-percentage-size.txt b/Tests/LibWeb/Text/expected/abspos-relayout-percentage-size.txt
deleted file mode 100644
index c5b69f368fe..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-percentage-size.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-boundary=30,20,200,150
-child=30,20,75,90
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-remove-reinsert.txt b/Tests/LibWeb/Text/expected/abspos-relayout-remove-reinsert.txt
deleted file mode 100644
index 226a23c5c7f..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-remove-reinsert.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-moving=55,40,35,20
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-remove-under-descendant.txt b/Tests/LibWeb/Text/expected/abspos-relayout-remove-under-descendant.txt
deleted file mode 100644
index 8a94ccf0e35..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-remove-under-descendant.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-hit-removed=false
-paint-count=0
-outside-before=0,130,120,25
-outside-after=0,130,120,25
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-rtl-static-position.txt b/Tests/LibWeb/Text/expected/abspos-relayout-rtl-static-position.txt
deleted file mode 100644
index da914b88fd1..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-rtl-static-position.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-live=180,10,120,40
-reference=180,10,120,40
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-scroller.txt b/Tests/LibWeb/Text/expected/abspos-relayout-scroller.txt
deleted file mode 100644
index ccdde9c8f13..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-scroller.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-scrollTop=150
-hit=probe
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-selection-preserved.txt b/Tests/LibWeb/Text/expected/abspos-relayout-selection-preserved.txt
index 17e8b838963..f37d98841b9 100644
--- a/Tests/LibWeb/Text/expected/abspos-relayout-selection-preserved.txt
+++ b/Tests/LibWeb/Text/expected/abspos-relayout-selection-preserved.txt
@@ -1,3 +1,2 @@
-partial-layouts=1 full-layouts=1
+partial-layout=[PARTIAL BlockContainer<DIV>#boundary] full-layout=[FULL]
selection-painting-matches-full-layout=true
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-shadow-child-reveal.txt b/Tests/LibWeb/Text/expected/abspos-relayout-shadow-child-reveal.txt
deleted file mode 100644
index 58261390de8..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-shadow-child-reveal.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-layout-passes partial=0 full=1
-revealed=0,0,120,50
-child=40,30,60,40
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-shadow-dom.txt b/Tests/LibWeb/Text/expected/abspos-relayout-shadow-dom.txt
deleted file mode 100644
index 23bd7178ec0..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-shadow-dom.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-shadow-child=55,35,30,20
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-shrink-to-fit.txt b/Tests/LibWeb/Text/expected/abspos-relayout-shrink-to-fit.txt
deleted file mode 100644
index 0ea69622da1..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-shrink-to-fit.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-boundary-before=25,20,80,50
-boundary-after=25,20,180,50
-content=25,20,180,20
-partial-layouts=1
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-sibling-paint-order.txt b/Tests/LibWeb/Text/expected/abspos-relayout-sibling-paint-order.txt
deleted file mode 100644
index 4456e2fe886..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-sibling-paint-order.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-layout-passes partial=1 full=0
-hit-before=second
-hit-after=second
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-static-position.txt b/Tests/LibWeb/Text/expected/abspos-relayout-static-position.txt
deleted file mode 100644
index 2e3e79c1c96..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-static-position.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-boundary-before=0,70,120,70
-boundary-after=0,70,120,70
-child=0,70,80,55
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-svg-inside.txt b/Tests/LibWeb/Text/expected/abspos-relayout-svg-inside.txt
deleted file mode 100644
index ab245edc2b2..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-svg-inside.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-boundary=40,50,220,160
-svg=40,50,100,80
-sibling-before=40,130,70,20
-sibling-after=40,130,70,20
-page-sibling=0,220,120,30
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-svg-position-flip.txt b/Tests/LibWeb/Text/expected/abspos-relayout-svg-position-flip.txt
deleted file mode 100644
index 21c689b8c1b..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-svg-position-flip.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-flip partial=0 full=1
-inside partial=1 full=0
-svg-after-flip=60,120,100,80
-child-after-flip=40,30,60,40
-rect-after-inside=60,120,70,40
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-text-into-boundary.txt b/Tests/LibWeb/Text/expected/abspos-relayout-text-into-boundary.txt
deleted file mode 100644
index 6b0f9a7bd21..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-text-into-boundary.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-boundary-before=40,30,150,90
-boundary-after=40,30,150,90
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-toggles.txt b/Tests/LibWeb/Text/expected/abspos-relayout-toggles.txt
new file mode 100644
index 00000000000..bdbc61026c6
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/abspos-relayout-toggles.txt
@@ -0,0 +1,29 @@
+Escaping descendants removed from a boundary:
+ one escaping descendant remains: FULL
+ last escaping descendant removed: PARTIAL BlockContainer<DIV>#boundary
+ escaping subtree moved away: PARTIAL BlockContainer<DIV>#boundary
+contain: layout toggle:
+ before toggle: PARTIAL BlockContainer<DIV>#boundary
+ fixed-before-toggle=80,100,50,20
+ after toggle: FULL
+ fixed-after-toggle=30,40,50,20
+Escaping fixed box removal:
+ while escaping: FULL
+ after removal: PARTIAL BlockContainer<DIV>#boundary
+ child=50,60,60,60
+Fixed containing block toggle:
+ before toggle: PARTIAL BlockContainer<DIV>#boundary
+ fixed-before-toggle=90,120,50,20
+ after toggle: FULL
+ fixed-after-toggle=30,40,50,20
+Boundary placed in a grid area:
+ subtree: PARTIAL BlockContainer<DIV>#boundary
+ subtree=110,90,180,100
+ self: FULL
+ self=110,90,180,100
+svg flipped to position: absolute:
+ flip: FULL
+ svg-after-flip=60,120,100,80
+ child-after-flip=40,30,60,40
+ inside: PARTIAL SVGSVGBox<svg>#svg.moved
+ rect-after-inside=60,120,70,40
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-toplayer-fallback.txt b/Tests/LibWeb/Text/expected/abspos-relayout-toplayer-fallback.txt
deleted file mode 100644
index 9075b26b7fd..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-toplayer-fallback.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-open=true
-dialog=70,40,80,50
-partial-layouts=0 full-layouts=1
-PASS
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-unrelated-anchor.txt b/Tests/LibWeb/Text/expected/abspos-relayout-unrelated-anchor.txt
deleted file mode 100644
index fc357c4bba0..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-unrelated-anchor.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-Change unrelated subtree: true
-Boundary resizes: true
-Move unrelated boundary: true
-Boundary position: true
-Rebuild unrelated boundary: true
-Consumer stays anchored: true
-Insert unrelated abspos: true
-Inserted position: true
-Move unrelated abspos between parents: true
-Moved position: true
-Remove unrelated abspos without layout: true
-Consumer survives unrelated removal: true
-Unresolved consumer outside boundary: true
-Consumer keeps fallback: true
-Position-area consumer outside boundary: true
-Boundary inside an anchor provider: true
-Anchor size unchanged: true
-Remove last contained consumer without layout: true
diff --git a/Tests/LibWeb/Text/expected/abspos-relayout-unused-anchor-names.txt b/Tests/LibWeb/Text/expected/abspos-relayout-unused-anchor-names.txt
deleted file mode 100644
index 5c23810abf2..00000000000
--- a/Tests/LibWeb/Text/expected/abspos-relayout-unused-anchor-names.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-Move control with unused header anchor: true
-Control position: 30,80
-Insert anchor consumer: true
-Consumer position: 130,40
-Move control with active consumer: true
-Remove last consumer: true
-Hidden consumer: true
-Show consumer: true
-Static consumer: true
-Make consumer positioned again: true
-position-area consumer: true
-Remove position-area dependency: true
diff --git a/Tests/LibWeb/Text/expected/css/animation-box-adjustment-skips-layout.txt b/Tests/LibWeb/Text/expected/css/animation-box-adjustment-skips-layout.txt
index 80731992b81..9162100cf96 100644
--- a/Tests/LibWeb/Text/expected/css/animation-box-adjustment-skips-layout.txt
+++ b/Tests/LibWeb/Text/expected/css/animation-box-adjustment-skips-layout.txt
@@ -1 +1 @@
-full layouts: 0
+layout while seeking the animation: (no layout)
diff --git a/Tests/LibWeb/Text/expected/css/font-cascade-stable-display-period.txt b/Tests/LibWeb/Text/expected/css/font-cascade-stable-display-period.txt
index e7e32ccabf5..11212ef12ee 100644
--- a/Tests/LibWeb/Text/expected/css/font-cascade-stable-display-period.txt
+++ b/Tests/LibWeb/Text/expected/css/font-cascade-stable-display-period.txt
@@ -1,7 +1,7 @@
selected face is loading: true
-paint change preserves pending layout: true
+layout after paint change while pending: (no layout)
display transition recomputes style: true
display transition keeps fallback metrics: true
-paint change preserves visible fallback layout: true
+layout after paint change with visible fallback: (no layout)
loaded face changes metrics: true
-paint change preserves loaded layout: true
+layout after paint change with loaded face: (no layout)
diff --git a/Tests/LibWeb/Text/expected/css/font-cascade-unchanged-pending-selection.txt b/Tests/LibWeb/Text/expected/css/font-cascade-unchanged-pending-selection.txt
index c2c2b0d5f49..f845fe3a06f 100644
--- a/Tests/LibWeb/Text/expected/css/font-cascade-unchanged-pending-selection.txt
+++ b/Tests/LibWeb/Text/expected/css/font-cascade-unchanged-pending-selection.txt
@@ -1,4 +1,4 @@
-paint change relaid out pending cascade: false
+layout after paint change with pending cascade: (no layout)
unused weight registration recomputed style: false
unused weight completion recomputed style: false
unchanged selection preserves width: true
diff --git a/Tests/LibWeb/Text/expected/css/scrollable-overflow-incremental-full-layout.txt b/Tests/LibWeb/Text/expected/css/scrollable-overflow-incremental-full-layout.txt
index 941941854b1..cd6c61cd3f8 100644
--- a/Tests/LibWeb/Text/expected/css/scrollable-overflow-incremental-full-layout.txt
+++ b/Tests/LibWeb/Text/expected/css/scrollable-overflow-incremental-full-layout.txt
@@ -1,10 +1,16 @@
initial: outer=250x200, nested=300x240
move cached subtree: outer=250x300, nested=300x240
+ layout: FULL
move cached subtree back: outer=250x190, nested=300x240
+ layout: FULL
clamped offsets: 40,30
shrink behind clipping boundary: outer=250x190, nested=120x90
+ layout: FULL
remove overflow: outer=250x190, nested=80x60
+ layout: FULL
restore overflow: outer=250x190, nested=120x90
+ layout: FULL
clip unchanged geometry: outer=100x120, nested=120x90
+ layout: FULL
restore visible overflow: outer=250x190, nested=120x90
-performed full layout: true
+ layout: FULL
diff --git a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-animation.txt b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-animation.txt
index 73070e090e7..fd3ef9a639b 100644
--- a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-animation.txt
+++ b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-animation.txt
@@ -1,4 +1,4 @@
initial scrollHeight: 100
scrollHeight at animation end: 550
scrollHeight at animation start: 100
-relayouts performed: 0
+layout passes: (no layout)
diff --git a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-nested-propagation.txt b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-nested-propagation.txt
index 86d1a5b2f8c..54ead169960 100644
--- a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-nested-propagation.txt
+++ b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-nested-propagation.txt
@@ -1,3 +1,3 @@
initial scrollHeight: 100
scrollHeight after transform change: 440
-relayouts performed: 0
+layout passes: (no layout)
diff --git a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-property-matrix.txt b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-property-matrix.txt
index 8b6fdf5adca..ac0ac798a5c 100644
--- a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-property-matrix.txt
+++ b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-property-matrix.txt
@@ -1,7 +1,7 @@
-initial: scrollWidth=100 scrollHeight=100 relayouts=1
-translate: scrollWidth=100 scrollHeight=390 relayouts=0
-rotate: scrollWidth=109 scrollHeight=109 relayouts=0
-scale: scrollWidth=270 scrollHeight=270 relayouts=0
-transform: scrollWidth=109 scrollHeight=109 relayouts=0
-transform-origin: scrollWidth=100 scrollHeight=127 relayouts=0
-transform-box: scrollWidth=100 scrollHeight=123 relayouts=0
+initial: scrollWidth=100 scrollHeight=100
+translate: scrollWidth=100 scrollHeight=390 layout=(no layout)
+rotate: scrollWidth=109 scrollHeight=109 layout=(no layout)
+scale: scrollWidth=270 scrollHeight=270 layout=(no layout)
+transform: scrollWidth=109 scrollHeight=109 layout=(no layout)
+transform-origin: scrollWidth=100 scrollHeight=127 layout=(no layout)
+transform-box: scrollWidth=100 scrollHeight=123 layout=(no layout)
diff --git a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-pseudo-element.txt b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-pseudo-element.txt
index 88c287efbb3..9b0414dd65c 100644
--- a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-pseudo-element.txt
+++ b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-pseudo-element.txt
@@ -1,3 +1,3 @@
initial scrollHeight: 100
scrollHeight after pseudo-element transform change: 550
-relayouts performed: 0
+layout passes: (no layout)
diff --git a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-scroll-offset-clamp.txt b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-scroll-offset-clamp.txt
index b07564c3557..8c83fb9514b 100644
--- a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-scroll-offset-clamp.txt
+++ b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-scroll-offset-clamp.txt
@@ -2,4 +2,4 @@ initial scrollHeight: 550
scrollTop clamped to: 450
scrollHeight after shrink: 200
scrollTop re-clamped to: 100
-relayouts performed: 0
+layout passes: (no layout)
diff --git a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-sticky.txt b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-sticky.txt
index cdfdd432789..80e53bb31ea 100644
--- a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-sticky.txt
+++ b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-sticky.txt
@@ -1,4 +1,4 @@
scrollHeight after transform change: 490
scrollTop in grown range: 300
sticky box sticks to scrollport top: true
-relayouts performed: 0
+layout passes: (no layout)
diff --git a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-svg-foreignobject-sticky.txt b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-svg-foreignobject-sticky.txt
index 14e8d01ed2d..ca9ed35268d 100644
--- a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-svg-foreignobject-sticky.txt
+++ b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-svg-foreignobject-sticky.txt
@@ -1,2 +1,2 @@
sticky position stable across partial SVG relayout: true
-relayouts performed: 0
+layout passes: PARTIAL SVGSVGBox<svg>
diff --git a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-transform-none-toggle.txt b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-transform-none-toggle.txt
index cbfe987d53b..0a9715905bf 100644
--- a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-transform-none-toggle.txt
+++ b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-transform-none-toggle.txt
@@ -3,4 +3,4 @@ scrollHeight after transform toggled on: 550
scrollTop clamped to: 450
scrollHeight after transform toggled off: 100
scrollTop after transform toggled off: 0
-relayouts performed: 0
+layout passes: (no layout)
diff --git a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-transform-value-change.txt b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-transform-value-change.txt
index fd593a7444d..10ca78ade4d 100644
--- a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-transform-value-change.txt
+++ b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-transform-value-change.txt
@@ -2,4 +2,4 @@ initial scrollWidth: 100
initial scrollHeight: 100
scrollWidth after transform change: 250
scrollHeight after transform change: 550
-relayouts performed: 0
+layout passes: (no layout)
diff --git a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-viewport.txt b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-viewport.txt
index 5e810b97826..462349754aa 100644
--- a/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-viewport.txt
+++ b/Tests/LibWeb/Text/expected/css/scrollable-overflow-recalc-viewport.txt
@@ -1,3 +1,3 @@
viewport scrollHeight grew: true
scrollY clamped to grown max: true
-relayouts performed: 0
+layout passes: (no layout)
diff --git a/Tests/LibWeb/Text/expected/css/style-engine/deferred-selection-style-computation.txt b/Tests/LibWeb/Text/expected/css/style-engine/deferred-selection-style-computation.txt
index 99326a65ee3..007c25591dd 100644
--- a/Tests/LibWeb/Text/expected/css/style-engine/deferred-selection-style-computation.txt
+++ b/Tests/LibWeb/Text/expected/css/style-engine/deferred-selection-style-computation.txt
@@ -2,7 +2,7 @@ unselected query: rgb(10, 20, 30)
query stays local: true
activation preserves element styles: false
activation stays local: false
-activation preserves layout: true
+layout after activation: (no layout)
selected query: rgb(40, 50, 60)
extension updates only intersecting subtrees: true
deselected query: rgb(70, 80, 90)
diff --git a/Tests/LibWeb/Text/expected/display_list/selection-display-contents-invalidation.txt b/Tests/LibWeb/Text/expected/display_list/selection-display-contents-invalidation.txt
index 996822444a5..35b8ab384b6 100644
--- a/Tests/LibWeb/Text/expected/display_list/selection-display-contents-invalidation.txt
+++ b/Tests/LibWeb/Text/expected/display_list/selection-display-contents-invalidation.txt
@@ -1,3 +1,3 @@
highlight commands rerecorded: true
updated highlight color: true
-layout preserved: true
+layout after highlight change: (no layout)
diff --git a/Tests/LibWeb/Text/expected/lazy-accumulated-visual-context-rebuild.txt b/Tests/LibWeb/Text/expected/lazy-accumulated-visual-context-rebuild.txt
index ad04e1939a7..144ac7eff03 100644
--- a/Tests/LibWeb/Text/expected/lazy-accumulated-visual-context-rebuild.txt
+++ b/Tests/LibWeb/Text/expected/lazy-accumulated-visual-context-rebuild.txt
@@ -2,7 +2,7 @@ offset width: 110
offset width: 120
offset width: 130
visual context updates after layout-only reads: 0
-extra layouts after clean read: 0
+layout during clean read: (no layout)
bounding rect width: 130
visual context updates after identity transform read: 0
bounding rect with transformed child: 130
diff --git a/Tests/LibWeb/Text/expected/multicol-incremental-relayout.txt b/Tests/LibWeb/Text/expected/multicol-incremental-relayout.txt
index 59a5839ed78..c26821ce71f 100644
--- a/Tests/LibWeb/Text/expected/multicol-incremental-relayout.txt
+++ b/Tests/LibWeb/Text/expected/multicol-incremental-relayout.txt
@@ -1,4 +1,4 @@
-balanced: partial-layouts=0 full-layouts=1 PASS
+balanced: layout=[FULL] PASS
div 0,0,100,40
div 0,40,100,54.671875
div 120,0,100,25.328125
@@ -10,35 +10,35 @@ balanced: partial-layouts=0 full-layouts=1 PASS
div 242,0,96,22.65625
div 242,22.65625,96,30
div 240,54.65625,100,40
-abspos: partial-layouts=1 full-layouts=0 PASS
+abspos: layout=[PARTIAL BlockContainer<DIV>.abspos] PASS
div 0,0,100,100
div 120,0,100,60
div 130,5,50,45
div 130,5,50,45
-svg: partial-layouts=1 full-layouts=0 PASS
+svg: layout=[PARTIAL SVGSVGBox<svg>] PASS
div 0,0,100,100
div 120,0,100,40
svg 120,40,60,40
rect 120,40,50,10
-split containing block: partial-layouts=1 full-layouts=0 PASS
+split containing block: layout=[PARTIAL BlockContainer<DIV>.abspos] PASS
div 0,0,100,60
div 0,60,100,40
div 120,0,100,40
div 10,65,50,45
div 10,65,50,45
-static position: partial-layouts=1 full-layouts=0 PASS
+static position: layout=[PARTIAL BlockContainer<DIV>.static] PASS
div 0,0,100,100
div 120,0,100,40
div 120,40,30,45
div 120,40,30,45
-svg in a later fragment: partial-layouts=1 full-layouts=0 PASS
+svg in a later fragment: layout=[PARTIAL SVGSVGBox<svg>] PASS
div 0,0,100,100
div 120,0,100,60
div 0,0,100,100
div 120,0,100,20
svg 120,20,60,40
rect 120,20,50,10
-moved to a later column: partial-layouts=0 full-layouts=1 PASS
+moved to a later column: layout=[FULL] PASS
div 0,0,100,100
div 120,0,100,100
div 240,0,100,40
diff --git a/Tests/LibWeb/Text/expected/stacking-context/flex-item-z-index-change-without-relayout.txt b/Tests/LibWeb/Text/expected/stacking-context/flex-item-z-index-change-without-relayout.txt
index ac34003a223..415a8c1f927 100644
--- a/Tests/LibWeb/Text/expected/stacking-context/flex-item-z-index-change-without-relayout.txt
+++ b/Tests/LibWeb/Text/expected/stacking-context/flex-item-z-index-change-without-relayout.txt
@@ -1,4 +1,4 @@
baseline: contexts=[document (anon) item1 item2] report-ok=true
first item to z 3: contexts=[document (anon) item2 item1] report-ok=true
first item back to z 1: contexts=[document (anon) item1 item2] report-ok=true
-layout runs during the z-index changes: 0
+layout during the z-index changes: (no layout)
diff --git a/Tests/LibWeb/Text/expected/svg-relayout-boundaries.txt b/Tests/LibWeb/Text/expected/svg-relayout-boundaries.txt
new file mode 100644
index 00000000000..7ad4a74fad9
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/svg-relayout-boundaries.txt
@@ -0,0 +1,5 @@
+inline-boundary-structural: PARTIAL SVGSVGBox<svg>#boundary
+ svg=40,20
+inside-relative-fragmented-inline: PARTIAL SVGSVGBox<svg>#target | PARTIAL SVGSVGBox<svg>#target
+ stable after first relayout: true
+ stable after second relayout: true
diff --git a/Tests/LibWeb/Text/expected/svg-relayout-inline-boundary-structural.txt b/Tests/LibWeb/Text/expected/svg-relayout-inline-boundary-structural.txt
deleted file mode 100644
index 8d5f63e963a..00000000000
--- a/Tests/LibWeb/Text/expected/svg-relayout-inline-boundary-structural.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-svg=40,20
-partial-layouts=1 full-layouts=0
-PASS
diff --git a/Tests/LibWeb/Text/expected/svg-relayout-inside-relative-fragmented-inline.txt b/Tests/LibWeb/Text/expected/svg-relayout-inside-relative-fragmented-inline.txt
deleted file mode 100644
index 1d4323af908..00000000000
--- a/Tests/LibWeb/Text/expected/svg-relayout-inside-relative-fragmented-inline.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-stable after first relayout: true
-stable after second relayout: true
-partial-layouts=2 full-layouts=0
diff --git a/Tests/LibWeb/Text/expected/table-colspan-change-relayout.txt b/Tests/LibWeb/Text/expected/table-colspan-change-relayout.txt
index 09e7d6413ed..e951f6f5f72 100644
--- a/Tests/LibWeb/Text/expected/table-colspan-change-relayout.txt
+++ b/Tests/LibWeb/Text/expected/table-colspan-change-relayout.txt
@@ -1,3 +1,3 @@
width before: 100
width after: 150
-no-op layout delta: 0
+layout after no-op colspan change: (no layout)
diff --git a/Tests/LibWeb/Text/input/Editing/execCommand-in-textarea-reveals-caret-once.html b/Tests/LibWeb/Text/input/Editing/execCommand-in-textarea-reveals-caret-once.html
index a604d2abab0..4e605f8b96d 100644
--- a/Tests/LibWeb/Text/input/Editing/execCommand-in-textarea-reveals-caret-once.html
+++ b/Tests/LibWeb/Text/input/Editing/execCommand-in-textarea-reveals-caret-once.html
@@ -1,16 +1,17 @@
<!DOCTYPE html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<textarea id="textarea" style="height: 40px"></textarea>
<script>
promiseTest(async () => {
textarea.focus();
document.body.offsetHeight;
- const layoutCount = () => internals.partialLayoutCount() + internals.fullLayoutCount();
- const layoutsBefore = layoutCount();
- for (let i = 0; i < 50; ++i)
- document.execCommand("insertText", false, `\nline ${i}`);
- println(`layouts during edits: ${layoutCount() - layoutsBefore}`);
+ const editWork = layoutWork(() => {
+ for (let i = 0; i < 50; ++i)
+ document.execCommand("insertText", false, `\nline ${i}`);
+ }, internals, { flush: false });
+ println(`layout during edits: ${editWork.passes().join(" | ") || "(no layout)"}`);
await new Promise(resolve => requestAnimationFrame(resolve));
const bottomOfLastLine = textarea.scrollHeight - parseFloat(getComputedStyle(textarea).paddingBottom);
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-after-escaping-descendant-removal.html b/Tests/LibWeb/Text/input/abspos-relayout-after-escaping-descendant-removal.html
deleted file mode 100644
index 39ce39fc97c..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-after-escaping-descendant-removal.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- #root { position: relative; width: 360px; height: 180px; }
- #boundary { position: absolute; left: 40px; top: 25px; width: 160px; height: 90px; }
- #content { width: 20px; height: 10px; }
- .escaping { position: fixed; left: 0; top: 0; width: 10px; height: 10px; }
-</style>
-<div id="root">
- <div id="boundary">
- <div id="content"></div>
- <div id="first"><div class="escaping"></div></div>
- <div id="second"><div class="escaping"></div></div>
- </div>
-</div>
-<script>
- test(() => {
- const content = document.getElementById("content");
- const results = [];
- function check(label, height) {
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- content.style.height = `${height}px`;
- document.body.offsetHeight;
- results.push(`${label}: partial=${internals.partialLayoutCount() - partialBefore} full=${internals.fullLayoutCount() - fullBefore}`);
- }
- document.body.offsetHeight;
- document.getElementById("first").firstElementChild.remove();
- document.body.offsetHeight;
- check("one escaping descendant remains", 20);
-
- document.getElementById("second").firstElementChild.remove();
- document.body.offsetHeight;
- check("last escaping descendant removed", 30);
-
- const subtree = document.createElement("div");
- const escaping = document.createElement("div");
- escaping.className = "escaping";
- subtree.append(escaping);
- document.getElementById("second").append(subtree);
- document.body.offsetHeight;
- document.getElementById("root").append(subtree);
- document.body.offsetHeight;
- check("escaping subtree moved away", 40);
- results.forEach(println);
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-anchor-dependencies.html b/Tests/LibWeb/Text/input/abspos-relayout-anchor-dependencies.html
deleted file mode 100644
index d62e8e2dc6f..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-anchor-dependencies.html
+++ /dev/null
@@ -1,89 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #stage { position: relative; width: 500px; height: 400px; }
- #boundary { position: absolute; left: 30px; top: 40px; width: 180px; }
- #spacer { height: 10px; }
- #provider { anchor-name: --a; width: 50px; height: 20px; }
- #consumer { position: absolute; left: anchor(--a right, 5px); top: anchor(--a bottom, 5px); width: 10px; height: 10px; }
- #unrelated { position: absolute; left: 300px; top: 30px; width: 50px; height: 10px; }
- #dependent-boundary { position: absolute; left: 200px; top: 200px; width: 100px; }
- #dependent-content { height: 10px; }
- #nested-consumer { position: absolute; left: anchor(--missing right, 7px); top: anchor(--missing bottom, 9px); width: 10px; height: 10px; }
-</style>
-<div id="stage">
- <div id="boundary"><div id="spacer"></div><div id="provider"></div></div>
- <div id="consumer"></div>
- <div id="unrelated"></div>
- <div id="dependent-boundary"><div id="dependent-content"></div><div id="nested-consumer"></div></div>
-</div>
-<script>
-test(() => {
- const results = [];
- const stage = document.getElementById("stage");
- const boundary = document.getElementById("boundary");
- const spacer = document.getElementById("spacer");
- const provider = document.getElementById("provider");
- const consumer = document.getElementById("consumer");
- const unrelated = document.getElementById("unrelated");
- const dependentContent = document.getElementById("dependent-content");
- const nestedConsumer = document.getElementById("nested-consumer");
- document.body.offsetHeight;
-
- function checkFullLayout(label, mutate, x, y) {
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- mutate();
- const rect = consumer.getBoundingClientRect();
- const partial = internals.partialLayoutCount() - partialBefore;
- const full = internals.fullLayoutCount() - fullBefore;
- const passed = partial === 0 && full > 0 && rect.x === x && rect.y === y;
- results.push(`${label}: ${passed}`);
- if (!passed)
- results.push(` partial=${partial} full=${full} position=${rect.x},${rect.y} expected=${x},${y}`);
- }
-
- checkFullLayout("Move a provider inside the boundary", () => spacer.style.height = "30px", 80, 90);
- checkFullLayout("Rebuild a boundary containing a provider", () => boundary.append(document.createElement("div")), 80, 90);
- checkFullLayout("Move the provider's boundary", () => boundary.style.left = "60px", 110, 90);
-
- // One affected boundary must reject the whole batch before any partial pass is committed.
- checkFullLayout("Batch unrelated and provider changes", () => {
- unrelated.style.top = "50px";
- provider.style.width = "60px";
- }, 120, 90);
- results.push(`Unrelated boundary also updated: ${unrelated.getBoundingClientRect().y === 50}`);
-
- checkFullLayout("Rename a provider", () => provider.style.anchorName = "--different", 5, 5);
- checkFullLayout("Restore a provider name", () => provider.style.anchorName = "--a", 120, 90);
- checkFullLayout("Clear a provider name", () => provider.style.anchorName = "none", 5, 5);
- checkFullLayout("Add a provider name", () => provider.style.anchorName = "--a", 120, 90);
- checkFullLayout("Remove an in-flow provider", () => provider.remove(), 5, 5);
-
- // The consumer already exists with a fallback when the incremental tree build creates the provider.
- provider.style.cssText = "position: absolute; left: 20px; top: 80px";
- checkFullLayout("Insert an abspos provider", () => boundary.append(provider), 130, 140);
- checkFullLayout("Remove a directly contained abspos provider", () => provider.remove(), 5, 5);
-
- const wrapper = document.createElement("div");
- wrapper.style.cssText = "position: absolute; left: 80px; top: 150px; width: 60px";
- provider.style.cssText = "width: 30px; height: 10px";
- wrapper.append(provider);
- checkFullLayout("Insert a subtree containing a provider", () => stage.insertBefore(wrapper, consumer), 110, 160);
- checkFullLayout("Remove a subtree containing a provider", () => wrapper.remove(), 5, 5);
-
- // A nested unresolved consumer still needs anchor resolution when its boundary is replayed.
- checkFullLayout("Boundary containing an unresolved consumer", () => dependentContent.style.height = "30px", 5, 5);
- const nestedRect = nestedConsumer.getBoundingClientRect();
- results.push(`Nested fallback position: ${nestedRect.x === 207 && nestedRect.y === 209}`);
- nestedConsumer.style.left = "auto";
- nestedConsumer.style.top = "auto";
- nestedConsumer.style.positionAnchor = "--missing";
- nestedConsumer.style.positionArea = "span-all";
- document.body.offsetHeight;
- checkFullLayout("Boundary containing a position-area consumer", () => dependentContent.style.height = "40px", 5, 5);
-
- results.forEach(println);
-});
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-anchor-elsewhere.html b/Tests/LibWeb/Text/input/abspos-relayout-anchor-elsewhere.html
deleted file mode 100644
index 7bcb8338b58..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-anchor-elsewhere.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #stage { position: relative; width: 400px; height: 300px; }
- #anchor {
- anchor-name: --a;
- width: 90px;
- height: 20px;
- }
- #tooltip {
- position: absolute;
- position-anchor: --a;
- left: anchor(right);
- top: anchor(top);
- width: 50px;
- height: 15px;
- }
- #boundary {
- position: absolute;
- left: 40px;
- top: 120px;
- width: 200px;
- height: 100px;
- overflow: hidden;
- }
- #child { width: 70px; height: 20px; }
-</style>
-<div id="stage">
- <div id="anchor"></div>
- <div id="tooltip"></div>
- <div id="boundary">
- <div id="child"></div>
- </div>
-</div>
-<script>
- // A boundary without anchor providers or consumers can be laid out independently,
- // preserving the geometry of anchor-positioned boxes elsewhere in the document.
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const tooltipBefore = document.getElementById("tooltip").getBoundingClientRect();
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("child").style.height = "50px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const tooltipAfter = document.getElementById("tooltip").getBoundingClientRect();
- const child = document.getElementById("child").getBoundingClientRect();
- println(`layout-passes partial=${partialDelta} full=${fullDelta}`);
- println(`tooltip-before=${rectToString(tooltipBefore)}`);
- println(`tooltip-after=${rectToString(tooltipAfter)}`);
- println(`child=${rectToString(child)}`);
- println(partialDelta === 1 && fullDelta === 0
- && rectToString(tooltipBefore) === "90,0,50,15"
- && rectToString(tooltipAfter) === "90,0,50,15"
- && rectToString(child) === "40,120,70,50" ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-anchor-inset-style-change.html b/Tests/LibWeb/Text/input/abspos-relayout-anchor-inset-style-change.html
deleted file mode 100644
index afacabe9bab..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-anchor-inset-style-change.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #stage { position: relative; width: 400px; height: 300px; }
- #anchor {
- anchor-name: --btn;
- position: absolute;
- left: 60px;
- top: 40px;
- width: 100px;
- height: 30px;
- }
- #anchored {
- position: absolute;
- position-anchor: --btn;
- left: 10px;
- top: 10px;
- width: 80px;
- height: 25px;
- }
-</style>
-<div id="stage">
- <div id="anchor"></div>
- <div id="anchored"></div>
-</div>
-<script>
- // A style change that puts anchor() functions into the box's insets takes the full
- // layout path, which resolves them against the anchor and lands the box at its
- // anchored position.
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const anchoredBefore = document.getElementById("anchored").getBoundingClientRect();
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- const anchoredStyle = document.getElementById("anchored").style;
- anchoredStyle.left = "anchor(right)";
- anchoredStyle.top = "anchor(top)";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const anchor = document.getElementById("anchor").getBoundingClientRect();
- const anchoredAfter = document.getElementById("anchored").getBoundingClientRect();
- println(`layout-passes partial=${partialDelta} full=${fullDelta}`);
- println(`anchor=${rectToString(anchor)}`);
- println(`anchored-before=${rectToString(anchoredBefore)}`);
- println(`anchored-after=${rectToString(anchoredAfter)}`);
- println(partialDelta === 0 && fullDelta === 1
- && rectToString(anchor) === "60,40,100,30"
- && rectToString(anchoredBefore) === "10,10,80,25"
- && rectToString(anchoredAfter) === "160,40,80,25" ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-anchor-name-inside.html b/Tests/LibWeb/Text/input/abspos-relayout-anchor-name-inside.html
deleted file mode 100644
index 9a319f0dc1b..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-anchor-name-inside.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #stage { position: relative; width: 400px; height: 240px; }
- #boundary {
- position: absolute;
- left: 30px;
- top: 40px;
- width: 180px;
- height: 120px;
- overflow: hidden;
- }
- #anchor {
- anchor-name: --a;
- position: absolute;
- left: 20px;
- top: 30px;
- width: 50px;
- height: 20px;
- }
- #target {
- position: absolute;
- position-anchor: --a;
- left: anchor(left);
- top: anchor(bottom);
- width: 60px;
- height: 25px;
- }
-</style>
-<div id="stage">
- <div id="boundary">
- <div id="anchor"></div>
- </div>
- <div id="target"></div>
-</div>
-<script>
- // An element with a registered anchor-name inside the boundary publishes geometry that
- // positioned boxes outside consume through anchor(), so a change inside the boundary
- // must take the full layout path to re-lay them out.
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const anchorBefore = document.getElementById("anchor").getBoundingClientRect();
- const targetBefore = document.getElementById("target").getBoundingClientRect();
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("anchor").style.top = "60px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const anchorAfter = document.getElementById("anchor").getBoundingClientRect();
- const targetAfter = document.getElementById("target").getBoundingClientRect();
- println(`layout-passes partial=${partialDelta} full=${fullDelta}`);
- println(`anchor-before=${rectToString(anchorBefore)}`);
- println(`target-before=${rectToString(targetBefore)}`);
- println(`anchor-after=${rectToString(anchorAfter)}`);
- println(`target-after=${rectToString(targetAfter)}`);
- println(partialDelta === 0 && fullDelta === 1
- && rectToString(anchorBefore) === "50,70,50,20"
- && rectToString(targetBefore) === "50,90,60,25"
- && rectToString(anchorAfter) === "50,100,50,20"
- && rectToString(targetAfter) === "50,120,60,25" ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-anchor-name-removal.html b/Tests/LibWeb/Text/input/abspos-relayout-anchor-name-removal.html
deleted file mode 100644
index ad30e1ef349..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-anchor-name-removal.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #stage { position: relative; width: 400px; height: 300px; }
- #boundary {
- position: absolute;
- left: 30px;
- top: 40px;
- width: 200px;
- height: 150px;
- }
- #anchor {
- anchor-name: --a;
- position: absolute;
- left: 20px;
- top: 30px;
- width: 50px;
- height: 20px;
- }
- #consumer {
- position: absolute;
- position-anchor: --a;
- left: anchor(right, 5px);
- top: anchor(top, 5px);
- width: 60px;
- height: 25px;
- }
-</style>
-<div id="stage">
- <div id="boundary">
- <div id="anchor"></div>
- </div>
- <div id="consumer"></div>
-</div>
-<script>
- // Removing the anchor provider unregisters its names before the next layout runs, so
- // the partial relayout planner's subtree check cannot see them. The removal
- // itself must force the full layout path, which re-resolves the outside consumer's
- // anchor() functions to their fallbacks.
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const consumerBefore = document.getElementById("consumer").getBoundingClientRect();
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("anchor").remove();
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const consumerAfter = document.getElementById("consumer").getBoundingClientRect();
- println(`layout-passes partial=${partialDelta} full=${fullDelta}`);
- println(`consumer-before=${rectToString(consumerBefore)}`);
- println(`consumer-after=${rectToString(consumerAfter)}`);
- println(partialDelta === 0 && fullDelta >= 1
- && rectToString(consumerBefore) === "100,70,60,25"
- && rectToString(consumerAfter) === "5,5,60,25" ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-anchor-repaint-restyle.html b/Tests/LibWeb/Text/input/abspos-relayout-anchor-repaint-restyle.html
deleted file mode 100644
index 52d4a0c4cbb..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-anchor-repaint-restyle.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #stage { position: relative; width: 400px; height: 300px; }
- #anchor {
- anchor-name: --btn;
- position: absolute;
- left: 60px;
- top: 40px;
- width: 100px;
- height: 30px;
- }
- #anchored {
- position: absolute;
- position-anchor: --btn;
- left: anchor(left);
- top: anchor(bottom);
- width: 120px;
- }
- #inner { width: 80px; height: 20px; }
-</style>
-<div id="stage">
- <div id="anchor"></div>
- <div id="anchored">
- <div id="inner"></div>
- </div>
-</div>
-<script>
- // A restyle rebuilds computed insets from the raw properties, degrading a bare anchor()
- // to auto and wiping the values the last full pass resolved. A repaint-only restyle
- // (color) followed by a change inside the box must take the full layout path, which
- // re-resolves the insets and keeps the box anchored.
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- document.getElementById("anchored").style.color = "red";
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("inner").style.height = "60px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const anchored = document.getElementById("anchored").getBoundingClientRect();
- println(`layout-passes partial=${partialDelta} full=${fullDelta}`);
- println(`anchored=${rectToString(anchored)}`);
- println(partialDelta === 0 && fullDelta === 1
- && rectToString(anchored) === "60,70,120,60" ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-anchor-target-boundary.html b/Tests/LibWeb/Text/input/abspos-relayout-anchor-target-boundary.html
deleted file mode 100644
index fe673a958a2..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-anchor-target-boundary.html
+++ /dev/null
@@ -1,61 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #stage { position: relative; width: 400px; height: 300px; }
- #anchor {
- anchor-name: --btn;
- margin-left: 40px;
- margin-top: 30px;
- width: 100px;
- height: 30px;
- }
- #anchored {
- position: absolute;
- position-anchor: --btn;
- left: anchor(left);
- top: anchor(bottom);
- width: 120px;
- }
- #inner { width: 80px; height: 20px; }
-</style>
-<div id="stage">
- <div id="anchor"></div>
- <div id="anchored">
- <div id="inner"></div>
- </div>
-</div>
-<script>
- // A box whose own insets come from anchor() functions must not replay its layout from
- // saved inputs, because only a full layout pass resolves anchor() insets. A change
- // inside it takes the full path and the box keeps its anchored position.
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const anchoredBefore = document.getElementById("anchored").getBoundingClientRect();
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("inner").style.height = "60px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const anchor = document.getElementById("anchor").getBoundingClientRect();
- const anchoredAfter = document.getElementById("anchored").getBoundingClientRect();
- const inner = document.getElementById("inner").getBoundingClientRect();
- println(`layout-passes partial=${partialDelta} full=${fullDelta}`);
- println(`anchor=${rectToString(anchor)}`);
- println(`anchored-before=${rectToString(anchoredBefore)}`);
- println(`anchored-after=${rectToString(anchoredAfter)}`);
- println(`inner=${rectToString(inner)}`);
- println(partialDelta === 0 && fullDelta === 1
- && rectToString(anchor) === "40,30,100,30"
- && rectToString(anchoredBefore) === "40,60,120,20"
- && rectToString(anchoredAfter) === "40,60,120,60"
- && rectToString(inner) === "40,60,80,60" ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-anchors.html b/Tests/LibWeb/Text/input/abspos-relayout-anchors.html
new file mode 100644
index 00000000000..8fe2a206c10
--- /dev/null
+++ b/Tests/LibWeb/Text/input/abspos-relayout-anchors.html
@@ -0,0 +1,366 @@
+<!DOCTYPE html>
+<script src="include.js"></script>
+<script src="work-test.js"></script>
+<script>
+ const byId = id => document.getElementById(id);
+ const rectOf = element => {
+ const rect = element.getBoundingClientRect();
+ return `${rect.left},${rect.top},${rect.width},${rect.height}`;
+ };
+ const positionOf = element => {
+ const rect = element.getBoundingClientRect();
+ return `${rect.x},${rect.y}`;
+ };
+
+ const cases = [
+ {
+ name: "Anchor providers inside a boundary and their consumers",
+ html: `
+<style>
+ body { margin: 0; }
+ #stage { position: relative; width: 500px; height: 400px; }
+ #boundary { position: absolute; left: 30px; top: 40px; width: 180px; }
+ #spacer { height: 10px; }
+ #provider { anchor-name: --a; width: 50px; height: 20px; }
+ #consumer { position: absolute; left: anchor(--a right, 5px); top: anchor(--a bottom, 5px); width: 10px; height: 10px; }
+ #unrelated { position: absolute; left: 300px; top: 30px; width: 50px; height: 10px; }
+ #dependent-boundary { position: absolute; left: 200px; top: 200px; width: 100px; }
+ #dependent-content { height: 10px; }
+ #nested-consumer { position: absolute; left: anchor(--missing right, 7px); top: anchor(--missing bottom, 9px); width: 10px; height: 10px; }
+</style>
+<div id="stage">
+ <div id="boundary"><div id="spacer"></div><div id="provider"></div></div>
+ <div id="consumer"></div>
+ <div id="unrelated"></div>
+ <div id="dependent-boundary"><div id="dependent-content"></div><div id="nested-consumer"></div></div>
+</div>`,
+ run({ step, print }) {
+ const stage = byId("stage");
+ const boundary = byId("boundary");
+ const provider = byId("provider");
+ const consumer = byId("consumer");
+ const unrelated = byId("unrelated");
+ const dependentContent = byId("dependent-content");
+ const nestedConsumer = byId("nested-consumer");
+ const stepWithConsumer = (name, mutate) => {
+ step(name, mutate);
+ print(`consumer=${positionOf(consumer)}`);
+ };
+
+ stepWithConsumer("Move a provider inside the boundary", () => (byId("spacer").style.height = "30px"));
+ stepWithConsumer("Rebuild a boundary containing a provider", () => boundary.append(document.createElement("div")));
+ stepWithConsumer("Move the provider's boundary", () => (boundary.style.left = "60px"));
+
+ // One affected boundary must reject the whole batch before any partial pass is committed.
+ stepWithConsumer("Batch unrelated and provider changes", () => {
+ unrelated.style.top = "50px";
+ provider.style.width = "60px";
+ });
+ print(`Unrelated boundary also updated: ${unrelated.getBoundingClientRect().y === 50}`);
+
+ stepWithConsumer("Rename a provider", () => (provider.style.anchorName = "--different"));
+ stepWithConsumer("Restore a provider name", () => (provider.style.anchorName = "--a"));
+ stepWithConsumer("Clear a provider name", () => (provider.style.anchorName = "none"));
+ stepWithConsumer("Add a provider name", () => (provider.style.anchorName = "--a"));
+ stepWithConsumer("Remove an in-flow provider", () => provider.remove());
+
+ // The consumer already exists with a fallback when the incremental tree build creates the provider.
+ provider.style.cssText = "position: absolute; left: 20px; top: 80px";
+ stepWithConsumer("Insert an abspos provider", () => boundary.append(provider));
+ stepWithConsumer("Remove a directly contained abspos provider", () => provider.remove());
+
+ const wrapper = document.createElement("div");
+ wrapper.style.cssText = "position: absolute; left: 80px; top: 150px; width: 60px";
+ provider.style.cssText = "width: 30px; height: 10px";
+ wrapper.append(provider);
+ stepWithConsumer("Insert a subtree containing a provider", () => stage.insertBefore(wrapper, consumer));
+ stepWithConsumer("Remove a subtree containing a provider", () => wrapper.remove());
+
+ // A nested unresolved consumer still needs anchor resolution when its boundary is replayed.
+ stepWithConsumer("Boundary containing an unresolved consumer", () => (dependentContent.style.height = "30px"));
+ const nestedRect = nestedConsumer.getBoundingClientRect();
+ print(`Nested fallback position: ${nestedRect.x === 207 && nestedRect.y === 209}`);
+ nestedConsumer.style.left = "auto";
+ nestedConsumer.style.top = "auto";
+ nestedConsumer.style.positionAnchor = "--missing";
+ nestedConsumer.style.positionArea = "span-all";
+ stepWithConsumer("Boundary containing a position-area consumer", () => (dependentContent.style.height = "40px"));
+ },
+ },
+ {
+ // A style change that puts anchor() functions into the box's insets takes the full layout path, which
+ // resolves them against the anchor and lands the box at its anchored position.
+ name: "anchor() insets from a style change",
+ html: `
+<style>
+ body { margin: 0; }
+ #stage { position: relative; width: 400px; height: 300px; }
+ #anchor { anchor-name: --btn; position: absolute; left: 60px; top: 40px; width: 100px; height: 30px; }
+ #anchored { position: absolute; position-anchor: --btn; left: 10px; top: 10px; width: 80px; height: 25px; }
+</style>
+<div id="stage">
+ <div id="anchor"></div>
+ <div id="anchored"></div>
+</div>`,
+ run({ step, print }) {
+ const anchored = byId("anchored");
+ const anchoredBefore = rectOf(anchored);
+ step("Set anchor() insets", () => {
+ anchored.style.left = "anchor(right)";
+ anchored.style.top = "anchor(top)";
+ });
+ print(`anchor=${rectOf(byId("anchor"))}`);
+ print(`anchored-before=${anchoredBefore}`);
+ print(`anchored-after=${rectOf(anchored)}`);
+ },
+ },
+ {
+ // An anchor-name inside the boundary publishes geometry that positioned boxes outside consume through
+ // anchor(), so a change inside the boundary must take the full layout path to lay them out again.
+ name: "anchor-name inside a boundary",
+ html: `
+<style>
+ body { margin: 0; }
+ #stage { position: relative; width: 400px; height: 240px; }
+ #boundary { position: absolute; left: 30px; top: 40px; width: 180px; height: 120px; overflow: hidden; }
+ #anchor { anchor-name: --a; position: absolute; left: 20px; top: 30px; width: 50px; height: 20px; }
+ #target { position: absolute; position-anchor: --a; left: anchor(left); top: anchor(bottom); width: 60px; height: 25px; }
+</style>
+<div id="stage">
+ <div id="boundary">
+ <div id="anchor"></div>
+ </div>
+ <div id="target"></div>
+</div>`,
+ run({ step, print }) {
+ const anchor = byId("anchor");
+ const target = byId("target");
+ const anchorBefore = rectOf(anchor);
+ const targetBefore = rectOf(target);
+ step("Move the anchor", () => (anchor.style.top = "60px"));
+ print(`anchor-before=${anchorBefore}`);
+ print(`target-before=${targetBefore}`);
+ print(`anchor-after=${rectOf(anchor)}`);
+ print(`target-after=${rectOf(target)}`);
+ },
+ },
+ {
+ // Removing the anchor provider unregisters its names before the next layout runs, so the partial relayout
+ // planner's subtree check cannot see them. The removal itself must force the full layout path, which
+ // resolves the outside consumer's anchor() functions to their fallbacks.
+ name: "Anchor provider removal",
+ html: `
+<style>
+ body { margin: 0; }
+ #stage { position: relative; width: 400px; height: 300px; }
+ #boundary { position: absolute; left: 30px; top: 40px; width: 200px; height: 150px; }
+ #anchor { anchor-name: --a; position: absolute; left: 20px; top: 30px; width: 50px; height: 20px; }
+ #consumer { position: absolute; position-anchor: --a; left: anchor(right, 5px); top: anchor(top, 5px); width: 60px; height: 25px; }
+</style>
+<div id="stage">
+ <div id="boundary">
+ <div id="anchor"></div>
+ </div>
+ <div id="consumer"></div>
+</div>`,
+ run({ step, print }) {
+ const consumer = byId("consumer");
+ const consumerBefore = rectOf(consumer);
+ step("Remove the anchor", () => byId("anchor").remove());
+ print(`consumer-before=${consumerBefore}`);
+ print(`consumer-after=${rectOf(consumer)}`);
+ },
+ },
+ {
+ // A restyle rebuilds computed insets from the raw properties, degrading a bare anchor() to auto and wiping
+ // the values the last full pass resolved. A repaint-only restyle (color) together with a change inside the
+ // box must take the full layout path, which resolves the insets again and keeps the box anchored.
+ name: "Repaint-only restyle of an anchored box",
+ html: `
+<style>
+ body { margin: 0; }
+ #stage { position: relative; width: 400px; height: 300px; }
+ #anchor { anchor-name: --btn; position: absolute; left: 60px; top: 40px; width: 100px; height: 30px; }
+ #anchored { position: absolute; position-anchor: --btn; left: anchor(left); top: anchor(bottom); width: 120px; }
+ #inner { width: 80px; height: 20px; }
+</style>
+<div id="stage">
+ <div id="anchor"></div>
+ <div id="anchored">
+ <div id="inner"></div>
+ </div>
+</div>`,
+ run({ step, print }) {
+ const anchored = byId("anchored");
+ step("Change color and grow the inner box", () => {
+ anchored.style.color = "red";
+ byId("inner").style.height = "60px";
+ });
+ print(`anchored=${rectOf(anchored)}`);
+ },
+ },
+ {
+ // A box whose own insets come from anchor() functions must not replay its layout from saved inputs,
+ // because only a full layout pass resolves anchor() insets.
+ name: "Change inside a box with anchor() insets",
+ html: `
+<style>
+ body { margin: 0; }
+ #stage { position: relative; width: 400px; height: 300px; }
+ #anchor { anchor-name: --btn; margin-left: 40px; margin-top: 30px; width: 100px; height: 30px; }
+ #anchored { position: absolute; position-anchor: --btn; left: anchor(left); top: anchor(bottom); width: 120px; }
+ #inner { width: 80px; height: 20px; }
+</style>
+<div id="stage">
+ <div id="anchor"></div>
+ <div id="anchored">
+ <div id="inner"></div>
+ </div>
+</div>`,
+ run({ step, print }) {
+ const anchored = byId("anchored");
+ const anchoredBefore = rectOf(anchored);
+ step("Grow the inner box", () => (byId("inner").style.height = "60px"));
+ print(`anchor=${rectOf(byId("anchor"))}`);
+ print(`anchored-before=${anchoredBefore}`);
+ print(`anchored-after=${rectOf(anchored)}`);
+ print(`inner=${rectOf(byId("inner"))}`);
+ },
+ },
+ {
+ name: "Boundaries unrelated to anchors",
+ html: `
+<style>
+ body { margin: 0; }
+ #anchor { anchor-name: --a; width: 100px; height: 20px; }
+ #consumer { position: absolute; left: anchor(--a right, 5px); top: anchor(--a bottom, 5px); width: 10px; height: 10px; }
+ #boundary { position: absolute; left: 200px; top: 40px; width: 100px; }
+ #inside { height: 20px; }
+ .container { position: relative; width: 100px; height: 50px; }
+ .control { position: absolute; left: 10px; top: 15px; width: 20px; height: 10px; }
+</style>
+<div id="anchor"></div>
+<div id="consumer"></div>
+<div id="boundary"><div id="inside"></div></div>
+<div id="first" class="container"></div>
+<div id="second" class="container"></div>`,
+ run({ step, print }) {
+ const anchor = byId("anchor");
+ const consumer = byId("consumer");
+ const boundary = byId("boundary");
+ const first = byId("first");
+ const checkPosition = (label, element, x, y) => {
+ const rect = element.getBoundingClientRect();
+ print(`${label}: ${rect.x === x && rect.y === y}`);
+ };
+
+ step("Change unrelated subtree", () => (byId("inside").style.height = "40px"));
+ print(`Boundary resizes: ${boundary.getBoundingClientRect().height === 40}`);
+ step("Move unrelated boundary", () => (boundary.style.left = "250px"));
+ checkPosition("Boundary position", boundary, 250, 40);
+ step("Rebuild unrelated boundary", () => boundary.append(document.createElement("div")));
+ checkPosition("Consumer stays anchored", consumer, 100, 20);
+
+ // These containers are in flow, so insertion and removal must remain confined to the control.
+ const control = document.createElement("div");
+ control.className = "control";
+ step("Insert unrelated abspos", () => first.append(control));
+ checkPosition("Inserted position", control, 10, 35);
+ step("Move unrelated abspos between parents", () => byId("second").append(control));
+ checkPosition("Moved position", control, 10, 85);
+ step("Remove unrelated abspos without layout", () => control.remove());
+ checkPosition("Consumer survives unrelated removal", consumer, 100, 20);
+
+ consumer.style.left = "anchor(--missing right, 5px)";
+ consumer.style.top = "anchor(--missing bottom, 5px)";
+ step("Unresolved consumer outside boundary", () => (boundary.style.top = "60px"));
+ checkPosition("Consumer keeps fallback", consumer, 5, 5);
+
+ consumer.style.left = "auto";
+ consumer.style.top = "auto";
+ consumer.style.positionAnchor = "--a";
+ consumer.style.positionArea = "span-all";
+ step("Position-area consumer outside boundary", () => (boundary.style.top = "70px"));
+
+ // Anchor names on ancestors do not change when an out-of-flow descendant lays itself out.
+ anchor.append(boundary);
+ step("Boundary inside an anchor provider", () => (boundary.style.top = "80px"));
+ print(`Anchor size unchanged: ${anchor.getBoundingClientRect().height === 20}`);
+
+ first.append(consumer);
+ step("Remove last contained consumer without layout", () => consumer.remove());
+ },
+ },
+ {
+ name: "Anchor names without consumers",
+ html: `
+<style>
+ body { margin: 0; }
+ #header { anchor-name: --menu; width: 100px; height: 20px; }
+ #boundary { position: absolute; left: 30px; top: 40px; width: 300px; }
+ #local-anchor { anchor-name: --line; width: 100px; height: 20px; }
+ table { width: 300px; border-spacing: 0; }
+ td { position: relative; height: 20px; padding: 0; }
+ .control { position: absolute; left: 0; top: 0; width: 20px; height: 20px; }
+ .consumer { position: absolute; position-anchor: --line; left: anchor(right); top: anchor(top); width: 10px; height: 10px; }
+</style>
+<div id="header"></div>
+<div id="boundary"><div id="local-anchor"></div><table><tr><td id="first">First line</td></tr><tr><td id="second">Second line</td></tr></table></div>`,
+ run({ step, print }) {
+ const boundary = byId("boundary");
+ const first = byId("first");
+ const second = byId("second");
+ const control = document.createElement("div");
+ control.className = "control";
+ first.append(control);
+
+ step("Move control with unused header anchor", () => second.append(control));
+ print(`Control position: ${positionOf(control)}`);
+
+ // Creating a consumer during the incremental tree build must still force full layout.
+ const consumer = document.createElement("div");
+ consumer.className = "consumer";
+ step("Insert anchor consumer", () => boundary.append(consumer));
+ print(`Consumer position: ${positionOf(consumer)}`);
+ step("Move control with active consumer", () => first.append(control));
+
+ consumer.remove();
+ step("Remove last consumer", () => second.append(control));
+
+ consumer.style.display = "none";
+ boundary.append(consumer);
+ step("Hidden consumer", () => first.append(control));
+ step("Show consumer", () => (consumer.style.display = "block"));
+ consumer.style.position = "static";
+ step("Static consumer", () => second.append(control));
+ step("Make consumer positioned again", () => (consumer.style.position = "absolute"));
+
+ // position-area consumes anchor geometry without an anchor() inset.
+ consumer.style.left = "auto";
+ consumer.style.top = "auto";
+ consumer.style.positionArea = "span-all";
+ step("position-area consumer", () => first.append(control));
+ consumer.style.positionArea = "none";
+ step("Remove position-area dependency", () => second.append(control));
+ },
+ },
+ ];
+
+ test(() => {
+ const output = [];
+ for (const { name, html, run } of cases) {
+ output.push(`${name}:`);
+ loadFixture(html);
+ const step = (stepName, mutate) => {
+ output.push(` ${stepName}: ${layoutWork(mutate).passes().join(" | ") || "(no layout)"}`);
+ };
+ const print = line => output.push(` ${line}`);
+ try {
+ run({ step, print });
+ } catch (error) {
+ output.push(` FAIL: ${error}`);
+ }
+ }
+ for (const line of output) println(line);
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-append-direct-many.html b/Tests/LibWeb/Text/input/abspos-relayout-append-direct-many.html
deleted file mode 100644
index 0504dbd1222..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-append-direct-many.html
+++ /dev/null
@@ -1,61 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 320px; height: 180px; }
- #boundary {
- position: absolute;
- left: 40px;
- top: 30px;
- width: 180px;
- height: 100px;
- overflow: hidden;
- }
- .abs-child {
- position: absolute;
- width: 20px;
- height: 15px;
- }
- #one { left: 5px; top: 10px; }
- #two { left: 35px; top: 25px; width: 25px; height: 10px; }
- #three { left: 55px; top: 50px; width: 30px; height: 12px; }
-</style>
-<div id="root">
- <div id="boundary"></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const boundary = document.getElementById("boundary");
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- for (const id of ["one", "two", "three"]) {
- const child = document.createElement("div");
- child.id = id;
- child.className = "abs-child";
- boundary.appendChild(child);
- }
- document.body.offsetHeight;
-
- const one = document.getElementById("one").getBoundingClientRect();
- const two = document.getElementById("two").getBoundingClientRect();
- const three = document.getElementById("three").getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`one=${rectToString(one)}`);
- println(`two=${rectToString(two)}`);
- println(`three=${rectToString(three)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(one) === "45,40,20,15"
- && rectToString(two) === "75,55,25,10"
- && rectToString(three) === "95,80,30,12"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-aspect-ratio.html b/Tests/LibWeb/Text/input/abspos-relayout-aspect-ratio.html
deleted file mode 100644
index 4a780c66bf0..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-aspect-ratio.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 400px; height: 300px; }
- #boundary {
- position: absolute;
- left: 20px;
- top: 10px;
- width: 150px;
- /* Height derives from the aspect ratio; replay re-solves it on every partial relayout. */
- aspect-ratio: 3 / 2;
- overflow: hidden;
- }
- #content { width: 50px; height: 30px; background: blue; }
-</style>
-<div id="root">
- <div id="boundary"><div id="content"></div></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const boundary = document.getElementById("boundary");
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- document.getElementById("content").style.width = "80px";
- document.body.offsetHeight;
-
- const rect = boundary.getBoundingClientRect();
- const content = document.getElementById("content").getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`boundary=${rectToString(rect)}`);
- println(`content=${rectToString(content)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(rect) === "20,10,150,100"
- && rectToString(content) === "20,10,80,30"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-backdrop-style-change.html b/Tests/LibWeb/Text/input/abspos-relayout-backdrop-style-change.html
deleted file mode 100644
index 5500c5561b7..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-backdrop-style-change.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- dialog {
- position: fixed;
- left: 100px;
- top: 80px;
- width: 160px;
- height: 100px;
- margin: 0;
- border: none;
- padding: 0;
- }
- dialog::backdrop { position: fixed; inset: 0; }
- dialog.big::backdrop { inset: 40px; }
- #child { width: 60px; height: 20px; }
-</style>
-<dialog id="dialog"><div id="child"></div></dialog>
-<script>
- // A rendered ::backdrop lives outside the dialog's subtree (its box is a sibling of the
- // dialog's box), but pseudo-element style diffs are merged into the dialog's aggregated
- // invalidation. A class toggle whose only relayout effect is on the ::backdrop must not
- // ride the boundary-self fast path, or the backdrop keeps stale geometry; it has to take
- // the full layout path.
- promiseTest(async () => {
- const dialog = document.getElementById("dialog");
- dialog.showModal();
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- dialog.classList.add("big");
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`layout-passes partial=${partialDelta} full=${fullDelta}`);
- println(partialDelta === 0 && fullDelta >= 1 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-basic.html b/Tests/LibWeb/Text/input/abspos-relayout-basic.html
deleted file mode 100644
index cde7db7055f..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-basic.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 400px; height: 200px; }
- #boundary {
- position: absolute;
- left: 40px;
- top: 30px;
- width: 160px;
- height: 80px;
- overflow: hidden;
- }
- #child { width: 70px; height: 20px; }
- #spacer { height: 120px; }
- #outside { width: 200px; height: 25px; }
-</style>
-<div id="root">
- <div id="boundary">
- <div id="child"></div>
- </div>
- <div id="spacer"></div>
- <div id="outside"></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const outsideBefore = document.getElementById("outside").getBoundingClientRect();
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("child").style.height = "60px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const child = document.getElementById("child").getBoundingClientRect();
- const outsideAfter = document.getElementById("outside").getBoundingClientRect();
- println(`child=${rectToString(child)}`);
- println(`outside-before=${rectToString(outsideBefore)}`);
- println(`outside-after=${rectToString(outsideAfter)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(child.left === 40 && child.top === 30 && child.width === 70 && child.height === 60
- && rectToString(outsideBefore) === rectToString(outsideAfter)
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-boundary-style-change.html b/Tests/LibWeb/Text/input/abspos-relayout-boundary-style-change.html
deleted file mode 100644
index f37fcfd8cf9..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-boundary-style-change.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 320px; height: 180px; }
- #boundary {
- position: absolute;
- left: 40px;
- top: 30px;
- width: 150px;
- height: 90px;
- overflow: hidden;
- }
- #child {
- position: absolute;
- right: 10px;
- top: 15px;
- width: 30px;
- height: 20px;
- }
-</style>
-<div id="root">
- <div id="boundary"><div id="child"></div></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const boundary = document.getElementById("boundary");
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- boundary.style.width = "180px";
- document.body.offsetHeight;
-
- const boundaryRect = boundary.getBoundingClientRect();
- const childRect = document.getElementById("child").getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`boundary=${rectToString(boundaryRect)}`);
- println(`child=${rectToString(childRect)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(boundaryRect) === "40,30,180,90"
- && rectToString(childRect) === "180,45,30,20"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-confined-containing-blocks.html b/Tests/LibWeb/Text/input/abspos-relayout-confined-containing-blocks.html
new file mode 100644
index 00000000000..5340f97187d
--- /dev/null
+++ b/Tests/LibWeb/Text/input/abspos-relayout-confined-containing-blocks.html
@@ -0,0 +1,312 @@
+<!DOCTYPE html>
+<script src="include.js"></script>
+<script src="work-test.js"></script>
+<script>
+ function rectToString(rect) {
+ return `${rect.left},${rect.top},${rect.width},${rect.height}`;
+ }
+
+ function rectOf(id) {
+ return rectToString(document.getElementById(id).getBoundingClientRect());
+ }
+
+ function rectInRootOf(id) {
+ const element = document.getElementById(id);
+ const rect = element.getBoundingClientRect();
+ const rootRect = element.closest(".root").getBoundingClientRect();
+ return `${rect.left - rootRect.left},${rect.top - rootRect.top},${rect.width},${rect.height}`;
+ }
+
+ const cases = [
+ {
+ name: "fixed-cb",
+ html: `
+ <style>
+ body { margin: 0; }
+ #parent { position: relative; width: 360px; height: 220px; }
+ #boundary {
+ position: absolute;
+ left: 60px;
+ top: 70px;
+ width: 180px;
+ height: 110px;
+ overflow: hidden;
+ transform: translate(0, 0);
+ }
+ #fixed {
+ position: fixed;
+ left: 15px;
+ top: 10px;
+ width: 40px;
+ height: 20px;
+ }
+ #sibling { width: 80px; height: 20px; }
+ </style>
+ <div id="parent">
+ <div id="boundary">
+ <div id="fixed"></div>
+ <div id="sibling"></div>
+ </div>
+ </div>`,
+ mutate: () => (document.getElementById("sibling").style.height = "65px"),
+ report: () => [`boundary=${rectOf("boundary")}`, `fixed=${rectOf("fixed")}`, `sibling=${rectOf("sibling")}`],
+ },
+ {
+ name: "inline-containing-block",
+ html: `
+ <style>
+ body { margin: 0; font: 16px/20px monospace; }
+ #cb { position: relative; }
+ #boundary {
+ /* The containing block is an inline box, whose rectangle derives from line box
+ fragments. The saved layout inputs carry it, so subtree changes replay without
+ a full layout. */
+ position: absolute;
+ left: 5px;
+ top: 30px;
+ width: 120px;
+ height: 40px;
+ overflow: hidden;
+ }
+ #content { width: 30px; height: 10px; background: red; }
+ </style>
+ <div>before<span id="cb">inline containing block<div id="boundary"><div id="content"></div></div></span>after</div>`,
+ before: () => ({ boundary: rectOf("boundary") }),
+ mutate: () => (document.getElementById("content").style.width = "60px"),
+ report: before => [
+ `boundary-before=${before.boundary}`,
+ `boundary-after=${rectOf("boundary")}`,
+ `content-width=${document.getElementById("content").getBoundingClientRect().width}`,
+ ],
+ },
+ {
+ name: "rtl-static-position",
+ html: `
+ <style>
+ body { margin: 0; }
+ .root { position: relative; width: 300px; height: 100px; direction: rtl; }
+ .boundary {
+ /* Both horizontal insets auto in an RTL context: the static position rect is
+ end-aligned, and re-aligns against the live shrink-to-fit width at replay. */
+ position: absolute;
+ top: 10px;
+ height: 40px;
+ overflow: hidden;
+ }
+ .content { height: 10px; background: teal; }
+ </style>
+ <div class="root">
+ <div id="live" class="boundary"><div id="live-content" class="content" style="width: 50px"></div></div>
+ </div>
+ <div class="root">
+ <div id="reference" class="boundary"><div class="content" style="width: 120px"></div></div>
+ </div>`,
+ mutate: () => (document.getElementById("live-content").style.width = "120px"),
+ report: () => [`live=${rectInRootOf("live")}`, `reference=${rectInRootOf("reference")}`],
+ },
+ {
+ name: "static-position",
+ html: `
+ <style>
+ body { margin: 0; }
+ #parent { position: relative; width: 400px; height: 260px; }
+ #before-a { height: 40px; }
+ #before-b { height: 30px; }
+ #boundary {
+ position: absolute;
+ width: 120px;
+ height: 70px;
+ overflow: hidden;
+ }
+ #child { width: 80px; height: 20px; }
+ </style>
+ <div id="parent">
+ <div id="before-a"></div>
+ <div id="before-b"></div>
+ <div id="boundary">
+ <div id="child"></div>
+ </div>
+ </div>`,
+ before: () => ({ boundary: rectOf("boundary") }),
+ mutate: () => (document.getElementById("child").style.height = "55px"),
+ report: before => [
+ `boundary-before=${before.boundary}`,
+ `boundary-after=${rectOf("boundary")}`,
+ `child=${rectOf("child")}`,
+ ],
+ },
+ {
+ name: "container-query",
+ html: `
+ <style>
+ body { margin: 0; }
+ #parent { position: relative; width: 300px; height: 160px; }
+ #boundary {
+ position: absolute;
+ left: 10px;
+ top: 10px;
+ width: 260px;
+ height: 120px;
+ overflow: hidden;
+ }
+ #container {
+ container-type: inline-size;
+ width: 100px;
+ height: 60px;
+ }
+ #target { color: rgb(0, 0, 0); }
+ @container (min-width: 150px) {
+ #target { color: rgb(0, 128, 0); }
+ }
+ </style>
+ <div id="parent">
+ <div id="boundary">
+ <div id="container">
+ <div id="target">target</div>
+ </div>
+ </div>
+ </div>`,
+ before: () => ({ color: getComputedStyle(document.getElementById("target")).color }),
+ mutate: () => (document.getElementById("container").style.width = "200px"),
+ report: before => [
+ `color-before=${before.color}`,
+ `container=${rectOf("container")}`,
+ `color-after=${getComputedStyle(document.getElementById("target")).color}`,
+ ],
+ },
+ {
+ name: "scroller",
+ html: `
+ <style>
+ body { margin: 0; }
+ #parent { position: relative; width: 220px; height: 160px; }
+ #boundary {
+ position: absolute;
+ left: 20px;
+ top: 30px;
+ width: 100px;
+ height: 100px;
+ overflow: auto;
+ }
+ #content {
+ width: 50px;
+ height: 500px;
+ box-sizing: border-box;
+ padding-top: 180px;
+ }
+ #probe { height: 20px; }
+ </style>
+ <div id="parent">
+ <div id="boundary">
+ <div id="content">
+ <div id="probe">probe</div>
+ </div>
+ </div>
+ </div>`,
+ before: () => {
+ document.getElementById("boundary").scrollTop = 150;
+ },
+ mutate: () => (document.getElementById("content").style.height = "520px"),
+ report: () => {
+ const hit = document.elementFromPoint(30, 65);
+ return [
+ `scrollTop=${document.getElementById("boundary").scrollTop}`,
+ `hit=${hit ? hit.id || hit.tagName : "null"}`,
+ ];
+ },
+ },
+ {
+ name: "shadow-dom",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 360px; height: 180px; }
+ #boundary {
+ position: absolute;
+ left: 40px;
+ top: 25px;
+ width: 160px;
+ height: 90px;
+ overflow: hidden;
+ }
+ #host { display: block; width: 80px; height: 30px; }
+ </style>
+ <div id="root">
+ <div id="boundary">
+ <div id="inner"><div id="host"></div></div>
+ </div>
+ </div>`,
+ before: () => {
+ const shadow = document.getElementById("host").attachShadow({ mode: "open" });
+ shadow.innerHTML = `
+ <style>
+ #existing { width: 20px; height: 10px; }
+ .new-child {
+ position: absolute;
+ left: 15px;
+ top: 10px;
+ width: 30px;
+ height: 20px;
+ }
+ </style>
+ <div id="existing"></div>
+ `;
+ const child = document.createElement("div");
+ child.id = "new-shadow-child";
+ child.className = "new-child";
+ return { shadow, child };
+ },
+ mutate: before => before.shadow.appendChild(before.child),
+ report: before => [`shadow-child=${rectToString(before.child.getBoundingClientRect())}`],
+ },
+ {
+ name: "svg-inside",
+ html: `
+ <style>
+ body { margin: 0; }
+ #parent { position: relative; width: 300px; height: 220px; }
+ #boundary {
+ position: absolute;
+ left: 40px;
+ top: 50px;
+ width: 220px;
+ height: 160px;
+ overflow: hidden;
+ }
+ #svg { display: block; }
+ #sibling { width: 70px; height: 20px; }
+ #page-sibling { width: 120px; height: 30px; }
+ </style>
+ <div id="parent">
+ <div id="boundary">
+ <svg id="svg" width="100" height="80">
+ <path id="path" d="M 10 10 L 50 50" stroke="black" fill="none"/>
+ </svg>
+ <div id="sibling"></div>
+ </div>
+ </div>
+ <div id="page-sibling"></div>`,
+ before: () => ({ sibling: rectOf("sibling") }),
+ mutate: () => document.getElementById("path").setAttribute("d", "M 10 10 L 90 60"),
+ report: before => [
+ `boundary=${rectOf("boundary")}`,
+ `svg=${rectOf("svg")}`,
+ `sibling-before=${before.sibling}`,
+ `sibling-after=${rectOf("sibling")}`,
+ `page-sibling=${rectOf("page-sibling")}`,
+ ],
+ },
+ ];
+
+ test(() => {
+ const output = [];
+ for (const { name, html, before, mutate, report } of cases) {
+ loadFixture(html);
+ const measuredBefore = before?.() ?? {};
+ const work = layoutWork(() => mutate(measuredBefore));
+ output.push(`${name}: ${work.passes().join(" | ") || "(no layout)"}`);
+ for (const line of report(measuredBefore)) output.push(` ${line}`);
+ }
+ for (const line of output) println(line);
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-confined-insertions-and-removals.html b/Tests/LibWeb/Text/input/abspos-relayout-confined-insertions-and-removals.html
new file mode 100644
index 00000000000..3e86461b8d7
--- /dev/null
+++ b/Tests/LibWeb/Text/input/abspos-relayout-confined-insertions-and-removals.html
@@ -0,0 +1,547 @@
+<!DOCTYPE html>
+<script src="include.js"></script>
+<script src="work-test.js"></script>
+<script>
+ function rectToString(rect) {
+ return `${rect.left},${rect.top},${rect.width},${rect.height}`;
+ }
+
+ function rectOf(id) {
+ return rectToString(document.getElementById(id).getBoundingClientRect());
+ }
+
+ function localRectOf(id, containerId) {
+ const rect = document.getElementById(id).getBoundingClientRect();
+ const containerRect = document.getElementById(containerId).getBoundingClientRect();
+ return `${rect.left - containerRect.left},${rect.top - containerRect.top},${rect.width},${rect.height}`;
+ }
+
+ function countColor(displayList, color) {
+ return displayList.split(`color=${color}`).length - 1;
+ }
+
+ function absoluteChild(tagName, id, className) {
+ const child = document.createElement(tagName);
+ child.id = id;
+ child.className = className;
+ return child;
+ }
+
+ const flexAnonymousItemFixture = `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 600px; height: 400px; }
+ .boundary {
+ position: absolute;
+ width: min-content;
+ height: 100px;
+ overflow: hidden;
+ }
+ .flex { display: flex; }
+ .grid { display: grid; grid-auto-flow: column; }
+ .anchor { width: 40px; height: 20px; }
+ .block { width: 120px; height: 20px; }
+ .wide { width: 150px; height: 20px; }
+ </style>
+ <div id="root">
+ <div class="boundary" id="flex-boundary" style="left: 20px; top: 10px">
+ <div class="flex" id="flex"><div class="anchor"></div></div>
+ </div>
+ <div class="boundary" id="grid-boundary" style="left: 20px; top: 130px">
+ <div class="grid" id="grid"><div class="anchor"></div></div>
+ </div>
+ <div class="boundary" id="nested-boundary" style="left: 260px; top: 10px">
+ <div class="flex" id="nested-flex">
+ <div class="anchor"></div>
+ <div id="nested-wrapper"></div>
+ </div>
+ </div>
+ <div class="boundary" id="text-boundary" style="left: 260px; top: 130px">
+ <div class="flex" id="text-flex"><div class="anchor"></div></div>
+ </div>
+ </div>`;
+
+ function insertedBlock(className = "block") {
+ const element = document.createElement("div");
+ element.className = className;
+ element.textContent = "inserted";
+ return element;
+ }
+
+ function flexAnonymousItemCase(prefix, mutate, { printAfterRect = true } = {}) {
+ const boundaryRect = () => document.getElementById(`${prefix}-boundary`).getBoundingClientRect();
+ return {
+ name: `insert-flex-anonymous-item ${prefix}`,
+ html: flexAnonymousItemFixture,
+ before: () => ({ boundary: boundaryRect() }),
+ mutate,
+ report: before => {
+ const after = boundaryRect();
+ return [
+ `${prefix}-before=${rectToString(before.boundary)}`,
+ printAfterRect
+ ? `${prefix}-after=${rectToString(after)}`
+ : `${prefix}-width-grew=${after.width > before.boundary.width}`,
+ ];
+ },
+ };
+ }
+
+ const cases = [
+ {
+ name: "append-direct-many",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 320px; height: 180px; }
+ #boundary {
+ position: absolute;
+ left: 40px;
+ top: 30px;
+ width: 180px;
+ height: 100px;
+ overflow: hidden;
+ }
+ .abs-child {
+ position: absolute;
+ width: 20px;
+ height: 15px;
+ }
+ #one { left: 5px; top: 10px; }
+ #two { left: 35px; top: 25px; width: 25px; height: 10px; }
+ #three { left: 55px; top: 50px; width: 30px; height: 12px; }
+ </style>
+ <div id="root">
+ <div id="boundary"></div>
+ </div>`,
+ mutate: () => {
+ for (const id of ["one", "two", "three"])
+ document.getElementById("boundary").appendChild(absoluteChild("div", id, "abs-child"));
+ },
+ report: () => [`one=${rectOf("one")}`, `two=${rectOf("two")}`, `three=${rectOf("three")}`],
+ },
+ {
+ name: "continuation",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 520px; height: 180px; }
+ .boundary {
+ position: absolute;
+ top: 20px;
+ width: 200px;
+ height: 120px;
+ overflow: hidden;
+ font-size: 0;
+ line-height: 10px;
+ }
+ #live-boundary { left: 40px; }
+ #reference-boundary { left: 280px; }
+ .marker {
+ display: inline-block;
+ width: 20px;
+ height: 10px;
+ vertical-align: top;
+ }
+ .inserted-block {
+ display: block;
+ width: 70px;
+ height: 25px;
+ }
+ </style>
+ <div id="root">
+ <div id="live-boundary" class="boundary">
+ <div><span id="live-inline"><span id="live-before" class="marker"></span></span><span id="live-after" class="marker"></span></div>
+ </div>
+ <div id="reference-boundary" class="boundary">
+ <div><span><span id="reference-before" class="marker"></span><div id="reference-inserted" class="inserted-block"></div></span><span id="reference-after" class="marker"></span></div>
+ </div>
+ </div>`,
+ mutate: () =>
+ document.getElementById("live-inline").appendChild(absoluteChild("div", "live-inserted", "inserted-block")),
+ report: () => {
+ const rectsMatch = ["before", "inserted", "after"].every(
+ part => localRectOf(`live-${part}`, "live-boundary") === localRectOf(`reference-${part}`, "reference-boundary")
+ );
+ return [`rects-match=${rectsMatch}`];
+ },
+ },
+ {
+ name: "direct-child-geometry",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 520px; height: 160px; }
+ .boundary {
+ position: absolute;
+ top: 20px;
+ width: 180px;
+ height: 90px;
+ overflow: hidden;
+ font-size: 0;
+ line-height: 10px;
+ }
+ #live-boundary { left: 40px; }
+ #reference-boundary { left: 280px; }
+ .marker {
+ display: inline-block;
+ width: 30px;
+ height: 10px;
+ vertical-align: top;
+ }
+ .gap {
+ display: inline-block;
+ width: 20px;
+ height: 10px;
+ vertical-align: top;
+ }
+ .static-abs {
+ position: absolute;
+ width: 14px;
+ height: 16px;
+ }
+ </style>
+ <div id="root">
+ <div id="live-boundary" class="boundary"><span class="marker"></span><span class="gap"></span></div>
+ <div id="reference-boundary" class="boundary"><span class="marker"></span><span class="gap"></span><span id="reference" class="static-abs"></span></div>
+ </div>`,
+ mutate: () =>
+ document.getElementById("live-boundary").appendChild(absoluteChild("span", "inserted", "static-abs")),
+ report: () => [
+ `live=${localRectOf("inserted", "live-boundary")}`,
+ `reference=${localRectOf("reference", "reference-boundary")}`,
+ ],
+ },
+ {
+ name: "insert-direct-child",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 320px; height: 170px; }
+ #boundary {
+ position: absolute;
+ left: 40px;
+ top: 30px;
+ width: 150px;
+ height: 90px;
+ overflow: hidden;
+ }
+ #outside { width: 120px; height: 20px; }
+ .abs-child {
+ position: absolute;
+ left: 10px;
+ top: 15px;
+ width: 30px;
+ height: 20px;
+ }
+ </style>
+ <div id="root">
+ <div id="boundary"><div id="inner"></div></div>
+ <div style="height: 130px"></div>
+ <div id="outside"></div>
+ </div>`,
+ mutate: () => document.getElementById("boundary").appendChild(absoluteChild("div", "inserted", "abs-child")),
+ report: () => [`inserted=${rectOf("inserted")}`],
+ },
+ flexAnonymousItemCase("flex", () => document.getElementById("flex").appendChild(insertedBlock())),
+ flexAnonymousItemCase("grid", () => document.getElementById("grid").appendChild(insertedBlock())),
+ flexAnonymousItemCase("nested", () => document.getElementById("nested-wrapper").appendChild(insertedBlock("wide"))),
+ flexAnonymousItemCase(
+ "text",
+ () => document.getElementById("text-flex").appendChild(document.createTextNode("inserted-text")),
+ { printAfterRect: false }
+ ),
+ {
+ name: "insert-static-position",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 360px; height: 150px; }
+ .boundary {
+ position: absolute;
+ top: 20px;
+ width: 120px;
+ height: 90px;
+ overflow: hidden;
+ }
+ #live-boundary { left: 30px; }
+ #reference-boundary { left: 200px; }
+ .before { width: 80px; height: 25px; }
+ .after { width: 80px; height: 30px; }
+ .static-abs {
+ position: absolute;
+ width: 40px;
+ height: 15px;
+ }
+ </style>
+ <div id="root">
+ <div id="live-boundary" class="boundary">
+ <div id="live-wrapper"><div class="before"></div><div id="live-after" class="after"></div></div>
+ </div>
+ <div id="reference-boundary" class="boundary">
+ <div><div class="before"></div><div id="reference-abs" class="static-abs"></div><div class="after"></div></div>
+ </div>
+ </div>`,
+ mutate: () =>
+ document
+ .getElementById("live-wrapper")
+ .insertBefore(absoluteChild("div", "live-abs", "static-abs"), document.getElementById("live-after")),
+ report: () => [
+ `live=${localRectOf("live-abs", "live-boundary")}`,
+ `reference=${localRectOf("reference-abs", "reference-boundary")}`,
+ ],
+ },
+ {
+ name: "insert-table-row",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 460px; height: 170px; }
+ #boundary {
+ position: absolute;
+ left: 30px;
+ top: 20px;
+ width: 180px;
+ height: 120px;
+ overflow: hidden;
+ }
+ #outside-wrapper {
+ position: absolute;
+ left: 260px;
+ top: 20px;
+ }
+ table { border-collapse: collapse; }
+ td {
+ padding: 0;
+ width: 50px;
+ height: 20px;
+ }
+ </style>
+ <div id="root">
+ <div id="boundary">
+ <div id="inner">
+ <table id="live-table"><tbody id="live-body"><tr><td>one</td></tr></tbody></table>
+ </div>
+ </div>
+ <div id="outside-wrapper">
+ <table id="outside-table"><tbody><tr><td>one</td></tr><tr><td id="outside-new">new</td></tr></tbody></table>
+ </div>
+ </div>`,
+ before: () => ({ outside: localRectOf("outside-new", "outside-table") }),
+ mutate: () => {
+ const row = document.createElement("tr");
+ row.innerHTML = "<td id='live-new'>new</td>";
+ document.getElementById("live-body").appendChild(row);
+ },
+ report: before => [
+ `live-new=${localRectOf("live-new", "live-table")}`,
+ `outside-before=${before.outside}`,
+ `outside-after=${localRectOf("outside-new", "outside-table")}`,
+ ],
+ },
+ {
+ name: "insert-under-descendant",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 360px; height: 180px; }
+ #boundary {
+ position: absolute;
+ left: 40px;
+ top: 30px;
+ width: 160px;
+ height: 90px;
+ overflow: hidden;
+ }
+ #inner { width: 80px; height: 30px; }
+ #outside { width: 120px; height: 25px; }
+ .abs-child {
+ position: absolute;
+ left: 15px;
+ top: 10px;
+ width: 35px;
+ height: 20px;
+ }
+ </style>
+ <div id="root">
+ <div id="boundary">
+ <div id="inner"></div>
+ </div>
+ <div style="height: 130px"></div>
+ <div id="outside"></div>
+ </div>`,
+ before: () => ({ outside: rectOf("outside") }),
+ mutate: () => document.getElementById("inner").appendChild(absoluteChild("div", "inserted", "abs-child")),
+ report: before => [
+ `inserted=${rectOf("inserted")}`,
+ `outside-before=${before.outside}`,
+ `outside-after=${rectOf("outside")}`,
+ ],
+ },
+ {
+ name: "move-before",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 520px; height: 180px; }
+ .boundary {
+ position: absolute;
+ top: 20px;
+ width: 200px;
+ height: 100px;
+ overflow: hidden;
+ font-size: 0;
+ line-height: 10px;
+ }
+ #live-boundary { left: 40px; }
+ #reference-boundary { left: 280px; }
+ .marker {
+ display: inline-block;
+ width: 30px;
+ height: 10px;
+ vertical-align: top;
+ }
+ .gap {
+ display: inline-block;
+ width: 20px;
+ height: 10px;
+ vertical-align: top;
+ }
+ .move-abs {
+ position: absolute;
+ width: 10px;
+ height: 10px;
+ }
+ #move { background: rgb(51, 52, 53); }
+ </style>
+ <div id="root">
+ <div id="live-boundary" class="boundary">
+ <span id="live-a"><span class="marker"></span><span id="move" class="move-abs"></span></span><span class="gap"></span><span id="live-b"><span class="marker"></span></span>
+ </div>
+ <div id="reference-boundary" class="boundary">
+ <span><span class="marker"></span></span><span class="gap"></span><span><span class="marker"></span><span id="reference-move" class="move-abs"></span></span>
+ </div>
+ </div>`,
+ before: () => ({ move: document.getElementById("move").getBoundingClientRect() }),
+ mutate: () => document.getElementById("live-b").moveBefore(document.getElementById("move"), null),
+ report: before => [
+ `live=${localRectOf("move", "live-boundary")}`,
+ `reference=${localRectOf("reference-move", "reference-boundary")}`,
+ `paint-count=${countColor(internals.dumpDisplayList(), "rgb(51, 52, 53)")}`,
+ `old-hit-is-moved=${document.elementFromPoint(before.move.left + 2, before.move.top + 2) === document.getElementById("move")}`,
+ ],
+ },
+ {
+ name: "remove-reinsert",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 360px; height: 180px; }
+ #boundary {
+ position: absolute;
+ left: 40px;
+ top: 30px;
+ width: 160px;
+ height: 90px;
+ overflow: hidden;
+ }
+ #inner { width: 80px; height: 30px; }
+ #moving {
+ position: absolute;
+ left: 15px;
+ top: 10px;
+ width: 35px;
+ height: 20px;
+ }
+ </style>
+ <div id="root">
+ <div id="boundary">
+ <div id="inner"><span></span><div id="moving"></div></div>
+ </div>
+ </div>`,
+ mutate: () => {
+ const moving = document.getElementById("moving");
+ const inner = document.getElementById("inner");
+ inner.removeChild(moving);
+ inner.appendChild(moving);
+ },
+ report: () => [`moving=${rectOf("moving")}`],
+ },
+ {
+ name: "remove-under-descendant",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 360px; height: 180px; }
+ #boundary {
+ position: absolute;
+ left: 40px;
+ top: 30px;
+ width: 160px;
+ height: 90px;
+ overflow: hidden;
+ }
+ #inner { width: 80px; height: 30px; }
+ #removed {
+ position: absolute;
+ left: 15px;
+ top: 10px;
+ width: 35px;
+ height: 20px;
+ background: rgb(41, 42, 43);
+ }
+ #outside { width: 120px; height: 25px; }
+ </style>
+ <div id="root">
+ <div id="boundary">
+ <div id="inner"><div id="removed"></div></div>
+ </div>
+ <div style="height: 130px"></div>
+ <div id="outside"></div>
+ </div>`,
+ before: () => ({ removed: document.getElementById("removed"), outside: rectOf("outside") }),
+ mutate: () => document.getElementById("inner").removeChild(document.getElementById("removed")),
+ report: before => [
+ `hit-removed=${document.elementFromPoint(57, 42) === before.removed}`,
+ `paint-count=${countColor(internals.dumpDisplayList(), "rgb(41, 42, 43)")}`,
+ `outside-before=${before.outside}`,
+ `outside-after=${rectOf("outside")}`,
+ ],
+ },
+ {
+ name: "text-into-boundary",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 320px; height: 170px; }
+ #boundary {
+ position: absolute;
+ left: 40px;
+ top: 30px;
+ width: 150px;
+ height: 90px;
+ overflow: hidden;
+ }
+ #inner { width: 80px; height: 20px; }
+ </style>
+ <div id="root">
+ <div id="boundary"><div id="inner"></div></div>
+ </div>`,
+ before: () => ({ boundary: rectOf("boundary") }),
+ mutate: () => document.getElementById("boundary").appendChild(document.createTextNode("text")),
+ report: before => [`boundary-before=${before.boundary}`, `boundary-after=${rectOf("boundary")}`],
+ },
+ ];
+
+ test(() => {
+ const output = [];
+ for (const { name, html, before, mutate, report } of cases) {
+ loadFixture(html);
+ const measuredBefore = before?.() ?? {};
+ const work = layoutWork(() => mutate(measuredBefore));
+ output.push(`${name}: ${work.passes().join(" | ") || "(no layout)"}`);
+ for (const line of report(measuredBefore)) output.push(` ${line}`);
+ }
+ for (const line of output) println(line);
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-confined-moves.html b/Tests/LibWeb/Text/input/abspos-relayout-confined-moves.html
new file mode 100644
index 00000000000..d5d165d587e
--- /dev/null
+++ b/Tests/LibWeb/Text/input/abspos-relayout-confined-moves.html
@@ -0,0 +1,567 @@
+<!DOCTYPE html>
+<script src="include.js"></script>
+<script src="work-test.js"></script>
+<script>
+ function rectToString(rect) {
+ return `${rect.left},${rect.top},${rect.width},${rect.height}`;
+ }
+
+ function rectOf(id) {
+ return rectToString(document.getElementById(id).getBoundingClientRect());
+ }
+
+ function hitIdAt(x, y) {
+ const hit = document.elementFromPoint(x, y);
+ return hit ? hit.id : "null";
+ }
+
+ const cases = [
+ {
+ name: "basic",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 400px; height: 200px; }
+ #boundary {
+ position: absolute;
+ left: 40px;
+ top: 30px;
+ width: 160px;
+ height: 80px;
+ overflow: hidden;
+ }
+ #child { width: 70px; height: 20px; }
+ #spacer { height: 120px; }
+ #outside { width: 200px; height: 25px; }
+ </style>
+ <div id="root">
+ <div id="boundary">
+ <div id="child"></div>
+ </div>
+ <div id="spacer"></div>
+ <div id="outside"></div>
+ </div>`,
+ before: () => ({ outside: rectOf("outside") }),
+ mutate: () => (document.getElementById("child").style.height = "60px"),
+ report: before => [
+ `child=${rectOf("child")}`,
+ `outside-before=${before.outside}`,
+ `outside-after=${rectOf("outside")}`,
+ ],
+ },
+ {
+ // A boundary without anchor providers or consumers can be laid out independently, preserving the
+ // geometry of anchor-positioned boxes elsewhere in the document.
+ name: "anchor-elsewhere",
+ html: `
+ <style>
+ body { margin: 0; }
+ #stage { position: relative; width: 400px; height: 300px; }
+ #anchor {
+ anchor-name: --a;
+ width: 90px;
+ height: 20px;
+ }
+ #tooltip {
+ position: absolute;
+ position-anchor: --a;
+ left: anchor(right);
+ top: anchor(top);
+ width: 50px;
+ height: 15px;
+ }
+ #boundary {
+ position: absolute;
+ left: 40px;
+ top: 120px;
+ width: 200px;
+ height: 100px;
+ overflow: hidden;
+ }
+ #child { width: 70px; height: 20px; }
+ </style>
+ <div id="stage">
+ <div id="anchor"></div>
+ <div id="tooltip"></div>
+ <div id="boundary">
+ <div id="child"></div>
+ </div>
+ </div>`,
+ before: () => ({ tooltip: rectOf("tooltip") }),
+ mutate: () => (document.getElementById("child").style.height = "50px"),
+ report: before => [
+ `tooltip-before=${before.tooltip}`,
+ `tooltip-after=${rectOf("tooltip")}`,
+ `child=${rectOf("child")}`,
+ ],
+ },
+ {
+ name: "aspect-ratio",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 400px; height: 300px; }
+ #boundary {
+ position: absolute;
+ left: 20px;
+ top: 10px;
+ width: 150px;
+ /* Height derives from the aspect ratio; replay re-solves it on every partial relayout. */
+ aspect-ratio: 3 / 2;
+ overflow: hidden;
+ }
+ #content { width: 50px; height: 30px; background: blue; }
+ </style>
+ <div id="root">
+ <div id="boundary"><div id="content"></div></div>
+ </div>`,
+ mutate: () => (document.getElementById("content").style.width = "80px"),
+ report: () => [`boundary=${rectOf("boundary")}`, `content=${rectOf("content")}`],
+ },
+ {
+ name: "boundary-style-change",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 320px; height: 180px; }
+ #boundary {
+ position: absolute;
+ left: 40px;
+ top: 30px;
+ width: 150px;
+ height: 90px;
+ overflow: hidden;
+ }
+ #child {
+ position: absolute;
+ right: 10px;
+ top: 15px;
+ width: 30px;
+ height: 20px;
+ }
+ </style>
+ <div id="root">
+ <div id="boundary"><div id="child"></div></div>
+ </div>`,
+ mutate: () => (document.getElementById("boundary").style.width = "180px"),
+ report: () => [`boundary=${rectOf("boundary")}`, `child=${rectOf("child")}`],
+ },
+ {
+ name: "content-growth-updates-scroller",
+ html: `
+ <style>
+ body { margin: 0; }
+ #scroller { position: relative; width: 300px; height: 150px; overflow: auto; }
+ #boundary {
+ position: absolute;
+ left: 10px;
+ top: 20px;
+ width: 100px;
+ /* Content-driven height: growth must resize the boundary and grow the scroller's
+ scrollable overflow, which the geometry diff after commit recomputes. */
+ overflow: hidden;
+ }
+ #content { width: 50px; height: 60px; background: purple; }
+ </style>
+ <div id="scroller">
+ <div id="boundary"><div id="content"></div></div>
+ </div>`,
+ before: () => ({ scrollHeight: document.getElementById("scroller").scrollHeight }),
+ mutate: () => (document.getElementById("content").style.height = "400px"),
+ report: before => [
+ `boundary-height=${document.getElementById("boundary").getBoundingClientRect().height}`,
+ `scroll-height-before=${before.scrollHeight} after=${document.getElementById("scroller").scrollHeight}`,
+ ],
+ },
+ {
+ name: "inset-stretch",
+ html: `
+ <style>
+ body { margin: 0; }
+ #parent { position: relative; width: 320px; height: 180px; }
+ #boundary {
+ position: absolute;
+ inset: 0;
+ overflow: hidden;
+ }
+ #child { width: 100px; height: 25px; }
+ </style>
+ <div id="parent">
+ <div id="boundary">
+ <div id="child"></div>
+ </div>
+ </div>`,
+ mutate: () => (document.getElementById("child").style.height = "70px"),
+ report: () => [`boundary=${rectOf("boundary")}`, `child=${rectOf("child")}`],
+ },
+ {
+ name: "min-content-width",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 400px; height: 300px; }
+ #boundary {
+ position: absolute;
+ left: 20px;
+ top: 10px;
+ /* Intrinsic sizing: replay re-runs it against subtree content on every partial relayout. */
+ width: min-content;
+ height: 80px;
+ overflow: hidden;
+ }
+ .item { width: 60px; height: 20px; background: green; }
+ </style>
+ <div id="root">
+ <div id="boundary"><div class="item" id="item"></div></div>
+ </div>`,
+ before: () => ({ boundary: rectOf("boundary") }),
+ mutate: () => (document.getElementById("item").style.width = "110px"),
+ report: before => [`boundary-before=${before.boundary}`, `boundary-after=${rectOf("boundary")}`],
+ },
+ {
+ name: "move-inset-only",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 400px; height: 300px; }
+ #boundary {
+ position: absolute;
+ left: 10px;
+ top: 20px;
+ width: 100px;
+ height: 50px;
+ overflow: hidden;
+ }
+ </style>
+ <div id="root">
+ <div id="boundary"></div>
+ </div>`,
+ mutate: () => {
+ const boundary = document.getElementById("boundary");
+ boundary.style.left = "70px";
+ boundary.style.top = "80px";
+ },
+ report: () => [`boundary=${rectOf("boundary")}`],
+ },
+ {
+ name: "move-margin-change",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 400px; height: 300px; }
+ #boundary {
+ position: absolute;
+ left: 10px;
+ top: 20px;
+ width: 100px;
+ height: 50px;
+ overflow: hidden;
+ }
+ </style>
+ <div id="root">
+ <div id="boundary"></div>
+ </div>`,
+ mutate: () => {
+ const boundary = document.getElementById("boundary");
+ boundary.style.marginLeft = "25px";
+ boundary.style.marginTop = "5px";
+ },
+ report: () => [`boundary=${rectOf("boundary")}`],
+ },
+ {
+ name: "move-multiple-boxes",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 400px; height: 300px; }
+ .boundary {
+ position: absolute;
+ width: 40px;
+ height: 30px;
+ overflow: hidden;
+ }
+ #a { left: 0px; top: 0px; }
+ #b { left: 50px; top: 0px; }
+ #c { left: 100px; top: 0px; }
+ </style>
+ <div id="root">
+ <div id="a" class="boundary"></div>
+ <div id="b" class="boundary"></div>
+ <div id="c" class="boundary"></div>
+ </div>`,
+ mutate: () => {
+ document.getElementById("a").style.top = "100px";
+ document.getElementById("b").style.top = "150px";
+ document.getElementById("c").style.left = "200px";
+ },
+ report: () => [`a=${rectOf("a")}`, `b=${rectOf("b")}`, `c=${rectOf("c")}`],
+ },
+ {
+ name: "move-percentage-insets",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 400px; height: 300px; }
+ #boundary {
+ position: absolute;
+ left: 10%;
+ top: 20%;
+ width: 25%;
+ height: 50px;
+ overflow: hidden;
+ }
+ </style>
+ <div id="root">
+ <div id="boundary"></div>
+ </div>`,
+ mutate: () => {
+ const boundary = document.getElementById("boundary");
+ boundary.style.left = "50%";
+ boundary.style.top = "50%";
+ },
+ report: () => [`boundary=${rectOf("boundary")}`],
+ },
+ {
+ name: "move-static-position",
+ html: `
+ <style>
+ body { margin: 0; }
+ #root { position: relative; width: 400px; height: 300px; }
+ #boundary {
+ /* left and right are both auto: the horizontal position comes from the static
+ position, which the saved layout inputs carry, so a boundary-self geometry
+ change replays without a full layout. */
+ position: absolute;
+ top: 10px;
+ width: 150px;
+ height: 60px;
+ overflow: hidden;
+ }
+ </style>
+ <div id="root">
+ <div id="boundary"></div>
+ </div>`,
+ mutate: () => (document.getElementById("boundary").style.top = "60px"),
+ report: () => [`boundary=${rectOf("boundary")}`],
+ },
+ {
+ name: "move-updates-ancestor-overflow",
+ html: `
+ <style>
+ body { margin: 0; }
+ #scroller {
+ position: relative;
+ width: 200px;
+ height: 200px;
+ overflow: scroll;
+ }
+ #boundary {
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ width: 50px;
+ height: 50px;
+ overflow: hidden;
+ }
+ </style>
+ <div id="scroller">
+ <div id="boundary"></div>
+ </div>`,
+ before: () => ({ scrollHeight: document.getElementById("scroller").scrollHeight }),
+ mutate: () => (document.getElementById("boundary").style.top = "500px"),
+ report: before => [
+ `scrollHeight-before=${before.scrollHeight}`,
+ `scrollHeight-after=${document.getElementById("scroller").scrollHeight}`,
+ ],
+ },
+ {
+ name: "nested-boundaries",
+ html: `
+ <style>
+ body { margin: 0; }
+ #parent { position: relative; width: 360px; height: 240px; }
+ #outer {
+ position: absolute;
+ left: 20px;
+ top: 30px;
+ width: 260px;
+ height: 160px;
+ overflow: hidden;
+ }
+ #between {
+ margin-left: 10px;
+ margin-top: 10px;
+ width: 90px;
+ height: 25px;
+ }
+ #inner {
+ position: absolute;
+ left: 50px;
+ top: 40px;
+ width: 100px;
+ height: 50px;
+ overflow: hidden;
+ }
+ #child { width: 60px; height: 15px; }
+ </style>
+ <div id="parent">
+ <div id="outer">
+ <div id="between"></div>
+ <div id="inner">
+ <div id="child"></div>
+ </div>
+ </div>
+ </div>`,
+ before: () => ({ between: rectOf("between") }),
+ mutate: () => (document.getElementById("child").style.height = "40px"),
+ report: before => [
+ `outer=${rectOf("outer")}`,
+ `inner=${rectOf("inner")}`,
+ `between-before=${before.between}`,
+ `between-after=${rectOf("between")}`,
+ `child=${rectOf("child")}`,
+ ],
+ },
+ {
+ name: "overflow-visible",
+ html: `
+ <style>
+ body { margin: 0; }
+ #scroller {
+ position: relative;
+ width: 200px;
+ height: 100px;
+ overflow: auto;
+ }
+ #spacer { height: 20px; }
+ #abspos {
+ position: absolute;
+ left: 0;
+ top: 10px;
+ width: 50px;
+ height: 50px;
+ overflow: visible;
+ }
+ #content { width: 50px; height: 40px; }
+ </style>
+ <div id="scroller">
+ <div id="spacer"></div>
+ <div id="abspos">
+ <div id="content"></div>
+ </div>
+ </div>`,
+ before: () => ({ scrollHeight: document.getElementById("scroller").scrollHeight }),
+ mutate: () => (document.getElementById("content").style.height = "180px"),
+ report: before => [
+ `scrollHeight-before=${before.scrollHeight}`,
+ `scrollHeight-after=${document.getElementById("scroller").scrollHeight}`,
+ ],
+ },
+ {
+ name: "percentage-size",
+ html: `
+ <style>
+ body { margin: 0; }
+ #parent { position: relative; width: 400px; height: 300px; }
+ #boundary {
+ position: absolute;
+ left: 30px;
+ top: 20px;
+ width: 50%;
+ height: 50%;
+ overflow: hidden;
+ }
+ #child { width: 75px; height: 20px; }
+ </style>
+ <div id="parent">
+ <div id="boundary">
+ <div id="child"></div>
+ </div>
+ </div>`,
+ mutate: () => (document.getElementById("child").style.height = "90px"),
+ report: () => [`boundary=${rectOf("boundary")}`, `child=${rectOf("child")}`],
+ },
+ {
+ name: "shrink-to-fit",
+ html: `
+ <style>
+ body { margin: 0; }
+ #parent { position: relative; width: 400px; height: 140px; }
+ #boundary {
+ position: absolute;
+ left: 25px;
+ top: 20px;
+ width: auto;
+ height: 50px;
+ overflow: hidden;
+ white-space: nowrap;
+ }
+ #content {
+ display: inline-block;
+ width: 80px;
+ height: 20px;
+ }
+ </style>
+ <div id="parent">
+ <div id="boundary"><span id="content"></span></div>
+ </div>`,
+ before: () => ({ boundary: rectOf("boundary") }),
+ mutate: () => (document.getElementById("content").style.width = "180px"),
+ report: before => [
+ `boundary-before=${before.boundary}`,
+ `boundary-after=${rectOf("boundary")}`,
+ `content=${rectOf("content")}`,
+ ],
+ },
+ {
+ // Two overlapping absolutely positioned siblings with auto z-index paint in tree order, so the later one
+ // covers the earlier one. A partial relayout of the earlier sibling must splice its rebuilt paint subtree
+ // back at its original position, or it would move on top of the later sibling and change paint and
+ // hit-test order compared to a full layout.
+ name: "sibling-paint-order",
+ html: `
+ <style>
+ body { margin: 0; }
+ #stage { position: relative; width: 400px; height: 300px; }
+ #first {
+ position: absolute;
+ left: 40px;
+ top: 40px;
+ width: 120px;
+ height: 100px;
+ background: rgb(200, 0, 0);
+ }
+ #second {
+ position: absolute;
+ left: 100px;
+ top: 80px;
+ width: 120px;
+ height: 100px;
+ background: rgb(0, 0, 200);
+ }
+ #child { width: 50px; height: 20px; }
+ </style>
+ <div id="stage">
+ <div id="first">
+ <div id="child"></div>
+ </div>
+ <div id="second"></div>
+ </div>`,
+ before: () => ({ hit: hitIdAt(150, 110) }),
+ mutate: () => (document.getElementById("child").style.height = "40px"),
+ report: before => [`hit-before=${before.hit}`, `hit-after=${hitIdAt(150, 110)}`],
+ },
+ ];
+
+ test(() => {
+ const output = [];
+ for (const { name, html, before, mutate, report } of cases) {
+ loadFixture(html);
+ const measuredBefore = before?.() ?? {};
+ const work = layoutWork(() => mutate(measuredBefore));
+ output.push(`${name}: ${work.passes().join(" | ") || "(no layout)"}`);
+ for (const line of report(measuredBefore)) output.push(` ${line}`);
+ }
+ for (const line of output) println(line);
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-contain-toggle.html b/Tests/LibWeb/Text/input/abspos-relayout-contain-toggle.html
deleted file mode 100644
index f3df7a371b7..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-contain-toggle.html
+++ /dev/null
@@ -1,75 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #stage { position: relative; width: 400px; height: 300px; }
- #boundary {
- position: absolute;
- left: 50px;
- top: 60px;
- width: 240px;
- height: 160px;
- }
- #wrapper {
- contain: layout;
- width: 200px;
- height: 100px;
- }
- #fixed {
- position: fixed;
- left: 30px;
- top: 40px;
- width: 50px;
- height: 20px;
- }
- #child { width: 60px; height: 20px; }
-</style>
-<div id="stage">
- <div id="boundary">
- <div id="wrapper">
- <div id="fixed"></div>
- </div>
- <div id="child"></div>
- </div>
-</div>
-<script>
- // The contain:layout wrapper is the fixed box's containing block, so the fixed box does
- // not escape the boundary and changes inside it use partial relayout. Dropping the
- // containment re-parents the fixed box's containing block to the viewport without
- // dirtying layout by itself; the escaped-by-abspos facts derived from the old containing
- // blocks can no longer be trusted, so the next layout must be a full pass, which re-lays
- // the fixed box out against the viewport.
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("child").style.height = "40px";
- document.body.offsetHeight;
- const partialDeltaBeforeToggle = internals.partialLayoutCount() - partialBefore;
- const fullDeltaBeforeToggle = internals.fullLayoutCount() - fullBefore;
- const fixedBeforeToggle = document.getElementById("fixed").getBoundingClientRect();
-
- const partialBeforeToggle = internals.partialLayoutCount();
- const fullBeforeToggle = internals.fullLayoutCount();
- document.getElementById("wrapper").style.contain = "none";
- document.getElementById("child").style.height = "60px";
- document.body.offsetHeight;
- const partialDeltaAfterToggle = internals.partialLayoutCount() - partialBeforeToggle;
- const fullDeltaAfterToggle = internals.fullLayoutCount() - fullBeforeToggle;
- const fixedAfterToggle = document.getElementById("fixed").getBoundingClientRect();
-
- println(`before-toggle partial=${partialDeltaBeforeToggle} full=${fullDeltaBeforeToggle}`);
- println(`after-toggle partial=${partialDeltaAfterToggle} full=${fullDeltaAfterToggle}`);
- println(`fixed-before-toggle=${rectToString(fixedBeforeToggle)}`);
- println(`fixed-after-toggle=${rectToString(fixedAfterToggle)}`);
- println(partialDeltaBeforeToggle === 1 && fullDeltaBeforeToggle === 0
- && partialDeltaAfterToggle === 0 && fullDeltaAfterToggle === 1
- && rectToString(fixedBeforeToggle) === "80,100,50,20"
- && rectToString(fixedAfterToggle) === "30,40,50,20" ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-contained-child-in-table-cell.html b/Tests/LibWeb/Text/input/abspos-relayout-contained-child-in-table-cell.html
index 1789f36c93a..c4b7ff7164a 100644
--- a/Tests/LibWeb/Text/input/abspos-relayout-contained-child-in-table-cell.html
+++ b/Tests/LibWeb/Text/input/abspos-relayout-contained-child-in-table-cell.html
@@ -36,13 +36,11 @@
return `${r.left},${r.top},${r.width},${r.height}`;
};
const step = (name, mutation) => {
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
internals.beginLayoutTrace();
mutation();
document.body.offsetHeight;
const roots = internals.takeLayoutTrace().split("\n").filter(line => line.startsWith("layout"));
- output.push(`${name}: partial=${internals.partialLayoutCount() - partialBefore} full=${internals.fullLayoutCount() - fullBefore} roots=[${roots.join(" | ")}]`);
+ output.push(`${name}: roots=[${roots.join(" | ")}]`);
if (bar.isConnected)
output.push(`${name}: bar=${rect(bar)} cell=${rect(bar.parentElement)}`);
};
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-contained-child-writing-modes.html b/Tests/LibWeb/Text/input/abspos-relayout-contained-child-writing-modes.html
index 78cb2398fbd..bd194ec02a3 100644
--- a/Tests/LibWeb/Text/input/abspos-relayout-contained-child-writing-modes.html
+++ b/Tests/LibWeb/Text/input/abspos-relayout-contained-child-writing-modes.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="include.js"></script>
+<script src="work-test.js"></script>
<style>
body { margin: 0; }
.container { position: relative; width: 200px; height: 150px; padding: 5px 17px 11px 29px; }
@@ -13,26 +14,22 @@
// A child laid out on its own from its parent's committed padding box lands where a full layout
// puts it, whatever the parent's writing mode.
test(() => {
- document.body.offsetHeight;
const output = [];
for (const id of ["a", "b", "c", "d"]) {
const container = document.getElementById(id);
const child = document.createElement("div");
child.className = "child";
- internals.beginLayoutTrace();
- container.appendChild(child);
- document.body.offsetHeight;
- const roots = internals.takeLayoutTrace().split("\n").filter(line => line.startsWith("layout")).join(" | ");
+ const roots = layoutWork(() => container.appendChild(child)).passes().join(" | ");
const r = child.getBoundingClientRect();
const fast = `${r.left},${r.top},${r.width},${r.height}`;
- const fullBefore = internals.fullLayoutCount();
- document.body.style.marginLeft = "1px";
- document.body.offsetHeight;
- document.body.style.marginLeft = "";
- document.body.offsetHeight;
+ const reference = layoutWork(() => {
+ document.body.style.marginLeft = "1px";
+ document.body.offsetHeight;
+ document.body.style.marginLeft = "";
+ }).passes().join(" | ");
const s = child.getBoundingClientRect();
const full = `${s.left},${s.top},${s.width},${s.height}`;
- output.push(`${id}: roots=[${roots}] full-layouts=${internals.fullLayoutCount() > fullBefore} matches-full-layout=${fast === full}`);
+ output.push(`${id}: roots=[${roots}] reference=[${reference}] matches-full-layout=${fast === full}`);
}
for (const line of output)
println(line);
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-container-query.html b/Tests/LibWeb/Text/input/abspos-relayout-container-query.html
deleted file mode 100644
index fb2b4d8bb23..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-container-query.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #parent { position: relative; width: 300px; height: 160px; }
- #boundary {
- position: absolute;
- left: 10px;
- top: 10px;
- width: 260px;
- height: 120px;
- overflow: hidden;
- }
- #container {
- container-type: inline-size;
- width: 100px;
- height: 60px;
- }
- #target { color: rgb(0, 0, 0); }
- @container (min-width: 150px) {
- #target { color: rgb(0, 128, 0); }
- }
-</style>
-<div id="parent">
- <div id="boundary">
- <div id="container">
- <div id="target">target</div>
- </div>
- </div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const target = document.getElementById("target");
- const colorBefore = getComputedStyle(target).color;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("container").style.width = "200px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const container = document.getElementById("container").getBoundingClientRect();
- const colorAfter = getComputedStyle(target).color;
- println(`color-before=${colorBefore}`);
- println(`container=${rectToString(container)}`);
- println(`color-after=${colorAfter}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(colorBefore === "rgb(0, 0, 0)"
- && rectToString(container) === "10,10,200,60"
- && colorAfter === "rgb(0, 128, 0)"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-content-growth-updates-scroller.html b/Tests/LibWeb/Text/input/abspos-relayout-content-growth-updates-scroller.html
deleted file mode 100644
index 4ad687df303..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-content-growth-updates-scroller.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #scroller { position: relative; width: 300px; height: 150px; overflow: auto; }
- #boundary {
- position: absolute;
- left: 10px;
- top: 20px;
- width: 100px;
- /* Content-driven height: growth must resize the boundary and grow the scroller's
- scrollable overflow, which the geometry diff after commit recomputes. */
- overflow: hidden;
- }
- #content { width: 50px; height: 60px; background: purple; }
-</style>
-<div id="scroller">
- <div id="boundary"><div id="content"></div></div>
-</div>
-<script>
- test(() => {
- document.body.offsetHeight;
-
- const scroller = document.getElementById("scroller");
- const scrollHeightBefore = scroller.scrollHeight;
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- document.getElementById("content").style.height = "400px";
- document.body.offsetHeight;
-
- const boundaryHeight = document.getElementById("boundary").getBoundingClientRect().height;
- const scrollHeightAfter = scroller.scrollHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`boundary-height=${boundaryHeight}`);
- println(`scroll-height-before=${scrollHeightBefore} after=${scrollHeightAfter}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(boundaryHeight === 400
- && scrollHeightBefore === 150 && scrollHeightAfter === 420
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-continuation.html b/Tests/LibWeb/Text/input/abspos-relayout-continuation.html
deleted file mode 100644
index fe4c7f1c44e..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-continuation.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 520px; height: 180px; }
- .boundary {
- position: absolute;
- top: 20px;
- width: 200px;
- height: 120px;
- overflow: hidden;
- font-size: 0;
- line-height: 10px;
- }
- #live-boundary { left: 40px; }
- #reference-boundary { left: 280px; }
- .marker {
- display: inline-block;
- width: 20px;
- height: 10px;
- vertical-align: top;
- }
- .inserted-block {
- display: block;
- width: 70px;
- height: 25px;
- }
-</style>
-<div id="root">
- <div id="live-boundary" class="boundary">
- <div><span id="live-inline"><span id="live-before" class="marker"></span></span><span id="live-after" class="marker"></span></div>
- </div>
- <div id="reference-boundary" class="boundary">
- <div><span><span id="reference-before" class="marker"></span><div id="reference-inserted" class="inserted-block"></div></span><span id="reference-after" class="marker"></span></div>
- </div>
-</div>
-<script>
- function localRectToString(element, container) {
- const rect = element.getBoundingClientRect();
- const containerRect = container.getBoundingClientRect();
- return `${rect.left - containerRect.left},${rect.top - containerRect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- const inserted = document.createElement("div");
- inserted.id = "live-inserted";
- inserted.className = "inserted-block";
- document.getElementById("live-inline").appendChild(inserted);
- document.body.offsetHeight;
-
- const liveBoundary = document.getElementById("live-boundary");
- const referenceBoundary = document.getElementById("reference-boundary");
- const rectsMatch =
- localRectToString(document.getElementById("live-before"), liveBoundary) === localRectToString(document.getElementById("reference-before"), referenceBoundary)
- && localRectToString(inserted, liveBoundary) === localRectToString(document.getElementById("reference-inserted"), referenceBoundary)
- && localRectToString(document.getElementById("live-after"), liveBoundary) === localRectToString(document.getElementById("reference-after"), referenceBoundary);
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`rects-match=${rectsMatch}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectsMatch && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-direct-child-geometry.html b/Tests/LibWeb/Text/input/abspos-relayout-direct-child-geometry.html
deleted file mode 100644
index f4431b7af4b..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-direct-child-geometry.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 520px; height: 160px; }
- .boundary {
- position: absolute;
- top: 20px;
- width: 180px;
- height: 90px;
- overflow: hidden;
- font-size: 0;
- line-height: 10px;
- }
- #live-boundary { left: 40px; }
- #reference-boundary { left: 280px; }
- .marker {
- display: inline-block;
- width: 30px;
- height: 10px;
- vertical-align: top;
- }
- .gap {
- display: inline-block;
- width: 20px;
- height: 10px;
- vertical-align: top;
- }
- .static-abs {
- position: absolute;
- width: 14px;
- height: 16px;
- }
-</style>
-<div id="root">
- <div id="live-boundary" class="boundary"><span class="marker"></span><span class="gap"></span></div>
- <div id="reference-boundary" class="boundary"><span class="marker"></span><span class="gap"></span><span id="reference" class="static-abs"></span></div>
-</div>
-<script>
- function localRectToString(element, container) {
- const rect = element.getBoundingClientRect();
- const containerRect = container.getBoundingClientRect();
- return `${rect.left - containerRect.left},${rect.top - containerRect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const liveBoundary = document.getElementById("live-boundary");
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- const inserted = document.createElement("span");
- inserted.id = "inserted";
- inserted.className = "static-abs";
- liveBoundary.appendChild(inserted);
- document.body.offsetHeight;
-
- const liveRect = localRectToString(inserted, liveBoundary);
- const referenceRect = localRectToString(document.getElementById("reference"), document.getElementById("reference-boundary"));
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`live=${liveRect}`);
- println(`reference=${referenceRect}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(liveRect === "50,0,14,16"
- && liveRect === referenceRect
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-document-element-excluded.html b/Tests/LibWeb/Text/input/abspos-relayout-document-element-excluded.html
deleted file mode 100644
index 310bc6059a6..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-document-element-excluded.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!DOCTYPE html>
-<html style="position: absolute; left: 10px; top: 10px; width: 300px; height: 200px; overflow: hidden;">
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #child { width: 70px; height: 20px; }
-</style>
-<div id="child"></div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("child").style.height = "60px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const child = document.getElementById("child").getBoundingClientRect();
- println(`child=${rectToString(child)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(child.left === 10 && child.top === 10 && child.width === 70 && child.height === 60
- && partialDelta === 0 && fullDelta === 1 ? "PASS" : "FAIL");
- });
-</script>
-</html>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-escaping-fixed-removal.html b/Tests/LibWeb/Text/input/abspos-relayout-escaping-fixed-removal.html
deleted file mode 100644
index 5cac5372c3b..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-escaping-fixed-removal.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #stage { position: relative; width: 400px; height: 300px; }
- #boundary {
- position: absolute;
- left: 50px;
- top: 60px;
- width: 240px;
- height: 160px;
- }
- #fixed {
- position: fixed;
- left: 30px;
- top: 40px;
- width: 50px;
- height: 20px;
- }
- #child { width: 60px; height: 20px; }
-</style>
-<div id="stage">
- <div id="boundary">
- <div id="fixed"></div>
- <div id="child"></div>
- </div>
-</div>
-<script>
- // The fixed box's containing block is the viewport, outside the boundary, so changes
- // inside the boundary take the full layout path. Removing the fixed box heals the
- // boundary: the full pass that performs the removal re-derives the escaped-by-abspos
- // facts, and the next change inside the boundary uses partial relayout again.
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("child").style.height = "40px";
- document.body.offsetHeight;
- const partialDeltaWhileEscaping = internals.partialLayoutCount() - partialBefore;
- const fullDeltaWhileEscaping = internals.fullLayoutCount() - fullBefore;
-
- document.getElementById("fixed").remove();
- document.body.offsetHeight;
-
- const partialBeforeHealed = internals.partialLayoutCount();
- const fullBeforeHealed = internals.fullLayoutCount();
- document.getElementById("child").style.height = "60px";
- document.body.offsetHeight;
- const partialDeltaAfterRemoval = internals.partialLayoutCount() - partialBeforeHealed;
- const fullDeltaAfterRemoval = internals.fullLayoutCount() - fullBeforeHealed;
-
- const child = document.getElementById("child").getBoundingClientRect();
- println(`while-escaping partial=${partialDeltaWhileEscaping} full=${fullDeltaWhileEscaping}`);
- println(`after-removal partial=${partialDeltaAfterRemoval} full=${fullDeltaAfterRemoval}`);
- println(`child=${rectToString(child)}`);
- println(partialDeltaWhileEscaping === 0 && fullDeltaWhileEscaping === 1
- && partialDeltaAfterRemoval === 1 && fullDeltaAfterRemoval === 0
- && rectToString(child) === "50,60,60,60" ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-fixed-cb-toggle.html b/Tests/LibWeb/Text/input/abspos-relayout-fixed-cb-toggle.html
deleted file mode 100644
index 6c78ce55ca0..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-fixed-cb-toggle.html
+++ /dev/null
@@ -1,75 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #stage { position: relative; width: 400px; height: 300px; }
- #boundary {
- position: absolute;
- left: 50px;
- top: 60px;
- width: 240px;
- height: 160px;
- }
- #wrapper {
- transform: translate(10px, 20px);
- width: 200px;
- height: 100px;
- }
- #fixed {
- position: fixed;
- left: 30px;
- top: 40px;
- width: 50px;
- height: 20px;
- }
- #child { width: 60px; height: 20px; }
-</style>
-<div id="stage">
- <div id="boundary">
- <div id="wrapper">
- <div id="fixed"></div>
- </div>
- <div id="child"></div>
- </div>
-</div>
-<script>
- // The transformed wrapper is the fixed box's containing block, so the fixed box does not
- // escape the boundary and changes inside it use partial relayout. Removing the transform
- // re-parents the fixed box's containing block to the viewport without dirtying layout by
- // itself; the escaped-by-abspos facts derived from the old containing blocks can no
- // longer be trusted, so the next layout must be a full pass, which re-lays the fixed box
- // out against the viewport.
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("child").style.height = "40px";
- document.body.offsetHeight;
- const partialDeltaBeforeToggle = internals.partialLayoutCount() - partialBefore;
- const fullDeltaBeforeToggle = internals.fullLayoutCount() - fullBefore;
- const fixedBeforeToggle = document.getElementById("fixed").getBoundingClientRect();
-
- const partialBeforeToggle = internals.partialLayoutCount();
- const fullBeforeToggle = internals.fullLayoutCount();
- document.getElementById("wrapper").style.transform = "none";
- document.getElementById("child").style.height = "60px";
- document.body.offsetHeight;
- const partialDeltaAfterToggle = internals.partialLayoutCount() - partialBeforeToggle;
- const fullDeltaAfterToggle = internals.fullLayoutCount() - fullBeforeToggle;
- const fixedAfterToggle = document.getElementById("fixed").getBoundingClientRect();
-
- println(`before-toggle partial=${partialDeltaBeforeToggle} full=${fullDeltaBeforeToggle}`);
- println(`after-toggle partial=${partialDeltaAfterToggle} full=${fullDeltaAfterToggle}`);
- println(`fixed-before-toggle=${rectToString(fixedBeforeToggle)}`);
- println(`fixed-after-toggle=${rectToString(fixedAfterToggle)}`);
- println(partialDeltaBeforeToggle === 1 && fullDeltaBeforeToggle === 0
- && partialDeltaAfterToggle === 0 && fullDeltaAfterToggle === 1
- && rectToString(fixedBeforeToggle) === "90,120,50,20"
- && rectToString(fixedAfterToggle) === "30,40,50,20" ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-fixed-cb.html b/Tests/LibWeb/Text/input/abspos-relayout-fixed-cb.html
deleted file mode 100644
index 9c2c363adf7..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-fixed-cb.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #parent { position: relative; width: 360px; height: 220px; }
- #boundary {
- position: absolute;
- left: 60px;
- top: 70px;
- width: 180px;
- height: 110px;
- overflow: hidden;
- transform: translate(0, 0);
- }
- #fixed {
- position: fixed;
- left: 15px;
- top: 10px;
- width: 40px;
- height: 20px;
- }
- #sibling { width: 80px; height: 20px; }
-</style>
-<div id="parent">
- <div id="boundary">
- <div id="fixed"></div>
- <div id="sibling"></div>
- </div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("sibling").style.height = "65px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const boundary = document.getElementById("boundary").getBoundingClientRect();
- const fixed = document.getElementById("fixed").getBoundingClientRect();
- const sibling = document.getElementById("sibling").getBoundingClientRect();
- println(`boundary=${rectToString(boundary)}`);
- println(`fixed=${rectToString(fixed)}`);
- println(`sibling=${rectToString(sibling)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(boundary) === "60,70,180,110"
- && rectToString(fixed) === "75,80,40,20"
- && rectToString(sibling) === "60,70,80,65"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-fixed-descendant-fallback.html b/Tests/LibWeb/Text/input/abspos-relayout-fixed-descendant-fallback.html
deleted file mode 100644
index b23879d79e2..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-fixed-descendant-fallback.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #parent { position: relative; width: 360px; height: 220px; }
- #boundary {
- position: absolute;
- left: 100px;
- top: 100px;
- width: 200px;
- height: 120px;
- overflow: hidden;
- }
- #fixed {
- position: fixed;
- left: 30px;
- top: 20px;
- width: 40px;
- height: 25px;
- }
- #sibling { width: 80px; height: 20px; }
-</style>
-<div id="parent">
- <div id="boundary">
- <div id="fixed"></div>
- <div id="sibling"></div>
- </div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const fixedBefore = document.getElementById("fixed").getBoundingClientRect();
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("sibling").style.height = "70px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const fixedAfter = document.getElementById("fixed").getBoundingClientRect();
- const sibling = document.getElementById("sibling").getBoundingClientRect();
- println(`fixed-before=${rectToString(fixedBefore)}`);
- println(`fixed-after=${rectToString(fixedAfter)}`);
- println(`sibling=${rectToString(sibling)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(fixedBefore) === "30,20,40,25"
- && rectToString(fixedBefore) === rectToString(fixedAfter)
- && rectToString(sibling) === "100,100,80,70"
- && partialDelta === 0 && fullDelta === 1 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-full-layout-fallbacks.html b/Tests/LibWeb/Text/input/abspos-relayout-full-layout-fallbacks.html
new file mode 100644
index 00000000000..932d1c29595
--- /dev/null
+++ b/Tests/LibWeb/Text/input/abspos-relayout-full-layout-fallbacks.html
@@ -0,0 +1,221 @@
+<!DOCTYPE html>
+<script src="include.js"></script>
+<script src="work-test.js"></script>
+<script>
+ const byId = id => document.getElementById(id);
+ const rectOf = element => {
+ const rect = element.getBoundingClientRect();
+ return `${rect.left},${rect.top},${rect.width},${rect.height}`;
+ };
+
+ const cases = [
+ {
+ name: "Fixed descendant of a boundary",
+ html: `
+<style>
+ body { margin: 0; }
+ #parent { position: relative; width: 360px; height: 220px; }
+ #boundary { position: absolute; left: 100px; top: 100px; width: 200px; height: 120px; overflow: hidden; }
+ #fixed { position: fixed; left: 30px; top: 20px; width: 40px; height: 25px; }
+ #sibling { width: 80px; height: 20px; }
+</style>
+<div id="parent">
+ <div id="boundary">
+ <div id="fixed"></div>
+ <div id="sibling"></div>
+ </div>
+</div>`,
+ run({ step, print }) {
+ const fixed = byId("fixed");
+ const sibling = byId("sibling");
+ const fixedBefore = rectOf(fixed);
+ step("Grow the sibling", () => (sibling.style.height = "70px"));
+ print(`fixed-before=${fixedBefore}`);
+ print(`fixed-after=${rectOf(fixed)}`);
+ print(`sibling=${rectOf(sibling)}`);
+ },
+ },
+ {
+ name: "Insertion into a display: none element",
+ html: `
+<style>
+ body { margin: 0; }
+ #root { position: relative; width: 360px; height: 180px; }
+ #boundary { position: absolute; left: 40px; top: 30px; width: 160px; height: 90px; overflow: hidden; }
+ #hidden { display: none; }
+ #sibling { width: 70px; height: 25px; }
+</style>
+<div id="root">
+ <div id="boundary">
+ <div id="hidden"></div>
+ <div id="sibling"></div>
+ </div>
+</div>`,
+ run({ step, print }) {
+ const sibling = byId("sibling");
+ const siblingBefore = rectOf(sibling);
+ const child = document.createElement("div");
+ child.id = "inserted";
+ child.style.width = "20px";
+ child.style.height = "20px";
+ step("Insert into the hidden element", () => byId("hidden").appendChild(child));
+ print(`inserted-rects=${child.getClientRects().length}`);
+ print(`sibling-before=${siblingBefore}`);
+ print(`sibling-after=${rectOf(sibling)}`);
+ },
+ },
+ {
+ name: "Insertion of a fixed box into a boundary",
+ html: `
+<style>
+ body { margin: 0; }
+ #root { position: relative; width: 360px; height: 180px; }
+ #boundary { position: absolute; left: 40px; top: 30px; width: 160px; height: 90px; overflow: hidden; }
+ #inner { width: 80px; height: 30px; }
+ #fixed { position: fixed; left: 25px; top: 18px; width: 35px; height: 20px; }
+</style>
+<div id="root">
+ <div id="boundary">
+ <div id="inner"></div>
+ </div>
+</div>`,
+ run({ step, print }) {
+ const fixed = document.createElement("div");
+ fixed.id = "fixed";
+ step("Insert the fixed box", () => byId("inner").appendChild(fixed));
+ print(`fixed=${rectOf(fixed)}`);
+ },
+ },
+ {
+ name: "Insertion of an abspos box under body",
+ html: `
+<style>
+ body { margin: 0; }
+ #inserted { position: absolute; left: 70px; top: 45px; width: 30px; height: 20px; }
+</style>`,
+ run({ step, print }) {
+ const inserted = document.createElement("div");
+ inserted.id = "inserted";
+ step("Append to body", () => document.body.appendChild(inserted));
+ print(`inserted=${rectOf(inserted)}`);
+ },
+ },
+ {
+ // A ShadowRoot direct child has no parent element, so revealing it from display: none marks the element
+ // itself, and with no layout node attached yet, neither layout dirt nor a subtree rebuilt in place records
+ // the change. When the same update also has dirt confined to a boundary, the partial path must not commit
+ // with the revealed subtree never laid out; the update has to take the full layout path.
+ name: "Shadow root child revealed",
+ html: `
+<style>
+ body { margin: 0; }
+ #stage { position: relative; width: 400px; height: 300px; }
+ #boundary { position: absolute; left: 40px; top: 30px; width: 200px; }
+ #child { width: 60px; height: 20px; }
+</style>
+<div id="stage">
+ <div id="boundary">
+ <div id="child"></div>
+ </div>
+ <div id="host"></div>
+</div>`,
+ run({ step, print }) {
+ const shadow = byId("host").attachShadow({ mode: "open" });
+ const revealed = document.createElement("div");
+ revealed.style.cssText = "display: none; width: 120px; height: 50px;";
+ shadow.appendChild(revealed);
+ step("Reveal the shadow child and grow the boundary child", () => {
+ revealed.style.display = "block";
+ byId("child").style.height = "40px";
+ });
+ print(`revealed=${rectOf(revealed)}`);
+ print(`child=${rectOf(byId("child"))}`);
+ },
+ },
+ {
+ // A rendered ::backdrop's box is a sibling of the dialog's box, outside its subtree, but pseudo-element
+ // style diffs are merged into the dialog's invalidation. A class toggle whose only relayout effect is on
+ // the ::backdrop must not ride the boundary-self fast path, or the backdrop keeps stale geometry.
+ name: "::backdrop style change",
+ html: `
+<style>
+ body { margin: 0; }
+ dialog { position: fixed; left: 100px; top: 80px; width: 160px; height: 100px; margin: 0; border: none; padding: 0; }
+ dialog::backdrop { position: fixed; inset: 0; }
+ dialog.big::backdrop { inset: 40px; }
+ #child { width: 60px; height: 20px; }
+</style>
+<dialog id="dialog"><div id="child"></div></dialog>`,
+ run({ step }) {
+ const dialog = byId("dialog");
+ dialog.showModal();
+ try {
+ step("Change the backdrop insets", () => dialog.classList.add("big"));
+ } finally {
+ dialog.close();
+ }
+ },
+ },
+ {
+ name: "Dialog moved to the top layer from inside a boundary",
+ html: `
+<style>
+ body { margin: 0; }
+ #root { position: relative; width: 360px; height: 180px; }
+ #boundary { position: absolute; left: 40px; top: 30px; width: 160px; height: 90px; overflow: hidden; }
+ dialog { position: fixed; left: 70px; top: 40px; width: 80px; height: 50px; margin: 0; padding: 0; border: 0; }
+</style>
+<div id="root">
+ <div id="boundary">
+ <div id="inner"><dialog id="modal"></dialog></div>
+ </div>
+</div>`,
+ run({ step, print }) {
+ const dialog = byId("modal");
+ try {
+ step("Show the dialog as a modal", () => dialog.showModal());
+ print(`open=${dialog.open}`);
+ print(`dialog=${rectOf(dialog)}`);
+ } finally {
+ dialog.close();
+ }
+ },
+ },
+ {
+ name: "Absolutely positioned document element",
+ html: `
+<style>
+ body { margin: 0; }
+ #child { width: 70px; height: 20px; }
+</style>
+<div id="child"></div>`,
+ run({ step, print }) {
+ document.documentElement.style.cssText = "position: absolute; left: 10px; top: 10px; width: 300px; height: 200px; overflow: hidden;";
+ try {
+ step("Grow a child of body", () => (byId("child").style.height = "60px"));
+ print(`child=${rectOf(byId("child"))}`);
+ } finally {
+ document.documentElement.removeAttribute("style");
+ }
+ },
+ },
+ ];
+
+ test(() => {
+ const output = [];
+ for (const { name, html, run } of cases) {
+ output.push(`${name}:`);
+ loadFixture(html);
+ const step = (stepName, mutate) => {
+ output.push(` ${stepName}: ${layoutWork(mutate).passes().join(" | ") || "(no layout)"}`);
+ };
+ const print = line => output.push(` ${line}`);
+ try {
+ run({ step, print });
+ } catch (error) {
+ output.push(` FAIL: ${error}`);
+ }
+ }
+ for (const line of output) println(line);
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-grid-area-boundary.html b/Tests/LibWeb/Text/input/abspos-relayout-grid-area-boundary.html
deleted file mode 100644
index b44490be78b..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-grid-area-boundary.html
+++ /dev/null
@@ -1,61 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #grid {
- position: relative;
- display: grid;
- grid-template-columns: 100px 200px;
- grid-template-rows: 80px 120px;
- width: 300px;
- height: 200px;
- }
- #boundary {
- position: absolute;
- grid-column: 2;
- grid-row: 2;
- inset: 10px;
- overflow: hidden;
- }
- #content { width: 40px; height: 20px; background: orange; }
-</style>
-<div id="grid">
- <div id="boundary"><div id="content"></div></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const boundary = document.getElementById("boundary");
-
- // A change inside the subtree replays from the saved grid-area inputs.
- let partialBefore = internals.partialLayoutCount();
- let fullBefore = internals.fullLayoutCount();
- document.getElementById("content").style.width = "70px";
- document.body.offsetHeight;
- const subtreeRect = rectToString(boundary.getBoundingClientRect());
- const subtreePartialDelta = internals.partialLayoutCount() - partialBefore;
- const subtreeFullDelta = internals.fullLayoutCount() - fullBefore;
-
- // A style change on the boundary itself may invalidate the saved grid placement
- // inputs, so it must fall back to a full layout.
- partialBefore = internals.partialLayoutCount();
- fullBefore = internals.fullLayoutCount();
- boundary.style.paddingLeft = "5px";
- document.body.offsetHeight;
- const selfRect = rectToString(boundary.getBoundingClientRect());
- const selfPartialDelta = internals.partialLayoutCount() - partialBefore;
- const selfFullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`subtree=${subtreeRect} partial-layouts=${subtreePartialDelta} full-layouts=${subtreeFullDelta}`);
- println(`self=${selfRect} partial-layouts=${selfPartialDelta} full-layouts=${selfFullDelta}`);
- println(subtreeRect === "110,90,180,100"
- && subtreePartialDelta === 1 && subtreeFullDelta === 0
- && selfRect === "110,90,180,100"
- && selfPartialDelta === 0 && selfFullDelta === 1 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-inline-containing-block.html b/Tests/LibWeb/Text/input/abspos-relayout-inline-containing-block.html
deleted file mode 100644
index e15bce51088..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-inline-containing-block.html
+++ /dev/null
@@ -1,49 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; font: 16px/20px monospace; }
- #cb { position: relative; }
- #boundary {
- /* The containing block is an inline box, whose rectangle derives from line box
- fragments. The saved layout inputs carry it, so subtree changes replay without
- a full layout. */
- position: absolute;
- left: 5px;
- top: 30px;
- width: 120px;
- height: 40px;
- overflow: hidden;
- }
- #content { width: 30px; height: 10px; background: red; }
-</style>
-<div>before<span id="cb">inline containing block<div id="boundary"><div id="content"></div></div></span>after</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const boundary = document.getElementById("boundary");
- const content = document.getElementById("content");
- const before = rectToString(boundary.getBoundingClientRect());
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- content.style.width = "60px";
- document.body.offsetHeight;
-
- const after = rectToString(boundary.getBoundingClientRect());
- const contentRect = content.getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`boundary-before=${before}`);
- println(`boundary-after=${after}`);
- println(`content-width=${contentRect.width}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(before === after && contentRect.width === 60
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-insert-direct-child.html b/Tests/LibWeb/Text/input/abspos-relayout-insert-direct-child.html
deleted file mode 100644
index 3f37d6655da..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-insert-direct-child.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 320px; height: 170px; }
- #boundary {
- position: absolute;
- left: 40px;
- top: 30px;
- width: 150px;
- height: 90px;
- overflow: hidden;
- }
- #outside { width: 120px; height: 20px; }
- .abs-child {
- position: absolute;
- left: 10px;
- top: 15px;
- width: 30px;
- height: 20px;
- }
-</style>
-<div id="root">
- <div id="boundary"><div id="inner"></div></div>
- <div style="height: 130px"></div>
- <div id="outside"></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- const child = document.createElement("div");
- child.id = "inserted";
- child.className = "abs-child";
- document.getElementById("boundary").appendChild(child);
- document.body.offsetHeight;
-
- const inserted = child.getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`inserted=${rectToString(inserted)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(inserted) === "50,45,30,20"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-insert-display-none.html b/Tests/LibWeb/Text/input/abspos-relayout-insert-display-none.html
deleted file mode 100644
index 405ad22061b..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-insert-display-none.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 360px; height: 180px; }
- #boundary {
- position: absolute;
- left: 40px;
- top: 30px;
- width: 160px;
- height: 90px;
- overflow: hidden;
- }
- #hidden { display: none; }
- #sibling { width: 70px; height: 25px; }
-</style>
-<div id="root">
- <div id="boundary">
- <div id="hidden"></div>
- <div id="sibling"></div>
- </div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const siblingBefore = document.getElementById("sibling").getBoundingClientRect();
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- const child = document.createElement("div");
- child.id = "inserted";
- child.style.width = "20px";
- child.style.height = "20px";
- document.getElementById("hidden").appendChild(child);
- document.body.offsetHeight;
-
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
- const siblingAfter = document.getElementById("sibling").getBoundingClientRect();
- const insertedRects = child.getClientRects().length;
-
- println(`inserted-rects=${insertedRects}`);
- println(`sibling-before=${rectToString(siblingBefore)}`);
- println(`sibling-after=${rectToString(siblingAfter)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(insertedRects === 0
- && rectToString(siblingBefore) === rectToString(siblingAfter)
- && partialDelta === 0 && fullDelta === 1 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-insert-fixed-fallback.html b/Tests/LibWeb/Text/input/abspos-relayout-insert-fixed-fallback.html
deleted file mode 100644
index ea3d6b692f1..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-insert-fixed-fallback.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 360px; height: 180px; }
- #boundary {
- position: absolute;
- left: 40px;
- top: 30px;
- width: 160px;
- height: 90px;
- overflow: hidden;
- }
- #inner { width: 80px; height: 30px; }
- #fixed {
- position: fixed;
- left: 25px;
- top: 18px;
- width: 35px;
- height: 20px;
- }
-</style>
-<div id="root">
- <div id="boundary">
- <div id="inner"></div>
- </div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- const fixed = document.createElement("div");
- fixed.id = "fixed";
- document.getElementById("inner").appendChild(fixed);
- document.body.offsetHeight;
-
- const fixedRect = fixed.getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`fixed=${rectToString(fixedRect)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(fixedRect) === "25,18,35,20"
- && partialDelta === 0 && fullDelta === 1 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-insert-flex-anonymous-item.html b/Tests/LibWeb/Text/input/abspos-relayout-insert-flex-anonymous-item.html
deleted file mode 100644
index 2bc45e95fd2..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-insert-flex-anonymous-item.html
+++ /dev/null
@@ -1,96 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 600px; height: 400px; }
- .boundary {
- position: absolute;
- width: min-content;
- height: 100px;
- overflow: hidden;
- }
- .flex { display: flex; }
- .grid { display: grid; grid-auto-flow: column; }
- .anchor { width: 40px; height: 20px; }
- .block { width: 120px; height: 20px; }
- .wide { width: 150px; height: 20px; }
-</style>
-<div id="root">
- <div class="boundary" id="flex-boundary" style="left: 20px; top: 10px">
- <div class="flex" id="flex"><div class="anchor"></div></div>
- </div>
- <div class="boundary" id="grid-boundary" style="left: 20px; top: 130px">
- <div class="grid" id="grid"><div class="anchor"></div></div>
- </div>
- <div class="boundary" id="nested-boundary" style="left: 260px; top: 10px">
- <div class="flex" id="nested-flex">
- <div class="anchor"></div>
- <div id="nested-wrapper"></div>
- </div>
- </div>
- <div class="boundary" id="text-boundary" style="left: 260px; top: 130px">
- <div class="flex" id="text-flex"><div class="anchor"></div></div>
- </div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- function runScenario(name, boundaryId, mutate, printAfterRect = true) {
- const boundary = document.getElementById(boundaryId);
- const beforeRect = boundary.getBoundingClientRect();
- const before = rectToString(beforeRect);
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- mutate();
- document.body.offsetHeight;
-
- const afterRect = boundary.getBoundingClientRect();
- const after = rectToString(afterRect);
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`${name}-before=${before}`);
- if (printAfterRect)
- println(`${name}-after=${after}`);
- else
- println(`${name}-width-grew=${afterRect.width > beforeRect.width}`);
- println(`${name}-partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- return { beforeRect, afterRect, before, after, partialDelta, fullDelta };
- }
-
- function block(className = "block") {
- const element = document.createElement("div");
- element.className = className;
- element.textContent = "inserted";
- return element;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const flex = runScenario("flex", "flex-boundary", () => {
- document.getElementById("flex").appendChild(block());
- });
- const grid = runScenario("grid", "grid-boundary", () => {
- document.getElementById("grid").appendChild(block());
- });
- const nested = runScenario("nested", "nested-boundary", () => {
- document.getElementById("nested-wrapper").appendChild(block("wide"));
- });
- const text = runScenario("text", "text-boundary", () => {
- document.getElementById("text-flex").appendChild(document.createTextNode("inserted-text"));
- }, false);
-
- println(flex.before === "20,10,40,100" && flex.after === "20,10,160,100"
- && flex.partialDelta === 1 && flex.fullDelta === 0 ? "PASS" : "FAIL");
- println(grid.before === "20,130,40,100" && grid.after === "20,130,160,100"
- && grid.partialDelta === 1 && grid.fullDelta === 0 ? "PASS" : "FAIL");
- println(nested.before === "260,10,40,100" && nested.after === "260,10,190,100"
- && nested.partialDelta === 1 && nested.fullDelta === 0 ? "PASS" : "FAIL");
- println(text.before === "260,130,40,100" && text.afterRect.width > text.beforeRect.width
- && text.partialDelta === 1 && text.fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-insert-static-position.html b/Tests/LibWeb/Text/input/abspos-relayout-insert-static-position.html
deleted file mode 100644
index 2cdad474d03..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-insert-static-position.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 360px; height: 150px; }
- .boundary {
- position: absolute;
- top: 20px;
- width: 120px;
- height: 90px;
- overflow: hidden;
- }
- #live-boundary { left: 30px; }
- #reference-boundary { left: 200px; }
- .before { width: 80px; height: 25px; }
- .after { width: 80px; height: 30px; }
- .static-abs {
- position: absolute;
- width: 40px;
- height: 15px;
- }
-</style>
-<div id="root">
- <div id="live-boundary" class="boundary">
- <div id="live-wrapper"><div class="before"></div><div id="live-after" class="after"></div></div>
- </div>
- <div id="reference-boundary" class="boundary">
- <div><div class="before"></div><div id="reference-abs" class="static-abs"></div><div class="after"></div></div>
- </div>
-</div>
-<script>
- function localRectToString(element, container) {
- const rect = element.getBoundingClientRect();
- const containerRect = container.getBoundingClientRect();
- return `${rect.left - containerRect.left},${rect.top - containerRect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- const liveAbs = document.createElement("div");
- liveAbs.id = "live-abs";
- liveAbs.className = "static-abs";
- document.getElementById("live-wrapper").insertBefore(liveAbs, document.getElementById("live-after"));
- document.body.offsetHeight;
-
- const liveRect = localRectToString(liveAbs, document.getElementById("live-boundary"));
- const referenceRect = localRectToString(document.getElementById("reference-abs"), document.getElementById("reference-boundary"));
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`live=${liveRect}`);
- println(`reference=${referenceRect}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(liveRect === "0,25,40,15"
- && liveRect === referenceRect
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-insert-table-row.html b/Tests/LibWeb/Text/input/abspos-relayout-insert-table-row.html
deleted file mode 100644
index 9497c932afb..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-insert-table-row.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 460px; height: 170px; }
- #boundary {
- position: absolute;
- left: 30px;
- top: 20px;
- width: 180px;
- height: 120px;
- overflow: hidden;
- }
- #outside-wrapper {
- position: absolute;
- left: 260px;
- top: 20px;
- }
- table { border-collapse: collapse; }
- td {
- padding: 0;
- width: 50px;
- height: 20px;
- }
-</style>
-<div id="root">
- <div id="boundary">
- <div id="inner">
- <table id="live-table"><tbody id="live-body"><tr><td>one</td></tr></tbody></table>
- </div>
- </div>
- <div id="outside-wrapper">
- <table id="outside-table"><tbody><tr><td>one</td></tr><tr><td id="outside-new">new</td></tr></tbody></table>
- </div>
-</div>
-<script>
- function localRectToString(element, container) {
- const rect = element.getBoundingClientRect();
- const containerRect = container.getBoundingClientRect();
- return `${rect.left - containerRect.left},${rect.top - containerRect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const outsideBefore = localRectToString(document.getElementById("outside-new"), document.getElementById("outside-table"));
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- const row = document.createElement("tr");
- row.innerHTML = "<td id='live-new'>new</td>";
- document.getElementById("live-body").appendChild(row);
- document.body.offsetHeight;
-
- const liveRect = localRectToString(document.getElementById("live-new"), document.getElementById("live-table"));
- const outsideAfter = localRectToString(document.getElementById("outside-new"), document.getElementById("outside-table"));
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`live-new=${liveRect}`);
- println(`outside-before=${outsideBefore}`);
- println(`outside-after=${outsideAfter}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(liveRect === "0,20,50,20"
- && outsideBefore === outsideAfter
- && liveRect === outsideAfter
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-insert-under-body.html b/Tests/LibWeb/Text/input/abspos-relayout-insert-under-body.html
deleted file mode 100644
index f11caef9f0e..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-insert-under-body.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #inserted {
- position: absolute;
- left: 70px;
- top: 45px;
- width: 30px;
- height: 20px;
- }
-</style>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- const inserted = document.createElement("div");
- inserted.id = "inserted";
- document.body.appendChild(inserted);
- document.body.offsetHeight;
-
- const insertedRect = inserted.getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`inserted=${rectToString(insertedRect)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(insertedRect) === "70,45,30,20"
- && partialDelta === 0 && fullDelta === 1 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-insert-under-descendant.html b/Tests/LibWeb/Text/input/abspos-relayout-insert-under-descendant.html
deleted file mode 100644
index 5c18293cf42..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-insert-under-descendant.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 360px; height: 180px; }
- #boundary {
- position: absolute;
- left: 40px;
- top: 30px;
- width: 160px;
- height: 90px;
- overflow: hidden;
- }
- #inner { width: 80px; height: 30px; }
- #outside { width: 120px; height: 25px; }
- .abs-child {
- position: absolute;
- left: 15px;
- top: 10px;
- width: 35px;
- height: 20px;
- }
-</style>
-<div id="root">
- <div id="boundary">
- <div id="inner"></div>
- </div>
- <div style="height: 130px"></div>
- <div id="outside"></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const outsideBefore = document.getElementById("outside").getBoundingClientRect();
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- const child = document.createElement("div");
- child.id = "inserted";
- child.className = "abs-child";
- document.getElementById("inner").appendChild(child);
- document.body.offsetHeight;
-
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
- const inserted = child.getBoundingClientRect();
- const outsideAfter = document.getElementById("outside").getBoundingClientRect();
-
- println(`inserted=${rectToString(inserted)}`);
- println(`outside-before=${rectToString(outsideBefore)}`);
- println(`outside-after=${rectToString(outsideAfter)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(inserted) === "55,40,35,20"
- && rectToString(outsideBefore) === rectToString(outsideAfter)
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-inset-stretch.html b/Tests/LibWeb/Text/input/abspos-relayout-inset-stretch.html
deleted file mode 100644
index 79f66363e08..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-inset-stretch.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #parent { position: relative; width: 320px; height: 180px; }
- #boundary {
- position: absolute;
- inset: 0;
- overflow: hidden;
- }
- #child { width: 100px; height: 25px; }
-</style>
-<div id="parent">
- <div id="boundary">
- <div id="child"></div>
- </div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("child").style.height = "70px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const boundary = document.getElementById("boundary").getBoundingClientRect();
- const child = document.getElementById("child").getBoundingClientRect();
- println(`boundary=${rectToString(boundary)}`);
- println(`child=${rectToString(child)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(boundary.left === 0 && boundary.top === 0 && boundary.width === 320 && boundary.height === 180
- && child.left === 0 && child.top === 0 && child.width === 100 && child.height === 70
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-min-content-width.html b/Tests/LibWeb/Text/input/abspos-relayout-min-content-width.html
deleted file mode 100644
index 4502674a923..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-min-content-width.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 400px; height: 300px; }
- #boundary {
- position: absolute;
- left: 20px;
- top: 10px;
- /* Intrinsic sizing: replay re-runs it against subtree content on every partial relayout. */
- width: min-content;
- height: 80px;
- overflow: hidden;
- }
- .item { width: 60px; height: 20px; background: green; }
-</style>
-<div id="root">
- <div id="boundary"><div class="item" id="item"></div></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const boundary = document.getElementById("boundary");
- const before = rectToString(boundary.getBoundingClientRect());
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- document.getElementById("item").style.width = "110px";
- document.body.offsetHeight;
-
- const after = rectToString(boundary.getBoundingClientRect());
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`boundary-before=${before}`);
- println(`boundary-after=${after}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(before === "20,10,60,80" && after === "20,10,110,80"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-move-before.html b/Tests/LibWeb/Text/input/abspos-relayout-move-before.html
deleted file mode 100644
index 27359bbe66c..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-move-before.html
+++ /dev/null
@@ -1,91 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 520px; height: 180px; }
- .boundary {
- position: absolute;
- top: 20px;
- width: 200px;
- height: 100px;
- overflow: hidden;
- font-size: 0;
- line-height: 10px;
- }
- #live-boundary { left: 40px; }
- #reference-boundary { left: 280px; }
- .marker {
- display: inline-block;
- width: 30px;
- height: 10px;
- vertical-align: top;
- }
- .gap {
- display: inline-block;
- width: 20px;
- height: 10px;
- vertical-align: top;
- }
- .move-abs {
- position: absolute;
- width: 10px;
- height: 10px;
- }
- #move { background: rgb(51, 52, 53); }
-</style>
-<div id="root">
- <div id="live-boundary" class="boundary">
- <span id="live-a"><span class="marker"></span><span id="move" class="move-abs"></span></span><span class="gap"></span><span id="live-b"><span class="marker"></span></span>
- </div>
- <div id="reference-boundary" class="boundary">
- <span><span class="marker"></span></span><span class="gap"></span><span><span class="marker"></span><span id="reference-move" class="move-abs"></span></span>
- </div>
-</div>
-<script>
- function countColor(displayList, color) {
- return displayList.split(`color=${color}`).length - 1;
- }
-
- function localRectToString(element, container) {
- const rect = element.getBoundingClientRect();
- const containerRect = container.getBoundingClientRect();
- return `${rect.left - containerRect.left},${rect.top - containerRect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const move = document.getElementById("move");
- const oldRect = move.getBoundingClientRect();
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- const destination = document.getElementById("live-b");
- if ("moveBefore" in Node.prototype)
- destination.moveBefore(move, null);
- else {
- // Older builds without Node.moveBefore still exercise the same remove+insert layout path.
- move.remove();
- destination.appendChild(move);
- }
- document.body.offsetHeight;
-
- const liveRect = localRectToString(move, document.getElementById("live-boundary"));
- const referenceRect = localRectToString(document.getElementById("reference-move"), document.getElementById("reference-boundary"));
- const paintCount = countColor(internals.dumpDisplayList(), "rgb(51, 52, 53)");
- const oldHitIsMoved = document.elementFromPoint(oldRect.left + 2, oldRect.top + 2) === move;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`live=${liveRect}`);
- println(`reference=${referenceRect}`);
- println(`paint-count=${paintCount}`);
- println(`old-hit-is-moved=${oldHitIsMoved}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(liveRect === "80,0,10,10"
- && liveRect === referenceRect
- && paintCount === 1
- && !oldHitIsMoved
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-move-inset-only.html b/Tests/LibWeb/Text/input/abspos-relayout-move-inset-only.html
deleted file mode 100644
index 91a4b733d46..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-move-inset-only.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 400px; height: 300px; }
- #boundary {
- position: absolute;
- left: 10px;
- top: 20px;
- width: 100px;
- height: 50px;
- overflow: hidden;
- }
-</style>
-<div id="root">
- <div id="boundary"></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const boundary = document.getElementById("boundary");
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- boundary.style.left = "70px";
- boundary.style.top = "80px";
- document.body.offsetHeight;
-
- const rect = boundary.getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`boundary=${rectToString(rect)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(rect) === "70,80,100,50"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-move-margin-change.html b/Tests/LibWeb/Text/input/abspos-relayout-move-margin-change.html
deleted file mode 100644
index 9dca3801d11..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-move-margin-change.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 400px; height: 300px; }
- #boundary {
- position: absolute;
- left: 10px;
- top: 20px;
- width: 100px;
- height: 50px;
- overflow: hidden;
- }
-</style>
-<div id="root">
- <div id="boundary"></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const boundary = document.getElementById("boundary");
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- boundary.style.marginLeft = "25px";
- boundary.style.marginTop = "5px";
- document.body.offsetHeight;
-
- const rect = boundary.getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`boundary=${rectToString(rect)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(rect) === "35,25,100,50"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-move-multiple-boxes.html b/Tests/LibWeb/Text/input/abspos-relayout-move-multiple-boxes.html
deleted file mode 100644
index 9ca3baf922c..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-move-multiple-boxes.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 400px; height: 300px; }
- .boundary {
- position: absolute;
- width: 40px;
- height: 30px;
- overflow: hidden;
- }
- #a { left: 0px; top: 0px; }
- #b { left: 50px; top: 0px; }
- #c { left: 100px; top: 0px; }
-</style>
-<div id="root">
- <div id="a" class="boundary"></div>
- <div id="b" class="boundary"></div>
- <div id="c" class="boundary"></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- document.getElementById("a").style.top = "100px";
- document.getElementById("b").style.top = "150px";
- document.getElementById("c").style.left = "200px";
- document.body.offsetHeight;
-
- const rectA = document.getElementById("a").getBoundingClientRect();
- const rectB = document.getElementById("b").getBoundingClientRect();
- const rectC = document.getElementById("c").getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`a=${rectToString(rectA)}`);
- println(`b=${rectToString(rectB)}`);
- println(`c=${rectToString(rectC)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(rectA) === "0,100,40,30"
- && rectToString(rectB) === "50,150,40,30"
- && rectToString(rectC) === "200,0,40,30"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-move-percentage-insets.html b/Tests/LibWeb/Text/input/abspos-relayout-move-percentage-insets.html
deleted file mode 100644
index e49847da306..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-move-percentage-insets.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 400px; height: 300px; }
- #boundary {
- position: absolute;
- left: 10%;
- top: 20%;
- width: 25%;
- height: 50px;
- overflow: hidden;
- }
-</style>
-<div id="root">
- <div id="boundary"></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const boundary = document.getElementById("boundary");
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- boundary.style.left = "50%";
- boundary.style.top = "50%";
- document.body.offsetHeight;
-
- const rect = boundary.getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`boundary=${rectToString(rect)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(rect) === "200,150,100,50"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-move-static-position.html b/Tests/LibWeb/Text/input/abspos-relayout-move-static-position.html
deleted file mode 100644
index a238d20ed77..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-move-static-position.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 400px; height: 300px; }
- #boundary {
- /* left and right are both auto: the horizontal position comes from the static
- position, which the saved layout inputs carry, so a boundary-self geometry
- change replays without a full layout. */
- position: absolute;
- top: 10px;
- width: 150px;
- height: 60px;
- overflow: hidden;
- }
-</style>
-<div id="root">
- <div id="boundary"></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const boundary = document.getElementById("boundary");
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- boundary.style.top = "60px";
- document.body.offsetHeight;
-
- const rect = boundary.getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`boundary=${rectToString(rect)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(rect) === "0,60,150,60"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-move-updates-ancestor-overflow.html b/Tests/LibWeb/Text/input/abspos-relayout-move-updates-ancestor-overflow.html
deleted file mode 100644
index 17778245769..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-move-updates-ancestor-overflow.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #scroller {
- position: relative;
- width: 200px;
- height: 200px;
- overflow: scroll;
- }
- #boundary {
- position: absolute;
- left: 0px;
- top: 0px;
- width: 50px;
- height: 50px;
- overflow: hidden;
- }
-</style>
-<div id="scroller">
- <div id="boundary"></div>
-</div>
-<script>
- test(() => {
- document.body.offsetHeight;
-
- const scroller = document.getElementById("scroller");
- const boundary = document.getElementById("boundary");
- const scrollHeightBefore = scroller.scrollHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- boundary.style.top = "500px";
- document.body.offsetHeight;
-
- const scrollHeightAfter = scroller.scrollHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`scrollHeight-before=${scrollHeightBefore}`);
- println(`scrollHeight-after=${scrollHeightAfter}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(scrollHeightAfter === 550
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-nested-boundaries.html b/Tests/LibWeb/Text/input/abspos-relayout-nested-boundaries.html
deleted file mode 100644
index 9cc6b4f3c26..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-nested-boundaries.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #parent { position: relative; width: 360px; height: 240px; }
- #outer {
- position: absolute;
- left: 20px;
- top: 30px;
- width: 260px;
- height: 160px;
- overflow: hidden;
- }
- #between {
- margin-left: 10px;
- margin-top: 10px;
- width: 90px;
- height: 25px;
- }
- #inner {
- position: absolute;
- left: 50px;
- top: 40px;
- width: 100px;
- height: 50px;
- overflow: hidden;
- }
- #child { width: 60px; height: 15px; }
-</style>
-<div id="parent">
- <div id="outer">
- <div id="between"></div>
- <div id="inner">
- <div id="child"></div>
- </div>
- </div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const betweenBefore = document.getElementById("between").getBoundingClientRect();
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("child").style.height = "40px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const outer = document.getElementById("outer").getBoundingClientRect();
- const inner = document.getElementById("inner").getBoundingClientRect();
- const betweenAfter = document.getElementById("between").getBoundingClientRect();
- const child = document.getElementById("child").getBoundingClientRect();
- println(`outer=${rectToString(outer)}`);
- println(`inner=${rectToString(inner)}`);
- println(`between-before=${rectToString(betweenBefore)}`);
- println(`between-after=${rectToString(betweenAfter)}`);
- println(`child=${rectToString(child)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(outer) === "20,30,260,160"
- && rectToString(inner) === "70,70,100,50"
- && rectToString(betweenBefore) === rectToString(betweenAfter)
- && rectToString(child) === "70,70,60,40"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-overflow-visible.html b/Tests/LibWeb/Text/input/abspos-relayout-overflow-visible.html
deleted file mode 100644
index 9e5f4b82635..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-overflow-visible.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #scroller {
- position: relative;
- width: 200px;
- height: 100px;
- overflow: auto;
- }
- #spacer { height: 20px; }
- #abspos {
- position: absolute;
- left: 0;
- top: 10px;
- width: 50px;
- height: 50px;
- overflow: visible;
- }
- #content { width: 50px; height: 40px; }
-</style>
-<div id="scroller">
- <div id="spacer"></div>
- <div id="abspos">
- <div id="content"></div>
- </div>
-</div>
-<script>
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const scroller = document.getElementById("scroller");
- const scrollHeightBefore = scroller.scrollHeight;
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("content").style.height = "180px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`scrollHeight-before=${scrollHeightBefore}`);
- println(`scrollHeight-after=${scroller.scrollHeight}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(scrollHeightBefore === 100 && scroller.scrollHeight === 190
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-percentage-size.html b/Tests/LibWeb/Text/input/abspos-relayout-percentage-size.html
deleted file mode 100644
index f2b6c3e9a10..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-percentage-size.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #parent { position: relative; width: 400px; height: 300px; }
- #boundary {
- position: absolute;
- left: 30px;
- top: 20px;
- width: 50%;
- height: 50%;
- overflow: hidden;
- }
- #child { width: 75px; height: 20px; }
-</style>
-<div id="parent">
- <div id="boundary">
- <div id="child"></div>
- </div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("child").style.height = "90px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const boundary = document.getElementById("boundary").getBoundingClientRect();
- const child = document.getElementById("child").getBoundingClientRect();
- println(`boundary=${rectToString(boundary)}`);
- println(`child=${rectToString(child)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(boundary.left === 30 && boundary.top === 20 && boundary.width === 200 && boundary.height === 150
- && child.left === 30 && child.top === 20 && child.width === 75 && child.height === 90
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-remove-reinsert.html b/Tests/LibWeb/Text/input/abspos-relayout-remove-reinsert.html
deleted file mode 100644
index a06f54cb559..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-remove-reinsert.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 360px; height: 180px; }
- #boundary {
- position: absolute;
- left: 40px;
- top: 30px;
- width: 160px;
- height: 90px;
- overflow: hidden;
- }
- #inner { width: 80px; height: 30px; }
- #moving {
- position: absolute;
- left: 15px;
- top: 10px;
- width: 35px;
- height: 20px;
- }
-</style>
-<div id="root">
- <div id="boundary">
- <div id="inner"><span></span><div id="moving"></div></div>
- </div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const moving = document.getElementById("moving");
- const inner = document.getElementById("inner");
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- inner.removeChild(moving);
- inner.appendChild(moving);
- document.body.offsetHeight;
-
- const movingRect = moving.getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`moving=${rectToString(movingRect)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(movingRect) === "55,40,35,20"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-remove-under-descendant.html b/Tests/LibWeb/Text/input/abspos-relayout-remove-under-descendant.html
deleted file mode 100644
index 1fc59e0fb75..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-remove-under-descendant.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 360px; height: 180px; }
- #boundary {
- position: absolute;
- left: 40px;
- top: 30px;
- width: 160px;
- height: 90px;
- overflow: hidden;
- }
- #inner { width: 80px; height: 30px; }
- #removed {
- position: absolute;
- left: 15px;
- top: 10px;
- width: 35px;
- height: 20px;
- background: rgb(41, 42, 43);
- }
- #outside { width: 120px; height: 25px; }
-</style>
-<div id="root">
- <div id="boundary">
- <div id="inner"><div id="removed"></div></div>
- </div>
- <div style="height: 130px"></div>
- <div id="outside"></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- function countColor(displayList, color) {
- return displayList.split(`color=${color}`).length - 1;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const removed = document.getElementById("removed");
- const outsideBefore = document.getElementById("outside").getBoundingClientRect();
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- document.getElementById("inner").removeChild(removed);
- document.body.offsetHeight;
-
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
- const hitRemoved = document.elementFromPoint(57, 42) === removed;
- const paintCount = countColor(internals.dumpDisplayList(), "rgb(41, 42, 43)");
- const outsideAfter = document.getElementById("outside").getBoundingClientRect();
-
- println(`hit-removed=${hitRemoved}`);
- println(`paint-count=${paintCount}`);
- println(`outside-before=${rectToString(outsideBefore)}`);
- println(`outside-after=${rectToString(outsideAfter)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(!hitRemoved
- && paintCount === 0
- && rectToString(outsideBefore) === rectToString(outsideAfter)
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-rtl-static-position.html b/Tests/LibWeb/Text/input/abspos-relayout-rtl-static-position.html
deleted file mode 100644
index 3140b38d6d1..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-rtl-static-position.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- .root { position: relative; width: 300px; height: 100px; direction: rtl; }
- .boundary {
- /* Both horizontal insets auto in an RTL context: the static position rect is
- end-aligned, and re-aligns against the live shrink-to-fit width at replay. */
- position: absolute;
- top: 10px;
- height: 40px;
- overflow: hidden;
- }
- .content { height: 10px; background: teal; }
-</style>
-<div class="root">
- <div id="live" class="boundary"><div id="live-content" class="content" style="width: 50px"></div></div>
-</div>
-<div class="root">
- <div id="reference" class="boundary"><div class="content" style="width: 120px"></div></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- function localRect(element) {
- const rect = element.getBoundingClientRect();
- const rootRect = element.closest(".root").getBoundingClientRect();
- return `${rect.left - rootRect.left},${rect.top - rootRect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- document.getElementById("live-content").style.width = "120px";
- document.body.offsetHeight;
-
- const live = localRect(document.getElementById("live"));
- const reference = localRect(document.getElementById("reference"));
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`live=${live}`);
- println(`reference=${reference}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(live === reference
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-scroller.html b/Tests/LibWeb/Text/input/abspos-relayout-scroller.html
deleted file mode 100644
index eca25834f1a..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-scroller.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #parent { position: relative; width: 220px; height: 160px; }
- #boundary {
- position: absolute;
- left: 20px;
- top: 30px;
- width: 100px;
- height: 100px;
- overflow: auto;
- }
- #content {
- width: 50px;
- height: 500px;
- box-sizing: border-box;
- padding-top: 180px;
- }
- #probe { height: 20px; }
-</style>
-<div id="parent">
- <div id="boundary">
- <div id="content">
- <div id="probe">probe</div>
- </div>
- </div>
-</div>
-<script>
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const scroller = document.getElementById("boundary");
- scroller.scrollTop = 150;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("content").style.height = "520px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const hit = document.elementFromPoint(30, 65);
- println(`scrollTop=${scroller.scrollTop}`);
- println(`hit=${hit ? (hit.id || hit.tagName) : "null"}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(scroller.scrollTop === 150 && hit && hit.id === "probe"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-selection-preserved.html b/Tests/LibWeb/Text/input/abspos-relayout-selection-preserved.html
index b4ac20af938..cd85ce36568 100644
--- a/Tests/LibWeb/Text/input/abspos-relayout-selection-preserved.html
+++ b/Tests/LibWeb/Text/input/abspos-relayout-selection-preserved.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="include.js"></script>
+<script src="work-test.js"></script>
<style>
body { margin: 0; }
#root { position: relative; width: 400px; height: 200px; }
@@ -34,21 +35,14 @@
// Mutate a sibling inside the boundary to trigger a partial relayout.
// Selection must survive the changed fragment output and any replaced
// layout nodes in that subtree.
- const partialBefore = internals.partialLayoutCount();
- document.getElementById("child").style.height = "40px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
+ const partialLayout = layoutWork(() => (document.getElementById("child").style.height = "40px")).passes();
const afterPartial = internals.dumpDisplayList();
// Ground truth: force a full layout without changing geometry and dump again.
- const fullBefore = internals.fullLayoutCount();
- document.body.style.minWidth = "1px";
- document.body.offsetHeight;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
+ const fullLayout = layoutWork(() => (document.body.style.minWidth = "1px")).passes();
const afterFull = internals.dumpDisplayList();
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
+ println(`partial-layout=[${partialLayout.join(" | ")}] full-layout=[${fullLayout.join(" | ")}]`);
println(`selection-painting-matches-full-layout=${afterPartial === afterFull}`);
- println(partialDelta === 1 && fullDelta === 1 && afterPartial === afterFull ? "PASS" : "FAIL");
});
</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-shadow-child-reveal.html b/Tests/LibWeb/Text/input/abspos-relayout-shadow-child-reveal.html
deleted file mode 100644
index 6df9e557556..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-shadow-child-reveal.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #stage { position: relative; width: 400px; height: 300px; }
- #boundary {
- position: absolute;
- left: 40px;
- top: 30px;
- width: 200px;
- }
- #child { width: 60px; height: 20px; }
-</style>
-<div id="stage">
- <div id="boundary">
- <div id="child"></div>
- </div>
- <div id="host"></div>
-</div>
-<script>
- // A ShadowRoot direct child has no parent element, so revealing it from display:none
- // marks the element itself - and with no layout node attached yet, neither layout dirt
- // nor a rebuilt-in-place subtree records the change. When the same update also contains
- // dirt confined to a boundary, the partial path must not commit with the freshly revealed
- // subtree never laid out and invisible; the update has to take the full layout path.
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- const shadow = document.getElementById("host").attachShadow({ mode: "open" });
- const revealed = document.createElement("div");
- revealed.style.cssText = "display: none; width: 120px; height: 50px;";
- shadow.appendChild(revealed);
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- revealed.style.display = "block";
- document.getElementById("child").style.height = "40px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const revealedRect = revealed.getBoundingClientRect();
- const childRect = document.getElementById("child").getBoundingClientRect();
- println(`layout-passes partial=${partialDelta} full=${fullDelta}`);
- println(`revealed=${rectToString(revealedRect)}`);
- println(`child=${rectToString(childRect)}`);
- println(partialDelta === 0 && fullDelta >= 1
- && rectToString(revealedRect) === "0,0,120,50"
- && rectToString(childRect) === "40,30,60,40" ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-shadow-dom.html b/Tests/LibWeb/Text/input/abspos-relayout-shadow-dom.html
deleted file mode 100644
index c051281632d..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-shadow-dom.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 360px; height: 180px; }
- #boundary {
- position: absolute;
- left: 40px;
- top: 25px;
- width: 160px;
- height: 90px;
- overflow: hidden;
- }
- #host { display: block; width: 80px; height: 30px; }
-</style>
-<div id="root">
- <div id="boundary">
- <div id="inner"><div id="host"></div></div>
- </div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- const host = document.getElementById("host");
- const shadow = host.attachShadow({ mode: "open" });
- shadow.innerHTML = `
- <style>
- #existing { width: 20px; height: 10px; }
- .new-child {
- position: absolute;
- left: 15px;
- top: 10px;
- width: 30px;
- height: 20px;
- }
- </style>
- <div id="existing"></div>
- `;
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- const child = document.createElement("div");
- child.id = "new-shadow-child";
- child.className = "new-child";
- shadow.appendChild(child);
- document.body.offsetHeight;
-
- const childRect = child.getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`shadow-child=${rectToString(childRect)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(childRect) === "55,35,30,20"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-shrink-to-fit.html b/Tests/LibWeb/Text/input/abspos-relayout-shrink-to-fit.html
deleted file mode 100644
index 55494ce7613..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-shrink-to-fit.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #parent { position: relative; width: 400px; height: 140px; }
- #boundary {
- position: absolute;
- left: 25px;
- top: 20px;
- width: auto;
- height: 50px;
- overflow: hidden;
- white-space: nowrap;
- }
- #content {
- display: inline-block;
- width: 80px;
- height: 20px;
- }
-</style>
-<div id="parent">
- <div id="boundary"><span id="content"></span></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const boundaryBefore = document.getElementById("boundary").getBoundingClientRect();
- const partialBefore = internals.partialLayoutCount();
- document.getElementById("content").style.width = "180px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
-
- const boundaryAfter = document.getElementById("boundary").getBoundingClientRect();
- const content = document.getElementById("content").getBoundingClientRect();
- println(`boundary-before=${rectToString(boundaryBefore)}`);
- println(`boundary-after=${rectToString(boundaryAfter)}`);
- println(`content=${rectToString(content)}`);
- println(`partial-layouts=${partialDelta}`);
- println(boundaryBefore.width === 80 && boundaryAfter.width === 180
- && rectToString(content) === "25,20,180,20"
- && partialDelta === 1 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-sibling-paint-order.html b/Tests/LibWeb/Text/input/abspos-relayout-sibling-paint-order.html
deleted file mode 100644
index 916ca4d4c15..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-sibling-paint-order.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #stage { position: relative; width: 400px; height: 300px; }
- #first {
- position: absolute;
- left: 40px;
- top: 40px;
- width: 120px;
- height: 100px;
- background: rgb(200, 0, 0);
- }
- #second {
- position: absolute;
- left: 100px;
- top: 80px;
- width: 120px;
- height: 100px;
- background: rgb(0, 0, 200);
- }
- #child { width: 50px; height: 20px; }
-</style>
-<div id="stage">
- <div id="first">
- <div id="child"></div>
- </div>
- <div id="second"></div>
-</div>
-<script>
- // Two overlapping absolutely positioned siblings with auto z-index paint in tree order,
- // so the later one covers the earlier one. A partial relayout of the earlier sibling must
- // splice its rebuilt paint subtree back at its original position; reattaching it at the
- // end of the parent's paintable children would move it on top of the later sibling,
- // changing paint and hit-test order compared to a full layout.
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const hitBefore = document.elementFromPoint(150, 110);
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("child").style.height = "40px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const hitAfter = document.elementFromPoint(150, 110);
- println(`layout-passes partial=${partialDelta} full=${fullDelta}`);
- println(`hit-before=${hitBefore ? hitBefore.id : "null"}`);
- println(`hit-after=${hitAfter ? hitAfter.id : "null"}`);
- println(partialDelta === 1 && fullDelta === 0
- && hitBefore && hitBefore.id === "second"
- && hitAfter && hitAfter.id === "second" ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-static-position.html b/Tests/LibWeb/Text/input/abspos-relayout-static-position.html
deleted file mode 100644
index 2f96f758a9b..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-static-position.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #parent { position: relative; width: 400px; height: 260px; }
- #before-a { height: 40px; }
- #before-b { height: 30px; }
- #boundary {
- position: absolute;
- width: 120px;
- height: 70px;
- overflow: hidden;
- }
- #child { width: 80px; height: 20px; }
-</style>
-<div id="parent">
- <div id="before-a"></div>
- <div id="before-b"></div>
- <div id="boundary">
- <div id="child"></div>
- </div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const boundaryBefore = document.getElementById("boundary").getBoundingClientRect();
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("child").style.height = "55px";
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const boundaryAfter = document.getElementById("boundary").getBoundingClientRect();
- const child = document.getElementById("child").getBoundingClientRect();
- println(`boundary-before=${rectToString(boundaryBefore)}`);
- println(`boundary-after=${rectToString(boundaryAfter)}`);
- println(`child=${rectToString(child)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(boundaryBefore) === "0,70,120,70"
- && rectToString(boundaryBefore) === rectToString(boundaryAfter)
- && rectToString(child) === "0,70,80,55"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-svg-inside.html b/Tests/LibWeb/Text/input/abspos-relayout-svg-inside.html
deleted file mode 100644
index e857ebba000..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-svg-inside.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #parent { position: relative; width: 300px; height: 220px; }
- #boundary {
- position: absolute;
- left: 40px;
- top: 50px;
- width: 220px;
- height: 160px;
- overflow: hidden;
- }
- #svg { display: block; }
- #sibling { width: 70px; height: 20px; }
- #page-sibling { width: 120px; height: 30px; }
-</style>
-<div id="parent">
- <div id="boundary">
- <svg id="svg" width="100" height="80">
- <path id="path" d="M 10 10 L 50 50" stroke="black" fill="none"/>
- </svg>
- <div id="sibling"></div>
- </div>
-</div>
-<div id="page-sibling"></div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const siblingBefore = document.getElementById("sibling").getBoundingClientRect();
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("path").setAttribute("d", "M 10 10 L 90 60");
- document.body.offsetHeight;
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- const boundary = document.getElementById("boundary").getBoundingClientRect();
- const svg = document.getElementById("svg").getBoundingClientRect();
- const siblingAfter = document.getElementById("sibling").getBoundingClientRect();
- const pageSibling = document.getElementById("page-sibling").getBoundingClientRect();
- println(`boundary=${rectToString(boundary)}`);
- println(`svg=${rectToString(svg)}`);
- println(`sibling-before=${rectToString(siblingBefore)}`);
- println(`sibling-after=${rectToString(siblingAfter)}`);
- println(`page-sibling=${rectToString(pageSibling)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(boundary) === "40,50,220,160"
- && rectToString(svg) === "40,50,100,80"
- && rectToString(siblingBefore) === rectToString(siblingAfter)
- && rectToString(pageSibling) === "0,220,120,30"
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-svg-position-flip.html b/Tests/LibWeb/Text/input/abspos-relayout-svg-position-flip.html
deleted file mode 100644
index 6219b8f47da..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-svg-position-flip.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #stage { position: relative; width: 400px; height: 300px; }
- #boundary {
- position: absolute;
- left: 40px;
- top: 30px;
- width: 240px;
- height: 200px;
- }
- #svg.moved {
- position: absolute;
- left: 20px;
- top: 90px;
- }
- #child { width: 60px; height: 20px; }
-</style>
-<div id="stage">
- <div id="boundary">
- <svg id="svg" width="100" height="80" viewBox="0 0 100 80">
- <rect id="r" width="50" height="40" fill="blue"/>
- </svg>
- <div id="child"></div>
- </div>
-</div>
-<script>
- // Flipping an in-flow outermost <svg> to position:absolute replaces its box in place;
- // the replacement carries no saved abspos layout inputs (the old box was in flow). The
- // rebuilt box must not qualify as its own partial relayout boundary through the SVG arm
- // of the predicate, or the replay path dereferences the missing inputs. The update takes
- // the full layout path; once that pass has saved inputs for the now-absolutely-positioned
- // svg root, changes inside it go back to partial relayout.
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- promiseTest(async () => {
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- document.getElementById("svg").classList.add("moved");
- document.getElementById("child").style.height = "40px";
- document.body.offsetHeight;
- const partialDeltaFlip = internals.partialLayoutCount() - partialBefore;
- const fullDeltaFlip = internals.fullLayoutCount() - fullBefore;
- const svgAfterFlip = document.getElementById("svg").getBoundingClientRect();
- const childAfterFlip = document.getElementById("child").getBoundingClientRect();
-
- const partialBeforeInside = internals.partialLayoutCount();
- const fullBeforeInside = internals.fullLayoutCount();
- document.getElementById("r").setAttribute("width", "70");
- document.body.offsetHeight;
- const partialDeltaInside = internals.partialLayoutCount() - partialBeforeInside;
- const fullDeltaInside = internals.fullLayoutCount() - fullBeforeInside;
- const rectAfterInside = document.getElementById("r").getBoundingClientRect();
-
- println(`flip partial=${partialDeltaFlip} full=${fullDeltaFlip}`);
- println(`inside partial=${partialDeltaInside} full=${fullDeltaInside}`);
- println(`svg-after-flip=${rectToString(svgAfterFlip)}`);
- println(`child-after-flip=${rectToString(childAfterFlip)}`);
- println(`rect-after-inside=${rectToString(rectAfterInside)}`);
- println(partialDeltaFlip === 0 && fullDeltaFlip >= 1
- && rectToString(svgAfterFlip) === "60,120,100,80"
- && rectToString(childAfterFlip) === "40,30,60,40"
- && rectToString(rectAfterInside) === "60,120,70,40" ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-text-into-boundary.html b/Tests/LibWeb/Text/input/abspos-relayout-text-into-boundary.html
deleted file mode 100644
index 22108364c86..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-text-into-boundary.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 320px; height: 170px; }
- #boundary {
- position: absolute;
- left: 40px;
- top: 30px;
- width: 150px;
- height: 90px;
- overflow: hidden;
- }
- #inner { width: 80px; height: 20px; }
-</style>
-<div id="root">
- <div id="boundary"><div id="inner"></div></div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const boundary = document.getElementById("boundary");
- const boundaryBefore = boundary.getBoundingClientRect();
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- boundary.appendChild(document.createTextNode("text"));
- document.body.offsetHeight;
-
- const boundaryAfter = boundary.getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`boundary-before=${rectToString(boundaryBefore)}`);
- println(`boundary-after=${rectToString(boundaryAfter)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(rectToString(boundaryBefore) === rectToString(boundaryAfter)
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-toggles.html b/Tests/LibWeb/Text/input/abspos-relayout-toggles.html
new file mode 100644
index 00000000000..61deb05ee46
--- /dev/null
+++ b/Tests/LibWeb/Text/input/abspos-relayout-toggles.html
@@ -0,0 +1,221 @@
+<!DOCTYPE html>
+<script src="include.js"></script>
+<script src="work-test.js"></script>
+<script>
+ const byId = id => document.getElementById(id);
+ const rectOf = element => {
+ const rect = element.getBoundingClientRect();
+ return `${rect.left},${rect.top},${rect.width},${rect.height}`;
+ };
+
+ const cases = [
+ {
+ name: "Escaping descendants removed from a boundary",
+ html: `
+<style>
+ #root { position: relative; width: 360px; height: 180px; }
+ #boundary { position: absolute; left: 40px; top: 25px; width: 160px; height: 90px; }
+ #content { width: 20px; height: 10px; }
+ .escaping { position: fixed; left: 0; top: 0; width: 10px; height: 10px; }
+</style>
+<div id="root">
+ <div id="boundary">
+ <div id="content"></div>
+ <div id="first"><div class="escaping"></div></div>
+ <div id="second"><div class="escaping"></div></div>
+ </div>
+</div>`,
+ run({ step }) {
+ const content = byId("content");
+ byId("first").firstElementChild.remove();
+ step("one escaping descendant remains", () => (content.style.height = "20px"));
+
+ byId("second").firstElementChild.remove();
+ step("last escaping descendant removed", () => (content.style.height = "30px"));
+
+ const subtree = document.createElement("div");
+ const escaping = document.createElement("div");
+ escaping.className = "escaping";
+ subtree.append(escaping);
+ byId("second").append(subtree);
+ internals.updateLayoutForTesting();
+ byId("root").append(subtree);
+ step("escaping subtree moved away", () => (content.style.height = "40px"));
+ },
+ },
+ {
+ // The contain:layout wrapper is the fixed box's containing block, so the fixed box does not escape the
+ // boundary. Dropping the containment makes the viewport its containing block without dirtying layout by
+ // itself; the escaped-by-abspos facts derived from the old containing blocks can no longer be trusted, so
+ // the next layout must be a full pass, which lays the fixed box out against the viewport.
+ name: "contain: layout toggle",
+ html: `
+<style>
+ body { margin: 0; }
+ #stage { position: relative; width: 400px; height: 300px; }
+ #boundary { position: absolute; left: 50px; top: 60px; width: 240px; height: 160px; }
+ #wrapper { contain: layout; width: 200px; height: 100px; }
+ #fixed { position: fixed; left: 30px; top: 40px; width: 50px; height: 20px; }
+ #child { width: 60px; height: 20px; }
+</style>
+<div id="stage">
+ <div id="boundary">
+ <div id="wrapper">
+ <div id="fixed"></div>
+ </div>
+ <div id="child"></div>
+ </div>
+</div>`,
+ run({ step, print }) {
+ const child = byId("child");
+ const fixed = byId("fixed");
+ step("before toggle", () => (child.style.height = "40px"));
+ print(`fixed-before-toggle=${rectOf(fixed)}`);
+ step("after toggle", () => {
+ byId("wrapper").style.contain = "none";
+ child.style.height = "60px";
+ });
+ print(`fixed-after-toggle=${rectOf(fixed)}`);
+ },
+ },
+ {
+ // The fixed box's containing block is the viewport, outside the boundary, so changes inside the boundary
+ // take the full layout path. Removing the fixed box heals the boundary: the full pass that performs the
+ // removal derives the escaped-by-abspos facts again, and the next change inside the boundary uses partial
+ // relayout again.
+ name: "Escaping fixed box removal",
+ html: `
+<style>
+ body { margin: 0; }
+ #stage { position: relative; width: 400px; height: 300px; }
+ #boundary { position: absolute; left: 50px; top: 60px; width: 240px; height: 160px; }
+ #fixed { position: fixed; left: 30px; top: 40px; width: 50px; height: 20px; }
+ #child { width: 60px; height: 20px; }
+</style>
+<div id="stage">
+ <div id="boundary">
+ <div id="fixed"></div>
+ <div id="child"></div>
+ </div>
+</div>`,
+ run({ step, print }) {
+ const child = byId("child");
+ step("while escaping", () => (child.style.height = "40px"));
+ byId("fixed").remove();
+ step("after removal", () => (child.style.height = "60px"));
+ print(`child=${rectOf(child)}`);
+ },
+ },
+ {
+ // The transformed wrapper is the fixed box's containing block, so the fixed box does not escape the
+ // boundary. Removing the transform makes the viewport its containing block without dirtying layout by
+ // itself; the escaped-by-abspos facts derived from the old containing blocks can no longer be trusted, so
+ // the next layout must be a full pass, which lays the fixed box out against the viewport.
+ name: "Fixed containing block toggle",
+ html: `
+<style>
+ body { margin: 0; }
+ #stage { position: relative; width: 400px; height: 300px; }
+ #boundary { position: absolute; left: 50px; top: 60px; width: 240px; height: 160px; }
+ #wrapper { transform: translate(10px, 20px); width: 200px; height: 100px; }
+ #fixed { position: fixed; left: 30px; top: 40px; width: 50px; height: 20px; }
+ #child { width: 60px; height: 20px; }
+</style>
+<div id="stage">
+ <div id="boundary">
+ <div id="wrapper">
+ <div id="fixed"></div>
+ </div>
+ <div id="child"></div>
+ </div>
+</div>`,
+ run({ step, print }) {
+ const child = byId("child");
+ const fixed = byId("fixed");
+ step("before toggle", () => (child.style.height = "40px"));
+ print(`fixed-before-toggle=${rectOf(fixed)}`);
+ step("after toggle", () => {
+ byId("wrapper").style.transform = "none";
+ child.style.height = "60px";
+ });
+ print(`fixed-after-toggle=${rectOf(fixed)}`);
+ },
+ },
+ {
+ name: "Boundary placed in a grid area",
+ html: `
+<style>
+ body { margin: 0; }
+ #grid { position: relative; display: grid; grid-template-columns: 100px 200px; grid-template-rows: 80px 120px; width: 300px; height: 200px; }
+ #boundary { position: absolute; grid-column: 2; grid-row: 2; inset: 10px; overflow: hidden; }
+ #content { width: 40px; height: 20px; background: orange; }
+</style>
+<div id="grid">
+ <div id="boundary"><div id="content"></div></div>
+</div>`,
+ run({ step, print }) {
+ const boundary = byId("boundary");
+ // A change inside the subtree replays from the saved grid-area inputs.
+ step("subtree", () => (byId("content").style.width = "70px"));
+ print(`subtree=${rectOf(boundary)}`);
+ // A style change on the boundary itself may invalidate the saved grid placement inputs, so it must
+ // fall back to a full layout.
+ step("self", () => (boundary.style.paddingLeft = "5px"));
+ print(`self=${rectOf(boundary)}`);
+ },
+ },
+ {
+ // Flipping an in-flow outermost <svg> to position:absolute replaces its box in place, and the replacement
+ // carries no saved abspos layout inputs. It must not qualify as its own partial relayout boundary through
+ // the SVG arm of the predicate; the update takes the full layout path. Once that pass has saved inputs for
+ // the absolutely positioned svg root, changes inside it go back to partial relayout.
+ name: "svg flipped to position: absolute",
+ html: `
+<style>
+ body { margin: 0; }
+ #stage { position: relative; width: 400px; height: 300px; }
+ #boundary { position: absolute; left: 40px; top: 30px; width: 240px; height: 200px; }
+ #svg.moved { position: absolute; left: 20px; top: 90px; }
+ #child { width: 60px; height: 20px; }
+</style>
+<div id="stage">
+ <div id="boundary">
+ <svg id="svg" width="100" height="80" viewBox="0 0 100 80">
+ <rect id="r" width="50" height="40" fill="blue"/>
+ </svg>
+ <div id="child"></div>
+ </div>
+</div>`,
+ run({ step, print }) {
+ const svg = byId("svg");
+ const child = byId("child");
+ step("flip", () => {
+ svg.classList.add("moved");
+ child.style.height = "40px";
+ });
+ print(`svg-after-flip=${rectOf(svg)}`);
+ print(`child-after-flip=${rectOf(child)}`);
+ step("inside", () => byId("r").setAttribute("width", "70"));
+ print(`rect-after-inside=${rectOf(byId("r"))}`);
+ },
+ },
+ ];
+
+ test(() => {
+ const output = [];
+ for (const { name, html, run } of cases) {
+ output.push(`${name}:`);
+ loadFixture(html);
+ const step = (stepName, mutate) => {
+ output.push(` ${stepName}: ${layoutWork(mutate).passes().join(" | ") || "(no layout)"}`);
+ };
+ const print = line => output.push(` ${line}`);
+ try {
+ run({ step, print });
+ } catch (error) {
+ output.push(` FAIL: ${error}`);
+ }
+ }
+ for (const line of output) println(line);
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-toplayer-fallback.html b/Tests/LibWeb/Text/input/abspos-relayout-toplayer-fallback.html
deleted file mode 100644
index 82b5331b52f..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-toplayer-fallback.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #root { position: relative; width: 360px; height: 180px; }
- #boundary {
- position: absolute;
- left: 40px;
- top: 30px;
- width: 160px;
- height: 90px;
- overflow: hidden;
- }
- dialog {
- position: fixed;
- left: 70px;
- top: 40px;
- width: 80px;
- height: 50px;
- margin: 0;
- padding: 0;
- border: 0;
- }
-</style>
-<div id="root">
- <div id="boundary">
- <div id="inner"><dialog id="modal"></dialog></div>
- </div>
-</div>
-<script>
- function rectToString(rect) {
- return `${rect.left},${rect.top},${rect.width},${rect.height}`;
- }
-
- test(() => {
- document.body.offsetHeight;
-
- const dialog = document.getElementById("modal");
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- dialog.showModal();
- document.body.offsetHeight;
-
- const dialogRect = dialog.getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`open=${dialog.open}`);
- println(`dialog=${rectToString(dialogRect)}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(dialog.open
- && rectToString(dialogRect) === "70,40,80,50"
- && partialDelta === 0 && fullDelta === 1 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-unrelated-anchor.html b/Tests/LibWeb/Text/input/abspos-relayout-unrelated-anchor.html
deleted file mode 100644
index 7406d0a5c5e..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-unrelated-anchor.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #anchor { anchor-name: --a; width: 100px; height: 20px; }
- #consumer { position: absolute; left: anchor(--a right, 5px); top: anchor(--a bottom, 5px); width: 10px; height: 10px; }
- #boundary { position: absolute; left: 200px; top: 40px; width: 100px; }
- #inside { height: 20px; }
- .container { position: relative; width: 100px; height: 50px; }
- .control { position: absolute; left: 10px; top: 15px; width: 20px; height: 10px; }
-</style>
-<div id="anchor"></div>
-<div id="consumer"></div>
-<div id="boundary"><div id="inside"></div></div>
-<div id="first" class="container"></div>
-<div id="second" class="container"></div>
-<script>
-test(() => {
- const results = [];
- const anchor = document.getElementById("anchor");
- const consumer = document.getElementById("consumer");
- const boundary = document.getElementById("boundary");
- const inside = document.getElementById("inside");
- const first = document.getElementById("first");
- const second = document.getElementById("second");
- document.body.offsetHeight;
-
- function checkLayout(label, mutate, expectPartial = true) {
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- mutate();
- document.body.offsetHeight;
- const partial = internals.partialLayoutCount() - partialBefore;
- const full = internals.fullLayoutCount() - fullBefore;
- results.push(`${label}: ${partial === (expectPartial ? 1 : 0) && full === 0}`);
- }
-
- function checkPosition(label, element, x, y) {
- const rect = element.getBoundingClientRect();
- results.push(`${label}: ${rect.x === x && rect.y === y}`);
- }
-
- checkLayout("Change unrelated subtree", () => inside.style.height = "40px");
- results.push(`Boundary resizes: ${boundary.getBoundingClientRect().height === 40}`);
- checkLayout("Move unrelated boundary", () => boundary.style.left = "250px");
- checkPosition("Boundary position", boundary, 250, 40);
- checkLayout("Rebuild unrelated boundary", () => boundary.append(document.createElement("div")));
- checkPosition("Consumer stays anchored", consumer, 100, 20);
-
- // These containers are in flow, so insertion and removal must remain confined to the control.
- const control = document.createElement("div");
- control.className = "control";
- checkLayout("Insert unrelated abspos", () => first.append(control));
- checkPosition("Inserted position", control, 10, 35);
- checkLayout("Move unrelated abspos between parents", () => second.append(control));
- checkPosition("Moved position", control, 10, 85);
- checkLayout("Remove unrelated abspos without layout", () => control.remove(), false);
- checkPosition("Consumer survives unrelated removal", consumer, 100, 20);
-
- consumer.style.left = "anchor(--missing right, 5px)";
- consumer.style.top = "anchor(--missing bottom, 5px)";
- document.body.offsetHeight;
- checkLayout("Unresolved consumer outside boundary", () => boundary.style.top = "60px");
- checkPosition("Consumer keeps fallback", consumer, 5, 5);
-
- consumer.style.left = "auto";
- consumer.style.top = "auto";
- consumer.style.positionAnchor = "--a";
- consumer.style.positionArea = "span-all";
- document.body.offsetHeight;
- checkLayout("Position-area consumer outside boundary", () => boundary.style.top = "70px");
-
- // Anchor names on ancestors do not change when an out-of-flow descendant lays itself out.
- anchor.append(boundary);
- document.body.offsetHeight;
- checkLayout("Boundary inside an anchor provider", () => boundary.style.top = "80px");
- results.push(`Anchor size unchanged: ${anchor.getBoundingClientRect().height === 20}`);
-
- first.append(consumer);
- document.body.offsetHeight;
- checkLayout("Remove last contained consumer without layout", () => consumer.remove(), false);
-
- results.forEach(println);
-});
-</script>
diff --git a/Tests/LibWeb/Text/input/abspos-relayout-unused-anchor-names.html b/Tests/LibWeb/Text/input/abspos-relayout-unused-anchor-names.html
deleted file mode 100644
index 5098fe5d4ae..00000000000
--- a/Tests/LibWeb/Text/input/abspos-relayout-unused-anchor-names.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #header { anchor-name: --menu; width: 100px; height: 20px; }
- #boundary { position: absolute; left: 30px; top: 40px; width: 300px; }
- #local-anchor { anchor-name: --line; width: 100px; height: 20px; }
- table { width: 300px; border-spacing: 0; }
- td { position: relative; height: 20px; padding: 0; }
- .control { position: absolute; left: 0; top: 0; width: 20px; height: 20px; }
- .consumer { position: absolute; position-anchor: --line; left: anchor(right); top: anchor(top); width: 10px; height: 10px; }
-</style>
-<div id="header"></div>
-<div id="boundary"><div id="local-anchor"></div><table><tr><td id="first">First line</td></tr><tr><td id="second">Second line</td></tr></table></div>
-<script>
- promiseTest(async () => {
- const results = [];
- const boundary = document.getElementById("boundary");
- const first = document.getElementById("first");
- const second = document.getElementById("second");
- const control = document.createElement("div");
- control.className = "control";
- first.append(control);
- document.body.offsetHeight;
-
- function checkLayout(label, mutate, expectPartial) {
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- mutate();
- document.body.offsetHeight;
- const partial = internals.partialLayoutCount() - partialBefore;
- const full = internals.fullLayoutCount() - fullBefore;
- results.push(`${label}: ${expectPartial ? partial > 0 && full === 0 : partial === 0 && full > 0}`);
- }
-
- checkLayout("Move control with unused header anchor", () => second.append(control), true);
- results.push(`Control position: ${control.getBoundingClientRect().x},${control.getBoundingClientRect().y}`);
-
- // Creating a consumer during the incremental tree build must still force full layout.
- const consumer = document.createElement("div");
- consumer.className = "consumer";
- checkLayout("Insert anchor consumer", () => boundary.append(consumer), false);
- results.push(`Consumer position: ${consumer.getBoundingClientRect().x},${consumer.getBoundingClientRect().y}`);
- checkLayout("Move control with active consumer", () => first.append(control), true);
-
- consumer.remove();
- document.body.offsetHeight;
- checkLayout("Remove last consumer", () => second.append(control), true);
-
- consumer.style.display = "none";
- boundary.append(consumer);
- document.body.offsetHeight;
- checkLayout("Hidden consumer", () => first.append(control), true);
- checkLayout("Show consumer", () => consumer.style.display = "block", false);
- consumer.style.position = "static";
- document.body.offsetHeight;
- checkLayout("Static consumer", () => second.append(control), true);
- checkLayout("Make consumer positioned again", () => consumer.style.position = "absolute", false);
-
- // position-area consumes anchor geometry without an anchor() inset.
- consumer.style.left = "auto";
- consumer.style.top = "auto";
- consumer.style.positionArea = "span-all";
- document.body.offsetHeight;
- checkLayout("position-area consumer", () => first.append(control), true);
- consumer.style.positionArea = "none";
- document.body.offsetHeight;
- checkLayout("Remove position-area dependency", () => second.append(control), true);
-
- results.forEach(println);
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/css/animation-box-adjustment-skips-layout.html b/Tests/LibWeb/Text/input/css/animation-box-adjustment-skips-layout.html
index 661d3f1912a..4dec7fa42dc 100644
--- a/Tests/LibWeb/Text/input/css/animation-box-adjustment-skips-layout.html
+++ b/Tests/LibWeb/Text/input/css/animation-box-adjustment-skips-layout.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<div style="display: flex"><span id="target"></span></div>
<script>
test(() => {
@@ -11,13 +12,14 @@
animation.currentTime = 100;
target.offsetWidth;
- const layoutsBefore = internals.fullLayoutCount();
- for (const time of [200, 300, 400]) {
- animation.currentTime = time;
- target.offsetWidth;
- }
+ const work = layoutWork(() => {
+ for (const time of [200, 300, 400]) {
+ animation.currentTime = time;
+ target.offsetWidth;
+ }
+ });
- println(`full layouts: ${internals.fullLayoutCount() - layoutsBefore}`);
+ println(`layout while seeking the animation: ${work.passes().join(" | ") || "(no layout)"}`);
});
</script>
diff --git a/Tests/LibWeb/Text/input/css/font-cascade-stable-display-period.html b/Tests/LibWeb/Text/input/css/font-cascade-stable-display-period.html
index 2825859d845..61f66bd1d1b 100644
--- a/Tests/LibWeb/Text/input/css/font-cascade-stable-display-period.html
+++ b/Tests/LibWeb/Text/input/css/font-cascade-stable-display-period.html
@@ -1,5 +1,6 @@
<!doctype html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<script>
asyncTest(async done => {
const server = httpTestServer();
@@ -21,11 +22,13 @@
const fallbackWidth = target.getBoundingClientRect().width;
const results = [`selected face is loading: ${face.status === "loading"}`];
internals.updateStyle();
+ const layoutPasses = work => work.passes().join(" | ") || "(no layout)";
- let before = internals.fullLayoutCount();
- target.style.color = "red";
- target.getBoundingClientRect();
- results.push(`paint change preserves pending layout: ${internals.fullLayoutCount() === before}`);
+ let work = layoutWork(() => {
+ target.style.color = "red";
+ target.getBoundingClientRect();
+ });
+ results.push(`layout after paint change while pending: ${layoutPasses(work)}`);
internals.resetStyleCounters();
face.display = "swap";
@@ -33,18 +36,20 @@
results.push(`display transition recomputes style: ${internals.styleCounters().passes > 0}`);
results.push(`display transition keeps fallback metrics: ${target.getBoundingClientRect().width === fallbackWidth}`);
- before = internals.fullLayoutCount();
- target.style.color = "blue";
- target.getBoundingClientRect();
- results.push(`paint change preserves visible fallback layout: ${internals.fullLayoutCount() === before}`);
+ work = layoutWork(() => {
+ target.style.color = "blue";
+ target.getBoundingClientRect();
+ });
+ results.push(`layout after paint change with visible fallback: ${layoutPasses(work)}`);
await fetch(`${server.baseURL}/unblock/${token}`);
await face.loaded;
results.push(`loaded face changes metrics: ${target.getBoundingClientRect().width !== fallbackWidth}`);
- before = internals.fullLayoutCount();
- target.style.color = "green";
- target.getBoundingClientRect();
- results.push(`paint change preserves loaded layout: ${internals.fullLayoutCount() === before}`);
+ work = layoutWork(() => {
+ target.style.color = "green";
+ target.getBoundingClientRect();
+ });
+ results.push(`layout after paint change with loaded face: ${layoutPasses(work)}`);
for (const result of results)
println(result);
done();
diff --git a/Tests/LibWeb/Text/input/css/font-cascade-unchanged-pending-selection.html b/Tests/LibWeb/Text/input/css/font-cascade-unchanged-pending-selection.html
index 22368f80683..27ad26204cc 100644
--- a/Tests/LibWeb/Text/input/css/font-cascade-unchanged-pending-selection.html
+++ b/Tests/LibWeb/Text/input/css/font-cascade-unchanged-pending-selection.html
@@ -1,5 +1,6 @@
<!doctype html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<script>
promiseTest(async () => {
const resident = new FontFace("PendingSelection", 'url("../../../Ref/data/fonts/Ahem.ttf")', { weight: "400", unicodeRange: "U+0-7F" });
@@ -14,10 +15,11 @@
internals.updateStyle();
const results = [];
- const layoutBefore = internals.fullLayoutCount();
- target.style.color = "red";
- target.getBoundingClientRect();
- results.push(`paint change relaid out pending cascade: ${internals.fullLayoutCount() !== layoutBefore}`);
+ const paintChangeWork = layoutWork(() => {
+ target.style.color = "red";
+ target.getBoundingClientRect();
+ });
+ results.push(`layout after paint change with pending cascade: ${paintChangeWork.passes().join(" | ") || "(no layout)"}`);
const unused = new FontFace("PendingSelection", 'url("../../../Ref/data/fonts/Ahem.ttf")', { weight: "700", unicodeRange: "U+0-7F" });
await unused.load();
diff --git a/Tests/LibWeb/Text/input/css/scrollable-overflow-incremental-full-layout.html b/Tests/LibWeb/Text/input/css/scrollable-overflow-incremental-full-layout.html
index fcb5d3736fa..72483ca0696 100644
--- a/Tests/LibWeb/Text/input/css/scrollable-overflow-incremental-full-layout.html
+++ b/Tests/LibWeb/Text/input/css/scrollable-overflow-incremental-full-layout.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<style>
body { margin: 0; }
#outer { width: 100px; height: 100px; overflow: hidden; }
@@ -20,31 +21,34 @@
const spacer = document.getElementById("spacer");
const nested = document.getElementById("nested");
const content = document.getElementById("content");
+ const lines = [];
const snapshot = label => {
- println(`${label}: outer=${outer.scrollWidth}x${outer.scrollHeight}, nested=${nested.scrollWidth}x${nested.scrollHeight}`);
+ lines.push(`${label}: outer=${outer.scrollWidth}x${outer.scrollHeight}, nested=${nested.scrollWidth}x${nested.scrollHeight}`);
+ };
+ const step = (label, mutate) => {
+ const work = layoutWork(() => {
+ mutate();
+ snapshot(label);
+ });
+ lines.push(` layout: ${work.passes().join(" | ") || "(no layout)"}`);
};
snapshot("initial");
- const fullLayouts = internals.fullLayoutCount();
- spacer.style.height = "120px";
- snapshot("move cached subtree");
- spacer.style.height = "10px";
- snapshot("move cached subtree back");
- nested.scrollTop = 1000;
- nested.scrollLeft = 1000;
- content.style.width = "120px";
- content.style.height = "90px";
- document.body.getBoundingClientRect();
- println(`clamped offsets: ${nested.scrollLeft},${nested.scrollTop}`);
- snapshot("shrink behind clipping boundary");
- content.remove();
- snapshot("remove overflow");
- nested.appendChild(content);
- snapshot("restore overflow");
+ step("move cached subtree", () => { spacer.style.height = "120px"; });
+ step("move cached subtree back", () => { spacer.style.height = "10px"; });
+ step("shrink behind clipping boundary", () => {
+ nested.scrollTop = 1000;
+ nested.scrollLeft = 1000;
+ content.style.width = "120px";
+ content.style.height = "90px";
+ document.body.getBoundingClientRect();
+ lines.push(`clamped offsets: ${nested.scrollLeft},${nested.scrollTop}`);
+ });
+ step("remove overflow", () => { content.remove(); });
+ step("restore overflow", () => { nested.appendChild(content); });
const reused = document.getElementById("reused");
- reused.style.overflow = "hidden";
- snapshot("clip unchanged geometry");
- reused.style.overflow = "visible";
- snapshot("restore visible overflow");
- println(`performed full layout: ${internals.fullLayoutCount() > fullLayouts}`);
+ step("clip unchanged geometry", () => { reused.style.overflow = "hidden"; });
+ step("restore visible overflow", () => { reused.style.overflow = "visible"; });
+ for (const line of lines)
+ println(line);
});
</script>
diff --git a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-animation.html b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-animation.html
index 799285b3d1e..f2f52d0373f 100644
--- a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-animation.html
+++ b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-animation.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<div id="scroller" style="overflow: scroll; width: 100px; height: 100px;">
<div id="child" style="width: 50px; height: 50px;"></div>
</div>
@@ -10,19 +11,21 @@
const scroller = document.getElementById("scroller");
const child = document.getElementById("child");
const initialHeight = scroller.scrollHeight;
- const animation = child.animate(
- [{ transform: "translateY(0px)" }, { transform: "translateY(500px)" }],
- { duration: 1000, fill: "forwards" });
- animation.pause();
- animation.currentTime = 1000;
- const countersBefore = internals.getStyleInvalidationCounters();
- const heightAtAnimationEnd = scroller.scrollHeight;
- animation.currentTime = 0;
- const heightAtAnimationStart = scroller.scrollHeight;
- const countersAfter = internals.getStyleInvalidationCounters();
+ let heightAtAnimationEnd;
+ let heightAtAnimationStart;
+ const work = layoutWork(() => {
+ const animation = child.animate(
+ [{ transform: "translateY(0px)" }, { transform: "translateY(500px)" }],
+ { duration: 1000, fill: "forwards" });
+ animation.pause();
+ animation.currentTime = 1000;
+ heightAtAnimationEnd = scroller.scrollHeight;
+ animation.currentTime = 0;
+ heightAtAnimationStart = scroller.scrollHeight;
+ });
println(`initial scrollHeight: ${initialHeight}`);
println(`scrollHeight at animation end: ${heightAtAnimationEnd}`);
println(`scrollHeight at animation start: ${heightAtAnimationStart}`);
- println(`relayouts performed: ${countersAfter.relayoutsPerformed - countersBefore.relayoutsPerformed}`);
+ println(`layout passes: ${work.passes().join(" | ") || "(no layout)"}`);
});
</script>
diff --git a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-nested-propagation.html b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-nested-propagation.html
index db932dd2902..41338a5c50e 100644
--- a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-nested-propagation.html
+++ b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-nested-propagation.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<div id="scroller" style="overflow: scroll; width: 100px; height: 100px;">
<div id="wrapper" style="width: 50px; height: 50px;">
<div id="child" style="width: 40px; height: 40px;"></div>
@@ -13,12 +14,13 @@
const scroller = document.getElementById("scroller");
const child = document.getElementById("child");
const initialHeight = scroller.scrollHeight;
- const countersBefore = internals.getStyleInvalidationCounters();
- child.style.transform = "translateY(400px)";
- const heightAfterChange = scroller.scrollHeight;
- const countersAfter = internals.getStyleInvalidationCounters();
+ let heightAfterChange;
+ const work = layoutWork(() => {
+ child.style.transform = "translateY(400px)";
+ heightAfterChange = scroller.scrollHeight;
+ });
println(`initial scrollHeight: ${initialHeight}`);
println(`scrollHeight after transform change: ${heightAfterChange}`);
- println(`relayouts performed: ${countersAfter.relayoutsPerformed - countersBefore.relayoutsPerformed}`);
+ println(`layout passes: ${work.passes().join(" | ") || "(no layout)"}`);
});
</script>
diff --git a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-property-matrix.html b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-property-matrix.html
index 51c99717b1f..32db900044d 100644
--- a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-property-matrix.html
+++ b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-property-matrix.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<div id="scroller" style="overflow: scroll; width: 100px; height: 100px;">
<div id="child" style="width: 90px; height: 90px; padding: 10px; box-sizing: border-box;"></div>
</div>
@@ -9,40 +10,46 @@
test(() => {
const scroller = document.getElementById("scroller");
const child = document.getElementById("child");
- const results = [];
- let relayoutsBefore = internals.getStyleInvalidationCounters().relayoutsPerformed;
- const step = name => {
- const width = scroller.scrollWidth;
- const height = scroller.scrollHeight;
- const relayoutsAfter = internals.getStyleInvalidationCounters().relayoutsPerformed;
- results.push([name, width, height, relayoutsAfter - relayoutsBefore]);
- relayoutsBefore = relayoutsAfter;
+ const results = [`initial: scrollWidth=${scroller.scrollWidth} scrollHeight=${scroller.scrollHeight}`];
+ const step = (name, change) => {
+ let width;
+ let height;
+ const work = layoutWork(() => {
+ change();
+ width = scroller.scrollWidth;
+ height = scroller.scrollHeight;
+ });
+ results.push(`${name}: scrollWidth=${width} scrollHeight=${height} layout=${work.passes().join(" | ") || "(no layout)"}`);
};
- step("initial");
+ step("translate", () => {
+ child.style.translate = "0px 300px";
+ });
- child.style.translate = "0px 300px";
- step("translate");
- child.style.translate = "";
+ step("rotate", () => {
+ child.style.translate = "";
+ child.style.rotate = "45deg";
+ });
- child.style.rotate = "45deg";
- step("rotate");
- child.style.rotate = "";
+ step("scale", () => {
+ child.style.rotate = "";
+ child.style.scale = "5";
+ });
- child.style.scale = "5";
- step("scale");
- child.style.scale = "";
+ step("transform", () => {
+ child.style.scale = "";
+ child.style.transform = "rotate(45deg)";
+ });
- child.style.transform = "rotate(45deg)";
- step("transform");
+ step("transform-origin", () => {
+ child.style.transformOrigin = "0 0";
+ });
- child.style.transformOrigin = "0 0";
- step("transform-origin");
+ step("transform-box", () => {
+ child.style.transformBox = "content-box";
+ });
- child.style.transformBox = "content-box";
- step("transform-box");
-
- for (const [name, width, height, relayouts] of results)
- println(`${name}: scrollWidth=${width} scrollHeight=${height} relayouts=${relayouts}`);
+ for (const result of results)
+ println(result);
});
</script>
diff --git a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-pseudo-element.html b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-pseudo-element.html
index 713a5273ac7..875f56e2394 100644
--- a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-pseudo-element.html
+++ b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-pseudo-element.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<style>
#host::before {
content: "";
@@ -21,12 +22,13 @@
const scroller = document.getElementById("scroller");
const host = document.getElementById("host");
const initialHeight = scroller.scrollHeight;
- const countersBefore = internals.getStyleInvalidationCounters();
- host.classList.add("moved");
- const heightAfterChange = scroller.scrollHeight;
- const countersAfter = internals.getStyleInvalidationCounters();
+ let heightAfterChange;
+ const work = layoutWork(() => {
+ host.classList.add("moved");
+ heightAfterChange = scroller.scrollHeight;
+ });
println(`initial scrollHeight: ${initialHeight}`);
println(`scrollHeight after pseudo-element transform change: ${heightAfterChange}`);
- println(`relayouts performed: ${countersAfter.relayoutsPerformed - countersBefore.relayoutsPerformed}`);
+ println(`layout passes: ${work.passes().join(" | ") || "(no layout)"}`);
});
</script>
diff --git a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-scroll-offset-clamp.html b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-scroll-offset-clamp.html
index 6f220e7d246..8e5f6e27c24 100644
--- a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-scroll-offset-clamp.html
+++ b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-scroll-offset-clamp.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<div id="scroller" style="overflow: scroll; width: 100px; height: 100px;">
<div id="child" style="width: 50px; height: 50px; transform: translateY(500px);"></div>
</div>
@@ -12,16 +13,18 @@
const initialHeight = scroller.scrollHeight;
scroller.scrollTop = 10000;
const scrollTopAtMax = scroller.scrollTop;
- const countersBefore = internals.getStyleInvalidationCounters();
- child.style.transform = "translateY(150px)";
- // Reading only the stored offset must settle the new scroll bounds too.
- const scrollTopAfterShrink = scroller.scrollTop;
- const heightAfterShrink = scroller.scrollHeight;
- const countersAfter = internals.getStyleInvalidationCounters();
+ let scrollTopAfterShrink;
+ let heightAfterShrink;
+ const work = layoutWork(() => {
+ child.style.transform = "translateY(150px)";
+ // Reading only the stored offset must settle the new scroll bounds too.
+ scrollTopAfterShrink = scroller.scrollTop;
+ heightAfterShrink = scroller.scrollHeight;
+ });
println(`initial scrollHeight: ${initialHeight}`);
println(`scrollTop clamped to: ${scrollTopAtMax}`);
println(`scrollHeight after shrink: ${heightAfterShrink}`);
println(`scrollTop re-clamped to: ${scrollTopAfterShrink}`);
- println(`relayouts performed: ${countersAfter.relayoutsPerformed - countersBefore.relayoutsPerformed}`);
+ println(`layout passes: ${work.passes().join(" | ") || "(no layout)"}`);
});
</script>
diff --git a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-sticky.html b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-sticky.html
index acf4cd03ab6..348a2186ea8 100644
--- a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-sticky.html
+++ b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-sticky.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<div id="scroller" style="overflow: scroll; width: 100px; height: 100px;">
<div id="sticky" style="position: sticky; top: 0; height: 20px;"></div>
<div style="height: 60px;"></div>
@@ -14,16 +15,19 @@
const sticky = document.getElementById("sticky");
const mover = document.getElementById("mover");
const scrollerTop = scroller.getBoundingClientRect().top;
- const countersBefore = internals.getStyleInvalidationCounters();
- mover.style.transform = "translateY(400px)";
- const heightAfterChange = scroller.scrollHeight;
- scroller.scrollTop = 300;
- const scrollTopInGrownRange = scroller.scrollTop;
- const stickyTop = sticky.getBoundingClientRect().top;
- const countersAfter = internals.getStyleInvalidationCounters();
+ let heightAfterChange;
+ let scrollTopInGrownRange;
+ let stickyTop;
+ const work = layoutWork(() => {
+ mover.style.transform = "translateY(400px)";
+ heightAfterChange = scroller.scrollHeight;
+ scroller.scrollTop = 300;
+ scrollTopInGrownRange = scroller.scrollTop;
+ stickyTop = sticky.getBoundingClientRect().top;
+ });
println(`scrollHeight after transform change: ${heightAfterChange}`);
println(`scrollTop in grown range: ${scrollTopInGrownRange}`);
println(`sticky box sticks to scrollport top: ${stickyTop === scrollerTop}`);
- println(`relayouts performed: ${countersAfter.relayoutsPerformed - countersBefore.relayoutsPerformed}`);
+ println(`layout passes: ${work.passes().join(" | ") || "(no layout)"}`);
});
</script>
diff --git a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-svg-foreignobject-sticky.html b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-svg-foreignobject-sticky.html
index 8748acdb673..238fe543a58 100644
--- a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-svg-foreignobject-sticky.html
+++ b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-svg-foreignobject-sticky.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<div id="scroller" style="overflow: scroll; width: 300px; height: 200px;">
<svg width="250" height="100" style="display: block;">
<foreignObject width="250" height="100">
@@ -25,17 +26,18 @@
scroller.scrollTop = 30;
const stickyTopBefore = sticky.getBoundingClientRect().top;
- const countersBefore = internals.getStyleInvalidationCounters();
- // Dirties layout inside the SVG subtree only, so the next layout update takes the partial
- // SVG relayout path instead of a full relayout. The filler is after the sticky element in
- // flow, so growing it must not move the sticky element.
- filler.style.height = "50px";
+ let stickyTopAfter;
+ const work = layoutWork(() => {
+ // Dirties layout inside the SVG subtree only, so the next layout update takes the partial
+ // SVG relayout path instead of a full relayout. The filler is after the sticky element in
+ // flow, so growing it must not move the sticky element.
+ filler.style.height = "50px";
- const stickyTopAfter = sticky.getBoundingClientRect().top;
- const countersAfter = internals.getStyleInvalidationCounters();
+ stickyTopAfter = sticky.getBoundingClientRect().top;
+ });
println(`sticky position stable across partial SVG relayout: ${stickyTopAfter === stickyTopBefore}`);
- println(`relayouts performed: ${countersAfter.relayoutsPerformed - countersBefore.relayoutsPerformed}`);
+ println(`layout passes: ${work.passes().join(" | ") || "(no layout)"}`);
});
</script>
diff --git a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-transform-none-toggle.html b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-transform-none-toggle.html
index 285c3278b91..51779332559 100644
--- a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-transform-none-toggle.html
+++ b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-transform-none-toggle.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<div id="scroller" style="overflow: scroll; width: 100px; height: 100px;">
<div id="child" style="width: 50px; height: 50px;"></div>
</div>
@@ -11,20 +12,24 @@
const scroller = document.getElementById("scroller");
const child = document.getElementById("child");
const initialHeight = scroller.scrollHeight;
- const countersBefore = internals.getStyleInvalidationCounters();
- child.style.transform = "translateY(500px)";
- const heightAfterToggleOn = scroller.scrollHeight;
- scroller.scrollTop = 10000;
- const scrollTopAfterToggleOn = scroller.scrollTop;
- child.style.transform = "none";
- const heightAfterToggleOff = scroller.scrollHeight;
- const scrollTopAfterToggleOff = scroller.scrollTop;
- const countersAfter = internals.getStyleInvalidationCounters();
+ let heightAfterToggleOn;
+ let scrollTopAfterToggleOn;
+ let heightAfterToggleOff;
+ let scrollTopAfterToggleOff;
+ const work = layoutWork(() => {
+ child.style.transform = "translateY(500px)";
+ heightAfterToggleOn = scroller.scrollHeight;
+ scroller.scrollTop = 10000;
+ scrollTopAfterToggleOn = scroller.scrollTop;
+ child.style.transform = "none";
+ heightAfterToggleOff = scroller.scrollHeight;
+ scrollTopAfterToggleOff = scroller.scrollTop;
+ });
println(`initial scrollHeight: ${initialHeight}`);
println(`scrollHeight after transform toggled on: ${heightAfterToggleOn}`);
println(`scrollTop clamped to: ${scrollTopAfterToggleOn}`);
println(`scrollHeight after transform toggled off: ${heightAfterToggleOff}`);
println(`scrollTop after transform toggled off: ${scrollTopAfterToggleOff}`);
- println(`relayouts performed: ${countersAfter.relayoutsPerformed - countersBefore.relayoutsPerformed}`);
+ println(`layout passes: ${work.passes().join(" | ") || "(no layout)"}`);
});
</script>
diff --git a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-transform-value-change.html b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-transform-value-change.html
index 6546f9470e2..9fb57dede5e 100644
--- a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-transform-value-change.html
+++ b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-transform-value-change.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<div id="scroller" style="overflow: scroll; width: 100px; height: 100px;">
<div id="child" style="width: 50px; height: 50px; transform: translate(1px, 1px);"></div>
</div>
@@ -13,15 +14,17 @@
const child = document.getElementById("child");
const initialWidth = scroller.scrollWidth;
const initialHeight = scroller.scrollHeight;
- const countersBefore = internals.getStyleInvalidationCounters();
- child.style.transform = "translate(200px, 500px)";
- const widthAfterChange = scroller.scrollWidth;
- const heightAfterChange = scroller.scrollHeight;
- const countersAfter = internals.getStyleInvalidationCounters();
+ let widthAfterChange;
+ let heightAfterChange;
+ const work = layoutWork(() => {
+ child.style.transform = "translate(200px, 500px)";
+ widthAfterChange = scroller.scrollWidth;
+ heightAfterChange = scroller.scrollHeight;
+ });
println(`initial scrollWidth: ${initialWidth}`);
println(`initial scrollHeight: ${initialHeight}`);
println(`scrollWidth after transform change: ${widthAfterChange}`);
println(`scrollHeight after transform change: ${heightAfterChange}`);
- println(`relayouts performed: ${countersAfter.relayoutsPerformed - countersBefore.relayoutsPerformed}`);
+ println(`layout passes: ${work.passes().join(" | ") || "(no layout)"}`);
});
</script>
diff --git a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-viewport.html b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-viewport.html
index f89d693a0a7..088b2b772fb 100644
--- a/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-viewport.html
+++ b/Tests/LibWeb/Text/input/css/scrollable-overflow-recalc-viewport.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<div id="child" style="width: 50px; height: 50px;"></div>
<script>
// A transform change must also refresh the viewport's scrollable overflow, so that
@@ -7,14 +8,16 @@
test(() => {
const child = document.getElementById("child");
const initialHeight = document.documentElement.scrollHeight;
- const countersBefore = internals.getStyleInvalidationCounters();
- child.style.transform = "translateY(2000px)";
- const heightAfterChange = document.documentElement.scrollHeight;
- window.scrollTo(0, 100000);
- const scrollYAfterGrow = window.scrollY;
- const countersAfter = internals.getStyleInvalidationCounters();
+ let heightAfterChange;
+ let scrollYAfterGrow;
+ const work = layoutWork(() => {
+ child.style.transform = "translateY(2000px)";
+ heightAfterChange = document.documentElement.scrollHeight;
+ window.scrollTo(0, 100000);
+ scrollYAfterGrow = window.scrollY;
+ });
println(`viewport scrollHeight grew: ${heightAfterChange > initialHeight}`);
println(`scrollY clamped to grown max: ${scrollYAfterGrow > 0 && scrollYAfterGrow === heightAfterChange - window.innerHeight}`);
- println(`relayouts performed: ${countersAfter.relayoutsPerformed - countersBefore.relayoutsPerformed}`);
+ println(`layout passes: ${work.passes().join(" | ") || "(no layout)"}`);
});
</script>
diff --git a/Tests/LibWeb/Text/input/css/style-engine/deferred-selection-style-computation.html b/Tests/LibWeb/Text/input/css/style-engine/deferred-selection-style-computation.html
index f9c86fe3bc6..70c68a95d57 100644
--- a/Tests/LibWeb/Text/input/css/style-engine/deferred-selection-style-computation.html
+++ b/Tests/LibWeb/Text/input/css/style-engine/deferred-selection-style-computation.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="../../include.js"></script>
+<script src="../../work-test.js"></script>
<style id="rules"></style>
<div id="container"></div>
<script>
@@ -24,16 +25,16 @@
target.getBoundingClientRect();
const range = document.createRange();
range.selectNodeContents(target);
- document.getSelection().addRange(range);
- internals.resetStyleCounters();
- const beforeActivation = internals.getStyleInvalidationCounters();
- internals.updateStyle();
- target.getBoundingClientRect();
- const afterActivation = internals.getStyleInvalidationCounters();
+ const activationWork = layoutWork(() => {
+ document.getSelection().addRange(range);
+ internals.resetStyleCounters();
+ internals.updateStyle();
+ target.getBoundingClientRect();
+ });
const activation = internals.styleCounters();
println(`activation preserves element styles: ${internals.styleLastPass().changed.length === 0}`);
println(`activation stays local: ${activation.styledElements < 16}`);
- println(`activation preserves layout: ${afterActivation.relayoutsPerformed === beforeActivation.relayoutsPerformed}`);
+ println(`layout after activation: ${activationWork.passes().join(" | ") || "(no layout)"}`);
println(`selected query: ${getComputedStyle(target, "::selection").backgroundColor}`);
internals.updateStyle();
diff --git a/Tests/LibWeb/Text/input/display_list/paint-cache-abspos-child-insertion.html b/Tests/LibWeb/Text/input/display_list/paint-cache-abspos-child-insertion.html
index 35db347bbb3..9df8c13f7eb 100644
--- a/Tests/LibWeb/Text/input/display_list/paint-cache-abspos-child-insertion.html
+++ b/Tests/LibWeb/Text/input/display_list/paint-cache-abspos-child-insertion.html
@@ -12,95 +12,97 @@
<div id="container"><div id="existing">Existing</div></div>
<div id="sibling">Sibling</div>
<script>
-let previousLayoutCount;
const insertionStep = {
// The new child fits inside its containing block without moving existing boxes
// or changing overflow. Only its own paint and hit-test items need recording.
name: "abspos insertion reuses all existing paint",
mutate: () => {
- previousLayoutCount = internals.fullLayoutCount() + internals.partialLayoutCount();
const inserted = document.createElement("div");
inserted.id = "inserted";
inserted.textContent = "New child";
container.appendChild(inserted);
},
check: equal => {
- const layoutCount = internals.fullLayoutCount() + internals.partialLayoutCount();
- equal(layoutCount > previousLayoutCount, true, "insertion performed layout");
equal(container.getBoundingClientRect().height, 100, "container height");
equal(existing.getBoundingClientRect().top, 0, "existing child position");
equal(sibling.getBoundingClientRect().top, 100, "sibling position");
equal(document.elementFromPoint(170, 30).id, "inserted", "inserted child hit target");
},
- expect: `
- damage: rows=5 moved=1 order=3 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 REPLAN
- 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>#container/descendants(background-and-borders) REPLAN
- BlockContainer<DIV>#sibling/descendants(background-and-borders) COPY
- 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>#container/descendants(foreground) REPLAN
- BlockContainer<DIV>#sibling/descendants(foreground) COPY
- BlockContainer<BODY>#body/outline COPY
- BlockContainer<BODY>#body/overlay/hit-test COPY
- BlockContainer<BODY>#body/overlay COPY
- BlockContainer<DIV>#container REPLAN
- BlockContainer<DIV>#container/background/hit-test COPY
- BlockContainer<DIV>#container/scroll-metadata COPY
- BlockContainer<DIV>#container/background COPY
- BlockContainer<DIV>#container/border COPY
- BlockContainer<DIV>#existing/descendants(background-and-borders) COPY
- BlockContainer<DIV>#inserted/descendants(background-and-borders) RECORD
- BlockContainer<DIV>#existing/descendants(floats) COPY
- BlockContainer<DIV>#inserted/descendants(floats) RECORD
- BlockContainer<DIV>#existing/descendants(inline-background-and-borders) COPY
- BlockContainer<DIV>#inserted/descendants(inline-background-and-borders) RECORD
- BlockContainer<DIV>#container/foreground/hit-test COPY
- BlockContainer<DIV>#container/foreground COPY
- BlockContainer<DIV>#existing/descendants(foreground) COPY
- BlockContainer<DIV>#inserted/descendants(foreground) RECORD
- BlockContainer<DIV>#container/outline COPY
- BlockContainer<DIV>#container/overlay/hit-test COPY
- BlockContainer<DIV>#container/overlay COPY
- BlockContainer<DIV>#existing COPY
- BlockContainer<DIV>#inserted RECORD
- BlockContainer<DIV>#inserted/background/hit-test RECORD
- BlockContainer<DIV>#inserted/scroll-metadata RECORD (empty)
- BlockContainer<DIV>#inserted/background RECORD
- BlockContainer<DIV>#inserted/border SKIP
- BlockContainer<DIV>#inserted/foreground/hit-test RECORD
- BlockContainer<DIV>#inserted/foreground RECORD
- BlockContainer<DIV>#inserted/outline SKIP
- BlockContainer<DIV>#inserted/overlay/hit-test RECORD (empty)
- BlockContainer<DIV>#inserted/overlay SKIP
- BlockContainer<DIV>#sibling COPY
- BlockContainer<HTML>#html/outline COPY
- @viewport/outline COPY
- `,
+ expect: {
+ layout: `
+ layout PARTIAL BlockContainer<DIV>#inserted
+ BlockContainer<DIV>#inserted/block RUN (cache=miss)
+ `,
+ displayList: `
+ damage: rows=5 moved=1 order=3 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 REPLAN
+ 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>#container/descendants(background-and-borders) REPLAN
+ BlockContainer<DIV>#sibling/descendants(background-and-borders) COPY
+ 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>#container/descendants(foreground) REPLAN
+ BlockContainer<DIV>#sibling/descendants(foreground) COPY
+ BlockContainer<BODY>#body/outline COPY
+ BlockContainer<BODY>#body/overlay/hit-test COPY
+ BlockContainer<BODY>#body/overlay COPY
+ BlockContainer<DIV>#container REPLAN
+ BlockContainer<DIV>#container/background/hit-test COPY
+ BlockContainer<DIV>#container/scroll-metadata COPY
+ BlockContainer<DIV>#container/background COPY
+ BlockContainer<DIV>#container/border COPY
+ BlockContainer<DIV>#existing/descendants(background-and-borders) COPY
+ BlockContainer<DIV>#inserted/descendants(background-and-borders) RECORD
+ BlockContainer<DIV>#existing/descendants(floats) COPY
+ BlockContainer<DIV>#inserted/descendants(floats) RECORD
+ BlockContainer<DIV>#existing/descendants(inline-background-and-borders) COPY
+ BlockContainer<DIV>#inserted/descendants(inline-background-and-borders) RECORD
+ BlockContainer<DIV>#container/foreground/hit-test COPY
+ BlockContainer<DIV>#container/foreground COPY
+ BlockContainer<DIV>#existing/descendants(foreground) COPY
+ BlockContainer<DIV>#inserted/descendants(foreground) RECORD
+ BlockContainer<DIV>#container/outline COPY
+ BlockContainer<DIV>#container/overlay/hit-test COPY
+ BlockContainer<DIV>#container/overlay COPY
+ BlockContainer<DIV>#existing COPY
+ BlockContainer<DIV>#inserted RECORD
+ BlockContainer<DIV>#inserted/background/hit-test RECORD
+ BlockContainer<DIV>#inserted/scroll-metadata RECORD (empty)
+ BlockContainer<DIV>#inserted/background RECORD
+ BlockContainer<DIV>#inserted/border SKIP
+ BlockContainer<DIV>#inserted/foreground/hit-test RECORD
+ BlockContainer<DIV>#inserted/foreground RECORD
+ BlockContainer<DIV>#inserted/outline SKIP
+ BlockContainer<DIV>#inserted/overlay/hit-test RECORD (empty)
+ BlockContainer<DIV>#inserted/overlay SKIP
+ BlockContainer<DIV>#sibling COPY
+ BlockContainer<HTML>#html/outline COPY
+ @viewport/outline COPY
+ `,
+ },
};
displayListTest({
setup: removeBodyWhitespace,
diff --git a/Tests/LibWeb/Text/input/display_list/paint-cache-relayout-paint-inputs.html b/Tests/LibWeb/Text/input/display_list/paint-cache-relayout-paint-inputs.html
index e8b635f79b7..a1af76480df 100644
--- a/Tests/LibWeb/Text/input/display_list/paint-cache-relayout-paint-inputs.html
+++ b/Tests/LibWeb/Text/input/display_list/paint-cache-relayout-paint-inputs.html
@@ -12,25 +12,31 @@
<div id="target"><span id="inline">Original</span></div>
<canvas id="trigger" width="100" height="20"></canvas>
<script>
-let previousLayoutCount;
displayListTest({
setup: removeBodyWhitespace,
steps: [
{
name: "identical inline output survives full relayout",
mutate: () => {
- previousLayoutCount = internals.fullLayoutCount();
trigger.width = trigger.width;
},
check: equal => {
- equal(internals.fullLayoutCount(), previousLayoutCount + 1, "full layout count");
equal(document.elementFromPoint(5, 10).id, "inline", "inline hit target");
},
- expect: `
- damage: rows=0 moved=0 order=0 eligibility=0 all=false
- @canvas RECORD (empty)
- @viewport COPY
- `,
+ expect: {
+ layout: `
+ layout FULL
+ @viewport/block RUN (cache=bypass)
+ BlockContainer<HTML>#html/block RUN (cache=miss)
+ BlockContainer<DIV>#target REUSE IN-FLOW SUBTREE
+ CanvasBox<CANVAS>#trigger/internal-replaced RUN (cache=bypass)
+ `,
+ displayList: `
+ damage: rows=0 moved=0 order=0 eligibility=0 all=false
+ @canvas RECORD (empty)
+ @viewport COPY
+ `,
+ },
},
{
name: "different text at the same size records new paint",
@@ -106,80 +112,87 @@ displayListTest({
{
name: "relayout preserves pending style paint invalidation",
mutate: () => {
- previousLayoutCount = internals.fullLayoutCount();
document.getElementById("inline").style.color = "red";
trigger.width = trigger.width;
},
check: equal => {
- equal(internals.fullLayoutCount(), previousLayoutCount + 1, "full layout count");
equal(getComputedStyle(document.getElementById("inline")).color, "rgb(255, 0, 0)", "new text color");
},
- expect: `
- damage: rows=5 moved=0 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>#target/descendants(background-and-borders) ASSEMBLE
- BlockContainer<DIV>#target/background/hit-test COPY
- BlockContainer<DIV>#target/scroll-metadata COPY
- BlockContainer<DIV>#target/background RECORD
- BlockContainer<DIV>#target/border SKIP
- InlineNode<SPAN>#inline/descendants(background-and-borders) ASSEMBLE
- CanvasBox<CANVAS>#trigger/descendants(background-and-borders) COPY
- BlockContainer<BODY>#body/descendants(inline-background-and-borders) ASSEMBLE
- BlockContainer<DIV>#target/descendants(inline-background-and-borders) ASSEMBLE
- InlineNode<SPAN>#inline/descendants(inline-background-and-borders) ASSEMBLE
- CanvasBox<CANVAS>#trigger/descendants(inline-background-and-borders) COPY
- 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>#target/descendants(foreground) ASSEMBLE
- BlockContainer<DIV>#target/foreground/hit-test COPY
- BlockContainer<DIV>#target/foreground RECORD (empty)
- InlineNode<SPAN>#inline/descendants(foreground) ASSEMBLE
- BlockContainer<DIV>#target/outline SKIP
- BlockContainer<DIV>#target/overlay/hit-test COPY
- BlockContainer<DIV>#target/overlay SKIP
- CanvasBox<CANVAS>#trigger/descendants(foreground) COPY
- BlockContainer<BODY>#body/outline COPY
- BlockContainer<BODY>#body/overlay/hit-test COPY
- BlockContainer<BODY>#body/overlay COPY
- InlineNode<SPAN>#inline ASSEMBLE
- InlineNode<SPAN>#inline/background/hit-test COPY
- InlineNode<SPAN>#inline/scroll-metadata COPY
- InlineNode<SPAN>#inline/background SKIP
- InlineNode<SPAN>#inline/border SKIP
- InlineNode<SPAN>#inline/foreground/hit-test COPY
- InlineNode<SPAN>#inline/inline-piece RECORD (empty)
- InlineNode<SPAN>#inline/text-fragment RECORD
- InlineNode<SPAN>#inline/foreground RECORD (empty)
- InlineNode<SPAN>#inline/outline SKIP
- InlineNode<SPAN>#inline/overlay/hit-test COPY
- InlineNode<SPAN>#inline/overlay SKIP
- BlockContainer<HTML>#html/outline COPY
- @viewport/outline COPY
- `,
+ expect: {
+ layout: `
+ layout FULL
+ @viewport/block RUN (cache=bypass)
+ BlockContainer<HTML>#html/block RUN (cache=miss)
+ BlockContainer<DIV>#target REUSE IN-FLOW SUBTREE
+ CanvasBox<CANVAS>#trigger/internal-replaced RUN (cache=bypass)
+ `,
+ displayList: `
+ damage: rows=5 moved=0 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>#target/descendants(background-and-borders) ASSEMBLE
+ BlockContainer<DIV>#target/background/hit-test COPY
+ BlockContainer<DIV>#target/scroll-metadata COPY
+ BlockContainer<DIV>#target/background RECORD
+ BlockContainer<DIV>#target/border SKIP
+ InlineNode<SPAN>#inline/descendants(background-and-borders) ASSEMBLE
+ CanvasBox<CANVAS>#trigger/descendants(background-and-borders) COPY
+ BlockContainer<BODY>#body/descendants(inline-background-and-borders) ASSEMBLE
+ BlockContainer<DIV>#target/descendants(inline-background-and-borders) ASSEMBLE
+ InlineNode<SPAN>#inline/descendants(inline-background-and-borders) ASSEMBLE
+ CanvasBox<CANVAS>#trigger/descendants(inline-background-and-borders) COPY
+ 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>#target/descendants(foreground) ASSEMBLE
+ BlockContainer<DIV>#target/foreground/hit-test COPY
+ BlockContainer<DIV>#target/foreground RECORD (empty)
+ InlineNode<SPAN>#inline/descendants(foreground) ASSEMBLE
+ BlockContainer<DIV>#target/outline SKIP
+ BlockContainer<DIV>#target/overlay/hit-test COPY
+ BlockContainer<DIV>#target/overlay SKIP
+ CanvasBox<CANVAS>#trigger/descendants(foreground) COPY
+ BlockContainer<BODY>#body/outline COPY
+ BlockContainer<BODY>#body/overlay/hit-test COPY
+ BlockContainer<BODY>#body/overlay COPY
+ InlineNode<SPAN>#inline ASSEMBLE
+ InlineNode<SPAN>#inline/background/hit-test COPY
+ InlineNode<SPAN>#inline/scroll-metadata COPY
+ InlineNode<SPAN>#inline/background SKIP
+ InlineNode<SPAN>#inline/border SKIP
+ InlineNode<SPAN>#inline/foreground/hit-test COPY
+ InlineNode<SPAN>#inline/inline-piece RECORD (empty)
+ InlineNode<SPAN>#inline/text-fragment RECORD
+ InlineNode<SPAN>#inline/foreground RECORD (empty)
+ InlineNode<SPAN>#inline/outline SKIP
+ InlineNode<SPAN>#inline/overlay/hit-test COPY
+ InlineNode<SPAN>#inline/overlay SKIP
+ BlockContainer<HTML>#html/outline COPY
+ @viewport/outline COPY
+ `,
+ },
},
],
});
diff --git a/Tests/LibWeb/Text/input/display_list/paint-cache-unchanged-relayout.html b/Tests/LibWeb/Text/input/display_list/paint-cache-unchanged-relayout.html
index b76a10db0b0..77426533d40 100644
--- a/Tests/LibWeb/Text/input/display_list/paint-cache-unchanged-relayout.html
+++ b/Tests/LibWeb/Text/input/display_list/paint-cache-unchanged-relayout.html
@@ -9,43 +9,54 @@
<canvas id="full" width="100" height="100"></canvas>
<div id="boundary"><canvas id="partial" width="100" height="100"></canvas></div>
<script>
-let previousLayoutCount;
displayListTest({
setup: removeBodyWhitespace,
steps: [
{
name: "unchanged canvas preserves cached paint after full relayout",
mutate: () => {
- previousLayoutCount = internals.fullLayoutCount();
// Reassigning the width requests layout even when the value is unchanged.
// Without a rendering context, there is no canvas content to reset.
full.width = full.width;
},
check: equal => {
- equal(internals.fullLayoutCount(), previousLayoutCount + 1, "full layout count");
equal(full.getBoundingClientRect().width, 100, "canvas width");
},
- expect: `
- damage: rows=0 moved=0 order=0 eligibility=0 all=false
- @canvas RECORD (empty)
- @viewport COPY
- `,
+ expect: {
+ layout: `
+ layout FULL
+ @viewport/block RUN (cache=bypass)
+ BlockContainer<HTML>/block RUN (cache=miss)
+ CanvasBox<CANVAS>#full/internal-replaced RUN (cache=bypass)
+ BlockContainer<DIV>#boundary/block REUSE SUBTREE
+ `,
+ displayList: `
+ damage: rows=0 moved=0 order=0 eligibility=0 all=false
+ @canvas RECORD (empty)
+ @viewport COPY
+ `,
+ },
},
{
name: "unchanged canvas preserves cached paint after partial relayout",
mutate: () => {
- previousLayoutCount = internals.partialLayoutCount();
partial.width = partial.width;
},
check: equal => {
- equal(internals.partialLayoutCount(), previousLayoutCount + 1, "partial layout count");
equal(partial.getBoundingClientRect().width, 100, "canvas width");
},
- expect: `
- damage: rows=0 moved=0 order=0 eligibility=0 all=false
- @canvas RECORD (empty)
- @viewport COPY
- `,
+ expect: {
+ layout: `
+ layout PARTIAL BlockContainer<DIV>#boundary
+ BlockContainer<DIV>#boundary/block RUN (cache=miss)
+ CanvasBox<CANVAS>#partial/internal-replaced RUN (cache=bypass)
+ `,
+ displayList: `
+ damage: rows=0 moved=0 order=0 eligibility=0 all=false
+ @canvas RECORD (empty)
+ @viewport COPY
+ `,
+ },
},
],
});
diff --git a/Tests/LibWeb/Text/input/display_list/selection-display-contents-invalidation.html b/Tests/LibWeb/Text/input/display_list/selection-display-contents-invalidation.html
index b7bcf901ec4..59c94c70c28 100644
--- a/Tests/LibWeb/Text/input/display_list/selection-display-contents-invalidation.html
+++ b/Tests/LibWeb/Text/input/display_list/selection-display-contents-invalidation.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<style id="rules">
#target { display: contents; }
#target::selection { background-color: rgb(10, 20, 30); }
@@ -9,15 +10,16 @@
test(() => {
getSelection().selectAllChildren(target);
internals.recordDisplayListForTesting();
- const layouts = internals.fullLayoutCount() + internals.partialLayoutCount();
- internals.beginDisplayListTrace();
- rules.sheet.cssRules[1].style.backgroundColor = "rgb(40, 50, 60)";
- internals.recordDisplayListForTesting();
- const trace = internals.takeDisplayListTrace();
- const unchangedLayout = internals.fullLayoutCount() + internals.partialLayoutCount() === layouts;
+ let trace;
+ const work = layoutWork(() => {
+ internals.beginDisplayListTrace();
+ rules.sheet.cssRules[1].style.backgroundColor = "rgb(40, 50, 60)";
+ internals.recordDisplayListForTesting();
+ trace = internals.takeDisplayListTrace();
+ });
const displayList = internals.dumpDisplayList();
println(`highlight commands rerecorded: ${trace.includes("BlockContainer<DIV>#owner/foreground RECORD")}`);
println(`updated highlight color: ${displayList.includes("color=rgb(40, 50, 60)")}`);
- println(`layout preserved: ${unchangedLayout}`);
+ println(`layout after highlight change: ${work.passes().join(" | ") || "(no layout)"}`);
});
</script>
diff --git a/Tests/LibWeb/Text/input/lazy-accumulated-visual-context-rebuild.html b/Tests/LibWeb/Text/input/lazy-accumulated-visual-context-rebuild.html
index c8daa3409ed..2fd5b7617f9 100644
--- a/Tests/LibWeb/Text/input/lazy-accumulated-visual-context-rebuild.html
+++ b/Tests/LibWeb/Text/input/lazy-accumulated-visual-context-rebuild.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="include.js"></script>
+<script src="work-test.js"></script>
<div id="target" style="width: 100px; height: 100px"></div>
<script>
test(() => {
@@ -17,9 +18,8 @@
}
lines.push(`visual context updates after layout-only reads: ${visualContextUpdateCount() - initialUpdateCount}`);
- const fullLayoutCount = internals.fullLayoutCount();
- target.offsetWidth;
- lines.push(`extra layouts after clean read: ${internals.fullLayoutCount() - fullLayoutCount}`);
+ const cleanReadWork = layoutWork(() => target.offsetWidth);
+ lines.push(`layout during clean read: ${cleanReadWork.passes().join(" | ") || "(no layout)"}`);
lines.push(`bounding rect width: ${target.getBoundingClientRect().width}`);
lines.push(`visual context updates after identity transform read: ${visualContextUpdateCount() - initialUpdateCount}`);
diff --git a/Tests/LibWeb/Text/input/multicol-incremental-relayout.html b/Tests/LibWeb/Text/input/multicol-incremental-relayout.html
index 0212aa81f83..6f138d9be32 100644
--- a/Tests/LibWeb/Text/input/multicol-incremental-relayout.html
+++ b/Tests/LibWeb/Text/input/multicol-incremental-relayout.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="include.js"></script>
+<script src="work-test.js"></script>
<style>
body { margin: 0; }
.pair { display: flex; gap: 40px; margin-bottom: 20px; }
@@ -109,17 +110,11 @@
}
function check(name, live, reference, mutate) {
- document.body.offsetHeight;
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
- mutate();
- document.body.offsetHeight;
- const partialLayouts = internals.partialLayoutCount() - partialBefore;
- const fullLayouts = internals.fullLayoutCount() - fullBefore;
+ const passes = layoutWork(mutate).passes().join(" | ") || "(no layout)";
const liveGeometry = geometryOf(document.getElementById(live));
const referenceGeometry = geometryOf(document.getElementById(reference));
const matches = liveGeometry.join("|") === referenceGeometry.join("|");
- println(`${name}: partial-layouts=${partialLayouts} full-layouts=${fullLayouts} ${matches ? "PASS" : "FAIL"}`);
+ println(`${name}: layout=[${passes}] ${matches ? "PASS" : "FAIL"}`);
for (const line of liveGeometry)
println(` ${line}`);
if (!matches) {
diff --git a/Tests/LibWeb/Text/input/stacking-context/flex-item-z-index-change-without-relayout.html b/Tests/LibWeb/Text/input/stacking-context/flex-item-z-index-change-without-relayout.html
index 8ae8c62f626..d253aeee73c 100644
--- a/Tests/LibWeb/Text/input/stacking-context/flex-item-z-index-change-without-relayout.html
+++ b/Tests/LibWeb/Text/input/stacking-context/flex-item-z-index-change-without-relayout.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="../include.js"></script>
+<script src="../work-test.js"></script>
<div style="display: flex">
<div id="item1" style="z-index: 1">one</div>
<div id="item2" style="z-index: 2">two</div>
@@ -13,7 +14,6 @@
.map(line => { const m = line.match(/#([A-Za-z0-9_-]+)/); return m ? m[1] : "(anon)"; })
.join(" ");
const lines = [];
- const layoutCount = () => internals.fullLayoutCount() + internals.partialLayoutCount();
const check = (name) => {
settle();
const r = report();
@@ -23,12 +23,13 @@
};
check("baseline");
- const layoutsBefore = layoutCount();
- document.getElementById("item1").style.zIndex = "3";
- check("first item to z 3");
- document.getElementById("item1").style.zIndex = "1";
- check("first item back to z 1");
- lines.push(`layout runs during the z-index changes: ${layoutCount() - layoutsBefore}`);
+ const work = layoutWork(() => {
+ document.getElementById("item1").style.zIndex = "3";
+ check("first item to z 3");
+ document.getElementById("item1").style.zIndex = "1";
+ check("first item back to z 1");
+ });
+ lines.push(`layout during the z-index changes: ${work.passes().join(" | ") || "(no layout)"}`);
for (const line of lines)
println(line);
diff --git a/Tests/LibWeb/Text/input/svg-relayout-boundaries.html b/Tests/LibWeb/Text/input/svg-relayout-boundaries.html
new file mode 100644
index 00000000000..9a26c410f56
--- /dev/null
+++ b/Tests/LibWeb/Text/input/svg-relayout-boundaries.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<script src="include.js"></script>
+<script src="work-test.js"></script>
+<script>
+ function svgCircle() {
+ const circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
+ circle.setAttribute("cx", "10");
+ circle.setAttribute("cy", "10");
+ circle.setAttribute("r", "5");
+ return circle;
+ }
+
+ const cases = [
+ {
+ name: "inline-boundary-structural",
+ html: `
+ <style>
+ body { margin: 0; }
+ span { border-left: 2px solid black; }
+ </style>
+ <span>before<svg id="boundary" width="40" height="20"></svg>after</span>`,
+ mutate: () => document.getElementById("boundary").appendChild(svgCircle()),
+ report: () => {
+ const svgRect = document.getElementById("boundary").getBoundingClientRect();
+ return [`svg=${svgRect.width},${svgRect.height}`];
+ },
+ },
+ {
+ // An in-flow block-level SVG root inside a position:relative fragmented inline is a partial relayout
+ // boundary whose offset is frozen at the previous layout's value. That frozen offset already includes the
+ // inline ancestor chain's relative inset, so the commit must not accumulate the chain again or the box
+ // drifts further on every subtree relayout.
+ name: "inside-relative-fragmented-inline",
+ html: `
+ <style>
+ body { margin: 0; }
+ #relative_inline {
+ position: relative;
+ top: 20px;
+ left: 30px;
+ }
+ svg { display: block; }
+ </style>
+ <span id="relative_inline">before
+ <svg id="target" width="120" height="100" viewBox="0 0 120 100">
+ <rect id="r" width="60" height="40" fill="rgb(200, 0, 0)"/>
+ </svg>
+ after</span>`,
+ before: () => ({ target: document.getElementById("target").getBoundingClientRect() }),
+ mutate: before => {
+ document.getElementById("r").setAttribute("width", "80");
+ before.afterFirstRelayout = document.getElementById("target").getBoundingClientRect();
+ document.getElementById("r").setAttribute("width", "100");
+ },
+ report: before => {
+ const afterSecondRelayout = document.getElementById("target").getBoundingClientRect();
+ const stableAt = rect => before.target.x === rect.x && before.target.y === rect.y;
+ return [
+ `stable after first relayout: ${stableAt(before.afterFirstRelayout)}`,
+ `stable after second relayout: ${stableAt(afterSecondRelayout)}`,
+ ];
+ },
+ },
+ ];
+
+ test(() => {
+ const output = [];
+ for (const { name, html, before, mutate, report } of cases) {
+ loadFixture(html);
+ const measuredBefore = before?.() ?? {};
+ const work = layoutWork(() => mutate(measuredBefore));
+ output.push(`${name}: ${work.passes().join(" | ") || "(no layout)"}`);
+ for (const line of report(measuredBefore)) output.push(` ${line}`);
+ }
+ for (const line of output) println(line);
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/svg-relayout-inline-boundary-structural.html b/Tests/LibWeb/Text/input/svg-relayout-inline-boundary-structural.html
deleted file mode 100644
index 551b52252fe..00000000000
--- a/Tests/LibWeb/Text/input/svg-relayout-inline-boundary-structural.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- span { border-left: 2px solid black; }
-</style>
-<span>before<svg id="boundary" width="40" height="20"></svg>after</span>
-<script>
- test(() => {
- document.body.offsetHeight;
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- const circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
- circle.setAttribute("cx", "10");
- circle.setAttribute("cy", "10");
- circle.setAttribute("r", "5");
- document.getElementById("boundary").appendChild(circle);
- document.body.offsetHeight;
-
- const svgRect = document.getElementById("boundary").getBoundingClientRect();
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`svg=${svgRect.width},${svgRect.height}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- println(svgRect.width === 40 && svgRect.height === 20
- && partialDelta === 1 && fullDelta === 0 ? "PASS" : "FAIL");
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/svg-relayout-inside-relative-fragmented-inline.html b/Tests/LibWeb/Text/input/svg-relayout-inside-relative-fragmented-inline.html
deleted file mode 100644
index 9f5c6fc01ae..00000000000
--- a/Tests/LibWeb/Text/input/svg-relayout-inside-relative-fragmented-inline.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<style>
- body { margin: 0; }
- #relative_inline {
- position: relative;
- top: 20px;
- left: 30px;
- }
- svg { display: block; }
-</style>
-<span id="relative_inline">before
- <svg id="target" width="120" height="100" viewBox="0 0 120 100">
- <rect id="r" width="60" height="40" fill="rgb(200, 0, 0)"/>
- </svg>
-after</span>
-<script>
- // An in-flow block-level SVG root inside a position:relative fragmented inline is a
- // partial relayout boundary whose offset is frozen at the previous layout's value.
- // That frozen offset already includes the inline ancestor chain's relative inset, so
- // the commit must not accumulate the chain again or the box drifts further on every
- // subtree relayout.
- test(() => {
- document.body.offsetHeight;
- const before = document.getElementById("target").getBoundingClientRect();
-
- const partialBefore = internals.partialLayoutCount();
- const fullBefore = internals.fullLayoutCount();
-
- document.getElementById("r").setAttribute("width", "80");
- document.body.offsetHeight;
- const afterFirstRelayout = document.getElementById("target").getBoundingClientRect();
-
- document.getElementById("r").setAttribute("width", "100");
- document.body.offsetHeight;
- const afterSecondRelayout = document.getElementById("target").getBoundingClientRect();
-
- const partialDelta = internals.partialLayoutCount() - partialBefore;
- const fullDelta = internals.fullLayoutCount() - fullBefore;
-
- println(`stable after first relayout: ${before.x === afterFirstRelayout.x && before.y === afterFirstRelayout.y}`);
- println(`stable after second relayout: ${before.x === afterSecondRelayout.x && before.y === afterSecondRelayout.y}`);
- println(`partial-layouts=${partialDelta} full-layouts=${fullDelta}`);
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/table-colspan-change-relayout.html b/Tests/LibWeb/Text/input/table-colspan-change-relayout.html
index afeed7cfdfe..50060d3b6ef 100644
--- a/Tests/LibWeb/Text/input/table-colspan-change-relayout.html
+++ b/Tests/LibWeb/Text/input/table-colspan-change-relayout.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<script src="include.js"></script>
+<script src="work-test.js"></script>
<style>
table { border-collapse: collapse; width: 300px; table-layout: fixed; }
td { padding: 0; height: 20px; }
@@ -20,14 +21,14 @@
const widthAfter = document.getElementById("first").getBoundingClientRect().width;
// A different attribute string with the same effective span must not relayout.
- const layoutsBefore = internals.fullLayoutCount();
- document.getElementById("first").setAttribute("colspan", "02");
- document.body.offsetHeight;
- const noopLayoutDelta = internals.fullLayoutCount() - layoutsBefore;
+ const noopWork = layoutWork(() => {
+ document.getElementById("first").setAttribute("colspan", "02");
+ document.body.offsetHeight;
+ });
println(`width before: ${widthBefore}`);
println(`width after: ${widthAfter}`);
- println(`no-op layout delta: ${noopLayoutDelta}`);
+ println(`layout after no-op colspan change: ${noopWork.passes().join(" | ") || "(no layout)"}`);
done();
});
</script>
diff --git a/Tests/LibWeb/Text/input/work-test.js b/Tests/LibWeb/Text/input/work-test.js
index 5038b140d85..41d49d9edc1 100644
--- a/Tests/LibWeb/Text/input/work-test.js
+++ b/Tests/LibWeb/Text/input/work-test.js
@@ -28,6 +28,14 @@ function removeBodyWhitespace() {
}
}
+// Replaces the content of the body with `html`, keeping the output element last, so that each case of a scenario file
+// starts from a fixture of its own as a page of its own would.
+function loadFixture(html) {
+ const template = document.createElement("template");
+ template.innerHTML = html;
+ document.body.replaceChildren(template.content, __outputElement);
+}
+
// The traced stages in pipeline order. Settling a stage brings every stage before it up to date as well.
const workStages = [
{