mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Invalidate viewport units on container-queries properly
By re-selector-matching the element (thus re-evaluating the container query condition). Depends on D159852 Differential Revision: https://phabricator.services.mozilla.com/D159853
This commit is contained in:
parent
b8c0a898ad
commit
15cf28815e
2 changed files with 39 additions and 17 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
//! Invalidates style of all elements that depend on viewport units.
|
||||
|
||||
use crate::data::ViewportUnitUsage;
|
||||
use crate::dom::{TElement, TNode};
|
||||
use crate::invalidation::element::restyle_hints::RestyleHint;
|
||||
|
||||
|
@ -32,10 +33,20 @@ where
|
|||
return false;
|
||||
}
|
||||
|
||||
let uses_viewport_units = data.styles.uses_viewport_units();
|
||||
let usage = data.styles.viewport_unit_usage();
|
||||
let uses_viewport_units = usage != ViewportUnitUsage::None;
|
||||
if uses_viewport_units {
|
||||
debug!("invalidate_recursively: {:?} uses viewport units", element);
|
||||
data.hint.insert(RestyleHint::RECASCADE_SELF);
|
||||
debug!("invalidate_recursively: {:?} uses viewport units {:?}", element, usage);
|
||||
}
|
||||
|
||||
match usage {
|
||||
ViewportUnitUsage::None => {},
|
||||
ViewportUnitUsage::FromQuery => {
|
||||
data.hint.insert(RestyleHint::RESTYLE_SELF);
|
||||
},
|
||||
ViewportUnitUsage::FromDeclaration => {
|
||||
data.hint.insert(RestyleHint::RECASCADE_SELF);
|
||||
}
|
||||
}
|
||||
|
||||
let mut any_children_invalid = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue