aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-06-02 19:43:00 -0400
committerGitHub <noreply@github.com>2019-06-02 19:43:00 -0400
commit886c2fad9217e87b4a67410e194fdf063af9332d (patch)
treeed09ba5fba30e0edfb0acd468adb417c9c778190 /components
parent03f223663f1c0bc7432f0f47b533fb41c0226eb1 (diff)
parentbb6052ca8e550eee079958e782b9162b1b526603 (diff)
downloadservo-886c2fad9217e87b4a67410e194fdf063af9332d.tar.gz
servo-886c2fad9217e87b4a67410e194fdf063af9332d.zip
Auto merge of #23477 - est31:unused_code_removal, r=jdm
Remove unused code (1/N) <!-- Please describe your changes on the following line: --> First PR in a series of PRs to remove unused/dead code from servo, powered by an (upcoming) tool of mine. Please take a look and tell me if you want to keep something. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because they only remove dead code <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23477) <!-- Reviewable:end -->
Diffstat (limited to 'components')
-rw-r--r--components/gfx/text/glyph.rs2
-rw-r--r--components/gfx/text/text_run.rs4
-rw-r--r--components/layout/display_list/items.rs92
-rw-r--r--components/layout/flex.rs4
-rw-r--r--components/layout/flow.rs103
-rw-r--r--components/layout/flow_list.rs21
-rw-r--r--components/layout/multicol.rs4
-rw-r--r--components/layout/table_caption.rs4
-rw-r--r--components/layout/table_wrapper.rs4
-rw-r--r--components/layout/traversal.rs6
10 files changed, 2 insertions, 242 deletions
diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs
index d84570442ab..df8180688f0 100644
--- a/components/gfx/text/glyph.rs
+++ b/components/gfx/text/glyph.rs
@@ -105,8 +105,6 @@ fn is_simple_advance(advance: Au) -> bool {
}
}
-pub type DetailedGlyphCount = u16;
-
// Getters and setters for GlyphEntry. Setter methods are functional,
// because GlyphEntry is immutable and only a u32 in size.
impl GlyphEntry {
diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs
index 12bee8a8e39..17eb5bf623a 100644
--- a/components/gfx/text/text_run.rs
+++ b/components/gfx/text/text_run.rs
@@ -280,10 +280,6 @@ impl<'a> TextRun {
self.font_metrics.ascent
}
- pub fn descent(&self) -> Au {
- self.font_metrics.descent
- }
-
pub fn advance_for_range(&self, range: &Range<ByteIndex>) -> Au {
if range.is_empty() {
return Au(0);
diff --git a/components/layout/display_list/items.rs b/components/layout/display_list/items.rs
index c66f0c8942b..10d3b81a8d8 100644
--- a/components/layout/display_list/items.rs
+++ b/components/layout/display_list/items.rs
@@ -27,7 +27,7 @@ use webrender_api as wr;
use webrender_api::{BorderRadius, ClipMode};
use webrender_api::{ComplexClipRegion, ExternalScrollId, FilterOp};
use webrender_api::{GlyphInstance, GradientStop, ImageKey, LayoutPoint};
-use webrender_api::{LayoutRect, LayoutSize, LayoutTransform, LayoutVector2D};
+use webrender_api::{LayoutRect, LayoutSize, LayoutTransform};
use webrender_api::{MixBlendMode, ScrollSensitivity, Shadow};
use webrender_api::{StickyOffsetBounds, TransformStyle};
@@ -510,62 +510,6 @@ impl ClippingRegion {
}
}
- /// Mutates this clipping region to intersect with the given rectangle.
- ///
- /// TODO(pcwalton): This could more eagerly eliminate complex clipping regions, at the cost of
- /// complexity.
- #[inline]
- pub fn intersect_rect(&mut self, rect: &LayoutRect) {
- self.main = self.main.intersection(rect).unwrap_or(LayoutRect::zero())
- }
-
- /// Returns true if this clipping region might be nonempty. This can return false positives,
- /// but never false negatives.
- #[inline]
- pub fn might_be_nonempty(&self) -> bool {
- !self.main.is_empty()
- }
-
- /// Returns true if this clipping region might contain the given point and false otherwise.
- /// This is a quick, not a precise, test; it can yield false positives.
- #[inline]
- pub fn might_intersect_point(&self, point: &LayoutPoint) -> bool {
- self.main.contains(point) &&
- self.complex
- .iter()
- .all(|complex| complex.rect.contains(point))
- }
-
- /// Returns true if this clipping region might intersect the given rectangle and false
- /// otherwise. This is a quick, not a precise, test; it can yield false positives.
- #[inline]
- pub fn might_intersect_rect(&self, rect: &LayoutRect) -> bool {
- self.main.intersects(rect) &&
- self.complex
- .iter()
- .all(|complex| complex.rect.intersects(rect))
- }
-
- /// Returns true if this clipping region completely surrounds the given rect.
- #[inline]
- pub fn does_not_clip_rect(&self, rect: &LayoutRect) -> bool {
- self.main.contains(&rect.origin) &&
- self.main.contains(&rect.bottom_right()) &&
- self.complex.iter().all(|complex| {
- complex.rect.contains(&rect.origin) && complex.rect.contains(&rect.bottom_right())
- })
- }
-
- /// Returns a bounding rect that surrounds this entire clipping region.
- #[inline]
- pub fn bounding_rect(&self) -> LayoutRect {
- let mut rect = self.main;
- for complex in &*self.complex {
- rect = rect.union(&complex.rect)
- }
- rect
- }
-
/// Intersects this clipping region with the given rounded rectangle.
#[inline]
pub fn intersect_with_rounded_rect(&mut self, rect: LayoutRect, radii: BorderRadius) {
@@ -593,28 +537,6 @@ impl ClippingRegion {
self.complex.push(new_complex_region);
}
-
- /// Translates this clipping region by the given vector.
- #[inline]
- pub fn translate(&self, delta: &LayoutVector2D) -> ClippingRegion {
- ClippingRegion {
- main: self.main.translate(delta),
- complex: self
- .complex
- .iter()
- .map(|complex| ComplexClipRegion {
- rect: complex.rect.translate(delta),
- radii: complex.radii,
- mode: complex.mode,
- })
- .collect(),
- }
- }
-
- #[inline]
- pub fn is_max(&self) -> bool {
- self.main == LayoutRect::max_rect() && self.complex.is_empty()
- }
}
impl fmt::Debug for ClippingRegion {
@@ -776,10 +698,6 @@ impl DisplayItem {
}
}
- pub fn scroll_node_index(&self) -> ClipScrollNodeIndex {
- self.base().clipping_and_scrolling.scrolling
- }
-
pub fn clipping_and_scrolling(&self) -> ClippingAndScrolling {
self.base().clipping_and_scrolling
}
@@ -795,14 +713,6 @@ impl DisplayItem {
pub fn bounds(&self) -> LayoutRect {
self.base().bounds
}
-
- pub fn debug_with_level(&self, level: u32) {
- let mut indent = String::new();
- for _ in 0..level {
- indent.push_str("| ")
- }
- println!("{}+ {:?}", indent, self);
- }
}
impl fmt::Debug for DisplayItem {
diff --git a/components/layout/flex.rs b/components/layout/flex.rs
index 82dd9533175..e6aa2f7b2c8 100644
--- a/components/layout/flex.rs
+++ b/components/layout/flex.rs
@@ -870,10 +870,6 @@ impl Flow for FlexFlow {
FlowClass::Flex
}
- fn as_mut_flex(&mut self) -> &mut FlexFlow {
- self
- }
-
fn as_flex(&self) -> &FlexFlow {
self
}
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index 86bd6b74edf..bcc38252b9b 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -35,11 +35,9 @@ use crate::flow_list::{FlowList, FlowListIterator, MutFlowListIterator};
use crate::flow_ref::{FlowRef, WeakFlowRef};
use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow};
use crate::inline::InlineFlow;
-use crate::model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo};
-use crate::multicol::MulticolFlow;
+use crate::model::{CollapsibleMargins, IntrinsicISizes};
use crate::parallel::FlowParallelInfo;
use crate::table::TableFlow;
-use crate::table_caption::TableCaptionFlow;
use crate::table_cell::TableCellFlow;
use crate::table_colgroup::TableColGroupFlow;
use crate::table_row::TableRowFlow;
@@ -53,7 +51,6 @@ use num_traits::cast::FromPrimitive;
use serde::ser::{Serialize, SerializeStruct, Serializer};
use servo_geometry::{au_rect_to_f32_rect, f32_rect_to_au_rect, MaxRect};
use std::fmt;
-use std::iter::Zip;
use std::slice::IterMut;
use std::sync::atomic::Ordering;
use std::sync::Arc;
@@ -130,11 +127,6 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
panic!("called as_flex() on a non-flex flow")
}
- /// If this is a flex flow, returns the underlying object, borrowed mutably. Fails otherwise.
- fn as_mut_flex(&mut self) -> &mut FlexFlow {
- panic!("called as_mut_flex() on a non-flex flow")
- }
-
/// If this is an inline flow, returns the underlying object. Fails otherwise.
fn as_inline(&self) -> &InlineFlow {
panic!("called as_inline() on a non-inline flow")
@@ -146,12 +138,6 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
panic!("called as_mut_inline() on a non-inline flow")
}
- /// If this is a table wrapper flow, returns the underlying object, borrowed mutably. Fails
- /// otherwise.
- fn as_mut_table_wrapper(&mut self) -> &mut TableWrapperFlow {
- panic!("called as_mut_table_wrapper() on a non-tablewrapper flow")
- }
-
/// If this is a table wrapper flow, returns the underlying object. Fails otherwise.
fn as_table_wrapper(&self) -> &TableWrapperFlow {
panic!("called as_table_wrapper() on a non-tablewrapper flow")
@@ -203,22 +189,10 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
/// If this is a table cell flow, returns the underlying object, borrowed mutably. Fails
/// otherwise.
- fn as_mut_table_caption(&mut self) -> &mut TableCaptionFlow {
- panic!("called as_mut_table_caption() on a non-tablecaption flow")
- }
-
- /// If this is a table cell flow, returns the underlying object, borrowed mutably. Fails
- /// otherwise.
fn as_mut_table_cell(&mut self) -> &mut TableCellFlow {
panic!("called as_mut_table_cell() on a non-tablecell flow")
}
- /// If this is a multicol flow, returns the underlying object, borrowed mutably. Fails
- /// otherwise.
- fn as_mut_multicol(&mut self) -> &mut MulticolFlow {
- panic!("called as_mut_multicol() on a non-multicol flow")
- }
-
/// If this is a table cell flow, returns the underlying object. Fails otherwise.
fn as_table_cell(&self) -> &TableCellFlow {
panic!("called as_table_cell() on a non-tablecell flow")
@@ -432,14 +406,6 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
/// Mutably iterates through fragments in this flow.
fn mutate_fragments(&mut self, mutator: &mut dyn FnMut(&mut Fragment));
- fn compute_collapsible_block_start_margin(
- &mut self,
- _layout_context: &mut LayoutContext,
- _margin_collapse_info: &mut MarginCollapseInfo,
- ) {
- // The default implementation is a no-op.
- }
-
/// Marks this flow as the root flow. The default implementation is a no-op.
fn mark_as_root(&mut self) {
debug!("called mark_as_root() on a flow of type {:?}", self.class());
@@ -530,9 +496,6 @@ pub trait ImmutableFlowUtils {
/// Returns true if this flow is a table caption flow.
fn is_table_caption(self) -> bool;
- /// Returns true if this flow is a proper table child.
- fn is_proper_table_child(self) -> bool;
-
/// Returns true if this flow is a table row flow.
fn is_table_row(self) -> bool;
@@ -545,18 +508,9 @@ pub trait ImmutableFlowUtils {
/// Returns true if this flow is a table rowgroup flow.
fn is_table_rowgroup(self) -> bool;
- /// Returns true if this flow is one of table-related flows.
- fn is_table_kind(self) -> bool;
-
- /// Returns true if this flow has no children.
- fn is_leaf(self) -> bool;
-
/// Returns the number of children that this flow possesses.
fn child_count(self) -> usize;
- /// Return true if this flow is a Block Container.
- fn is_block_container(self) -> bool;
-
/// Returns true if this flow is a block flow.
fn is_block_flow(self) -> bool;
@@ -826,8 +780,6 @@ impl<'a> Iterator for AbsoluteDescendantIter<'a> {
}
}
-pub type AbsoluteDescendantOffsetIter<'a> = Zip<AbsoluteDescendantIter<'a>, IterMut<'a, Au>>;
-
/// Information needed to compute absolute (i.e. viewport-relative) flow positions (not to be
/// confused with absolutely-positioned flows) that is computed during block-size assignment.
#[derive(Clone, Copy)]
@@ -1205,10 +1157,6 @@ impl BaseFlow {
p as usize
}
- pub fn flow_id(&self) -> usize {
- return self as *const BaseFlow as usize;
- }
-
pub fn collect_stacking_contexts_for_children(
&mut self,
state: &mut StackingContextCollectionState,
@@ -1252,19 +1200,6 @@ impl<'a> ImmutableFlowUtils for &'a dyn Flow {
self.class().is_block_like()
}
- /// Returns true if this flow is a proper table child.
- /// 'Proper table child' is defined as table-row flow, table-rowgroup flow,
- /// table-column-group flow, or table-caption flow.
- fn is_proper_table_child(self) -> bool {
- match self.class() {
- FlowClass::TableRow |
- FlowClass::TableRowGroup |
- FlowClass::TableColGroup |
- FlowClass::TableCaption => true,
- _ => false,
- }
- }
-
/// Returns true if this flow is a table row flow.
fn is_table_row(self) -> bool {
match self.class() {
@@ -1313,47 +1248,11 @@ impl<'a> ImmutableFlowUtils for &'a dyn Flow {
}
}
- /// Returns true if this flow is one of table-related flows.
- fn is_table_kind(self) -> bool {
- match self.class() {
- FlowClass::TableWrapper |
- FlowClass::Table |
- FlowClass::TableColGroup |
- FlowClass::TableRowGroup |
- FlowClass::TableRow |
- FlowClass::TableCaption |
- FlowClass::TableCell => true,
- _ => false,
- }
- }
-
- /// Returns true if this flow has no children.
- fn is_leaf(self) -> bool {
- self.base().children.is_empty()
- }
-
/// Returns the number of children that this flow possesses.
fn child_count(self) -> usize {
self.base().children.len()
}
- /// Return true if this flow is a Block Container.
- ///
- /// Except for table fragments and replaced elements, block-level fragments (`BlockFlow`) are
- /// also block container fragments.
- /// Non-replaced inline blocks and non-replaced table cells are also block
- /// containers.
- fn is_block_container(self) -> bool {
- match self.class() {
- // TODO: Change this when inline-blocks are supported.
- FlowClass::Block | FlowClass::TableCaption | FlowClass::TableCell => {
- // FIXME: Actually check the type of the node
- self.child_count() != 0
- },
- _ => false,
- }
- }
-
/// Returns true if this flow is a block flow.
fn is_block_flow(self) -> bool {
match self.class() {
diff --git a/components/layout/flow_list.rs b/components/layout/flow_list.rs
index 0283c15ae81..a27db03920a 100644
--- a/components/layout/flow_list.rs
+++ b/components/layout/flow_list.rs
@@ -73,17 +73,6 @@ impl FlowList {
self.flows.push_back(FlowRef::new(new_head));
}
- pub fn back(&self) -> Option<&dyn Flow> {
- self.flows.back().map(|x| &**x)
- }
-
- /// Add an element first in the list
- ///
- /// O(1)
- pub fn push_front(&mut self, new_head: FlowRef) {
- self.flows.push_front(new_head);
- }
-
pub fn push_front_arc(&mut self, new_head: Arc<dyn Flow>) {
self.flows.push_front(FlowRef::new(new_head));
}
@@ -92,10 +81,6 @@ impl FlowList {
self.flows.pop_front().map(FlowRef::into_arc)
}
- pub fn front(&self) -> Option<&dyn Flow> {
- self.flows.front().map(|x| &**x)
- }
-
/// Create an empty list
#[inline]
pub fn new() -> FlowList {
@@ -142,12 +127,6 @@ impl FlowList {
/// O(1)
#[inline]
- pub fn is_empty(&self) -> bool {
- self.flows.is_empty()
- }
-
- /// O(1)
- #[inline]
pub fn len(&self) -> usize {
self.flows.len()
}
diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs
index 46ccbc64653..d49e5f1d79f 100644
--- a/components/layout/multicol.rs
+++ b/components/layout/multicol.rs
@@ -74,10 +74,6 @@ impl Flow for MulticolFlow {
&self.block_flow
}
- fn as_mut_multicol(&mut self) -> &mut MulticolFlow {
- self
- }
-
fn bubble_inline_sizes(&mut self) {
// FIXME(SimonSapin) http://dev.w3.org/csswg/css-sizing/#multicol-intrinsic
self.block_flow.bubble_inline_sizes();
diff --git a/components/layout/table_caption.rs b/components/layout/table_caption.rs
index 883d5d6501d..3d44190f986 100644
--- a/components/layout/table_caption.rs
+++ b/components/layout/table_caption.rs
@@ -40,10 +40,6 @@ impl Flow for TableCaptionFlow {
FlowClass::TableCaption
}
- fn as_mut_table_caption(&mut self) -> &mut TableCaptionFlow {
- self
- }
-
fn as_mut_block(&mut self) -> &mut BlockFlow {
&mut self.block_flow
}
diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs
index 1c9c049356e..65ecc07d3ab 100644
--- a/components/layout/table_wrapper.rs
+++ b/components/layout/table_wrapper.rs
@@ -333,10 +333,6 @@ impl Flow for TableWrapperFlow {
FlowClass::TableWrapper
}
- fn as_mut_table_wrapper(&mut self) -> &mut TableWrapperFlow {
- self
- }
-
fn as_table_wrapper(&self) -> &TableWrapperFlow {
self
}
diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs
index 6d44fcfc5e4..e968c184341 100644
--- a/components/layout/traversal.rs
+++ b/components/layout/traversal.rs
@@ -25,12 +25,6 @@ pub struct RecalcStyleAndConstructFlows<'a> {
}
impl<'a> RecalcStyleAndConstructFlows<'a> {
- pub fn layout_context(&self) -> &LayoutContext<'a> {
- &self.context
- }
-}
-
-impl<'a> RecalcStyleAndConstructFlows<'a> {
/// Creates a traversal context, taking ownership of the shared layout context.
pub fn new(context: LayoutContext<'a>) -> Self {
RecalcStyleAndConstructFlows { context: context }