layout: Start using the new extensible RestyleDamage type from Stylo (#37592)

This will allow Servo to add custom types of damage in the near future
which correspond to minor phases layout. The damage exposed by Stylo
only corresponds to the major layout phses. In the future, both phases
will likely be managed by Servo itself and implementors will need to
provide their own damage system entirely.

Testing: This shouldn't change behavior and thus is covered by existing
tests.

Stylo PR: https://github.com/servo/stylo/pull/207

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Martin Robinson 2025-06-26 16:10:48 +02:00 committed by GitHub
parent a9dc2ac83a
commit 5286869b96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 56 additions and 35 deletions

View file

@ -840,8 +840,8 @@ impl LayoutThread {
let mut damage =
compute_damage_and_repair_style(layout_context.shared_context(), root_node);
if viewport_changed {
damage = RestyleDamage::REBUILD_BOX;
} else if !damage.contains(RestyleDamage::REBUILD_BOX) {
damage = RestyleDamage::RELAYOUT;
} else if !damage.contains(RestyleDamage::RELAYOUT) {
layout_context.style_context.stylist.rule_tree().maybe_gc();
return damage;
}