diff options
-rw-r--r-- | components/layout_2020/context.rs | 2 | ||||
-rw-r--r-- | components/layout_2020/display_list.rs | 2 | ||||
-rw-r--r-- | components/layout_2020/dom_traversal.rs | 3 | ||||
-rw-r--r-- | components/layout_2020/flow/float.rs | 2 | ||||
-rw-r--r-- | components/layout_2020/flow/inline.rs | 7 | ||||
-rw-r--r-- | components/layout_2020/flow/mod.rs | 14 | ||||
-rw-r--r-- | components/layout_2020/flow/root.rs | 6 | ||||
-rw-r--r-- | components/layout_2020/formatting_contexts.rs | 5 | ||||
-rw-r--r-- | components/layout_2020/geom.rs | 21 | ||||
-rw-r--r-- | components/layout_2020/lib.rs | 16 | ||||
-rw-r--r-- | components/layout_2020/positioned.rs | 2 | ||||
-rw-r--r-- | components/layout_2020/replaced.rs | 5 | ||||
-rw-r--r-- | components/layout_thread_2020/lib.rs | 3 |
13 files changed, 15 insertions, 73 deletions
diff --git a/components/layout_2020/context.rs b/components/layout_2020/context.rs index 5bde114ca57..42106a76387 100644 --- a/components/layout_2020/context.rs +++ b/components/layout_2020/context.rs @@ -5,7 +5,7 @@ use gfx::font_cache_thread::FontCacheThread; use gfx::font_context::FontContext; use msg::constellation_msg::PipelineId; -use std::cell::{RefCell, RefMut}; +use std::cell::RefCell; use std::sync::Mutex; use style::context::SharedStyleContext; diff --git a/components/layout_2020/display_list.rs b/components/layout_2020/display_list.rs index 16592a8a5d0..f578988f9c0 100644 --- a/components/layout_2020/display_list.rs +++ b/components/layout_2020/display_list.rs @@ -5,10 +5,8 @@ use crate::fragments::{BoxFragment, Fragment}; use crate::geom::physical::{Rect, Vec2}; use crate::style_ext::ComputedValuesExt; -use app_units::Au; use euclid::{Point2D, SideOffsets2D}; use gfx::text::glyph::GlyphStore; -use servo_geometry::MaxRect; use std::sync::Arc; use style::values::computed::{BorderStyle, Length}; use webrender_api::{self as wr, units, CommonItemProperties, PrimitiveFlags}; diff --git a/components/layout_2020/dom_traversal.rs b/components/layout_2020/dom_traversal.rs index ee368566bef..1a3ec7f1c98 100644 --- a/components/layout_2020/dom_traversal.rs +++ b/components/layout_2020/dom_traversal.rs @@ -8,10 +8,9 @@ use crate::replaced::ReplacedContent; use crate::style_ext::{Display, DisplayGeneratingBox, DisplayInside, DisplayOutside}; use crate::wrapper::GetRawData; use atomic_refcell::{AtomicRefCell, AtomicRefMut}; -use net_traits::image::base::{Image as NetImage, ImageMetadata}; +use net_traits::image::base::Image as NetImage; use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode}; use servo_arc::Arc as ServoArc; -use std::convert::TryInto; use std::marker::PhantomData as marker; use std::sync::Arc; use style::context::SharedStyleContext; diff --git a/components/layout_2020/flow/float.rs b/components/layout_2020/flow/float.rs index 4698e9d2f1c..f9be366bc97 100644 --- a/components/layout_2020/flow/float.rs +++ b/components/layout_2020/flow/float.rs @@ -3,8 +3,6 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::formatting_contexts::IndependentFormattingContext; -use servo_arc::Arc; -use style::properties::ComputedValues; #[derive(Debug)] pub(crate) struct FloatBox { diff --git a/components/layout_2020/flow/inline.rs b/components/layout_2020/flow/inline.rs index f944fdbedf2..33d1d8a0ed9 100644 --- a/components/layout_2020/flow/inline.rs +++ b/components/layout_2020/flow/inline.rs @@ -6,9 +6,8 @@ use crate::context::LayoutContext; use crate::flow::float::FloatBox; use crate::flow::FlowLayout; use crate::formatting_contexts::IndependentFormattingContext; -use crate::fragments::{ - AnonymousFragment, BoxFragment, CollapsedBlockMargins, Fragment, TextFragment, -}; +use crate::fragments::CollapsedBlockMargins; +use crate::fragments::{AnonymousFragment, BoxFragment, Fragment, TextFragment}; use crate::geom::flow_relative::{Rect, Sides, Vec2}; use crate::positioned::{AbsolutelyPositionedBox, AbsolutelyPositionedFragment}; use crate::style_ext::{ComputedValuesExt, Display, DisplayGeneratingBox, DisplayOutside}; @@ -285,7 +284,7 @@ impl<'box_tree> PartialInlineBoxFragment<'box_tree> { impl TextRun { fn layout(&self, layout_context: &LayoutContext, ifc: &mut InlineFormattingContextState) { - use gfx::font::{ShapingFlags, ShapingOptions}; + use gfx::font::ShapingFlags; use style::computed_values::text_rendering::T as TextRendering; use style::computed_values::word_break::T as WordBreak; use style::values::generics::text::LineHeight; diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs index 4b887abde35..8bda0c69d24 100644 --- a/components/layout_2020/flow/mod.rs +++ b/components/layout_2020/flow/mod.rs @@ -8,13 +8,11 @@ use crate::context::LayoutContext; use crate::flow::float::{FloatBox, FloatContext}; use crate::flow::inline::InlineFormattingContext; use crate::formatting_contexts::{IndependentFormattingContext, IndependentLayout}; -use crate::fragments::{ - AnonymousFragment, BoxFragment, CollapsedBlockMargins, CollapsedMargin, Fragment, -}; +use crate::fragments::{AnonymousFragment, BoxFragment, Fragment}; +use crate::fragments::{CollapsedBlockMargins, CollapsedMargin}; use crate::geom::flow_relative::{Rect, Sides, Vec2}; -use crate::positioned::{ - adjust_static_positions, AbsolutelyPositionedBox, AbsolutelyPositionedFragment, -}; +use crate::positioned::adjust_static_positions; +use crate::positioned::{AbsolutelyPositionedBox, AbsolutelyPositionedFragment}; use crate::replaced::ReplacedContent; use crate::style_ext::{ComputedValuesExt, Position}; use crate::{relative_adjustement, ContainingBlock}; @@ -297,7 +295,6 @@ impl BlockLevelBox { }, BlockLevelBox::Independent(contents) => match contents.as_replaced() { Ok(replaced) => Fragment::Box(layout_in_flow_replaced_block_level( - layout_context, containing_block, &contents.style, replaced, @@ -475,7 +472,6 @@ fn layout_in_flow_non_replaced_block_level<'a>( /// https://drafts.csswg.org/css2/visudet.html#inline-replaced-width /// https://drafts.csswg.org/css2/visudet.html#inline-replaced-height fn layout_in_flow_replaced_block_level<'a>( - layout_context: &LayoutContext, containing_block: &ContainingBlock, style: &Arc<ComputedValues>, replaced: &ReplacedContent, @@ -530,7 +526,7 @@ fn layout_in_flow_replaced_block_level<'a>( containing_block.mode, containing_block_for_children.mode, "Mixed writing modes are not supported yet" ); - let independent_layout = replaced.layout(layout_context, style, &containing_block_for_children); + let independent_layout = replaced.layout(style, &containing_block_for_children); let relative_adjustement = relative_adjustement( style, inline_size, diff --git a/components/layout_2020/flow/root.rs b/components/layout_2020/flow/root.rs index f4cb0abafb9..7c062f12f47 100644 --- a/components/layout_2020/flow/root.rs +++ b/components/layout_2020/flow/root.rs @@ -14,15 +14,12 @@ use crate::geom; use crate::geom::flow_relative::Vec2; use crate::positioned::AbsolutelyPositionedBox; use crate::replaced::ReplacedContent; -use crate::style_ext::{ - Direction, Display, DisplayGeneratingBox, DisplayInside, DisplayOutside, WritingMode, -}; +use crate::style_ext::{Direction, Display, DisplayGeneratingBox, DisplayInside, WritingMode}; use crate::{ContainingBlock, DefiniteContainingBlock}; use rayon::iter::{IntoParallelRefIterator, ParallelExtend, ParallelIterator}; use script_layout_interface::wrapper_traits::LayoutNode; use servo_arc::Arc; use style::context::SharedStyleContext; -use style::properties::ComputedValues; use style::values::computed::{Length, LengthOrAuto}; use style::Zero; use style_traits::CSSPixel; @@ -137,7 +134,6 @@ impl FragmentTreeRoot { pub fn build_display_list( &self, builder: &mut crate::display_list::DisplayListBuilder, - pipeline_id: msg::constellation_msg::PipelineId, viewport_size: webrender_api::units::LayoutSize, ) -> IsContentful { let containing_block = geom::physical::Rect { diff --git a/components/layout_2020/formatting_contexts.rs b/components/layout_2020/formatting_contexts.rs index 06e863da1b1..0517f599852 100644 --- a/components/layout_2020/formatting_contexts.rs +++ b/components/layout_2020/formatting_contexts.rs @@ -6,10 +6,9 @@ use crate::context::LayoutContext; use crate::dom_traversal::{Contents, NodeExt}; use crate::flow::BlockFormattingContext; use crate::fragments::Fragment; -use crate::geom::flow_relative::Vec2; use crate::positioned::AbsolutelyPositionedFragment; use crate::replaced::ReplacedContent; -use crate::style_ext::{ComputedValuesExt, Direction, DisplayInside, Position, WritingMode}; +use crate::style_ext::DisplayInside; use crate::ContainingBlock; use servo_arc::Arc; use std::convert::TryInto; @@ -83,7 +82,7 @@ impl IndependentFormattingContext { absolutely_positioned_fragments: &mut Vec<AbsolutelyPositionedFragment<'a>>, ) -> IndependentLayout { match self.as_replaced() { - Ok(replaced) => replaced.layout(layout_context, &self.style, containing_block), + Ok(replaced) => replaced.layout(&self.style, containing_block), Err(ifc) => ifc.layout( layout_context, containing_block, diff --git a/components/layout_2020/geom.rs b/components/layout_2020/geom.rs index f37685821a3..d75a1634561 100644 --- a/components/layout_2020/geom.rs +++ b/components/layout_2020/geom.rs @@ -141,17 +141,6 @@ impl flow_relative::Vec2<Length> { } } -impl flow_relative::Sides<Length> { - pub fn zero() -> Self { - Self { - inline_start: Length::zero(), - inline_end: Length::zero(), - block_start: Length::zero(), - block_end: Length::zero(), - } - } -} - impl flow_relative::Rect<Length> { pub fn zero() -> Self { Self { @@ -244,16 +233,6 @@ impl<T> flow_relative::Sides<T> { { self.block_start + self.block_end } - - pub fn start_corner(&self) -> flow_relative::Vec2<T> - where - T: Clone, - { - flow_relative::Vec2 { - inline: self.inline_start.clone(), - block: self.block_start.clone(), - } - } } impl flow_relative::Sides<LengthPercentage> { diff --git a/components/layout_2020/lib.rs b/components/layout_2020/lib.rs index 07956417087..80254421e66 100644 --- a/components/layout_2020/lib.rs +++ b/components/layout_2020/lib.rs @@ -2,16 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#![allow(dead_code)] -#![allow(unreachable_code)] -#![allow(unused_imports)] -#![allow(unused_variables)] #![deny(unsafe_code)] #![feature(exact_size_is_empty)] -#[macro_use] -extern crate serde; - pub mod context; pub mod data; pub mod display_list; @@ -31,15 +24,8 @@ pub mod wrapper; pub use flow::{BoxTreeRoot, FragmentTreeRoot}; -use crate::context::LayoutContext; -use crate::dom_traversal::{Contents, NodeExt}; -use crate::flow::BlockFormattingContext; use crate::geom::flow_relative::Vec2; -use crate::positioned::AbsolutelyPositionedFragment; -use crate::replaced::ReplacedContent; -use crate::style_ext::{ComputedValuesExt, Direction, DisplayInside, Position, WritingMode}; -use servo_arc::Arc; -use std::convert::TryInto; +use crate::style_ext::{ComputedValuesExt, Direction, Position, WritingMode}; use style::properties::ComputedValues; use style::values::computed::{Length, LengthOrAuto}; use style::Zero; diff --git a/components/layout_2020/positioned.rs b/components/layout_2020/positioned.rs index 92bd4c8a4d5..3577a86642b 100644 --- a/components/layout_2020/positioned.rs +++ b/components/layout_2020/positioned.rs @@ -9,8 +9,6 @@ use crate::geom::flow_relative::{Rect, Sides, Vec2}; use crate::style_ext::{ComputedValuesExt, Direction, WritingMode}; use crate::{ContainingBlock, DefiniteContainingBlock}; use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; -use servo_arc::Arc; -use style::properties::ComputedValues; use style::values::computed::{Length, LengthOrAuto, LengthPercentage, LengthPercentageOrAuto}; use style::Zero; diff --git a/components/layout_2020/replaced.rs b/components/layout_2020/replaced.rs index bb003f613fa..ecb8d2433e3 100644 --- a/components/layout_2020/replaced.rs +++ b/components/layout_2020/replaced.rs @@ -2,20 +2,16 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use crate::context::LayoutContext; use crate::dom_traversal::NodeExt; use crate::formatting_contexts::IndependentLayout; use crate::fragments::{Fragment, ImageFragment}; use crate::geom::{flow_relative, physical}; -use crate::positioned::AbsolutelyPositionedFragment; use crate::ContainingBlock; use net_traits::image::base::Image; use servo_arc::Arc as ServoArc; use std::sync::Arc; -use style::context::SharedStyleContext; use style::properties::ComputedValues; use style::values::computed::Length; -use style::Zero; #[derive(Debug)] pub(crate) struct ReplacedContent { @@ -41,7 +37,6 @@ impl ReplacedContent { pub fn layout<'a>( &'a self, - layout_context: &LayoutContext, style: &ServoArc<ComputedValues>, containing_block: &ContainingBlock, ) -> IndependentLayout { diff --git a/components/layout_thread_2020/lib.rs b/components/layout_thread_2020/lib.rs index d3c50d2103c..77e89950d57 100644 --- a/components/layout_thread_2020/lib.rs +++ b/components/layout_thread_2020/lib.rs @@ -1281,8 +1281,7 @@ impl LayoutThread { self.viewport_size.height.to_f32_px(), )); let mut display_list = DisplayListBuilder::new(self.id.to_webrender(), viewport_size); - let is_contentful = - fragment_tree.build_display_list(&mut display_list, self.id, viewport_size); + let is_contentful = fragment_tree.build_display_list(&mut display_list, viewport_size); debug!("Layout done!"); |