1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibWeb: Keep tree order of sibling stacking contexts with same z-index

This commit is contained in:
Andreas Kling 2022-02-05 19:02:00 +01:00
parent 270aa9e5d0
commit dbe5af3c6f

View file

@ -22,9 +22,12 @@ StackingContext::StackingContext(Box& box, StackingContext* parent)
m_parent->m_children.append(this);
// FIXME: Don't sort on every append..
// FIXME: Apparently this also breaks tree order inside layers
quick_sort(m_parent->m_children, [](auto& a, auto& b) {
return a->m_box.computed_values().z_index().value_or(0) < b->m_box.computed_values().z_index().value_or(0);
auto a_z_index = a->m_box.computed_values().z_index().value_or(0);
auto b_z_index = b->m_box.computed_values().z_index().value_or(0);
if (a_z_index == b_z_index)
return a->m_box.is_before(b->m_box);
return a_z_index < b_z_index;
});
}
}