diff options
author | Simon Wülker <simon.wuelker@arcor.de> | 2025-03-03 12:26:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-03 11:26:53 +0000 |
commit | 3d320fa96ae2ca95a720c454c47ee7827864c5af (patch) | |
tree | 1b7718d574cb9164d924b7571760d90d6d2099c4 /components/layout | |
parent | 6300e820b4e3fbfcec260048f931528d4998d5e4 (diff) | |
download | servo-3d320fa96ae2ca95a720c454c47ee7827864c5af.tar.gz servo-3d320fa96ae2ca95a720c454c47ee7827864c5af.zip |
Update rustfmt to the 2024 style edition (#35764)
* Use 2024 style edition
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Reformat all code
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Diffstat (limited to 'components/layout')
-rw-r--r-- | components/layout/block.rs | 9 | ||||
-rw-r--r-- | components/layout/construct.rs | 6 | ||||
-rw-r--r-- | components/layout/display_list/border.rs | 2 | ||||
-rw-r--r-- | components/layout/display_list/builder.rs | 10 | ||||
-rw-r--r-- | components/layout/display_list/webrender_helpers.rs | 2 | ||||
-rw-r--r-- | components/layout/flex.rs | 9 | ||||
-rw-r--r-- | components/layout/flow.rs | 6 | ||||
-rw-r--r-- | components/layout/flow_list.rs | 4 | ||||
-rw-r--r-- | components/layout/fragment.rs | 10 | ||||
-rw-r--r-- | components/layout/inline.rs | 4 | ||||
-rw-r--r-- | components/layout/multicol.rs | 2 | ||||
-rw-r--r-- | components/layout/query.rs | 6 | ||||
-rw-r--r-- | components/layout/table.rs | 2 | ||||
-rw-r--r-- | components/layout/table_wrapper.rs | 2 | ||||
-rw-r--r-- | components/layout/text.rs | 6 | ||||
-rw-r--r-- | components/layout/traversal.rs | 4 |
16 files changed, 39 insertions, 45 deletions
diff --git a/components/layout/block.rs b/components/layout/block.rs index df1f9b8085d..e14aaf9a2c8 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -793,10 +793,11 @@ impl BlockFlow { viewport_size: &Size2D<Au>, descendant: OpaqueFlow, ) -> LogicalSize<Au> { - debug_assert!(self - .base - .flags - .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)); + debug_assert!( + self.base + .flags + .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) + ); if self.is_fixed() || self.is_root() { // Initial containing block is the CB for the root LogicalSize::from_physical(self.base.writing_mode, *viewport_size) diff --git a/components/layout/construct.rs b/components/layout/construct.rs index c73c534e50d..ce25d23ecc8 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -14,8 +14,8 @@ use std::collections::LinkedList; use std::marker::PhantomData; use std::mem; -use std::sync::atomic::Ordering; use std::sync::Arc; +use std::sync::atomic::Ordering; use html5ever::{local_name, namespace_url, ns}; use log::debug; @@ -24,6 +24,7 @@ use script_layout_interface::wrapper_traits::{ }; use script_layout_interface::{LayoutElementType, LayoutNodeType}; use servo_url::ServoUrl; +use style::LocalName; 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; @@ -38,7 +39,6 @@ use style::selector_parser::{PseudoElement, RestyleDamage}; use style::servo::restyle_damage::ServoRestyleDamage; use style::values::computed::Image; use style::values::generics::counters::ContentItem; -use style::LocalName; use crate::block::BlockFlow; use crate::context::LayoutContext; @@ -71,7 +71,7 @@ use crate::table_wrapper::TableWrapperFlow; use crate::text::TextRunScanner; use crate::traversal::PostorderNodeMutTraversal; use crate::wrapper::{TextContent, ThreadSafeLayoutNodeHelpers}; -use crate::{parallel, ServoArc}; +use crate::{ServoArc, parallel}; /// The results of flow construction for a DOM node. #[derive(Clone, Default)] diff --git a/components/layout/display_list/border.rs b/components/layout/display_list/border.rs index a77c6516155..0b098717a65 100644 --- a/components/layout/display_list/border.rs +++ b/components/layout/display_list/border.rs @@ -11,8 +11,8 @@ use style::values::computed::{ BorderCornerRadius, BorderImageSideWidth, BorderImageWidth, NonNegativeLengthOrNumber, NumberOrPercentage, }; -use style::values::generics::rect::Rect as StyleRect; use style::values::generics::NonNegative; +use style::values::generics::rect::Rect as StyleRect; use webrender_api::units::{LayoutSideOffsets, LayoutSize}; use webrender_api::{BorderRadius, BorderSide, BorderStyle, ColorF, NormalBorder}; diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs index 9ed59e15f94..314a3c20db5 100644 --- a/components/layout/display_list/builder.rs +++ b/components/layout/display_list/builder.rs @@ -12,13 +12,13 @@ use std::default::Default; use std::sync::Arc; use std::{f32, mem}; -use app_units::{Au, AU_PER_PX}; +use app_units::{AU_PER_PX, Au}; use base::id::PipelineId; use bitflags::bitflags; use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg}; use embedder_traits::Cursor; use euclid::default::{Point2D, Rect, SideOffsets2D as UntypedSideOffsets2D, Size2D}; -use euclid::{rect, Scale, SideOffsets2D}; +use euclid::{Scale, SideOffsets2D, rect}; use fnv::FnvHashMap; use fonts::ByteIndex; use ipc_channel::ipc; @@ -26,7 +26,7 @@ use log::{debug, warn}; use net_traits::image_cache::UsePlaceholder; use range::Range; use script_layout_interface::{ - combine_id_with_fragment_type, FragmentType, IFrameSize, IFrameSizes, + FragmentType, IFrameSize, IFrameSizes, combine_id_with_fragment_type, }; use servo_geometry::{self, MaxRect}; use style::color::AbsoluteColor; @@ -36,7 +36,7 @@ use style::computed_values::pointer_events::T as PointerEvents; use style::computed_values::position::T as StylePosition; use style::computed_values::visibility::T as Visibility; use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect}; -use style::properties::{style_structs, ComputedValues}; +use style::properties::{ComputedValues, style_structs}; use style::servo::restyle_damage::ServoRestyleDamage; use style::values::computed::effects::SimpleShadow; use style::values::computed::image::Image; @@ -64,7 +64,7 @@ use crate::display_list::items::{ PushTextShadowDisplayItem, StackingContext, StackingContextType, StickyFrameData, TextOrientation, WebRenderImageInfo, }; -use crate::display_list::{border, gradient, FilterToLayout, ToLayout}; +use crate::display_list::{FilterToLayout, ToLayout, border, gradient}; use crate::flow::{BaseFlow, Flow, FlowFlags}; use crate::flow_ref::FlowRef; use crate::fragment::{ diff --git a/components/layout/display_list/webrender_helpers.rs b/components/layout/display_list/webrender_helpers.rs index edfb3265329..d18cf1f62c7 100644 --- a/components/layout/display_list/webrender_helpers.rs +++ b/components/layout/display_list/webrender_helpers.rs @@ -7,8 +7,8 @@ // This might be achieved by sharing types between WR and Servo display lists, or // completely converting layout to directly generate WebRender display lists, for example. -use base::id::PipelineId; use base::WebRenderEpochToU16; +use base::id::PipelineId; use log::trace; use webrender_api::units::{LayoutPoint, LayoutSize, LayoutVector2D}; use webrender_api::{ diff --git a/components/layout/flex.rs b/components/layout/flex.rs index 7e422078967..9c7601ee789 100644 --- a/components/layout/flex.rs +++ b/components/layout/flex.rs @@ -847,14 +847,7 @@ impl FlexFlow { } let self_align = { - let self_align = block - .fragment - .style() - .get_position() - .align_self - .0 - .0 - .value(); + let self_align = block.fragment.style().get_position().align_self.0.0.value(); match self_align { AlignFlags::AUTO | AlignFlags::NORMAL => align_items, diff --git a/components/layout/flow.rs b/components/layout/flow.rs index ac167aad890..c3b2df15d43 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -27,17 +27,17 @@ use std::fmt; use std::slice::IterMut; -use std::sync::atomic::Ordering; use std::sync::Arc; +use std::sync::atomic::Ordering; use app_units::Au; use base::print_tree::PrintTree; use bitflags::bitflags; use euclid::default::{Point2D, Rect, Size2D, Vector2D}; use log::debug; -use serde::ser::{SerializeStruct, Serializer}; use serde::Serialize; -use servo_geometry::{au_rect_to_f32_rect, f32_rect_to_au_rect, MaxRect}; +use serde::ser::{SerializeStruct, Serializer}; +use servo_geometry::{MaxRect, au_rect_to_f32_rect, f32_rect_to_au_rect}; use style::computed_values::overflow_x::T as StyleOverflow; use style::computed_values::position::T as Position; use style::computed_values::text_align::T as TextAlign; diff --git a/components/layout/flow_list.rs b/components/layout/flow_list.rs index eceed09028c..ba32830f4a6 100644 --- a/components/layout/flow_list.rs +++ b/components/layout/flow_list.rs @@ -2,12 +2,12 @@ * 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 std::collections::{linked_list, LinkedList}; +use std::collections::{LinkedList, linked_list}; use std::ops::Deref; use std::sync::Arc; use serde::ser::{Serialize, SerializeSeq, Serializer}; -use serde_json::{to_value, Map, Value}; +use serde_json::{Map, Value, to_value}; use crate::flow::{Flow, FlowClass}; use crate::flow_ref::FlowRef; diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index b697c7da395..3d818045203 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -5,7 +5,7 @@ //! The `Fragment` type, which represents the leaves of the layout tree. use std::borrow::ToOwned; -use std::cmp::{max, min, Ordering}; +use std::cmp::{Ordering, max, min}; use std::collections::LinkedList; use std::sync::{Arc, Mutex}; use std::{f32, fmt}; @@ -57,7 +57,7 @@ use webrender_api::units::LayoutTransform; use webrender_api::{self, ImageKey}; use crate::context::LayoutContext; -use crate::display_list::items::{ClipScrollNodeIndex, OpaqueNode, BLUR_INFLATION_FACTOR}; +use crate::display_list::items::{BLUR_INFLATION_FACTOR, ClipScrollNodeIndex, OpaqueNode}; use crate::display_list::{StackingContextId, ToLayout}; use crate::floats::ClearType; use crate::flow::{GetBaseFlow, ImmutableFlowUtils}; @@ -67,12 +67,12 @@ use crate::inline::{ LineMetrics, }; use crate::model::{ - self, style_length, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, SizeConstraint, + self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, SizeConstraint, style_length, }; use crate::text::TextRunScanner; use crate::text_run::{TextRun, TextRunSlice}; use crate::wrapper::ThreadSafeLayoutNodeHelpers; -use crate::{text, ServoArc}; +use crate::{ServoArc, text}; // From gfxFontConstants.h in Firefox. static FONT_SUBSCRIPT_OFFSET_RATIO: f32 = 0.20; @@ -1649,7 +1649,7 @@ impl Fragment { }, SpecificFragmentInfo::TruncatedFragment(_) => { - return IntrinsicISizesContribution::new() + return IntrinsicISizesContribution::new(); }, SpecificFragmentInfo::UnscannedText(..) => { diff --git a/components/layout/inline.rs b/components/layout/inline.rs index e72a0d1524a..87984165f44 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -13,7 +13,7 @@ use bitflags::bitflags; use euclid::default::{Point2D, Rect, Size2D}; use fonts::{FontContext, FontMetrics}; use log::debug; -use range::{int_range_index, Range, RangeIndex}; +use range::{Range, RangeIndex, int_range_index}; use script_layout_interface::wrapper_traits::PseudoElementType; use serde::Serialize; use servo_geometry::MaxRect; @@ -50,7 +50,7 @@ use crate::fragment::{ }; use crate::model::IntrinsicISizesContribution; use crate::traversal::PreorderFlowTraversal; -use crate::{text, ServoArc}; +use crate::{ServoArc, text}; /// `Line`s are represented as offsets into the child list, rather than /// as an object that "owns" fragments. Choosing a different set of line diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index b143c1215ca..3ef3d6c6d80 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -19,13 +19,13 @@ use style::values::computed::length::{ }; use style::values::generics::column::ColumnCount; +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, FragmentationContext, GetBaseFlow, OpaqueFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; -use crate::ServoArc; #[allow(unsafe_code)] unsafe impl crate::flow::HasBaseFlow for MulticolFlow {} diff --git a/components/layout/query.rs b/components/layout/query.rs index b86c156d1db..212e37856f0 100644 --- a/components/layout/query.rs +++ b/components/layout/query.rs @@ -23,8 +23,8 @@ use style::dom::TElement; use style::logical_geometry::{BlockFlowDirection, InlineBaseDirection, WritingMode}; use style::properties::style_structs::{self, Font}; use style::properties::{ - parse_one_declaration_into, ComputedValues, Importance, LonghandId, PropertyDeclarationBlock, - PropertyDeclarationId, PropertyId, ShorthandId, SourcePropertyDeclaration, + ComputedValues, Importance, LonghandId, PropertyDeclarationBlock, PropertyDeclarationId, + PropertyId, ShorthandId, SourcePropertyDeclaration, parse_one_declaration_into, }; use style::selector_parser::PseudoElement; use style::shared_lock::SharedRwLock; @@ -32,8 +32,8 @@ use style::stylesheets::{CssRuleType, Origin, UrlExtraData}; use style_traits::{ParsingMode, ToCss}; use crate::construct::ConstructionResult; -use crate::display_list::items::OpaqueNode; use crate::display_list::IndexableText; +use crate::display_list::items::OpaqueNode; use crate::flow::{Flow, GetBaseFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, FragmentFlags, SpecificFragmentInfo}; use crate::inline::InlineFragmentNodeFlags; diff --git a/components/layout/table.rs b/components/layout/table.rs index 02f8fe9231c..f0f792daaeb 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -16,8 +16,8 @@ use style::context::SharedStyleContext; use style::logical_geometry::LogicalSize; use style::properties::ComputedValues; use style::servo::restyle_damage::ServoRestyleDamage; -use style::values::computed::Size; use style::values::CSSFloat; +use style::values::computed::Size; use crate::block::{ BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer, ISizeConstraintInput, diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index 21313e47c4e..72a30969b63 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -24,8 +24,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::computed::Size; use style::values::CSSFloat; +use style::values::computed::Size; use crate::block::{ AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer, diff --git a/components/layout/text.rs b/components/layout/text.rs index c8bde51f635..8a74a2d14e6 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -11,8 +11,8 @@ use std::sync::Arc; use app_units::Au; use base::text::is_bidi_control; use fonts::{ - self, ByteIndex, FontContext, FontIdentifier, FontMetrics, FontRef, RunMetrics, ShapingFlags, - ShapingOptions, LAST_RESORT_GLYPH_ADVANCE, + self, ByteIndex, FontContext, FontIdentifier, FontMetrics, FontRef, LAST_RESORT_GLYPH_ADVANCE, + RunMetrics, ShapingFlags, ShapingOptions, }; use log::{debug, warn}; use range::Range; @@ -20,8 +20,8 @@ use style::computed_values::text_rendering::T as TextRendering; use style::computed_values::white_space_collapse::T as WhiteSpaceCollapse; use style::computed_values::word_break::T as WordBreak; use style::logical_geometry::{LogicalSize, WritingMode}; -use style::properties::style_structs::Font as FontStyleStruct; use style::properties::ComputedValues; +use style::properties::style_structs::Font as FontStyleStruct; use style::values::generics::font::LineHeight; use style::values::specified::text::{TextTransform, TextTransformCase}; use unicode_bidi as bidi; diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index f045cc9d856..4cc785aa477 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -12,14 +12,14 @@ use style::data::ElementData; use style::dom::{NodeInfo, TElement, TNode}; use style::selector_parser::RestyleDamage; use style::servo::restyle_damage::ServoRestyleDamage; -use style::traversal::{recalc_style_at, DomTraversal, PerLevelTraversalData}; +use style::traversal::{DomTraversal, PerLevelTraversalData, recalc_style_at}; +use crate::LayoutData; use crate::construct::FlowConstructor; use crate::context::LayoutContext; use crate::display_list::DisplayListBuildState; use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils}; use crate::wrapper::ThreadSafeLayoutNodeHelpers; -use crate::LayoutData; pub struct RecalcStyleAndConstructFlows<'a> { context: LayoutContext<'a>, |