diff options
author | Keegan McAllister <kmcallister@mozilla.com> | 2013-08-09 15:15:18 -0700 |
---|---|---|
committer | Keegan McAllister <kmcallister@mozilla.com> | 2013-08-15 13:55:40 -0700 |
commit | 1bdaff0fad9c76e65be969dc9844ab52df318e78 (patch) | |
tree | 24cb881133e405c0f867579266cb838133626b0b /src/components/main/layout | |
parent | abaeb582035e05ecbe1134ec542cda463f808f7a (diff) | |
download | servo-1bdaff0fad9c76e65be969dc9844ab52df318e78.tar.gz servo-1bdaff0fad9c76e65be969dc9844ab52df318e78.zip |
Reorganize tree ref / node traits
rustc is no longer happy with
impl<NR:TreeNodeRef<N>,N:TreeNode<NR>> TreeUtils for NR
Diffstat (limited to 'src/components/main/layout')
-rw-r--r-- | src/components/main/layout/aux.rs | 2 | ||||
-rw-r--r-- | src/components/main/layout/block.rs | 2 | ||||
-rw-r--r-- | src/components/main/layout/box_builder.rs | 2 | ||||
-rw-r--r-- | src/components/main/layout/float.rs | 2 | ||||
-rw-r--r-- | src/components/main/layout/flow.rs | 86 | ||||
-rw-r--r-- | src/components/main/layout/inline.rs | 2 | ||||
-rw-r--r-- | src/components/main/layout/layout_task.rs | 2 |
7 files changed, 49 insertions, 49 deletions
diff --git a/src/components/main/layout/aux.rs b/src/components/main/layout/aux.rs index d63df74c53d..459106e3b39 100644 --- a/src/components/main/layout/aux.rs +++ b/src/components/main/layout/aux.rs @@ -9,7 +9,7 @@ use layout::incremental::RestyleDamage; use newcss::complete::CompleteSelectResults; use script::dom::node::{AbstractNode, LayoutView}; -use servo_util::tree::TreeUtils; +use servo_util::tree::TreeNodeRef; /// Data that layout associates with a node. pub struct LayoutData { diff --git a/src/components/main/layout/block.rs b/src/components/main/layout/block.rs index e78bc87f158..ef191d4697a 100644 --- a/src/components/main/layout/block.rs +++ b/src/components/main/layout/block.rs @@ -18,7 +18,7 @@ use geom::rect::Rect; use gfx::display_list::DisplayList; use gfx::geometry::Au; use gfx::geometry; -use servo_util::tree::{TreeNodeRef, TreeUtils}; +use servo_util::tree::TreeNodeRef; pub struct BlockFlowData { /// Data common to all flows. diff --git a/src/components/main/layout/box_builder.rs b/src/components/main/layout/box_builder.rs index 5ea78c8a0fe..b49c368833d 100644 --- a/src/components/main/layout/box_builder.rs +++ b/src/components/main/layout/box_builder.rs @@ -30,7 +30,7 @@ use script::dom::element::*; use script::dom::node::{AbstractNode, CommentNodeTypeId, DoctypeNodeTypeId}; use script::dom::node::{ElementNodeTypeId, LayoutView, TextNodeTypeId}; use servo_util::range::Range; -use servo_util::tree::{TreeNodeRef, TreeNode, TreeUtils}; +use servo_util::tree::{TreeNodeRef, TreeNode}; pub struct LayoutTreeBuilder { root_flow: Option<FlowContext>, diff --git a/src/components/main/layout/float.rs b/src/components/main/layout/float.rs index 2a2758d4aab..64d0c1c5cd3 100644 --- a/src/components/main/layout/float.rs +++ b/src/components/main/layout/float.rs @@ -15,7 +15,7 @@ use geom::rect::Rect; use gfx::display_list::DisplayList; use gfx::geometry::Au; use gfx::geometry; -use servo_util::tree::{TreeNodeRef, TreeUtils}; +use servo_util::tree::TreeNodeRef; pub struct FloatFlowData { /// Data common to all flows. diff --git a/src/components/main/layout/flow.rs b/src/components/main/layout/flow.rs index 6dc7e9409dc..1da6655ef70 100644 --- a/src/components/main/layout/flow.rs +++ b/src/components/main/layout/flow.rs @@ -43,7 +43,7 @@ use geom::rect::Rect; use gfx::display_list::DisplayList; use gfx::geometry::Au; use script::dom::node::{AbstractNode, LayoutView}; -use servo_util::tree::{TreeNode, TreeNodeRef, TreeUtils}; +use servo_util::tree::{TreeNode, TreeNodeRef}; /// The type of the formatting context and data specific to each context, such as line box /// structures or float lists. @@ -164,8 +164,50 @@ impl TreeNodeRef<FlowData> for FlowContext { TableFlow(info) => callback(info), } } + + fn parent_node(node: &FlowData) -> Option<FlowContext> { + node.parent + } + + fn first_child(node: &FlowData) -> Option<FlowContext> { + node.first_child + } + + fn last_child(node: &FlowData) -> Option<FlowContext> { + node.last_child + } + + fn prev_sibling(node: &FlowData) -> Option<FlowContext> { + node.prev_sibling + } + + fn next_sibling(node: &FlowData) -> Option<FlowContext> { + node.next_sibling + } + + fn set_parent_node(node: &mut FlowData, new_parent_node: Option<FlowContext>) { + node.parent = new_parent_node + } + + fn set_first_child(node: &mut FlowData, new_first_child: Option<FlowContext>) { + node.first_child = new_first_child + } + + fn set_last_child(node: &mut FlowData, new_last_child: Option<FlowContext>) { + node.last_child = new_last_child + } + + fn set_prev_sibling(node: &mut FlowData, new_prev_sibling: Option<FlowContext>) { + node.prev_sibling = new_prev_sibling + } + + fn set_next_sibling(node: &mut FlowData, new_next_sibling: Option<FlowContext>) { + node.next_sibling = new_next_sibling + } } +impl TreeNode<FlowContext> for FlowData { } + /// Data common to all flows. /// /// FIXME: We need a naming convention for pseudo-inheritance like this. How about @@ -196,48 +238,6 @@ pub struct FlowData { is_inorder: bool, } -impl TreeNode<FlowContext> for FlowData { - fn parent_node(&self) -> Option<FlowContext> { - self.parent - } - - fn first_child(&self) -> Option<FlowContext> { - self.first_child - } - - fn last_child(&self) -> Option<FlowContext> { - self.last_child - } - - fn prev_sibling(&self) -> Option<FlowContext> { - self.prev_sibling - } - - fn next_sibling(&self) -> Option<FlowContext> { - self.next_sibling - } - - fn set_parent_node(&mut self, new_parent_node: Option<FlowContext>) { - self.parent = new_parent_node - } - - fn set_first_child(&mut self, new_first_child: Option<FlowContext>) { - self.first_child = new_first_child - } - - fn set_last_child(&mut self, new_last_child: Option<FlowContext>) { - self.last_child = new_last_child - } - - fn set_prev_sibling(&mut self, new_prev_sibling: Option<FlowContext>) { - self.prev_sibling = new_prev_sibling - } - - fn set_next_sibling(&mut self, new_next_sibling: Option<FlowContext>) { - self.next_sibling = new_next_sibling - } -} - pub struct BoxIterator { priv boxes: ~[RenderBox], priv index: uint, diff --git a/src/components/main/layout/inline.rs b/src/components/main/layout/inline.rs index 3a4f8122dfe..d6a6c5dc2a2 100644 --- a/src/components/main/layout/inline.rs +++ b/src/components/main/layout/inline.rs @@ -21,7 +21,7 @@ use newcss::values::{CSSTextAlignLeft, CSSTextAlignCenter, CSSTextAlignRight, CS use newcss::units::{Em, Px, Pt}; use newcss::values::{CSSLineHeightNormal, CSSLineHeightNumber, CSSLineHeightLength, CSSLineHeightPercentage}; use servo_util::range::Range; -use servo_util::tree::{TreeNodeRef, TreeUtils}; +use servo_util::tree::TreeNodeRef; use extra::container::Deque; use extra::ringbuf::RingBuf; diff --git a/src/components/main/layout/layout_task.rs b/src/components/main/layout/layout_task.rs index 73f9e5c9556..c107d6a3e3f 100644 --- a/src/components/main/layout/layout_task.rs +++ b/src/components/main/layout/layout_task.rs @@ -41,7 +41,7 @@ use script::script_task::{ReflowCompleteMsg, ScriptChan, SendEventMsg}; use servo_msg::constellation_msg::{ConstellationChan, PipelineId}; use servo_net::image_cache_task::{ImageCacheTask, ImageResponseMsg}; use servo_net::local_image_cache::LocalImageCache; -use servo_util::tree::{TreeNodeRef, TreeUtils}; +use servo_util::tree::TreeNodeRef; use servo_util::time::{ProfilerChan, profile}; use servo_util::time; use extra::url::Url; |