kozan_core/layout/
box_model.rs1use style::properties::ComputedValues;
6
7pub(crate) fn is_stacking_context(style: &ComputedValues) -> bool {
11 use style::computed_values::position::T as Position;
12
13 let position = style.clone_position();
14 if matches!(
15 position,
16 Position::Relative | Position::Absolute | Position::Fixed
17 ) {
18 let z_index = style.clone_z_index();
21 if !z_index.is_auto() {
22 return true;
23 }
24 }
25 if style.get_effects().opacity != 1.0 {
26 return true;
27 }
28 if !style.get_box().transform.0.is_empty() {
29 return true;
30 }
31 false
32}
33
34#[cfg(test)]
35mod tests {
36 use super::*;
37
38 #[test]
39 fn stacking_context_default_is_false() {
40 let style = crate::styling::initial_values_arc();
41 assert!(!is_stacking_context(&style));
42 }
43}