From 2f6e94943a0b444eb0b2c38ad9b302799447d44d Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 18 Nov 2015 16:59:40 -0800 Subject: [PATCH] Rename Layout*Trait to Layout*. The next step will be to remote the Servo-specificity of the layout code we want to share by making it operate generically on Layout*. --- components/layout/css/matching.rs | 2 +- components/layout/layout_task.rs | 2 +- components/layout/parallel.rs | 2 +- components/layout/sequential.rs | 2 +- components/layout/traversal.rs | 2 +- components/layout/wrapper.rs | 24 ++++++++++++------------ 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index f1a61eed705..fc5e7aadb14 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -31,7 +31,7 @@ use util::arc_ptr_eq; use util::cache::{LRUCache, SimpleHashCache}; use util::opts; use util::vec::ForgetfulSink; -use wrapper::{ServoLayoutElement, LayoutElementTrait, ServoLayoutNode, LayoutNodeTrait}; +use wrapper::{LayoutElement, LayoutNode, ServoLayoutElement, ServoLayoutNode}; pub struct ApplicableDeclarations { pub normal: SmallVec<[DeclarationBlock; 16]>, diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index c027bdb8787..0ce3744d9ac 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -82,7 +82,7 @@ use util::opts; use util::task::spawn_named_with_send_on_failure; use util::task_state; use util::workqueue::WorkQueue; -use wrapper::{LayoutDocumentTrait, LayoutElementTrait, ServoLayoutNode, LayoutNodeTrait, ThreadSafeLayoutNode}; +use wrapper::{LayoutDocument, LayoutElement, LayoutNode, ServoLayoutNode, ThreadSafeLayoutNode}; /// The number of screens of data we're allowed to generate display lists for in each direction. pub const DISPLAY_PORT_SIZE_FACTOR: i32 = 8; diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs index f439e6caefd..c8549c37eb6 100644 --- a/components/layout/parallel.rs +++ b/components/layout/parallel.rs @@ -23,7 +23,7 @@ use traversal::{PostorderDomTraversal, PreorderDomTraversal}; use util::opts; use util::workqueue::{WorkQueue, WorkUnit, WorkerProxy}; use wrapper::UnsafeLayoutNode; -use wrapper::{ServoLayoutNode, LayoutNodeTrait, layout_node_from_unsafe_layout_node, layout_node_to_unsafe_layout_node}; +use wrapper::{LayoutNode, ServoLayoutNode, layout_node_from_unsafe_layout_node, layout_node_to_unsafe_layout_node}; const CHUNK_SIZE: usize = 64; diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs index 26117bb2d9c..36f754a2cf5 100644 --- a/components/layout/sequential.rs +++ b/components/layout/sequential.rs @@ -19,7 +19,7 @@ use traversal::{BuildDisplayList, ComputeAbsolutePositions}; use traversal::{PostorderDomTraversal, PreorderDomTraversal}; use util::geometry::ZERO_POINT; use util::opts; -use wrapper::{ServoLayoutNode, LayoutNodeTrait}; +use wrapper::{LayoutNode, ServoLayoutNode}; pub fn traverse_dom_preorder(root: ServoLayoutNode, shared_layout_context: &SharedLayoutContext) { diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index d066f8c1401..18fb3e19124 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -17,7 +17,7 @@ use std::cell::RefCell; use std::mem; use util::opts; use util::tid::tid; -use wrapper::{ServoLayoutNode, LayoutNodeTrait, layout_node_to_unsafe_layout_node}; +use wrapper::{LayoutNode, ServoLayoutNode, layout_node_to_unsafe_layout_node}; use wrapper::{ThreadSafeLayoutNode, UnsafeLayoutNode}; /// Every time we do another layout, the old bloom filters are invalid. This is diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 95583df7604..a38009f7a52 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -75,13 +75,13 @@ use util::str::{is_whitespace, search_index}; /// only ever see these and must never see instances of `LayoutJS`. pub trait WrapperTypes<'a> : Sized { - type Node: LayoutNodeTrait<'a, Self>; - type Document: LayoutDocumentTrait<'a, Self>; - type Element: LayoutElementTrait<'a, Self>; + type Node: LayoutNode<'a, Self>; + type Document: LayoutDocument<'a, Self>; + type Element: LayoutElement<'a, Self>; } -pub trait LayoutNodeTrait<'ln, Wrappers> : Sized + Copy + Clone - where Wrappers: WrapperTypes<'ln> { +pub trait LayoutNode<'ln, Wrappers> : Sized + Copy + Clone + where Wrappers: WrapperTypes<'ln> { /// Returns the type ID of this node. fn type_id(&self) -> NodeTypeId; @@ -165,8 +165,8 @@ pub trait LayoutNodeTrait<'ln, Wrappers> : Sized + Copy + Clone fn next_sibling(&self) -> Option; } -pub trait LayoutDocumentTrait<'ld, Wrappers> : Sized + Copy + Clone - where Wrappers: WrapperTypes<'ld> { +pub trait LayoutDocument<'ld, Wrappers> : Sized + Copy + Clone + where Wrappers: WrapperTypes<'ld> { fn as_node(&self) -> Wrappers::Node; fn root_node(&self) -> Option; @@ -174,8 +174,8 @@ pub trait LayoutDocumentTrait<'ld, Wrappers> : Sized + Copy + Clone fn drain_modified_elements(&self) -> Vec<(Wrappers::Element, ElementSnapshot)>; } -pub trait LayoutElementTrait<'le, Wrappers> : Sized + Copy + Clone + ::selectors::Element - where Wrappers: WrapperTypes<'le> { +pub trait LayoutElement<'le, Wrappers> : Sized + Copy + Clone + ::selectors::Element + where Wrappers: WrapperTypes<'le> { fn as_node(&self) -> Wrappers::Node; fn style_attribute(&self) -> &'le Option; @@ -272,7 +272,7 @@ impl<'ln> ServoLayoutNode<'ln> { } } -impl<'ln> LayoutNodeTrait<'ln, ServoWrapperTypes<'ln>> for ServoLayoutNode<'ln> { +impl<'ln> LayoutNode<'ln, ServoWrapperTypes<'ln>> for ServoLayoutNode<'ln> { fn type_id(&self) -> NodeTypeId { unsafe { self.node.type_id_for_layout() @@ -508,7 +508,7 @@ pub struct ServoLayoutDocument<'ld> { chain: PhantomData<&'ld ()>, } -impl<'ld> LayoutDocumentTrait<'ld, ServoWrapperTypes<'ld>> for ServoLayoutDocument<'ld> { +impl<'ld> LayoutDocument<'ld, ServoWrapperTypes<'ld>> for ServoLayoutDocument<'ld> { fn as_node(&self) -> ServoLayoutNode<'ld> { ServoLayoutNode::from_layout_js(self.document.upcast()) } @@ -539,7 +539,7 @@ pub struct ServoLayoutElement<'le> { chain: PhantomData<&'le ()>, } -impl<'le> LayoutElementTrait<'le, ServoWrapperTypes<'le>> for ServoLayoutElement<'le> { +impl<'le> LayoutElement<'le, ServoWrapperTypes<'le>> for ServoLayoutElement<'le> { fn as_node(&self) -> ServoLayoutNode<'le> { ServoLayoutNode::from_layout_js(self.element.upcast()) }