aboutsummaryrefslogtreecommitdiffstats
path: root/components/gfx/paint_task.rs
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-08-19 18:34:58 -0600
committerbors-servo <metajack+bors@gmail.com>2015-08-19 18:34:58 -0600
commitc328b76459f34dfe33570d686452e08b7718b4bd (patch)
tree2961916b3e5a25e1668dd9dc67f7968295ecfa15 /components/gfx/paint_task.rs
parentac4ca053376fe061a324d3b860892719aa3a32ad (diff)
parent277cbf407e86a73ca8a6f6382af4fe4771b33199 (diff)
downloadservo-c328b76459f34dfe33570d686452e08b7718b4bd.tar.gz
servo-c328b76459f34dfe33570d686452e08b7718b4bd.zip
Auto merge of #7292 - pcwalton:layer-sorting, r=glennw
gfx: Sort layers according to their Z-index value before handing them off to the compositor. Closes #7166. r? @glennw <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7292) <!-- Reviewable:end -->
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)
}
}