aboutsummaryrefslogtreecommitdiffstats
path: root/components/gfx/paint_task.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/gfx/paint_task.rs')
-rw-r--r--components/gfx/paint_task.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs
index 175a7b040f1..26c5308ae3e 100644
--- a/components/gfx/paint_task.rs
+++ b/components/gfx/paint_task.rs
@@ -27,6 +27,7 @@ use msg::constellation_msg::PipelineExitType;
use profile_traits::mem::{self, ReportsChan};
use profile_traits::time::{self, profile};
use rand::{self, Rng};
+use smallvec::SmallVec;
use skia::gl_context::GLContext;
use std::borrow::ToOwned;
use std::mem as std_mem;
@@ -393,7 +394,14 @@ impl<C> PaintTask<C> where C: PaintListener + Send + 'static {
}
};
+ // Sort positioned children according to z-index.
+ let mut positioned_children: SmallVec<[Arc<StackingContext>; 8]> = SmallVec::new();
for kid in &stacking_context.display_list.children {
+ positioned_children.push((*kid).clone());
+ }
+ positioned_children.sort_by(|this, other| this.z_index.cmp(&other.z_index));
+
+ for kid in positioned_children.iter() {
build(properties, &**kid, &page_position, &transform, &perspective, next_parent_id)
}
}