mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:08:10 +00:00
LibWeb: Only propagate CSS overflow to the viewport once per tree build
Before this change, we were doing it after every layout, which meant that already-propagated overflow could be propagated again, which led to incorrect scrolling behavior.
This commit is contained in:
parent
bc6f19da0e
commit
f9cab320e6
5 changed files with 13 additions and 6 deletions
|
@ -542,6 +542,13 @@ static Element::RequiredInvalidationAfterStyleChange compute_required_invalidati
|
|||
return Element::RequiredInvalidationAfterStyleChange::full();
|
||||
}
|
||||
|
||||
// NOTE: If one of the overflow properties change, we rebuild the entire layout tree.
|
||||
// This ensures that overflow propagation from root/body to viewport happens correctly.
|
||||
// In the future, we can make this invalidation narrower.
|
||||
if (property_id == CSS::PropertyID::OverflowX || property_id == CSS::PropertyID::OverflowY) {
|
||||
return Element::RequiredInvalidationAfterStyleChange::full();
|
||||
}
|
||||
|
||||
// OPTIMIZATION: Special handling for CSS `visibility`:
|
||||
if (property_id == CSS::PropertyID::Visibility) {
|
||||
// We don't need to relayout if the visibility changes from visible to hidden or vice versa. Only collapse requires relayout.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue