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>
This commit is contained in:
Simon Wülker 2025-03-03 12:26:53 +01:00 committed by GitHub
parent 6300e820b4
commit 3d320fa96a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
603 changed files with 1739 additions and 1648 deletions

View file

@ -8,6 +8,7 @@ use std::borrow::Cow;
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use crate::PropagatedBoxTreeData;
use crate::context::LayoutContext;
use crate::dom::{BoxSlot, NodeExt};
use crate::dom_traversal::{Contents, NodeAndStyleInfo, TraversalHandler};
@ -19,7 +20,6 @@ use crate::formatting_contexts::{
};
use crate::layout_box_base::LayoutBoxBase;
use crate::style_ext::DisplayGeneratingBox;
use crate::PropagatedBoxTreeData;
/// A builder used for both flex and grid containers.
pub(crate) struct ModernContainerBuilder<'a, 'dom, Node> {

View file

@ -8,14 +8,14 @@ use style::computed_values::background_attachment::SingleComputedValue as Backgr
use style::computed_values::background_clip::single_value::T as Clip;
use style::computed_values::background_origin::single_value::T as Origin;
use style::properties::ComputedValues;
use style::values::computed::background::BackgroundSize as Size;
use style::values::computed::LengthPercentage;
use style::values::computed::background::BackgroundSize as Size;
use style::values::specified::background::{
BackgroundRepeat as RepeatXY, BackgroundRepeatKeyword as Repeat,
};
use webrender_api::{self as wr, units};
use wr::units::LayoutSize;
use wr::ClipChainId;
use wr::units::LayoutSize;
use crate::replaced::NaturalSizes;

View file

@ -8,11 +8,11 @@ use style::values::computed::length_percentage::NonNegativeLengthPercentage;
use style::values::computed::position::Position;
use style::values::generics::basic_shape::{GenericShapeRadius, ShapeBox, ShapeGeometryBox};
use style::values::generics::position::GenericPositionOrAuto;
use webrender_api::units::{LayoutRect, LayoutSideOffsets, LayoutSize};
use webrender_api::ClipChainId;
use webrender_api::units::{LayoutRect, LayoutSideOffsets, LayoutSize};
use webrender_traits::display_list::ScrollTreeNodeId;
use super::{compute_margin_box_radius, normalize_radii, BuilderForBoxFragment, DisplayList};
use super::{BuilderForBoxFragment, DisplayList, compute_margin_box_radius, normalize_radii};
pub(super) fn build_clip_path_clip_chain_if_necessary(
clip_path: ClipPath,

View file

@ -11,7 +11,7 @@ use style::computed_values::transform_style::T as ComputedTransformStyle;
use style::values::computed::Filter as ComputedFilter;
use style::values::specified::border::BorderImageRepeatKeyword;
use webrender_api::{
units, FilterOp, ImageRendering, LineStyle, MixBlendMode, RepeatMode, Shadow, TransformStyle,
FilterOp, ImageRendering, LineStyle, MixBlendMode, RepeatMode, Shadow, TransformStyle, units,
};
use crate::geom::{PhysicalPoint, PhysicalRect, PhysicalSides, PhysicalSize};

View file

@ -4,6 +4,7 @@
use app_units::Au;
use euclid::Size2D;
use style::Zero;
use style::color::mix::ColorInterpolationMethod;
use style::properties::ComputedValues;
use style::values::computed::image::{EndingShape, Gradient, LineDirection};
@ -11,11 +12,10 @@ use style::values::computed::{Angle, AngleOrPercentage, Color, LengthPercentage,
use style::values::generics::image::{
Circle, ColorStop, Ellipse, GradientFlags, GradientItem, ShapeExtent,
};
use style::Zero;
use webrender_api::units::LayoutPixel;
use webrender_api::{
self as wr, units, ConicGradient as WebRenderConicGradient,
Gradient as WebRenderLinearGradient, RadialGradient as WebRenderRadialGradient,
self as wr, ConicGradient as WebRenderConicGradient, Gradient as WebRenderLinearGradient,
RadialGradient as WebRenderRadialGradient, units,
};
use wr::ColorF;

View file

@ -13,27 +13,27 @@ use fonts::GlyphStore;
use gradient::WebRenderGradient;
use net_traits::image_cache::UsePlaceholder;
use servo_geometry::MaxRect;
use style::Zero;
use style::color::{AbsoluteColor, ColorSpace};
use style::computed_values::border_image_outset::T as BorderImageOutset;
use style::computed_values::text_decoration_style::T as ComputedTextDecorationStyle;
use style::dom::OpaqueNode;
use style::properties::ComputedValues;
use style::properties::longhands::visibility::computed_value::T as Visibility;
use style::properties::style_structs::Border;
use style::properties::ComputedValues;
use style::values::computed::image::Image;
use style::values::computed::{
BorderImageSideWidth, BorderImageWidth, BorderStyle, LengthPercentage,
NonNegativeLengthOrNumber, NumberOrPercentage, OutlineStyle,
};
use style::values::generics::rect::Rect;
use style::values::generics::NonNegative;
use style::values::generics::rect::Rect;
use style::values::specified::text::TextDecorationLine;
use style::values::specified::ui::CursorKind;
use style::Zero;
use webrender_api::units::{DevicePixel, LayoutPixel, LayoutRect, LayoutSize};
use webrender_api::{
self as wr, units, BorderDetails, BoxShadowClipMode, ClipChainId, CommonItemProperties,
ImageRendering, NinePatchBorder, NinePatchBorderSource,
self as wr, BorderDetails, BoxShadowClipMode, ClipChainId, CommonItemProperties,
ImageRendering, NinePatchBorder, NinePatchBorderSource, units,
};
use webrender_traits::display_list::{
AxesScrollSensitivity, CompositorDisplayListInfo, ScrollTreeNodeId,
@ -1074,7 +1074,7 @@ impl<'a> BuilderForBoxFragment<'a> {
}
},
Image::CrossFade(_) | Image::ImageSet(_) | Image::None | Image::PaintWorklet(_) => {
return false
return false;
},
};

View file

@ -8,11 +8,12 @@ use std::mem;
use app_units::Au;
use base::print_tree::PrintTree;
use euclid::default::{Point2D, Rect, Size2D};
use euclid::SideOffsets2D;
use euclid::default::{Point2D, Rect, Size2D};
use log::warn;
use servo_arc::Arc as ServoArc;
use servo_config::opts::DebugOptions;
use style::Zero;
use style::computed_values::float::T as ComputedFloat;
use style::computed_values::mix_blend_mode::T as ComputedMixBlendMode;
use style::computed_values::overflow_x::T as ComputedOverflow;
@ -23,17 +24,16 @@ use style::values::computed::{ClipRectOrAuto, Length};
use style::values::generics::box_::Perspective;
use style::values::generics::transform;
use style::values::specified::box_::DisplayOutside;
use style::Zero;
use webrender_api::units::{LayoutPoint, LayoutRect, LayoutTransform, LayoutVector2D};
use webrender_api::{self as wr, BorderRadius};
use webrender_traits::display_list::{AxesScrollSensitivity, ScrollTreeNodeId, ScrollableNodeInfo};
use wr::units::{LayoutPixel, LayoutSize};
use wr::{ClipChainId, SpatialTreeItemKey, StickyOffsetBounds};
use super::clip_path::build_clip_path_clip_chain_if_necessary;
use super::DisplayList;
use super::clip_path::build_clip_path_clip_chain_if_necessary;
use crate::display_list::conversions::{FilterToWebRender, ToWebRender};
use crate::display_list::{offset_radii, BuilderForBoxFragment, DisplayListBuilder};
use crate::display_list::{BuilderForBoxFragment, DisplayListBuilder, offset_radii};
use crate::fragment_tree::{
BoxFragment, ContainingBlockManager, Fragment, FragmentFlags, FragmentTree,
PositioningFragment, SpecificLayoutInfo,
@ -486,28 +486,31 @@ impl StackingContext {
self.real_stacking_contexts_and_positioned_stacking_containers
.sort_by_key(|a| a.z_index());
debug_assert!(self
.real_stacking_contexts_and_positioned_stacking_containers
.iter()
.all(|c| matches!(
c.context_type,
StackingContextType::RealStackingContext |
StackingContextType::PositionedStackingContainer
)));
debug_assert!(self
.float_stacking_containers
.iter()
.all(
|c| c.context_type == StackingContextType::FloatStackingContainer &&
c.z_index() == 0
));
debug_assert!(self
.atomic_inline_stacking_containers
.iter()
.all(
|c| c.context_type == StackingContextType::AtomicInlineStackingContainer &&
c.z_index() == 0
));
debug_assert!(
self.real_stacking_contexts_and_positioned_stacking_containers
.iter()
.all(|c| matches!(
c.context_type,
StackingContextType::RealStackingContext |
StackingContextType::PositionedStackingContainer
))
);
debug_assert!(
self.float_stacking_containers
.iter()
.all(
|c| c.context_type == StackingContextType::FloatStackingContainer &&
c.z_index() == 0
)
);
debug_assert!(
self.atomic_inline_stacking_containers
.iter()
.all(
|c| c.context_type == StackingContextType::AtomicInlineStackingContainer &&
c.z_index() == 0
)
);
}
fn push_webrender_stacking_context_if_necessary(
@ -1056,9 +1059,10 @@ impl BoxFragment {
// but all fragments that establish reference frames also establish
// containing blocks for absolute and fixed descendants, so those
// properties will be replaced before recursing into children.
assert!(self
.style
.establishes_containing_block_for_all_descendants(self.base.flags));
assert!(
self.style
.establishes_containing_block_for_all_descendants(self.base.flags)
);
let adjusted_containing_block = ContainingBlock::new(
containing_block
.rect

View file

@ -22,8 +22,8 @@ use crate::cell::ArcRefCell;
use crate::context::LayoutContext;
use crate::dom_traversal::WhichPseudoElement;
use crate::flexbox::FlexLevelBox;
use crate::flow::inline::InlineItem;
use crate::flow::BlockLevelBox;
use crate::flow::inline::InlineItem;
use crate::geom::PhysicalSize;
use crate::replaced::{CanvasInfo, CanvasSource};
use crate::taffy::TaffyItemBox;

View file

@ -5,7 +5,7 @@
use std::borrow::Cow;
use std::iter::FusedIterator;
use html5ever::{local_name, LocalName};
use html5ever::{LocalName, local_name};
use log::warn;
use script_layout_interface::wrapper_traits::{ThreadSafeLayoutElement, ThreadSafeLayoutNode};
use script_layout_interface::{LayoutElementType, LayoutNodeType};

View file

@ -11,18 +11,18 @@ use itertools::izip;
use rayon::iter::{
IndexedParallelIterator, IntoParallelRefIterator, ParallelDrainRange, ParallelIterator,
};
use style::Zero;
use style::computed_values::position::T as Position;
use style::logical_geometry::Direction;
use style::properties::ComputedValues;
use style::properties::longhands::align_items::computed_value::T as AlignItems;
use style::properties::longhands::box_sizing::computed_value::T as BoxSizing;
use style::properties::longhands::flex_direction::computed_value::T as FlexDirection;
use style::properties::longhands::flex_wrap::computed_value::T as FlexWrap;
use style::properties::ComputedValues;
use style::values::computed::LengthPercentage;
use style::values::generics::flex::GenericFlexBasis as FlexBasis;
use style::values::generics::length::{GenericLengthPercentageOrAuto, LengthPercentageOrNormal};
use style::values::specified::align::AlignFlags;
use style::Zero;
use super::geom::{FlexAxis, FlexRelativeRect, FlexRelativeSides, FlexRelativeVec2};
use super::{
@ -36,7 +36,7 @@ use crate::formatting_contexts::{
use crate::fragment_tree::{BoxFragment, CollapsedBlockMargins, Fragment, FragmentFlags};
use crate::geom::{AuOrAuto, LogicalRect, LogicalSides, LogicalVec2, Size, Sizes};
use crate::positioned::{
relative_adjustement, AbsolutelyPositionedBox, PositioningContext, PositioningContextLength,
AbsolutelyPositionedBox, PositioningContext, PositioningContextLength, relative_adjustement,
};
use crate::sizing::{
ComputeInlineContentSizes, ContentSizes, InlineContentSizesResult, IntrinsicSizingMode,
@ -2160,7 +2160,7 @@ impl FlexItem<'_> {
cross_end,
main_start,
main_end,
}
};
},
(AuOrAuto::Auto, AuOrAuto::Auto) => 2,
_ => 1,

View file

@ -6,10 +6,10 @@ use app_units::Au;
use geom::{FlexAxis, MainStartCrossStart};
use servo_arc::Arc as ServoArc;
use style::logical_geometry::WritingMode;
use style::properties::ComputedValues;
use style::properties::longhands::align_items::computed_value::T as AlignItems;
use style::properties::longhands::flex_direction::computed_value::T as FlexDirection;
use style::properties::longhands::flex_wrap::computed_value::T as FlexWrap;
use style::properties::ComputedValues;
use style::values::computed::{AlignContent, JustifyContent};
use style::values::specified::align::AlignFlags;

View file

@ -7,15 +7,16 @@ use std::convert::TryFrom;
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use servo_arc::Arc;
use style::properties::longhands::list_style_position::computed_value::T as ListStylePosition;
use style::properties::ComputedValues;
use style::properties::longhands::list_style_position::computed_value::T as ListStylePosition;
use style::selector_parser::PseudoElement;
use style::str::char_is_whitespace;
use super::OutsideMarker;
use super::inline::InlineFormattingContext;
use super::inline::construct::InlineFormattingContextBuilder;
use super::inline::inline_box::InlineBox;
use super::inline::InlineFormattingContext;
use super::OutsideMarker;
use crate::PropagatedBoxTreeData;
use crate::cell::ArcRefCell;
use crate::context::LayoutContext;
use crate::dom::{BoxSlot, LayoutBox, NodeExt};
@ -30,7 +31,6 @@ use crate::layout_box_base::LayoutBoxBase;
use crate::positioned::AbsolutelyPositionedBox;
use crate::style_ext::{ComputedValuesExt, DisplayGeneratingBox, DisplayInside, DisplayOutside};
use crate::table::{AnonymousTableContent, Table};
use crate::PropagatedBoxTreeData;
impl BlockFormattingContext {
pub(crate) fn construct<'dom, Node>(
@ -204,9 +204,11 @@ where
}
pub(crate) fn finish(mut self) -> BlockContainer {
debug_assert!(!self
.inline_formatting_context_builder
.currently_processing_inline_box());
debug_assert!(
!self
.inline_formatting_context_builder
.currently_processing_inline_box()
);
self.finish_anonymous_table_if_needed();

View file

@ -26,7 +26,7 @@ use crate::dom_traversal::{Contents, NodeAndStyleInfo};
use crate::formatting_contexts::IndependentFormattingContext;
use crate::fragment_tree::{BoxFragment, CollapsedMargin};
use crate::geom::{LogicalRect, LogicalVec2, ToLogical};
use crate::positioned::{relative_adjustement, PositioningContext};
use crate::positioned::{PositioningContext, relative_adjustement};
use crate::style_ext::{DisplayInside, PaddingBorderMargin};
use crate::{ContainingBlock, PropagatedBoxTreeData};

View file

@ -13,6 +13,7 @@ use unicode_bidi::Level;
use super::text_run::TextRun;
use super::{InlineBox, InlineBoxIdentifier, InlineBoxes, InlineFormattingContext, InlineItem};
use crate::PropagatedBoxTreeData;
use crate::cell::ArcRefCell;
use crate::context::LayoutContext;
use crate::dom::NodeExt;
@ -21,7 +22,6 @@ use crate::flow::float::FloatBox;
use crate::formatting_contexts::IndependentFormattingContext;
use crate::positioned::AbsolutelyPositionedBox;
use crate::style_ext::ComputedValuesExt;
use crate::PropagatedBoxTreeData;
#[derive(Default)]
pub(crate) struct InlineFormattingContextBuilder {

View file

@ -9,14 +9,14 @@ use fonts::FontMetrics;
use servo_arc::Arc;
use style::properties::ComputedValues;
use super::{inline_container_needs_strut, InlineContainerState, InlineContainerStateFlags};
use super::{InlineContainerState, InlineContainerStateFlags, inline_container_needs_strut};
use crate::ContainingBlock;
use crate::cell::ArcRefCell;
use crate::context::LayoutContext;
use crate::dom::NodeExt;
use crate::dom_traversal::NodeAndStyleInfo;
use crate::fragment_tree::BaseFragmentInfo;
use crate::style_ext::{LayoutStyle, PaddingBorderMargin};
use crate::ContainingBlock;
#[derive(Debug)]
pub(crate) struct InlineBox {

View file

@ -7,6 +7,7 @@ use bitflags::bitflags;
use fonts::{FontMetrics, GlyphStore};
use itertools::Either;
use servo_arc::Arc;
use style::Zero;
use style::computed_values::position::T as Position;
use style::computed_values::white_space_collapse::T as WhiteSpaceCollapse;
use style::properties::ComputedValues;
@ -15,7 +16,6 @@ use style::values::generics::font::LineHeight;
use style::values::specified::align::AlignFlags;
use style::values::specified::box_::DisplayOutside;
use style::values::specified::text::TextDecorationLine;
use style::Zero;
use unicode_bidi::{BidiInfo, Level};
use webrender_api::FontInstanceKey;
@ -27,7 +27,7 @@ use crate::fragment_tree::{
};
use crate::geom::{LogicalRect, LogicalVec2, PhysicalRect, ToLogical};
use crate::positioned::{
relative_adjustement, AbsolutelyPositionedBox, PositioningContext, PositioningContextLength,
AbsolutelyPositionedBox, PositioningContext, PositioningContextLength, relative_adjustement,
};
use crate::{ContainingBlock, ContainingBlockSize};

View file

@ -89,28 +89,28 @@ use line::{
};
use line_breaker::LineBreaker;
use servo_arc::Arc;
use style::Zero;
use style::computed_values::text_wrap_mode::T as TextWrapMode;
use style::computed_values::vertical_align::T as VerticalAlign;
use style::computed_values::white_space_collapse::T as WhiteSpaceCollapse;
use style::context::QuirksMode;
use style::properties::style_structs::InheritedText;
use style::properties::ComputedValues;
use style::properties::style_structs::InheritedText;
use style::values::generics::box_::VerticalAlignKeyword;
use style::values::generics::font::LineHeight;
use style::values::specified::box_::BaselineSource;
use style::values::specified::text::{TextAlignKeyword, TextDecorationLine};
use style::values::specified::{TextAlignLast, TextJustify};
use style::Zero;
use text_run::{
add_or_get_font, get_font_for_first_font_for_style, TextRun, XI_LINE_BREAKING_CLASS_GL,
XI_LINE_BREAKING_CLASS_WJ, XI_LINE_BREAKING_CLASS_ZWJ,
TextRun, XI_LINE_BREAKING_CLASS_GL, XI_LINE_BREAKING_CLASS_WJ, XI_LINE_BREAKING_CLASS_ZWJ,
add_or_get_font, get_font_for_first_font_for_style,
};
use unicode_bidi::{BidiInfo, Level};
use webrender_api::FontInstanceKey;
use xi_unicode::linebreak_property;
use super::float::{Clear, PlacementAmongFloats};
use super::IndependentFormattingContextContents;
use super::float::{Clear, PlacementAmongFloats};
use crate::cell::ArcRefCell;
use crate::context::LayoutContext;
use crate::flow::float::{FloatBox, SequentialLayoutState};

View file

@ -8,7 +8,7 @@ use std::ops::Range;
use app_units::Au;
use base::text::is_bidi_control;
use fonts::{
FontContext, FontRef, GlyphRun, ShapingFlags, ShapingOptions, LAST_RESORT_GLYPH_ADVANCE,
FontContext, FontRef, GlyphRun, LAST_RESORT_GLYPH_ADVANCE, ShapingFlags, ShapingOptions,
};
use fonts_traits::ByteIndex;
use log::warn;

View file

@ -9,6 +9,7 @@ use app_units::{Au, MAX_AU};
use inline::InlineFormattingContext;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
use servo_arc::Arc;
use style::Zero;
use style::computed_values::clear::T as StyleClear;
use style::logical_geometry::Direction;
use style::properties::ComputedValues;
@ -16,7 +17,6 @@ use style::servo::selector_parser::PseudoElement;
use style::values::computed::Size as StyleSize;
use style::values::specified::align::AlignFlags;
use style::values::specified::{Display, TextAlignKeyword};
use style::Zero;
use crate::cell::ArcRefCell;
use crate::context::LayoutContext;
@ -815,10 +815,10 @@ impl BlockLevelBox {
BlockLevelBox::OutOfFlowAbsolutelyPositionedBox(box_) => &box_.borrow().context,
BlockLevelBox::OutOfFlowFloatBox(float_box) => &float_box.contents,
BlockLevelBox::OutsideMarker(outside_marker) => {
return outside_marker.inline_content_sizes(layout_context, constraint_space)
return outside_marker.inline_content_sizes(layout_context, constraint_space);
},
BlockLevelBox::SameFormattingContextBlock { base, contents, .. } => {
return base.inline_content_sizes(layout_context, constraint_space, contents)
return base.inline_content_sizes(layout_context, constraint_space, contents);
},
};
independent_formatting_context.inline_content_sizes(layout_context, constraint_space)

View file

@ -18,7 +18,7 @@ use webrender_traits::display_list::AxesScrollSensitivity;
use crate::cell::ArcRefCell;
use crate::context::LayoutContext;
use crate::dom::{LayoutBox, NodeExt};
use crate::dom_traversal::{iter_child_nodes, Contents, NodeAndStyleInfo, NonReplacedContents};
use crate::dom_traversal::{Contents, NodeAndStyleInfo, NonReplacedContents, iter_child_nodes};
use crate::flexbox::FlexLevelBox;
use crate::flow::float::FloatBox;
use crate::flow::inline::InlineItem;

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use bitflags::bitflags;
use script_layout_interface::{combine_id_with_fragment_type, FragmentType};
use script_layout_interface::{FragmentType, combine_id_with_fragment_type};
use style::dom::OpaqueNode;
use style::selector_parser::PseudoElement;

View file

@ -6,12 +6,12 @@ use app_units::Au;
use atomic_refcell::AtomicRefCell;
use base::print_tree::PrintTree;
use servo_arc::Arc as ServoArc;
use style::Zero;
use style::computed_values::border_collapse::T as BorderCollapse;
use style::computed_values::overflow_x::T as ComputedOverflow;
use style::computed_values::position::T as ComputedPosition;
use style::logical_geometry::WritingMode;
use style::properties::ComputedValues;
use style::Zero;
use super::{BaseFragment, BaseFragmentInfo, CollapsedBlockMargins, Fragment};
use crate::formatting_contexts::Baselines;

View file

@ -9,9 +9,9 @@ use base::id::PipelineId;
use base::print_tree::PrintTree;
use fonts::{FontMetrics, GlyphStore};
use servo_arc::Arc as ServoArc;
use style::Zero;
use style::properties::ComputedValues;
use style::values::specified::text::TextDecorationLine;
use style::Zero;
use webrender_api::{FontInstanceKey, ImageKey};
use super::{

View file

@ -8,17 +8,17 @@ use std::fmt;
use std::ops::{Add, AddAssign, Neg, Sub, SubAssign};
use app_units::{Au, MAX_AU};
use style::Zero;
use style::logical_geometry::{BlockFlowDirection, Direction, InlineBaseDirection, WritingMode};
use style::values::computed::{
CSSPixelLength, LengthPercentage, MaxSize as StyleMaxSize, Percentage, Size as StyleSize,
};
use style::values::generics::length::GenericLengthPercentageOrAuto as AutoOr;
use style::Zero;
use style_traits::CSSPixel;
use crate::ContainingBlock;
use crate::sizing::ContentSizes;
use crate::style_ext::Clamp;
use crate::ContainingBlock;
pub type PhysicalPoint<U> = euclid::Point2D<U, CSSPixel>;
pub type PhysicalSize<U> = euclid::Size2D<U, CSSPixel>;

View file

@ -6,11 +6,11 @@ use atomic_refcell::AtomicRefCell;
use servo_arc::Arc;
use style::properties::ComputedValues;
use crate::ConstraintSpace;
use crate::context::LayoutContext;
use crate::fragment_tree::BaseFragmentInfo;
use crate::geom::SizeConstraint;
use crate::sizing::{ComputeInlineContentSizes, InlineContentSizesResult};
use crate::ConstraintSpace;
/// A box tree node that handles containing information about style and the original DOM
/// node or pseudo-element that it is based on. This also handles caching of layout values

View file

@ -7,11 +7,11 @@ use std::mem;
use app_units::Au;
use rayon::iter::IntoParallelRefMutIterator;
use rayon::prelude::{IndexedParallelIterator, ParallelIterator};
use style::Zero;
use style::computed_values::position::T as Position;
use style::logical_geometry::{Direction, WritingMode};
use style::properties::ComputedValues;
use style::values::specified::align::AlignFlags;
use style::Zero;
use crate::cell::ArcRefCell;
use crate::context::LayoutContext;
@ -488,7 +488,7 @@ impl HoistedAbsolutelyPositionedBox {
end: box_offset.inline_end,
};
let inline_alignment = match inline_box_offsets.either_specified() {
true => style.clone_justify_self().0 .0,
true => style.clone_justify_self().0.0,
false => shared_fragment.resolved_alignment.inline,
};
@ -515,7 +515,7 @@ impl HoistedAbsolutelyPositionedBox {
end: box_offset.block_end,
};
let block_alignment = match block_box_offsets.either_specified() {
true => style.clone_align_self().0 .0,
true => style.clone_align_self().0.0,
false => shared_fragment.resolved_alignment.block,
};
let mut block_axis_solver = AbsoluteAxisSolver {
@ -938,7 +938,7 @@ impl AbsoluteAxisSolver<'_> {
// Therefore the free space is zero and the alignment value is irrelevant.
(Some(start), None) => return start.to_used_value(self.containing_size),
(None, Some(end)) => {
return self.containing_size - size - end.to_used_value(self.containing_size)
return self.containing_size - size - end.to_used_value(self.containing_size);
},
};

View file

@ -24,8 +24,8 @@ use style::context::{QuirksMode, SharedStyleContext, StyleContext, ThreadLocalSt
use style::dom::{OpaqueNode, TElement};
use style::properties::style_structs::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;
@ -34,8 +34,8 @@ use style::stylist::RuleInclusion;
use style::traversal::resolve_style;
use style::values::computed::Float;
use style::values::generics::font::LineHeight;
use style::values::specified::box_::DisplayInside;
use style::values::specified::GenericGridTemplateComponent;
use style::values::specified::box_::DisplayInside;
use style_traits::{ParsingMode, ToCss};
use crate::flow::inline::construct::{TextTransformation, WhitespaceCollapse};
@ -200,13 +200,13 @@ pub fn process_resolved_style_request<'dom>(
match longhand_id {
LonghandId::Top => return Some(resolved_insets().top.to_css_string()),
LonghandId::Right => {
return Some(resolved_insets().right.to_css_string())
return Some(resolved_insets().right.to_css_string());
},
LonghandId::Bottom => {
return Some(resolved_insets().bottom.to_css_string())
return Some(resolved_insets().bottom.to_css_string());
},
LonghandId::Left => {
return Some(resolved_insets().left.to_css_string())
return Some(resolved_insets().left.to_css_string());
},
_ => {},
}

View file

@ -16,13 +16,13 @@ use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder};
use pixels::Image;
use script_layout_interface::IFrameSize;
use servo_arc::Arc as ServoArc;
use style::Zero;
use style::computed_values::object_fit::T as ObjectFit;
use style::logical_geometry::{Direction, WritingMode};
use style::properties::ComputedValues;
use style::servo::url::ComputedUrl;
use style::values::computed::image::Image as ComputedImage;
use style::values::CSSFloat;
use style::Zero;
use style::values::computed::image::Image as ComputedImage;
use url::Url;
use webrender_api::ImageKey;

View file

@ -8,8 +8,8 @@ use std::cell::LazyCell;
use std::ops::{Add, AddAssign};
use app_units::Au;
use style::values::computed::LengthPercentage;
use style::Zero;
use style::values::computed::LengthPercentage;
use crate::context::LayoutContext;
use crate::geom::Size;

View file

@ -3,6 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use app_units::Au;
use style::Zero;
use style::color::AbsoluteColor;
use style::computed_values::direction::T as Direction;
use style::computed_values::isolation::T as ComputedIsolation;
@ -11,21 +12,20 @@ use style::computed_values::position::T as ComputedPosition;
use style::computed_values::transform_style::T as ComputedTransformStyle;
use style::computed_values::unicode_bidi::T as UnicodeBidi;
use style::logical_geometry::{Direction as AxisDirection, WritingMode};
use style::properties::ComputedValues;
use style::properties::longhands::backface_visibility::computed_value::T as BackfaceVisiblity;
use style::properties::longhands::box_sizing::computed_value::T as BoxSizing;
use style::properties::longhands::column_span::computed_value::T as ColumnSpan;
use style::properties::style_structs::Border;
use style::properties::ComputedValues;
use style::servo::selector_parser::PseudoElement;
use style::values::CSSFloat;
use style::values::computed::basic_shape::ClipPath;
use style::values::computed::image::Image as ComputedImageLayer;
use style::values::computed::{AlignItems, BorderStyle, Color, Inset, LengthPercentage, Margin};
use style::values::generics::box_::Perspective;
use style::values::generics::position::{GenericAspectRatio, PreferredRatio};
use style::values::specified::align::AlignFlags;
use style::values::specified::{box_ as stylo, Overflow};
use style::values::CSSFloat;
use style::Zero;
use style::values::specified::{Overflow, box_ as stylo};
use webrender_api as wr;
use crate::dom_traversal::Contents;
@ -802,7 +802,7 @@ impl ComputedValuesExt for ComputedValues {
resolved_auto_value: AlignItems,
resolved_normal_value: AlignItems,
) -> AlignItems {
match self.clone_align_self().0 .0 {
match self.clone_align_self().0.0 {
AlignFlags::AUTO => resolved_auto_value,
AlignFlags::NORMAL => resolved_normal_value,
value => AlignItems(value),
@ -1033,7 +1033,7 @@ impl From<stylo::Display> for Display {
// This should not be a value of DisplayInside, but oh well
// special-case display: contents because we still want it to work despite the early return
stylo::DisplayOutside::None if inside == stylo::DisplayInside::Contents => {
return Display::Contents
return Display::Contents;
},
stylo::DisplayOutside::None => return Display::None,
};

View file

@ -9,8 +9,8 @@ use std::iter::repeat;
use log::warn;
use script_layout_interface::wrapper_traits::ThreadSafeLayoutNode;
use servo_arc::Arc;
use style::properties::style_structs::Font;
use style::properties::ComputedValues;
use style::properties::style_structs::Font;
use style::selector_parser::PseudoElement;
use style::str::char_is_whitespace;
@ -18,6 +18,7 @@ use super::{
Table, TableCaption, TableSlot, TableSlotCell, TableSlotCoordinates, TableSlotOffset,
TableTrack, TableTrackGroup, TableTrackGroupType,
};
use crate::PropagatedBoxTreeData;
use crate::cell::ArcRefCell;
use crate::context::LayoutContext;
use crate::dom::{BoxSlot, NodeExt};
@ -30,7 +31,6 @@ use crate::formatting_contexts::{
use crate::fragment_tree::BaseFragmentInfo;
use crate::layout_box_base::LayoutBoxBase;
use crate::style_ext::{DisplayGeneratingBox, DisplayLayoutInternal};
use crate::PropagatedBoxTreeData;
/// A reference to a slot and its coordinates in the table
#[derive(Clone, Copy, Debug)]
@ -187,7 +187,9 @@ impl TableSlot {
pub fn push_spanned(&mut self, new_offset: TableSlotOffset) {
match *self {
TableSlot::Cell { .. } => {
panic!("Should never have a table model error with an originating cell slot overlapping a spanned slot")
panic!(
"Should never have a table model error with an originating cell slot overlapping a spanned slot"
)
},
TableSlot::Spanned(ref mut vec) => vec.insert(0, new_offset),
TableSlot::Empty => {

View file

@ -10,6 +10,7 @@ use app_units::Au;
use log::warn;
use rayon::iter::{IndexedParallelIterator, IntoParallelRefIterator, ParallelIterator};
use servo_arc::Arc;
use style::Zero;
use style::computed_values::border_collapse::T as BorderCollapse;
use style::computed_values::box_sizing::T as BoxSizing;
use style::computed_values::caption_side::T as CaptionSide;
@ -22,7 +23,6 @@ use style::values::computed::{
BorderStyle, LengthPercentage as ComputedLengthPercentage, Percentage,
};
use style::values::generics::box_::{GenericVerticalAlign as VerticalAlign, VerticalAlignKeyword};
use style::Zero;
use super::{
ArcRefCell, CollapsedBorder, CollapsedBorderLine, SpecificTableGridInfo, Table, TableCaption,
@ -38,7 +38,7 @@ use crate::geom::{
LogicalRect, LogicalSides, LogicalVec2, PhysicalPoint, PhysicalRect, PhysicalSides,
PhysicalVec, Size, SizeConstraint, ToLogical, ToLogicalWithContainingBlock,
};
use crate::positioned::{relative_adjustement, PositioningContext, PositioningContextLength};
use crate::positioned::{PositioningContext, PositioningContextLength, relative_adjustement};
use crate::sizing::{ComputeInlineContentSizes, ContentSizes, InlineContentSizesResult};
use crate::style_ext::{
BorderStyleColor, Clamp, ComputedValuesExt, LayoutStyle, PaddingBorderMargin,

View file

@ -75,8 +75,8 @@ pub(crate) use construct::AnonymousTableContent;
pub use construct::TableBuilder;
use euclid::{Point2D, Size2D, UnknownUnit, Vector2D};
use servo_arc::Arc;
use style::properties::style_structs::Font;
use style::properties::ComputedValues;
use style::properties::style_structs::Font;
use style_traits::dom::OpaqueNode;
use super::flow::BlockFormattingContext;

View file

@ -4,10 +4,10 @@
use app_units::Au;
use atomic_refcell::{AtomicRef, AtomicRefCell};
use style::Zero;
use style::properties::ComputedValues;
use style::values::specified::align::AlignFlags;
use style::values::specified::box_::DisplayInside;
use style::Zero;
use taffy::style_helpers::{TaffyMaxContent, TaffyMinContent};
use taffy::{AvailableSpace, MaybeMath, RequestedAxis, RunMode};
@ -619,11 +619,11 @@ impl TaffyContainer {
)),
LogicalVec2 {
inline: resolve_alignment(
child.style.clone_align_self().0 .0,
child.style.clone_align_self().0.0,
align_items.0,
),
block: resolve_alignment(
child.style.clone_justify_self().0 .0,
child.style.clone_justify_self().0.0,
justify_items.computed.0,
),
},

View file

@ -10,6 +10,7 @@ use servo_arc::Arc;
use style::properties::ComputedValues;
use stylo_taffy::TaffyStyloStyle;
use crate::PropagatedBoxTreeData;
use crate::cell::ArcRefCell;
use crate::construct_modern::{ModernContainerBuilder, ModernItemKind};
use crate::context::LayoutContext;
@ -18,7 +19,6 @@ use crate::dom_traversal::{NodeAndStyleInfo, NonReplacedContents};
use crate::formatting_contexts::IndependentFormattingContext;
use crate::fragment_tree::Fragment;
use crate::positioned::{AbsolutelyPositionedBox, PositioningContext};
use crate::PropagatedBoxTreeData;
#[derive(Debug)]
pub(crate) struct TaffyContainer {

View file

@ -8,11 +8,11 @@ mod stylo {
pub(crate) use style::properties::longhands::aspect_ratio::computed_value::T as AspectRatio;
pub(crate) use style::properties::longhands::position::computed_value::T as Position;
pub(crate) use style::values::computed::{LengthPercentage, Percentage};
pub(crate) use style::values::generics::NonNegative;
pub(crate) use style::values::generics::length::{
GenericLengthPercentageOrNormal, GenericMargin, GenericMaxSize, GenericSize,
};
pub(crate) use style::values::generics::position::{Inset as GenericInset, PreferredRatio};
pub(crate) use style::values::generics::NonNegative;
pub(crate) use style::values::specified::align::{AlignFlags, ContentDistribution};
pub(crate) use style::values::specified::box_::{
Display, DisplayInside, DisplayOutside, Overflow,
@ -157,7 +157,7 @@ pub fn overflow(input: stylo::Overflow) -> taffy::Overflow {
pub fn aspect_ratio(input: stylo::AspectRatio) -> Option<f32> {
match input.ratio {
stylo::PreferredRatio::None => None,
stylo::PreferredRatio::Ratio(val) => Some(val.0 .0 / val.1 .0),
stylo::PreferredRatio::Ratio(val) => Some(val.0.0 / val.1.0),
}
}

View file

@ -216,11 +216,11 @@ impl<T: Deref<Target = ComputedValues>> taffy::GridItemStyle for TaffyStyloStyle
#[inline]
fn align_self(&self) -> Option<taffy::AlignSelf> {
convert::item_alignment(self.0.get_position().align_self.0 .0)
convert::item_alignment(self.0.get_position().align_self.0.0)
}
#[inline]
fn justify_self(&self) -> Option<taffy::AlignSelf> {
convert::item_alignment(self.0.get_position().justify_self.0 .0)
convert::item_alignment(self.0.get_position().justify_self.0.0)
}
}

View file

@ -6,7 +6,7 @@ use script_layout_interface::wrapper_traits::LayoutNode;
use style::context::{SharedStyleContext, StyleContext};
use style::data::ElementData;
use style::dom::{NodeInfo, TElement, TNode};
use style::traversal::{recalc_style_at, DomTraversal, PerLevelTraversalData};
use style::traversal::{DomTraversal, PerLevelTraversalData, recalc_style_at};
use crate::context::LayoutContext;
use crate::dom::DOMLayoutData;