mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
gfx: Sort layers according to their Z-index value before handing them
off to the compositor. Closes #7166.
This commit is contained in:
parent
ac4ca05337
commit
277cbf407e
4 changed files with 57 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue