mirror of
https://github.com/servo/servo.git
synced 2025-06-17 12:54:28 +00:00
Do not allocate when sorting the display list.
This commit is contained in:
parent
361b2b900e
commit
93c9dda793
1 changed files with 3 additions and 3 deletions
|
@ -37,6 +37,7 @@ use std::collections::HashMap;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::hash::{BuildHasherDefault, Hash};
|
use std::hash::{BuildHasherDefault, Hash};
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
use std::mem;
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use style::computed_values::{border_style, filter, image_rendering, mix_blend_mode};
|
use style::computed_values::{border_style, filter, image_rendering, mix_blend_mode};
|
||||||
|
@ -246,8 +247,7 @@ impl DisplayList {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sort(&mut self) {
|
fn sort(&mut self) {
|
||||||
let mut list = Vec::new();
|
let mut list = mem::replace(&mut self.list, Vec::new());
|
||||||
list.append(&mut self.list);
|
|
||||||
|
|
||||||
list.sort_by(|a, b| {
|
list.sort_by(|a, b| {
|
||||||
if a.base().stacking_context_id == b.base().stacking_context_id {
|
if a.base().stacking_context_id == b.base().stacking_context_id {
|
||||||
|
@ -256,7 +256,7 @@ impl DisplayList {
|
||||||
self.get_offset_for_item(a).cmp(&self.get_offset_for_item(b))
|
self.get_offset_for_item(a).cmp(&self.get_offset_for_item(b))
|
||||||
});
|
});
|
||||||
|
|
||||||
self.list.append(&mut list);
|
mem::replace(&mut self.list, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn print(&self) {
|
pub fn print(&self) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue