diff options
author | Pyfisch <pyfisch@gmail.com> | 2018-11-06 20:38:02 +0100 |
---|---|---|
committer | Pyfisch <pyfisch@gmail.com> | 2018-11-06 22:35:07 +0100 |
commit | 9e92eb205a2a12fe0be883e42cb7f82deebc9031 (patch) | |
tree | 48c1660b942d5dfffb289dc5d4110604caca54fb /components/layout | |
parent | 4a947dd7195c3ece1e4996a6bdf7c300bf6ec655 (diff) | |
download | servo-9e92eb205a2a12fe0be883e42cb7f82deebc9031.tar.gz servo-9e92eb205a2a12fe0be883e42cb7f82deebc9031.zip |
Reorder imports
Diffstat (limited to 'components/layout')
31 files changed, 145 insertions, 106 deletions
diff --git a/components/layout/animation.rs b/components/layout/animation.rs index 9ce47e16d5a..2a2b49d9715 100644 --- a/components/layout/animation.rs +++ b/components/layout/animation.rs @@ -11,10 +11,10 @@ use crate::opaque_node::OpaqueNodeMethods; use fxhash::FxHashMap; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; -use script_traits::{AnimationState, ConstellationControlMsg, LayoutMsg as ConstellationMsg}; use script_traits::UntrustedNodeAddress; +use script_traits::{AnimationState, ConstellationControlMsg, LayoutMsg as ConstellationMsg}; use servo_channel::Receiver; -use style::animation::{Animation, update_style_for_animation}; +use style::animation::{update_style_for_animation, Animation}; use style::dom::TElement; use style::font_metrics::ServoMetricsProvider; use style::selector_parser::RestyleDamage; diff --git a/components/layout/block.rs b/components/layout/block.rs index 99ca7ada523..9fbd7434ea9 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -27,18 +27,26 @@ use app_units::{Au, MAX_AU}; use crate::context::LayoutContext; +use crate::display_list::items::DisplayListSection; +use crate::display_list::StackingContextCollectionState; use crate::display_list::{BlockFlowDisplayListBuilding, BorderPaintingMode}; use crate::display_list::{DisplayListBuildState, StackingContextCollectionFlags}; -use crate::display_list::StackingContextCollectionState; -use crate::display_list::items::DisplayListSection; use crate::floats::{ClearType, FloatKind, Floats, PlacementInfo}; -use crate::flow::{BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ForceNonfloatedFlag, GetBaseFlow}; -use crate::flow::{ImmutableFlowUtils, LateAbsolutePositionInfo, OpaqueFlow, FragmentationContext, FlowFlags}; +use crate::flow::{ + BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ForceNonfloatedFlag, GetBaseFlow, +}; +use crate::flow::{ + FlowFlags, FragmentationContext, ImmutableFlowUtils, LateAbsolutePositionInfo, OpaqueFlow, +}; use crate::flow_list::FlowList; -use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow, FragmentFlags}; +use crate::fragment::{ + CoordinateSystem, Fragment, FragmentBorderBoxIterator, FragmentFlags, Overflow, +}; use crate::incremental::RelayoutMode; use crate::layout_debug; -use crate::model::{AdjoiningMargins, CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto}; +use crate::model::{ + AdjoiningMargins, CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto, +}; use crate::sequential; use crate::traversal::PreorderFlowTraversal; use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; @@ -58,8 +66,8 @@ use style::context::SharedStyleContext; use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect, LogicalSize, WritingMode}; use style::properties::ComputedValues; use style::servo::restyle_damage::ServoRestyleDamage; -use style::values::computed::{LengthOrPercentageOrNone, LengthOrPercentage}; use style::values::computed::LengthOrPercentageOrAuto; +use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrNone}; /// Information specific to floated blocks. #[derive(Clone, Serialize)] diff --git a/components/layout/construct.rs b/components/layout/construct.rs index bfa6e878943..ee0e0ee451a 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -11,21 +11,28 @@ //! maybe it's an absolute or fixed position thing that hasn't found its containing block yet. //! Construction items bubble up the tree from children to parents until they find their homes. -use crate::ServoArc; use crate::block::BlockFlow; -use crate::context::{LayoutContext, with_thread_local_font_context}; -use crate::data::{LayoutDataFlags, LayoutData}; +use crate::context::{with_thread_local_font_context, LayoutContext}; +use crate::data::{LayoutData, LayoutDataFlags}; use crate::display_list::items::OpaqueNode; use crate::flex::FlexFlow; use crate::floats::FloatKind; use crate::flow::{AbsoluteDescendants, Flow, FlowClass, GetBaseFlow, ImmutableFlowUtils}; use crate::flow::{FlowFlags, MutableFlowUtils, MutableOwnedFlowUtils}; use crate::flow_ref::FlowRef; -use crate::fragment::{CanvasFragmentInfo, Fragment, FragmentFlags, GeneratedContentInfo, IframeFragmentInfo}; -use crate::fragment::{ImageFragmentInfo, InlineAbsoluteFragmentInfo, InlineAbsoluteHypotheticalFragmentInfo}; -use crate::fragment::{InlineBlockFragmentInfo, MediaFragmentInfo, SpecificFragmentInfo, SvgFragmentInfo}; -use crate::fragment::{TableColumnFragmentInfo, UnscannedTextFragmentInfo, WhitespaceStrippingResult}; -use crate::inline::{InlineFlow, InlineFragmentNodeInfo, InlineFragmentNodeFlags}; +use crate::fragment::{ + CanvasFragmentInfo, Fragment, FragmentFlags, GeneratedContentInfo, IframeFragmentInfo, +}; +use crate::fragment::{ + ImageFragmentInfo, InlineAbsoluteFragmentInfo, InlineAbsoluteHypotheticalFragmentInfo, +}; +use crate::fragment::{ + InlineBlockFragmentInfo, MediaFragmentInfo, SpecificFragmentInfo, SvgFragmentInfo, +}; +use crate::fragment::{ + TableColumnFragmentInfo, UnscannedTextFragmentInfo, WhitespaceStrippingResult, +}; +use crate::inline::{InlineFlow, InlineFragmentNodeFlags, InlineFragmentNodeInfo}; use crate::linked_list::prepend_from; use crate::list_item::{ListItemFlow, ListStyleTypeContent}; use crate::multicol::{MulticolColumnFlow, MulticolFlow}; @@ -40,15 +47,18 @@ use crate::table_wrapper::TableWrapperFlow; use crate::text::TextRunScanner; use crate::traversal::PostorderNodeMutTraversal; use crate::wrapper::{LayoutNodeLayoutData, TextContent, ThreadSafeLayoutNodeHelpers}; -use script_layout_interface::{LayoutElementType, LayoutNodeType, is_image_data}; -use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode}; +use crate::ServoArc; +use script_layout_interface::wrapper_traits::{ + PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode, +}; +use script_layout_interface::{is_image_data, LayoutElementType, LayoutNodeType}; use servo_config::opts; use servo_url::ServoUrl; use std::collections::LinkedList; use std::marker::PhantomData; use std::mem; -use std::sync::Arc; use std::sync::atomic::Ordering; +use std::sync::Arc; use style::computed_values::caption_side::T as CaptionSide; use style::computed_values::display::T as Display; use style::computed_values::empty_cells::T as EmptyCells; diff --git a/components/layout/context.rs b/components/layout/context.rs index 134a3cedec1..1ab4637cd8a 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -4,7 +4,7 @@ //! Data needed by the layout thread. -use crate::display_list::items::{WebRenderImageInfo, OpaqueNode}; +use crate::display_list::items::{OpaqueNode, WebRenderImageInfo}; use crate::opaque_node::OpaqueNodeMethods; use fnv::FnvHasher; use gfx::font_cache_thread::FontCacheThread; diff --git a/components/layout/display_list/background.rs b/components/layout/display_list/background.rs index 23e519f1c1d..a8d0cebde12 100644 --- a/components/layout/display_list/background.rs +++ b/components/layout/display_list/background.rs @@ -13,8 +13,8 @@ use style::computed_values::background_clip::single_value::T as BackgroundClip; use style::computed_values::background_origin::single_value::T as BackgroundOrigin; use style::properties::style_structs::Background; use style::values::computed::{BackgroundSize, LengthOrPercentageOrAuto}; -use style::values::generics::NonNegative; use style::values::generics::background::BackgroundSize as GenericBackgroundSize; +use style::values::generics::NonNegative; use style::values::specified::background::BackgroundRepeatKeyword; use webrender_api::BorderRadius; diff --git a/components/layout/display_list/border.rs b/components/layout/display_list/border.rs index f32f5a84399..a70fc2bb452 100644 --- a/components/layout/display_list/border.rs +++ b/components/layout/display_list/border.rs @@ -9,14 +9,14 @@ use crate::display_list::ToLayout; use euclid::{Rect, SideOffsets2D, Size2D}; use style::computed_values::border_image_outset::T as BorderImageOutset; use style::properties::style_structs::Border; -use style::values::Either; +use style::values::computed::NumberOrPercentage; use style::values::computed::{BorderCornerRadius, BorderImageWidth}; use style::values::computed::{BorderImageSideWidth, LengthOrNumber}; -use style::values::computed::NumberOrPercentage; -use style::values::generics::border::{BorderImageSideWidth as GenericBorderImageSideWidth}; +use style::values::generics::border::BorderImageSideWidth as GenericBorderImageSideWidth; use style::values::generics::rect::Rect as StyleRect; +use style::values::Either; use webrender_api::{BorderRadius, BorderSide, BorderStyle, ColorF}; -use webrender_api::{LayoutSize, LayoutSideOffsets, NormalBorder}; +use webrender_api::{LayoutSideOffsets, LayoutSize, NormalBorder}; /// Computes a border radius size against the containing size. /// diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs index 2d99900eac2..a57f9292bb1 100644 --- a/components/layout/display_list/builder.rs +++ b/components/layout/display_list/builder.rs @@ -12,31 +12,31 @@ use app_units::{Au, AU_PER_PX}; use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg}; use crate::block::BlockFlow; use crate::context::LayoutContext; -use crate::display_list::ToLayout; use crate::display_list::background::{self, get_cyclic}; use crate::display_list::border; use crate::display_list::gradient; -use crate::display_list::items::{BaseDisplayItem, BLUR_INFLATION_FACTOR, ClipScrollNode}; +use crate::display_list::items::{BaseDisplayItem, ClipScrollNode, BLUR_INFLATION_FACTOR}; use crate::display_list::items::{ClipScrollNodeIndex, ClipScrollNodeType, ClippingAndScrolling}; use crate::display_list::items::{ClippingRegion, DisplayItem, DisplayItemMetadata, DisplayList}; -use crate::display_list::items::{DisplayListSection, CommonDisplayItem}; +use crate::display_list::items::{CommonDisplayItem, DisplayListSection}; use crate::display_list::items::{IframeDisplayItem, OpaqueNode}; use crate::display_list::items::{PopAllTextShadowsDisplayItem, PushTextShadowDisplayItem}; use crate::display_list::items::{StackingContext, StackingContextType, StickyFrameData}; use crate::display_list::items::{TextOrientation, WebRenderImageInfo}; +use crate::display_list::ToLayout; use crate::flex::FlexFlow; use crate::flow::{BaseFlow, Flow, FlowFlags}; use crate::flow_ref::FlowRef; -use crate::fragment::{CanvasFragmentSource, CoordinateSystem, Fragment, ScannedTextFragmentInfo}; use crate::fragment::SpecificFragmentInfo; +use crate::fragment::{CanvasFragmentSource, CoordinateSystem, Fragment, ScannedTextFragmentInfo}; use crate::inline::{InlineFlow, InlineFragmentNodeFlags}; use crate::list_item::ListItemFlow; use crate::model::MaybeAuto; use crate::table_cell::CollapsedBordersForCell; use euclid::{rect, Point2D, Rect, SideOffsets2D, Size2D, TypedSize2D, Vector2D}; use fnv::FnvHashMap; -use gfx::text::TextRun; use gfx::text::glyph::ByteIndex; +use gfx::text::TextRun; use gfx_traits::{combine_id_with_fragment_type, FragmentType, StackingContextId}; use ipc_channel::ipc; use msg::constellation_msg::{BrowsingContextId, PipelineId}; @@ -56,20 +56,20 @@ use style::computed_values::visibility::T as Visibility; use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect}; use style::properties::{style_structs, ComputedValues}; use style::servo::restyle_damage::ServoRestyleDamage; -use style::values::{Either, RGBA}; -use style::values::computed::Gradient; use style::values::computed::effects::SimpleShadow; use style::values::computed::image::Image as ComputedImage; +use style::values::computed::Gradient; use style::values::generics::background::BackgroundSize; use style::values::generics::image::{GradientKind, Image, PaintWorklet}; use style::values::generics::ui::Cursor; +use style::values::{Either, RGBA}; +use style_traits::cursor::CursorKind; use style_traits::CSSPixel; use style_traits::ToCss; -use style_traits::cursor::CursorKind; use webrender_api::{self, BorderDetails, BorderRadius, BorderSide, BoxShadowClipMode, ColorF}; use webrender_api::{ExternalScrollId, FilterOp, GlyphInstance, ImageRendering, LayoutRect}; use webrender_api::{LayoutSize, LayoutTransform, LayoutVector2D, LineStyle, NinePatchBorder}; -use webrender_api::{NinePatchBorderSource, NormalBorder, StickyOffsetBounds, ScrollSensitivity}; +use webrender_api::{NinePatchBorderSource, NormalBorder, ScrollSensitivity, StickyOffsetBounds}; fn establishes_containing_block_for_absolute( flags: StackingContextCollectionFlags, diff --git a/components/layout/display_list/conversions.rs b/components/layout/display_list/conversions.rs index a40dadb0eb9..39c67253915 100644 --- a/components/layout/display_list/conversions.rs +++ b/components/layout/display_list/conversions.rs @@ -7,10 +7,10 @@ use euclid::{Point2D, Rect, SideOffsets2D, Size2D, Vector2D}; use style::computed_values::image_rendering::T as ImageRendering; use style::computed_values::mix_blend_mode::T as MixBlendMode; use style::computed_values::transform_style::T as TransformStyle; -use style::values::RGBA; use style::values::computed::{BorderStyle, Filter}; use style::values::generics::effects::Filter as GenericFilter; use style::values::specified::border::BorderImageRepeatKeyword; +use style::values::RGBA; use webrender_api as wr; pub trait ToLayout { diff --git a/components/layout/display_list/gradient.rs b/components/layout/display_list/gradient.rs index 70f53cce024..5ce61f84615 100644 --- a/components/layout/display_list/gradient.rs +++ b/components/layout/display_list/gradient.rs @@ -8,11 +8,11 @@ use app_units::Au; use crate::display_list::ToLayout; use euclid::{Point2D, Size2D, Vector2D}; use style::properties::ComputedValues; -use style::values::computed::{Angle, GradientItem, LengthOrPercentage, Percentage, Position}; use style::values::computed::image::{EndingShape, LineDirection}; -use style::values::generics::image::{Circle, Ellipse, ShapeExtent}; +use style::values::computed::{Angle, GradientItem, LengthOrPercentage, Percentage, Position}; use style::values::generics::image::EndingShape as GenericEndingShape; use style::values::generics::image::GradientItem as GenericGradientItem; +use style::values::generics::image::{Circle, Ellipse, ShapeExtent}; use style::values::specified::position::{X, Y}; use webrender_api::{ExtendMode, Gradient, GradientBuilder, GradientStop, RadialGradient}; diff --git a/components/layout/display_list/items.rs b/components/layout/display_list/items.rs index 0a85e0a290a..f07099c5b07 100644 --- a/components/layout/display_list/items.rs +++ b/components/layout/display_list/items.rs @@ -13,8 +13,8 @@ //! low-level drawing primitives. use euclid::{SideOffsets2D, TypedRect, Vector2D}; -use gfx_traits::{self, StackingContextId}; use gfx_traits::print_tree::PrintTree; +use gfx_traits::{self, StackingContextId}; use msg::constellation_msg::PipelineId; use net_traits::image::base::Image; use servo_geometry::MaxRect; diff --git a/components/layout/flex.rs b/components/layout/flex.rs index d8f0f167198..42cf2c454fe 100644 --- a/components/layout/flex.rs +++ b/components/layout/flex.rs @@ -7,10 +7,10 @@ use app_units::{Au, MAX_AU}; use crate::block::{AbsoluteAssignBSizesTraversal, BlockFlow, MarginsMayCollapseFlag}; use crate::context::LayoutContext; -use crate::display_list::{DisplayListBuildState, FlexFlowDisplayListBuilding}; use crate::display_list::StackingContextCollectionState; +use crate::display_list::{DisplayListBuildState, FlexFlowDisplayListBuilding}; use crate::floats::FloatKind; -use crate::flow::{Flow, FlowClass, GetBaseFlow, ImmutableFlowUtils, OpaqueFlow, FlowFlags}; +use crate::flow::{Flow, FlowClass, FlowFlags, GetBaseFlow, ImmutableFlowUtils, OpaqueFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; use crate::layout_debug; use crate::model::{AdjoiningMargins, CollapsibleMargins}; @@ -27,8 +27,10 @@ use style::computed_values::justify_content::T as JustifyContent; use style::logical_geometry::{Direction, LogicalSize}; use style::properties::ComputedValues; use style::servo::restyle_damage::ServoRestyleDamage; -use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; use style::values::computed::flex::FlexBasis; +use style::values::computed::{ + LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone, +}; use style::values::generics::flex::FlexBasis as GenericFlexBasis; /// The size of an axis. May be a specified size, a min/max diff --git a/components/layout/flow.rs b/components/layout/flow.rs index aa6b1b1e79d..fea1c94f89d 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -28,8 +28,8 @@ use app_units::Au; use crate::block::{BlockFlow, FormattingContextType}; use crate::context::LayoutContext; -use crate::display_list::{DisplayListBuildState, StackingContextCollectionState}; use crate::display_list::items::ClippingAndScrolling; +use crate::display_list::{DisplayListBuildState, StackingContextCollectionState}; use crate::flex::FlexFlow; use crate::floats::{Floats, SpeculatedFloatPlacement}; use crate::flow_list::{FlowList, FlowListIterator, MutFlowListIterator}; @@ -46,16 +46,16 @@ use crate::table_colgroup::TableColGroupFlow; use crate::table_row::TableRowFlow; use crate::table_rowgroup::TableRowGroupFlow; use crate::table_wrapper::TableWrapperFlow; -use euclid::{Point2D, Vector2D, Rect, Size2D}; -use gfx_traits::StackingContextId; +use euclid::{Point2D, Rect, Size2D, Vector2D}; use gfx_traits::print_tree::PrintTree; +use gfx_traits::StackingContextId; 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::Arc; use std::sync::atomic::Ordering; +use std::sync::Arc; use style::computed_values::clear::T as Clear; use style::computed_values::float::T as Float; use style::computed_values::overflow_x::T as StyleOverflow; diff --git a/components/layout/flow_list.rs b/components/layout/flow_list.rs index ca6fffe627b..c24734a5a7d 100644 --- a/components/layout/flow_list.rs +++ b/components/layout/flow_list.rs @@ -5,8 +5,8 @@ use crate::flow::{Flow, FlowClass}; use crate::flow_ref::FlowRef; use serde::ser::{Serialize, SerializeSeq, Serializer}; -use serde_json::{Map, Value, to_value}; -use std::collections::{LinkedList, linked_list}; +use serde_json::{to_value, Map, Value}; +use std::collections::{linked_list, LinkedList}; use std::ops::Deref; use std::sync::Arc; diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index cb781484e63..37a23807e82 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -5,24 +5,24 @@ //! The `Fragment` type, which represents the leaves of the layout tree. use app_units::Au; -use canvas_traits::canvas::{CanvasMsg, CanvasId}; -use crate::ServoArc; -use crate::context::{LayoutContext, with_thread_local_font_context}; +use canvas_traits::canvas::{CanvasId, CanvasMsg}; +use crate::context::{with_thread_local_font_context, LayoutContext}; +use crate::display_list::items::{ClipScrollNodeIndex, OpaqueNode, BLUR_INFLATION_FACTOR}; use crate::display_list::ToLayout; -use crate::display_list::items::{BLUR_INFLATION_FACTOR, ClipScrollNodeIndex, OpaqueNode}; use crate::floats::ClearType; use crate::flow::{GetBaseFlow, ImmutableFlowUtils}; use crate::flow_ref::FlowRef; -use crate::inline::{InlineFragmentNodeFlags, InlineFragmentContext, InlineFragmentNodeInfo}; +use crate::inline::{InlineFragmentContext, InlineFragmentNodeFlags, InlineFragmentNodeInfo}; use crate::inline::{InlineMetrics, LineMetrics}; #[cfg(debug_assertions)] use crate::layout_debug; -use crate::model::{self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, SizeConstraint}; use crate::model::style_length; +use crate::model::{self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, SizeConstraint}; use crate::text; use crate::text::TextRunScanner; use crate::wrapper::ThreadSafeLayoutNodeHelpers; -use euclid::{Point2D, Vector2D, Rect, Size2D}; +use crate::ServoArc; +use euclid::{Point2D, Rect, Size2D, Vector2D}; use gfx; use gfx::text::glyph::ByteIndex; use gfx::text::text_run::{TextRun, TextRunSlice}; @@ -32,15 +32,17 @@ use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image::base::{Image, ImageMetadata}; use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder}; use range::*; +use script_layout_interface::wrapper_traits::{ + PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode, +}; use script_layout_interface::{HTMLCanvasData, HTMLCanvasDataSource, HTMLMediaData, SVGSVGData}; -use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode}; use serde::ser::{Serialize, SerializeStruct, Serializer}; use servo_url::ServoUrl; -use std::{f32, fmt}; use std::borrow::ToOwned; -use std::cmp::{Ordering, max, min}; +use std::cmp::{max, min, Ordering}; use std::collections::LinkedList; use std::sync::{Arc, Mutex}; +use std::{f32, fmt}; use style::computed_values::border_collapse::T as BorderCollapse; use style::computed_values::box_sizing::T as BoxSizing; use style::computed_values::clear::T as Clear; @@ -59,8 +61,8 @@ use style::properties::ComputedValues; use style::selector_parser::RestyleDamage; use style::servo::restyle_damage::ServoRestyleDamage; use style::str::char_is_whitespace; -use style::values::computed::{Length, LengthOrPercentage, LengthOrPercentageOrAuto}; use style::values::computed::counters::ContentItem; +use style::values::computed::{Length, LengthOrPercentage, LengthOrPercentageOrAuto}; use style::values::generics::box_::{Perspective, VerticalAlign}; use style::values::generics::transform; use webrender_api::{self, LayoutTransform}; diff --git a/components/layout/generated_content.rs b/components/layout/generated_content.rs index f7a2836e036..024d51b22fb 100644 --- a/components/layout/generated_content.rs +++ b/components/layout/generated_content.rs @@ -8,10 +8,12 @@ //! done in parallel and is therefore a sequential pass that runs on as little of the flow tree //! as possible. -use crate::context::{LayoutContext, with_thread_local_font_context}; +use crate::context::{with_thread_local_font_context, LayoutContext}; use crate::display_list::items::OpaqueNode; use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils}; -use crate::fragment::{Fragment, GeneratedContentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo}; +use crate::fragment::{ + Fragment, GeneratedContentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo, +}; use crate::text::TextRunScanner; use crate::traversal::InorderFlowTraversal; use script_layout_interface::wrapper_traits::PseudoElementType; diff --git a/components/layout/incremental.rs b/components/layout/incremental.rs index b0b4ec51437..6734620e5a0 100644 --- a/components/layout/incremental.rs +++ b/components/layout/incremental.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::flow::{FlowFlags, Flow, GetBaseFlow}; +use crate::flow::{Flow, FlowFlags, GetBaseFlow}; use style::computed_values::float::T as Float; use style::selector_parser::RestyleDamage; use style::servo::restyle_damage::ServoRestyleDamage; diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 7f52c817dd1..08a371bac08 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -3,32 +3,32 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use app_units::{Au, MIN_AU}; -use crate::ServoArc; use crate::block::AbsoluteAssignBSizesTraversal; use crate::context::{LayoutContext, LayoutFontContext}; -use crate::display_list::{DisplayListBuildState, InlineFlowDisplayListBuilding}; -use crate::display_list::StackingContextCollectionState; use crate::display_list::items::OpaqueNode; +use crate::display_list::StackingContextCollectionState; +use crate::display_list::{DisplayListBuildState, InlineFlowDisplayListBuilding}; use crate::floats::{FloatKind, Floats, PlacementInfo}; use crate::flow::{BaseFlow, Flow, FlowClass, ForceNonfloatedFlag}; -use crate::flow::{FlowFlags, EarlyAbsolutePositionInfo, GetBaseFlow, OpaqueFlow}; +use crate::flow::{EarlyAbsolutePositionInfo, FlowFlags, GetBaseFlow, OpaqueFlow}; use crate::flow_ref::FlowRef; -use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow}; use crate::fragment::FragmentFlags; use crate::fragment::SpecificFragmentInfo; +use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow}; use crate::layout_debug; use crate::model::IntrinsicISizesContribution; use crate::text; use crate::traversal::PreorderFlowTraversal; +use crate::ServoArc; use euclid::{Point2D, Size2D}; use gfx::font::FontMetrics; use gfx_traits::print_tree::PrintTree; use range::{Range, RangeIndex}; use script_layout_interface::wrapper_traits::PseudoElementType; -use std::{fmt, i32, isize, mem}; use std::cmp::max; use std::collections::VecDeque; use std::sync::Arc; +use std::{fmt, i32, isize, mem}; use style::computed_values::display::T as Display; use style::computed_values::overflow_x::T as StyleOverflow; use style::computed_values::position::T as Position; diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs index 88bae7be23c..dec9d49def5 100644 --- a/components/layout/layout_debug.rs +++ b/components/layout/layout_debug.rs @@ -13,7 +13,7 @@ use std::cell::RefCell; use std::fs::File; use std::io::Write; #[cfg(debug_assertions)] -use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering}; +use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; thread_local!(static STATE_KEY: RefCell<Option<State>> = RefCell::new(None)); diff --git a/components/layout/lib.rs b/components/layout/lib.rs index 725ad09061f..b91ee22eba8 100644 --- a/components/layout/lib.rs +++ b/components/layout/lib.rs @@ -87,9 +87,9 @@ pub mod traversal; pub mod wrapper; // For unit tests: +pub use self::data::LayoutData; pub use crate::fragment::Fragment; pub use crate::fragment::SpecificFragmentInfo; -pub use self::data::LayoutData; // We can't use servo_arc for everything in layout, because the Flow stuff uses // weak references. diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs index 08473cb89ef..cef1487f2f0 100644 --- a/components/layout/list_item.rs +++ b/components/layout/list_item.rs @@ -7,13 +7,15 @@ use app_units::Au; use crate::block::BlockFlow; -use crate::context::{LayoutContext, with_thread_local_font_context}; -use crate::display_list::{DisplayListBuildState, ListItemFlowDisplayListBuilding}; +use crate::context::{with_thread_local_font_context, LayoutContext}; use crate::display_list::StackingContextCollectionState; +use crate::display_list::{DisplayListBuildState, ListItemFlowDisplayListBuilding}; use crate::floats::FloatKind; use crate::flow::{Flow, FlowClass, OpaqueFlow}; -use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, GeneratedContentInfo}; use crate::fragment::Overflow; +use crate::fragment::{ + CoordinateSystem, Fragment, FragmentBorderBoxIterator, GeneratedContentInfo, +}; use crate::generated_content; use crate::inline::InlineFlow; use euclid::Point2D; diff --git a/components/layout/model.rs b/components/layout/model.rs index 0c10159f480..3fba3e27fba 100644 --- a/components/layout/model.rs +++ b/components/layout/model.rs @@ -11,8 +11,8 @@ use std::cmp::{max, min}; use std::fmt; use style::logical_geometry::{LogicalMargin, WritingMode}; use style::properties::ComputedValues; -use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentage}; use style::values::computed::LengthOrPercentageOrNone; +use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto}; /// A collapsible margin. See CSS 2.1 § 8.3.1. #[derive(Clone, Copy, Debug)] diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index 79f25482d9e..71d9befac61 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -5,23 +5,23 @@ //! CSS Multi-column layout http://dev.w3.org/csswg/css-multicol/ use app_units::Au; -use crate::ServoArc; use crate::block::BlockFlow; use crate::context::LayoutContext; use crate::display_list::{DisplayListBuildState, StackingContextCollectionState}; use crate::floats::FloatKind; -use crate::flow::{Flow, FlowClass, OpaqueFlow, FragmentationContext, GetBaseFlow}; +use crate::flow::{Flow, FlowClass, FragmentationContext, GetBaseFlow, OpaqueFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; +use crate::ServoArc; use euclid::{Point2D, Vector2D}; use gfx_traits::print_tree::PrintTree; -use std::cmp::{min, max}; +use std::cmp::{max, min}; use std::fmt; use std::sync::Arc; use style::logical_geometry::LogicalSize; use style::properties::ComputedValues; -use style::values::Either; use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; use style::values::generics::column::ColumnCount; +use style::values::Either; #[allow(unsafe_code)] unsafe impl crate::flow::HasBaseFlow for MulticolFlow {} diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs index 1587e957007..f510851ce92 100644 --- a/components/layout/parallel.rs +++ b/components/layout/parallel.rs @@ -14,7 +14,7 @@ use crate::flow::{Flow, GetBaseFlow}; use crate::flow_ref::FlowRef; use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes}; use crate::traversal::{PostorderFlowTraversal, PreorderFlowTraversal}; -use profile_traits::time::{self, TimerMetadata, profile}; +use profile_traits::time::{self, profile, TimerMetadata}; use rayon; use servo_config::opts; use smallvec::SmallVec; diff --git a/components/layout/query.rs b/components/layout/query.rs index 95623c7a98b..7a6a85824ed 100644 --- a/components/layout/query.rs +++ b/components/layout/query.rs @@ -7,27 +7,29 @@ use app_units::Au; use crate::construct::ConstructionResult; use crate::context::LayoutContext; -use crate::display_list::IndexableText; use crate::display_list::items::{DisplayList, OpaqueNode, ScrollOffsetMap}; +use crate::display_list::IndexableText; use crate::flow::{Flow, GetBaseFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; use crate::inline::InlineFragmentNodeFlags; use crate::opaque_node::OpaqueNodeMethods; use crate::sequential; use crate::wrapper::LayoutNodeLayoutData; -use euclid::{Point2D, Vector2D, Rect, Size2D}; +use euclid::{Point2D, Rect, Size2D, Vector2D}; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; -use script_layout_interface::{LayoutElementType, LayoutNodeType}; -use script_layout_interface::StyleData; +use script_layout_interface::rpc::TextIndexResponse; use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse, LayoutRPC}; use script_layout_interface::rpc::{NodeGeometryResponse, NodeScrollIdResponse}; use script_layout_interface::rpc::{OffsetParentResponse, ResolvedStyleResponse, StyleResponse}; -use script_layout_interface::rpc::TextIndexResponse; -use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode}; +use script_layout_interface::wrapper_traits::{ + LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode, +}; +use script_layout_interface::StyleData; +use script_layout_interface::{LayoutElementType, LayoutNodeType}; use script_traits::LayoutMsg as ConstellationMsg; use script_traits::UntrustedNodeAddress; -use std::cmp::{min, max}; +use std::cmp::{max, min}; use std::ops::Deref; use std::sync::{Arc, Mutex}; use style::computed_values::display::T as Display; @@ -35,8 +37,8 @@ use style::computed_values::position::T as Position; use style::computed_values::visibility::T as Visibility; use style::context::{StyleContext, ThreadLocalStyleContext}; use style::dom::TElement; -use style::logical_geometry::{WritingMode, BlockFlowDirection, InlineBaseDirection}; -use style::properties::{style_structs, PropertyId, PropertyDeclarationId, LonghandId}; +use style::logical_geometry::{BlockFlowDirection, InlineBaseDirection, WritingMode}; +use style::properties::{style_structs, LonghandId, PropertyDeclarationId, PropertyId}; use style::selector_parser::PseudoElement; use style_traits::ToCss; use webrender_api::ExternalScrollId; diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs index b35bba206b2..3203dee5e49 100644 --- a/components/layout/sequential.rs +++ b/components/layout/sequential.rs @@ -8,8 +8,8 @@ use app_units::Au; use crate::context::LayoutContext; use crate::display_list::{DisplayListBuildState, StackingContextCollectionState}; use crate::floats::SpeculatedFloatPlacement; -use crate::flow::{Flow, ImmutableFlowUtils, FlowFlags, GetBaseFlow}; -use crate::fragment::{FragmentBorderBoxIterator, CoordinateSystem}; +use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils}; +use crate::fragment::{CoordinateSystem, FragmentBorderBoxIterator}; use crate::generated_content::ResolveGeneratedContent; use crate::incremental::RelayoutMode; use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList}; diff --git a/components/layout/table.rs b/components/layout/table.rs index f167f74911e..4f28b22e6f6 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -9,8 +9,13 @@ use crate::block::{BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer}; use crate::block::{ISizeConstraintInput, ISizeConstraintSolution}; use crate::context::LayoutContext; use crate::display_list::{BlockFlowDisplayListBuilding, BorderPaintingMode}; -use crate::display_list::{DisplayListBuildState, StackingContextCollectionFlags, StackingContextCollectionState}; -use crate::flow::{BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ImmutableFlowUtils, GetBaseFlow, OpaqueFlow}; +use crate::display_list::{ + DisplayListBuildState, StackingContextCollectionFlags, StackingContextCollectionState, +}; +use crate::flow::{ + BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, GetBaseFlow, ImmutableFlowUtils, + OpaqueFlow, +}; use crate::flow_list::{FlowListIterator, MutFlowListIterator}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; use crate::layout_debug; @@ -25,11 +30,11 @@ use std::{cmp, fmt}; use style::computed_values::{border_collapse, border_spacing, table_layout}; use style::context::SharedStyleContext; use style::logical_geometry::LogicalSize; -use style::properties::ComputedValues; use style::properties::style_structs::Background; +use style::properties::ComputedValues; use style::servo::restyle_damage::ServoRestyleDamage; -use style::values::CSSFloat; use style::values::computed::LengthOrPercentageOrAuto; +use style::values::CSSFloat; #[allow(unsafe_code)] unsafe impl crate::flow::HasBaseFlow for TableFlow {} diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 15d660098bf..5b50b48448e 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -9,7 +9,9 @@ use crate::block::{BlockFlow, ISizeAndMarginsComputer}; use crate::context::LayoutContext; use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState}; use crate::display_list::{StackingContextCollectionFlags, StackingContextCollectionState}; -use crate::flow::{EarlyAbsolutePositionInfo, Flow, FlowClass, ImmutableFlowUtils, GetBaseFlow, OpaqueFlow}; +use crate::flow::{ + EarlyAbsolutePositionInfo, Flow, FlowClass, GetBaseFlow, ImmutableFlowUtils, OpaqueFlow, +}; use crate::flow_list::MutFlowListIterator; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; use crate::layout_debug; diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index cb4a033298c..ad6bee3b4e3 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -12,13 +12,17 @@ //! Hereafter this document is referred to as INTRINSIC. use app_units::Au; -use crate::block::{AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer, ISizeConstraintInput}; +use crate::block::{ + AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer, ISizeConstraintInput, +}; use crate::block::{ISizeConstraintSolution, MarginsMayCollapseFlag}; use crate::context::LayoutContext; -use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState, StackingContextCollectionFlags}; use crate::display_list::StackingContextCollectionState; +use crate::display_list::{ + BlockFlowDisplayListBuilding, DisplayListBuildState, StackingContextCollectionFlags, +}; use crate::floats::FloatKind; -use crate::flow::{Flow, FlowClass, ImmutableFlowUtils, FlowFlags, OpaqueFlow}; +use crate::flow::{Flow, FlowClass, FlowFlags, ImmutableFlowUtils, OpaqueFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; use crate::model::MaybeAuto; use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize}; @@ -31,8 +35,8 @@ use style::computed_values::{position, table_layout}; use style::context::SharedStyleContext; use style::logical_geometry::{LogicalRect, LogicalSize}; use style::properties::ComputedValues; -use style::values::CSSFloat; use style::values::computed::LengthOrPercentageOrAuto; +use style::values::CSSFloat; #[derive(Clone, Copy, Debug, Serialize)] pub enum TableLayout { diff --git a/components/layout/text.rs b/components/layout/text.rs index 358a386d887..6ba30eb2cc0 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -10,7 +10,7 @@ use crate::fragment::{Fragment, ScannedTextFlags}; use crate::fragment::{ScannedTextFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo}; use crate::inline::{InlineFragmentNodeFlags, InlineFragments}; use crate::linked_list::split_off_head; -use gfx::font::{FontRef, FontMetrics, RunMetrics, ShapingFlags, ShapingOptions}; +use gfx::font::{FontMetrics, FontRef, RunMetrics, ShapingFlags, ShapingOptions}; use gfx::text::glyph::ByteIndex; use gfx::text::text_run::TextRun; use gfx::text::util::{self, CompressionMode}; @@ -26,11 +26,11 @@ use style::computed_values::text_transform::T as TextTransform; use style::computed_values::white_space::T as WhiteSpace; use style::computed_values::word_break::T as WordBreak; use style::logical_geometry::{LogicalSize, WritingMode}; -use style::properties::ComputedValues; use style::properties::style_structs::Font as FontStyleStruct; +use style::properties::ComputedValues; use style::values::generics::text::LineHeight; use unicode_bidi as bidi; -use unicode_script::{Script, get_script}; +use unicode_script::{get_script, Script}; use xi_unicode::LineBreakLeafIter; /// Returns the concatenated text of a list of unscanned text fragments. diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index c18eeae5112..51888069cac 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -7,9 +7,9 @@ use crate::construct::FlowConstructor; use crate::context::LayoutContext; use crate::display_list::DisplayListBuildState; -use crate::flow::{FlowFlags, Flow, GetBaseFlow, ImmutableFlowUtils}; -use crate::wrapper::{GetRawData, LayoutNodeLayoutData}; +use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils}; use crate::wrapper::ThreadSafeLayoutNodeHelpers; +use crate::wrapper::{GetRawData, LayoutNodeLayoutData}; use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode}; use servo_config::opts; use style::context::{SharedStyleContext, StyleContext}; @@ -17,8 +17,8 @@ use style::data::ElementData; use style::dom::{NodeInfo, TElement, TNode}; use style::selector_parser::RestyleDamage; use style::servo::restyle_damage::ServoRestyleDamage; -use style::traversal::{DomTraversal, recalc_style_at}; use style::traversal::PerLevelTraversalData; +use style::traversal::{recalc_style_at, DomTraversal}; pub struct RecalcStyleAndConstructFlows<'a> { context: LayoutContext<'a>, diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 42369c04761..82ffd6be718 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -32,8 +32,8 @@ use atomic_refcell::{AtomicRef, AtomicRefMut}; use crate::data::{LayoutData, LayoutDataFlags, StyleAndLayoutData}; -use script_layout_interface::wrapper_traits::{ThreadSafeLayoutElement, ThreadSafeLayoutNode}; use script_layout_interface::wrapper_traits::GetLayoutData; +use script_layout_interface::wrapper_traits::{ThreadSafeLayoutElement, ThreadSafeLayoutNode}; use style::dom::{NodeInfo, TNode}; use style::selector_parser::RestyleDamage; use style::values::computed::counters::ContentItem; |