mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Rename dlist to linked_list.
This commit is contained in:
parent
6a58cbd118
commit
1ead92b474
6 changed files with 41 additions and 41 deletions
|
@ -26,7 +26,7 @@ use text::TextRun;
|
||||||
use azure::azure::AzFloat;
|
use azure::azure::AzFloat;
|
||||||
use azure::azure_hl::{Color};
|
use azure::azure_hl::{Color};
|
||||||
|
|
||||||
use collections::dlist::{self, DList};
|
use collections::linked_list::{self, LinkedList};
|
||||||
use geom::{Point2D, Rect, SideOffsets2D, Size2D, Matrix2D};
|
use geom::{Point2D, Rect, SideOffsets2D, Size2D, Matrix2D};
|
||||||
use geom::approxeq::ApproxEq;
|
use geom::approxeq::ApproxEq;
|
||||||
use geom::num::Zero;
|
use geom::num::Zero;
|
||||||
|
@ -35,7 +35,7 @@ use paint_task::PaintLayer;
|
||||||
use msg::compositor_msg::LayerId;
|
use msg::compositor_msg::LayerId;
|
||||||
use net::image::base::Image;
|
use net::image::base::Image;
|
||||||
use util::cursor::Cursor;
|
use util::cursor::Cursor;
|
||||||
use util::dlist as servo_dlist;
|
use util::linked_list::prepend_from;
|
||||||
use util::geometry::{self, Au, MAX_RECT, ZERO_RECT};
|
use util::geometry::{self, Au, MAX_RECT, ZERO_RECT};
|
||||||
use util::memory::SizeOf;
|
use util::memory::SizeOf;
|
||||||
use util::range::Range;
|
use util::range::Range;
|
||||||
|
@ -81,17 +81,17 @@ impl OpaqueNode {
|
||||||
/// structure, omitting several pointers and lengths.
|
/// structure, omitting several pointers and lengths.
|
||||||
pub struct DisplayList {
|
pub struct DisplayList {
|
||||||
/// The border and backgrounds for the root of this stacking context: steps 1 and 2.
|
/// The border and backgrounds for the root of this stacking context: steps 1 and 2.
|
||||||
pub background_and_borders: DList<DisplayItem>,
|
pub background_and_borders: LinkedList<DisplayItem>,
|
||||||
/// Borders and backgrounds for block-level descendants: step 4.
|
/// Borders and backgrounds for block-level descendants: step 4.
|
||||||
pub block_backgrounds_and_borders: DList<DisplayItem>,
|
pub block_backgrounds_and_borders: LinkedList<DisplayItem>,
|
||||||
/// Floats: step 5. These are treated as pseudo-stacking contexts.
|
/// Floats: step 5. These are treated as pseudo-stacking contexts.
|
||||||
pub floats: DList<DisplayItem>,
|
pub floats: LinkedList<DisplayItem>,
|
||||||
/// All other content.
|
/// All other content.
|
||||||
pub content: DList<DisplayItem>,
|
pub content: LinkedList<DisplayItem>,
|
||||||
/// Outlines: step 10.
|
/// Outlines: step 10.
|
||||||
pub outlines: DList<DisplayItem>,
|
pub outlines: LinkedList<DisplayItem>,
|
||||||
/// Child stacking contexts.
|
/// Child stacking contexts.
|
||||||
pub children: DList<Arc<StackingContext>>,
|
pub children: LinkedList<Arc<StackingContext>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DisplayList {
|
impl DisplayList {
|
||||||
|
@ -99,12 +99,12 @@ impl DisplayList {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new() -> DisplayList {
|
pub fn new() -> DisplayList {
|
||||||
DisplayList {
|
DisplayList {
|
||||||
background_and_borders: DList::new(),
|
background_and_borders: LinkedList::new(),
|
||||||
block_backgrounds_and_borders: DList::new(),
|
block_backgrounds_and_borders: LinkedList::new(),
|
||||||
floats: DList::new(),
|
floats: LinkedList::new(),
|
||||||
content: DList::new(),
|
content: LinkedList::new(),
|
||||||
outlines: DList::new(),
|
outlines: LinkedList::new(),
|
||||||
children: DList::new(),
|
children: LinkedList::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,10 +123,10 @@ impl DisplayList {
|
||||||
/// Merges all display items from all non-float stacking levels to the `float` stacking level.
|
/// Merges all display items from all non-float stacking levels to the `float` stacking level.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn form_float_pseudo_stacking_context(&mut self) {
|
pub fn form_float_pseudo_stacking_context(&mut self) {
|
||||||
servo_dlist::prepend_from(&mut self.floats, &mut self.outlines);
|
prepend_from(&mut self.floats, &mut self.outlines);
|
||||||
servo_dlist::prepend_from(&mut self.floats, &mut self.content);
|
prepend_from(&mut self.floats, &mut self.content);
|
||||||
servo_dlist::prepend_from(&mut self.floats, &mut self.block_backgrounds_and_borders);
|
prepend_from(&mut self.floats, &mut self.block_backgrounds_and_borders);
|
||||||
servo_dlist::prepend_from(&mut self.floats, &mut self.background_and_borders);
|
prepend_from(&mut self.floats, &mut self.background_and_borders);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a list of all items in this display list concatenated together. This is extremely
|
/// Returns a list of all items in this display list concatenated together. This is extremely
|
||||||
|
@ -1004,7 +1004,7 @@ pub enum BoxShadowClipMode {
|
||||||
|
|
||||||
pub enum DisplayItemIterator<'a> {
|
pub enum DisplayItemIterator<'a> {
|
||||||
Empty,
|
Empty,
|
||||||
Parent(dlist::Iter<'a,DisplayItem>),
|
Parent(linked_list::Iter<'a,DisplayItem>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Iterator for DisplayItemIterator<'a> {
|
impl<'a> Iterator for DisplayItemIterator<'a> {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
use display_list::{DisplayItem, DisplayList, StackingContext};
|
use display_list::{DisplayItem, DisplayList, StackingContext};
|
||||||
|
|
||||||
use collections::dlist::DList;
|
use collections::linked_list::LinkedList;
|
||||||
use geom::rect::Rect;
|
use geom::rect::Rect;
|
||||||
use util::geometry::{self, Au};
|
use util::geometry::{self, Au};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -42,7 +42,7 @@ impl DisplayListOptimizer {
|
||||||
|
|
||||||
/// Adds display items that intersect the visible rect to `result_list`.
|
/// Adds display items that intersect the visible rect to `result_list`.
|
||||||
fn add_in_bounds_display_items<'a,I>(&self,
|
fn add_in_bounds_display_items<'a,I>(&self,
|
||||||
result_list: &mut DList<DisplayItem>,
|
result_list: &mut LinkedList<DisplayItem>,
|
||||||
display_items: I)
|
display_items: I)
|
||||||
where I: Iterator<Item=&'a DisplayItem> {
|
where I: Iterator<Item=&'a DisplayItem> {
|
||||||
for display_item in display_items {
|
for display_item in display_items {
|
||||||
|
@ -55,7 +55,7 @@ impl DisplayListOptimizer {
|
||||||
|
|
||||||
/// Adds child stacking contexts whose boundaries intersect the visible rect to `result_list`.
|
/// Adds child stacking contexts whose boundaries intersect the visible rect to `result_list`.
|
||||||
fn add_in_bounds_stacking_contexts<'a,I>(&self,
|
fn add_in_bounds_stacking_contexts<'a,I>(&self,
|
||||||
result_list: &mut DList<Arc<StackingContext>>,
|
result_list: &mut LinkedList<Arc<StackingContext>>,
|
||||||
stacking_contexts: I)
|
stacking_contexts: I)
|
||||||
where I: Iterator<Item=&'a Arc<StackingContext>> {
|
where I: Iterator<Item=&'a Arc<StackingContext>> {
|
||||||
for stacking_context in stacking_contexts {
|
for stacking_context in stacking_contexts {
|
||||||
|
|
|
@ -15,7 +15,7 @@ use gfx::font_context::FontContext;
|
||||||
use gfx::text::glyph::CharIndex;
|
use gfx::text::glyph::CharIndex;
|
||||||
use gfx::text::text_run::TextRun;
|
use gfx::text::text_run::TextRun;
|
||||||
use gfx::text::util::{self, CompressionMode};
|
use gfx::text::util::{self, CompressionMode};
|
||||||
use util::dlist;
|
use util::linked_list::split_off_head;
|
||||||
use util::geometry::Au;
|
use util::geometry::Au;
|
||||||
use util::logical_geometry::{LogicalSize, WritingMode};
|
use util::logical_geometry::{LogicalSize, WritingMode};
|
||||||
use util::range::Range;
|
use util::range::Range;
|
||||||
|
@ -50,13 +50,13 @@ impl TextRunScanner {
|
||||||
let mut last_whitespace = true;
|
let mut last_whitespace = true;
|
||||||
while !fragments.is_empty() {
|
while !fragments.is_empty() {
|
||||||
// Create a clump.
|
// Create a clump.
|
||||||
self.clump.append(&mut dlist::split_off_head(&mut fragments));
|
self.clump.append(&mut split_off_head(&mut fragments));
|
||||||
while !fragments.is_empty() && self.clump
|
while !fragments.is_empty() && self.clump
|
||||||
.back()
|
.back()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.can_merge_with_fragment(fragments.front()
|
.can_merge_with_fragment(fragments.front()
|
||||||
.unwrap()) {
|
.unwrap()) {
|
||||||
self.clump.append(&mut dlist::split_off_head(&mut fragments));
|
self.clump.append(&mut split_off_head(&mut fragments));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush that clump to the list of fragments we're building up.
|
// Flush that clump to the list of fragments we're building up.
|
||||||
|
|
|
@ -59,7 +59,7 @@ pub mod cache;
|
||||||
pub mod cursor;
|
pub mod cursor;
|
||||||
pub mod debug_utils;
|
pub mod debug_utils;
|
||||||
pub mod deque;
|
pub mod deque;
|
||||||
pub mod dlist;
|
pub mod linked_list;
|
||||||
pub mod fnv;
|
pub mod fnv;
|
||||||
pub mod geometry;
|
pub mod geometry;
|
||||||
pub mod logical_geometry;
|
pub mod logical_geometry;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
use libc::{c_char,c_int,c_void,size_t};
|
use libc::{c_char,c_int,c_void,size_t};
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::collections::LinkedList as DList;
|
use std::collections::LinkedList;
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
use std::iter::AdditiveIterator;
|
use std::iter::AdditiveIterator;
|
||||||
|
@ -109,18 +109,18 @@ impl<T: SizeOf> SizeOf for Vec<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME(njn): We can't implement SizeOf accurately for DList because it requires access to the
|
// FIXME(njn): We can't implement SizeOf accurately for LinkedList because it requires access to the
|
||||||
// private Node type. Eventually we'll want to add SizeOf (or equivalent) to Rust itself. In the
|
// private Node type. Eventually we'll want to add SizeOf (or equivalent) to Rust itself. In the
|
||||||
// meantime, we use the dirty hack of transmuting DList into an identical type (DList2) and
|
// meantime, we use the dirty hack of transmuting LinkedList into an identical type (LinkedList2) and
|
||||||
// measuring that.
|
// measuring that.
|
||||||
impl<T: SizeOf> SizeOf for DList<T> {
|
impl<T: SizeOf> SizeOf for LinkedList<T> {
|
||||||
fn size_of_excluding_self(&self) -> usize {
|
fn size_of_excluding_self(&self) -> usize {
|
||||||
let list2: &DList2<T> = unsafe { transmute(self) };
|
let list2: &LinkedList2<T> = unsafe { transmute(self) };
|
||||||
list2.size_of_excluding_self()
|
list2.size_of_excluding_self()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DList2<T> {
|
struct LinkedList2<T> {
|
||||||
_length: usize,
|
_length: usize,
|
||||||
list_head: Link<T>,
|
list_head: Link<T>,
|
||||||
_list_tail: Rawlink<Node<T>>,
|
_list_tail: Rawlink<Node<T>>,
|
||||||
|
@ -140,14 +140,14 @@ struct Node<T> {
|
||||||
|
|
||||||
impl<T: SizeOf> SizeOf for Node<T> {
|
impl<T: SizeOf> SizeOf for Node<T> {
|
||||||
// Unlike most size_of_excluding_self() functions, this one does *not* measure descendents.
|
// Unlike most size_of_excluding_self() functions, this one does *not* measure descendents.
|
||||||
// Instead, DList2<T>::size_of_excluding_self() handles that, so that it can use iteration
|
// Instead, LinkedList2<T>::size_of_excluding_self() handles that, so that it can use iteration
|
||||||
// instead of recursion, which avoids potentially blowing the stack.
|
// instead of recursion, which avoids potentially blowing the stack.
|
||||||
fn size_of_excluding_self(&self) -> usize {
|
fn size_of_excluding_self(&self) -> usize {
|
||||||
self.value.size_of_excluding_self()
|
self.value.size_of_excluding_self()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: SizeOf> SizeOf for DList2<T> {
|
impl<T: SizeOf> SizeOf for LinkedList2<T> {
|
||||||
fn size_of_excluding_self(&self) -> usize {
|
fn size_of_excluding_self(&self) -> usize {
|
||||||
let mut size = 0;
|
let mut size = 0;
|
||||||
let mut curr: &Link<T> = &self.list_head;
|
let mut curr: &Link<T> = &self.list_head;
|
||||||
|
@ -159,17 +159,17 @@ impl<T: SizeOf> SizeOf for DList2<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a basic sanity check. If the representation of DList changes such that it becomes a
|
// This is a basic sanity check. If the representation of LinkedList changes such that it becomes a
|
||||||
// different size to DList2, this will fail at compile-time.
|
// different size to LinkedList2, this will fail at compile-time.
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
unsafe fn dlist2_check() {
|
unsafe fn linked_list2_check() {
|
||||||
transmute::<DList<i32>, DList2<i32>>(panic!());
|
transmute::<LinkedList<i32>, LinkedList2<i32>>(panic!());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Currently, types that implement the Drop type are larger than those that don't. Because DList
|
// Currently, types that implement the Drop type are larger than those that don't. Because
|
||||||
// implements Drop, DList2 must also so that dlist2_check() doesn't fail.
|
// LinkedList implements Drop, LinkedList2 must also so that linked_list2_check() doesn't fail.
|
||||||
#[unsafe_destructor]
|
#[unsafe_destructor]
|
||||||
impl<T> Drop for DList2<T> {
|
impl<T> Drop for LinkedList2<T> {
|
||||||
fn drop(&mut self) {}
|
fn drop(&mut self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue