From 5ec1cdea9b3e0b07a417bdba5487c7368367bda6 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 16 Nov 2015 19:24:11 +0100 Subject: [PATCH] Remove dead code from layout. --- components/layout/css/matching.rs | 7 ----- components/layout/floats.rs | 4 --- components/layout/flow.rs | 9 ------- components/layout/flow_list.rs | 40 ----------------------------- components/layout/fragment.rs | 13 +--------- components/layout/inline.rs | 10 -------- components/layout/parallel.rs | 12 --------- components/layout/table.rs | 7 ----- components/layout/table_row.rs | 7 +++-- components/layout/table_rowgroup.rs | 4 --- components/layout/wrapper.rs | 7 ----- 11 files changed, 4 insertions(+), 116 deletions(-) diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index d0260fa5c98..4afd9a77815 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -51,13 +51,6 @@ impl ApplicableDeclarations { normal_shareable: false, } } - - pub fn clear(&mut self) { - self.normal = SmallVec::new(); - self.before = Vec::new(); - self.after = Vec::new(); - self.normal_shareable = false; - } } #[derive(Clone)] diff --git a/components/layout/floats.rs b/components/layout/floats.rs index f406cd2194b..9385bd69afc 100644 --- a/components/layout/floats.rs +++ b/components/layout/floats.rs @@ -153,10 +153,6 @@ impl Floats { } } - pub fn len(&self) -> usize { - self.list.floats.len() - } - /// Returns a rectangle that encloses the region from block-start to block-start + block-size, /// with inline-size small enough that it doesn't collide with any floats. max_x is the /// inline-size beyond which floats have no effect. (Generally this is the containing block diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 6902341edae..8251bd88b6c 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -1430,11 +1430,6 @@ impl ContainingBlockLink { self.link = Some(Arc::downgrade(&link)) } - #[allow(unsafe_code)] - pub unsafe fn get(&mut self) -> &mut Option { - &mut self.link - } - #[inline] pub fn generated_containing_block_size(&self, for_flow: OpaqueFlow) -> LogicalSize { match self.link { @@ -1483,8 +1478,4 @@ impl OpaqueFlow { OpaqueFlow(object.data as usize) } } - - pub fn from_base_flow(base_flow: &BaseFlow) -> OpaqueFlow { - OpaqueFlow(base_flow as *const BaseFlow as usize) - } } diff --git a/components/layout/flow_list.rs b/components/layout/flow_list.rs index 786cf4b5d63..94045f21d3d 100644 --- a/components/layout/flow_list.rs +++ b/components/layout/flow_list.rs @@ -22,46 +22,6 @@ pub struct MutFlowListIterator<'a> { } impl FlowList { - /// Provide a reference to the front element, or None if the list is empty - #[inline] - pub fn front(&self) -> Option<&Flow> { - self.flows.front().map(|head| &**head) - } - - /// Provide a mutable reference to the front element, or None if the list is empty - #[inline] - #[allow(unsafe_code)] - pub unsafe fn front_mut(&mut self) -> Option<&mut Flow> { - self.flows.front_mut().map(flow_ref::deref_mut) - } - - /// Provide a reference to the back element, or None if the list is empty - #[inline] - pub fn back(&self) -> Option<&Flow> { - self.flows.back().map(|tail| &**tail) - } - - /// Provide a mutable reference to the back element, or None if the list is empty - #[inline] - #[allow(unsafe_code)] - pub unsafe fn back_mut(&mut self) -> Option<&mut Flow> { - self.flows.back_mut().map(flow_ref::deref_mut) - } - - /// Add an element first in the list - /// - /// O(1) - pub fn push_front(&mut self, new_head: FlowRef) { - self.flows.push_front(new_head); - } - - /// Remove the first element and return it, or None if the list is empty - /// - /// O(1) - pub fn pop_front(&mut self) -> Option { - self.flows.pop_front() - } - /// Add an element last in the list /// /// O(1) diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index ce0047e3ce9..1814e1ad664 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -37,7 +37,7 @@ use std::sync::{Arc, Mutex}; use string_cache::Atom; use style::computed_values::content::ContentItem; use style::computed_values::{border_collapse, clear, display, mix_blend_mode, overflow_wrap}; -use style::computed_values::{overflow_x, position, text_align, text_decoration, transform_style}; +use style::computed_values::{overflow_x, position, text_decoration, transform_style}; use style::computed_values::{white_space, word_break, z_index}; use style::properties::ComputedValues; use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto}; @@ -812,11 +812,6 @@ impl Fragment { } } - pub fn reset_inline_sizes(&mut self) { - self.border_padding = LogicalMargin::zero(self.style.writing_mode); - self.margin = LogicalMargin::zero(self.style.writing_mode); - } - /// Returns a debug ID of this fragment. This ID should not be considered stable across /// multiple layouts or fragment manipulations. pub fn debug_id(&self) -> u16 { @@ -1239,12 +1234,6 @@ impl Fragment { &*self.style } - /// Returns the text alignment of the computed style of the nearest ancestor-or-self `Element` - /// node. - pub fn text_align(&self) -> text_align::T { - self.style().get_inheritedtext().text_align - } - pub fn white_space(&self) -> white_space::T { self.style().get_inheritedtext().white_space } diff --git a/components/layout/inline.rs b/components/layout/inline.rs index fe798496e11..4cee4454620 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -804,16 +804,6 @@ impl InlineFragments { self.fragments.is_empty() } - /// Pushes a new inline fragment. - pub fn push(&mut self, fragment: &mut Fragment) { - self.fragments.push(fragment.clone()); - } - - /// Merges another set of inline fragments with this one. - pub fn push_all(&mut self, mut other: InlineFragments) { - self.fragments.append(&mut other.fragments); - } - /// A convenience function to return the fragment at a given index. pub fn get(&self, index: usize) -> &Fragment { &self.fragments[index] diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs index 658ce8030d6..1b1f4056706 100644 --- a/components/layout/parallel.rs +++ b/components/layout/parallel.rs @@ -44,12 +44,6 @@ fn null_unsafe_flow() -> UnsafeFlow { (0, 0) } -pub fn owned_flow_to_unsafe_flow(flow: *const FlowRef) -> UnsafeFlow { - unsafe { - mem::transmute::<&Flow, UnsafeFlow>(&**flow) - } -} - pub fn mut_owned_flow_to_unsafe_flow(flow: *mut FlowRef) -> UnsafeFlow { unsafe { mem::transmute::<&Flow, UnsafeFlow>(&**flow) @@ -62,12 +56,6 @@ pub fn borrowed_flow_to_unsafe_flow(flow: &Flow) -> UnsafeFlow { } } -pub fn mut_borrowed_flow_to_unsafe_flow(flow: &mut Flow) -> UnsafeFlow { - unsafe { - mem::transmute::<&Flow, UnsafeFlow>(flow) - } -} - /// Information that we need stored in each DOM node. pub struct DomParallelInfo { /// The number of children that still need work done. diff --git a/components/layout/table.rs b/components/layout/table.rs index c6785d52340..2876fd3bf69 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -632,13 +632,6 @@ impl ColumnIntrinsicInlineSize { } } - /// Returns the true minimum size of this column, given the containing block's inline size. - /// Beware that this is generally only correct for fixed table layout. (Compare CSS 2.1 § - /// 17.5.2.1 with the algorithm in INTRINSIC § 4.) - pub fn minimum(&self, containing_block_inline_size: Au) -> Au { - cmp::max(self.minimum_length, containing_block_inline_size.scale_by(self.percentage)) - } - /// Returns the higher of the two percentages specified in `self` and `other`. pub fn greatest_percentage(&self, other: &ColumnIntrinsicInlineSize) -> CSSFloat { if self.percentage > other.percentage { diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 24dde406441..6f6eafab9ab 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -95,10 +95,6 @@ impl TableRowFlow { } } - pub fn fragment(&mut self) -> &Fragment { - &self.block_flow.fragment - } - /// Assign block-size for table-row flow. /// /// TODO(pcwalton): This doesn't handle floats and positioned elements right. @@ -538,6 +534,9 @@ impl Encodable for CollapsedBorder { /// /// The integer values here correspond to the border conflict resolution rules in CSS 2.1 § /// 17.6.2.1. Higher values override lower values. +// FIXME(#8586): FromTableRow, FromTableRowGroup, FromTableColumn, +// FromTableColumnGroup are unused +#[allow(dead_code)] #[derive(Copy, Clone, Debug, PartialEq, RustcEncodable)] pub enum CollapsedBorderProvenance { FromPreviousTableCell = 6, diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs index be927b2fa23..04c49c4c071 100644 --- a/components/layout/table_rowgroup.rs +++ b/components/layout/table_rowgroup.rs @@ -78,10 +78,6 @@ impl TableRowGroupFlow { } } - pub fn fragment(&mut self) -> &Fragment { - &self.block_flow.fragment - } - pub fn populate_collapsed_border_spacing<'a, I>( &mut self, collapsed_inline_direction_border_widths_for_table: &[Au], diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index c463f7146c1..11a4a0e514e 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -672,13 +672,6 @@ impl PseudoElementType { } } - pub fn is_after(&self) -> bool { - match *self { - PseudoElementType::After(_) => true, - _ => false, - } - } - pub fn strip(&self) -> PseudoElementType<()> { match *self { PseudoElementType::Normal => PseudoElementType::Normal,