Add initial stacking context paint order support to layout_2020

This adds very rudimentary support for paint order in stacking context.
In particular z-index is now handled properly, apart from issues with
hoisted fragments.
This commit is contained in:
Martin Robinson 2020-02-13 17:22:22 +01:00
parent 318cc16799
commit 4a2787b974
21 changed files with 235 additions and 58 deletions

View file

@ -3,6 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::context::LayoutContext;
use crate::display_list::stacking_context::{StackingContext, StackingContextType};
use crate::dom_traversal::{Contents, NodeExt};
use crate::flow::construct::ContainsFloats;
use crate::flow::float::FloatBox;
@ -181,7 +182,7 @@ impl BoxTreeRoot {
impl FragmentTreeRoot {
pub fn build_display_list(&self, builder: &mut crate::display_list::DisplayListBuilder) {
let mut stacking_context = Default::default();
let mut stacking_context = StackingContext::new(StackingContextType::Real, 0);
for fragment in &self.children {
fragment.build_stacking_context_tree(
builder,
@ -190,6 +191,7 @@ impl FragmentTreeRoot {
);
}
stacking_context.sort_stacking_contexts();
stacking_context.build_display_list(builder);
}