LibWeb: Suppress rendering due to view transitions

This also fixes a bug in the view transitions code that was
required to get the imported test to pass. The code for setting
the initial containing block size just did not set the right thing,
since doing so would trigger an error later on.

That later error resulted from walking up the tree, without
considering that the document element has a parent that is not
itself an element. (and then doing element things to it)
This commit is contained in:
Psychpsyo 2025-09-09 09:45:52 +02:00 committed by Jelle Raaijmakers
commit 17e5289524
Notes: github-actions[bot] 2025-09-09 08:26:40 +00:00
7 changed files with 412 additions and 8 deletions

View file

@ -232,7 +232,7 @@ ErrorOr<void> ViewTransition::capture_the_old_state()
return Error::from_string_literal("The snapshot containing block is too large.");
// 6. Set transitions initial snapshot containing block size to the snapshot containing block size.
m_initial_snapshot_containing_block_size = CSSPixelSize { snapshot_containing_block.width().raw_value(), snapshot_containing_block.height().raw_value() };
m_initial_snapshot_containing_block_size = snapshot_containing_block.size();
// 7. For each element of every element that is connected, and has a node document equal to document, in paint
// order:
@ -856,8 +856,8 @@ ErrorOr<void> ViewTransition::update_pseudo_element_styles()
// 1. Return failure if any of the following conditions is true:
// - capturedElements new element has a flat tree ancestor that skips its contents.
for (auto* ancestor = captured_element->new_element->parent(); ancestor; ancestor = ancestor->parent()) {
if (as<DOM::Element>(*ancestor).skips_its_contents())
for (auto ancestor = captured_element->new_element->parent_element(); ancestor; ancestor = ancestor->parent_element()) {
if (ancestor->skips_its_contents())
return Error::from_string_literal("capturedElements new element has a flat tree ancestor that skips its contents.");
}