diff --git a/components/layout/block.rs b/components/layout/block.rs index 24413a31f4e..4b0999489ee 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -2548,8 +2548,16 @@ impl Flow for BlockFlow { .base .flags .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) && - self.fragment.style().logical_position().inline_start.is_auto() && - self.fragment.style().logical_position().inline_end.is_auto() + self.fragment + .style() + .logical_position() + .inline_start + .is_auto() && + self.fragment + .style() + .logical_position() + .inline_end + .is_auto() { self.base.position.start.i = inline_position } @@ -2560,7 +2568,11 @@ impl Flow for BlockFlow { .base .flags .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) && - self.fragment.style().logical_position().block_start.is_auto() && + self.fragment + .style() + .logical_position() + .block_start + .is_auto() && self.fragment.style().logical_position().block_end.is_auto() { self.base.position.start.b = block_position @@ -2848,11 +2860,8 @@ pub trait ISizeAndMarginsComputer { parent_flow_inline_size: Au, shared_context: &SharedStyleContext, ) -> MaybeAuto { - let inline_size = self.containing_block_inline_size( - block, - parent_flow_inline_size, - shared_context, - ); + let inline_size = + self.containing_block_inline_size(block, parent_flow_inline_size, shared_context); MaybeAuto::from_option( block diff --git a/components/layout/display_list/gradient.rs b/components/layout/display_list/gradient.rs index 454cd0be6db..e683bbb963c 100644 --- a/components/layout/display_list/gradient.rs +++ b/components/layout/display_list/gradient.rs @@ -91,7 +91,10 @@ fn convert_gradient_stops( color, position: None, }), - GradientItem::ComplexColorStop { color, ref position } => Some(ColorStop { + GradientItem::ComplexColorStop { + color, + ref position, + } => Some(ColorStop { color, position: Some(position.clone()), }), @@ -125,7 +128,13 @@ fn convert_gradient_stops( // // FIXME(emilio): Once we know the offsets, it seems like converting the // positions to absolute at once then process that would be cheaper. - let mut last_stop_position = stop_items.first().unwrap().position.as_ref().unwrap().clone(); + let mut last_stop_position = stop_items + .first() + .unwrap() + .position + .as_ref() + .unwrap() + .clone(); for stop in stop_items.iter_mut().skip(1) { if let Some(ref pos) = stop.position { if position_to_offset(&last_stop_position, total_length) > @@ -147,8 +156,10 @@ fn convert_gradient_stops( // Initialize a new stop run. // `unwrap()` here should never fail because this is the beginning of // a stop run, which is always bounded by a length or percentage. - let start_offset = - position_to_offset(stop_items[i - 1].position.as_ref().unwrap(), total_length); + let start_offset = position_to_offset( + stop_items[i - 1].position.as_ref().unwrap(), + total_length, + ); // `unwrap()` here should never fail because this is the end of // a stop run, which is always bounded by a length or percentage. let (end_index, end_stop) = stop_items[(i + 1)..] @@ -156,7 +167,8 @@ fn convert_gradient_stops( .enumerate() .find(|&(_, ref stop)| stop.position.is_some()) .unwrap(); - let end_offset = position_to_offset(end_stop.position.as_ref().unwrap(), total_length); + let end_offset = + position_to_offset(end_stop.position.as_ref().unwrap(), total_length); stop_run = Some(StopRun { start_offset, end_offset, diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 9ddfb274757..c2d01b7f9f9 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -1113,12 +1113,11 @@ impl BaseFlow { self.flags.set( FlowFlags::INLINE_POSITION_IS_STATIC, logical_position.inline_start.is_auto() && - logical_position.inline_end.is_auto() + logical_position.inline_end.is_auto(), ); self.flags.set( FlowFlags::BLOCK_POSITION_IS_STATIC, - logical_position.block_start.is_auto() && - logical_position.block_end.is_auto() + logical_position.block_start.is_auto() && logical_position.block_end.is_auto(), ); } } diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 3eadf0a0ac8..c0240f72071 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -2527,10 +2527,20 @@ impl Fragment { { continue; } - if !inline_context_node.style.logical_margin().inline_end.is_definitely_zero() { + if !inline_context_node + .style + .logical_margin() + .inline_end + .is_definitely_zero() + { return false; } - if !inline_context_node.style.logical_padding().inline_end.is_definitely_zero() { + if !inline_context_node + .style + .logical_padding() + .inline_end + .is_definitely_zero() + { return false; } if inline_context_node.style.logical_border_width().inline_end != Au(0) { @@ -2549,10 +2559,20 @@ impl Fragment { { continue; } - if !inline_context_node.style.logical_margin().inline_start.is_definitely_zero() { + if !inline_context_node + .style + .logical_margin() + .inline_start + .is_definitely_zero() + { return false; } - if !inline_context_node.style.logical_padding().inline_start.is_definitely_zero() { + if !inline_context_node + .style + .logical_padding() + .inline_start + .is_definitely_zero() + { return false; } if inline_context_node diff --git a/components/layout_2020/geom.rs b/components/layout_2020/geom.rs index 16df6a9c0a7..86e6faf45a7 100644 --- a/components/layout_2020/geom.rs +++ b/components/layout_2020/geom.rs @@ -177,11 +177,15 @@ impl flow_relative::Vec2> { flow_relative::Vec2 { inline: match self.inline { MaxSize::None => None, - MaxSize::LengthPercentage(ref lp) => Some(lp.percentage_relative_to(containing_block.inline_size)), + MaxSize::LengthPercentage(ref lp) => { + Some(lp.percentage_relative_to(containing_block.inline_size)) + }, }, block: match self.block { MaxSize::None => None, - MaxSize::LengthPercentage(ref lp) => lp.maybe_percentage_relative_to(containing_block.block_size.non_auto()), + MaxSize::LengthPercentage(ref lp) => { + lp.maybe_percentage_relative_to(containing_block.block_size.non_auto()) + }, }, } } diff --git a/components/layout_2020/style_ext.rs b/components/layout_2020/style_ext.rs index b232381add2..2d5af4da38e 100644 --- a/components/layout_2020/style_ext.rs +++ b/components/layout_2020/style_ext.rs @@ -180,7 +180,9 @@ impl From for Display { fn size_to_length(size: Size) -> LengthPercentageOrAuto { match size { - Size::LengthPercentage(length) => LengthPercentageOrAuto::LengthPercentage(length.0.clone()), + Size::LengthPercentage(length) => { + LengthPercentageOrAuto::LengthPercentage(length.0.clone()) + }, Size::Auto => LengthPercentageOrAuto::Auto, } } diff --git a/components/selectors/builder.rs b/components/selectors/builder.rs index 57551771174..7a58e35d17f 100644 --- a/components/selectors/builder.rs +++ b/components/selectors/builder.rs @@ -324,7 +324,7 @@ where Component::LastOfType | Component::OnlyOfType => { specificity.class_like_selectors += 1; - } + }, Component::NonTSPseudoClass(ref pseudo) => { if !pseudo.has_zero_specificity() { specificity.class_like_selectors += 1; diff --git a/components/style/dom.rs b/components/style/dom.rs index adba4ff30db..74067e225c8 100644 --- a/components/style/dom.rs +++ b/components/style/dom.rs @@ -867,14 +867,14 @@ pub trait TElement: break; } inner_shadow = shadow; - } + }, None => { // TODO(emilio): Should probably distinguish with // MatchesDocumentRules::{No,Yes,IfPart} or // something so that we could skip some work. doc_rules_apply = true; break; - } + }, } } } diff --git a/components/style/font_metrics.rs b/components/style/font_metrics.rs index 5ceb2b0f4cc..b521fdf76c9 100644 --- a/components/style/font_metrics.rs +++ b/components/style/font_metrics.rs @@ -7,8 +7,8 @@ #![deny(missing_docs)] use crate::context::SharedStyleContext; -use crate::Atom; use crate::values::computed::Length; +use crate::Atom; /// Represents the font metrics that style needs from a font to compute the /// value of certain CSS units like `ex`. diff --git a/components/style/gecko/media_queries.rs b/components/style/gecko/media_queries.rs index 390c1d4fe58..3f82b832bce 100644 --- a/components/style/gecko/media_queries.rs +++ b/components/style/gecko/media_queries.rs @@ -138,7 +138,8 @@ impl Device { /// Set the font size of the root element (for rem) pub fn set_root_font_size(&self, size: Au) { - self.root_font_size.store(size.0 as isize, Ordering::Relaxed) + self.root_font_size + .store(size.0 as isize, Ordering::Relaxed) } /// Sets the body text color for the "inherit color from body" quirk. diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 8bf5135d96f..e4b2d7f0be1 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -1000,7 +1000,8 @@ impl structs::FontSizePrefs { GenericFontFamily::MozEmoji => unreachable!( "Should never get here, since this doesn't (yet) appear on font family" ), - }).into() + }) + .into() } } @@ -2131,7 +2132,9 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { true }, NonTSPseudoClass::MozNativeAnonymous | - NonTSPseudoClass::MozNativeAnonymousNoSpecificity => self.is_in_native_anonymous_subtree(), + NonTSPseudoClass::MozNativeAnonymousNoSpecificity => { + self.is_in_native_anonymous_subtree() + }, NonTSPseudoClass::MozUseShadowTreeRoot => self.is_root_of_use_element_shadow_tree(), NonTSPseudoClass::MozTableBorderNonzero => unsafe { bindings::Gecko_IsTableBorderNonzero(self.0) diff --git a/components/style/invalidation/element/invalidation_map.rs b/components/style/invalidation/element/invalidation_map.rs index 2256a7220f1..6d9f6a8602d 100644 --- a/components/style/invalidation/element/invalidation_map.rs +++ b/components/style/invalidation/element/invalidation_map.rs @@ -396,9 +396,11 @@ impl<'a> SelectorVisitor for CompoundSelectorDependencyCollector<'a> { if may_match_in_no_namespace { if *local_name_lower == local_name!("id") { - self.flags.insert(InvalidationMapFlags::HAS_ID_ATTR_SELECTOR) + self.flags + .insert(InvalidationMapFlags::HAS_ID_ATTR_SELECTOR) } else if *local_name_lower == local_name!("class") { - self.flags.insert(InvalidationMapFlags::HAS_CLASS_ATTR_SELECTOR) + self.flags + .insert(InvalidationMapFlags::HAS_CLASS_ATTR_SELECTOR) } } diff --git a/components/style/invalidation/element/state_and_attributes.rs b/components/style/invalidation/element/state_and_attributes.rs index 024599219bc..628f174a3d7 100644 --- a/components/style/invalidation/element/state_and_attributes.rs +++ b/components/style/invalidation/element/state_and_attributes.rs @@ -204,7 +204,10 @@ where } if log_enabled!(::log::Level::Debug) { - debug!("Collecting changes for: {:?}, flags {:?}", element, attr_selector_flags); + debug!( + "Collecting changes for: {:?}, flags {:?}", + element, attr_selector_flags + ); if !state_changes.is_empty() { debug!(" > state: {:?}", state_changes); } @@ -362,8 +365,8 @@ where } } - let should_examine_attribute_selector_map = self.snapshot.other_attr_changed() || - map.flags.intersects(self.attr_selector_flags); + let should_examine_attribute_selector_map = + self.snapshot.other_attr_changed() || map.flags.intersects(self.attr_selector_flags); if should_examine_attribute_selector_map { self.collect_dependencies_in_map(&map.other_attribute_affecting_selectors) diff --git a/components/style/logical_geometry.rs b/components/style/logical_geometry.rs index fc3d5c95d12..d4d058adc61 100644 --- a/components/style/logical_geometry.rs +++ b/components/style/logical_geometry.rs @@ -916,7 +916,6 @@ impl LogicalMargin { } } - impl LogicalMargin { #[inline] pub fn new_all_same(mode: WritingMode, value: T) -> LogicalMargin { diff --git a/components/style/rule_collector.rs b/components/style/rule_collector.rs index 6469d65f616..9841eb9e70f 100644 --- a/components/style/rule_collector.rs +++ b/components/style/rule_collector.rs @@ -348,7 +348,6 @@ where return; } - let inner_shadow_host = inner_shadow.host(); let outer_shadow = inner_shadow_host.containing_shadow(); let part_rules = match outer_shadow { diff --git a/components/style/rule_tree/mod.rs b/components/style/rule_tree/mod.rs index 0925e0f1c5b..19e3accb851 100644 --- a/components/style/rule_tree/mod.rs +++ b/components/style/rule_tree/mod.rs @@ -592,8 +592,8 @@ impl RuleTree { last = node; } - let rule = - self.insert_ordered_rules_from(last.parent().unwrap().clone(), children.drain(..).rev()); + let rule = self + .insert_ordered_rules_from(last.parent().unwrap().clone(), children.drain(..).rev()); rule } diff --git a/components/style/servo/media_queries.rs b/components/style/servo/media_queries.rs index be842dc0f9a..4cdfc80eef7 100644 --- a/components/style/servo/media_queries.rs +++ b/components/style/servo/media_queries.rs @@ -11,8 +11,8 @@ use crate::media_queries::media_feature_expression::RangeOrOperator; use crate::media_queries::MediaType; use crate::properties::ComputedValues; use crate::values::computed::CSSPixelLength; -use crate::values::KeyframesName; use crate::values::specified::font::FONT_MEDIUM_PX; +use crate::values::KeyframesName; use app_units::Au; use cssparser::RGBA; use euclid::default::Size2D as UntypedSize2D; diff --git a/components/style/stylesheets/mod.rs b/components/style/stylesheets/mod.rs index 054708dbbb0..c9697ead615 100644 --- a/components/style/stylesheets/mod.rs +++ b/components/style/stylesheets/mod.rs @@ -59,8 +59,8 @@ pub use self::rules_iterator::{AllRules, EffectiveRules}; pub use self::rules_iterator::{NestedRuleIterationCondition, RulesIterator}; pub use self::style_rule::StyleRule; pub use self::stylesheet::{DocumentStyleSheet, Namespaces, Stylesheet}; -pub use self::stylesheet::{StylesheetContents, StylesheetInDocument, UserAgentStylesheets}; pub use self::stylesheet::{SanitizationData, SanitizationKind}; +pub use self::stylesheet::{StylesheetContents, StylesheetInDocument, UserAgentStylesheets}; pub use self::supports_rule::SupportsRule; pub use self::viewport_rule::ViewportRule; diff --git a/components/style/stylesheets/stylesheet.rs b/components/style/stylesheets/stylesheet.rs index bf9e99192bd..068bfb6502a 100644 --- a/components/style/stylesheets/stylesheet.rs +++ b/components/style/stylesheets/stylesheet.rs @@ -368,9 +368,7 @@ impl SanitizationKind { CssRule::Supports(..) | CssRule::Import(..) => false, - CssRule::FontFace(..) | - CssRule::Namespace(..) | - CssRule::Style(..) => true, + CssRule::FontFace(..) | CssRule::Namespace(..) | CssRule::Style(..) => true, CssRule::Keyframes(..) | CssRule::Page(..) | diff --git a/components/style/values/animated/transform.rs b/components/style/values/animated/transform.rs index 2285497680b..3d93ae93f6d 100644 --- a/components/style/values/animated/transform.rs +++ b/components/style/values/animated/transform.rs @@ -1373,11 +1373,7 @@ impl ComputedTranslate { LengthPercentage::zero(), Length::zero(), ), - Translate::Translate(ref tx, ref ty, ref tz) => ( - tx.clone(), - ty.clone(), - tz.clone(), - ), + Translate::Translate(ref tx, ref ty, ref tz) => (tx.clone(), ty.clone(), tz.clone()), } } } diff --git a/components/style/values/computed/length.rs b/components/style/values/computed/length.rs index df93e874922..c9248f97c95 100644 --- a/components/style/values/computed/length.rs +++ b/components/style/values/computed/length.rs @@ -75,9 +75,7 @@ impl ToComputedValue for specified::Length { /// /// https://drafts.csswg.org/css-values-4/#typedef-length-percentage #[allow(missing_docs)] -#[derive( - Clone, Debug, Deserialize, MallocSizeOf, Serialize, ToAnimatedZero, ToResolvedValue, -)] +#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize, ToAnimatedZero, ToResolvedValue)] #[repr(C)] pub struct LengthPercentage { length: Length, diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index bf3fb6cbb1a..f5b3440f426 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -75,11 +75,11 @@ pub use self::resolution::Resolution; pub use self::svg::MozContextProperties; pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind}; pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth}; +pub use self::text::TextUnderlinePosition; pub use self::text::{InitialLetter, LetterSpacing, LineBreak, LineHeight}; pub use self::text::{OverflowWrap, TextOverflow, WordBreak, WordSpacing}; pub use self::text::{TextAlign, TextEmphasisPosition, TextEmphasisStyle}; pub use self::text::{TextDecorationLength, TextDecorationSkipInk}; -pub use self::text::TextUnderlinePosition; pub use self::time::Time; pub use self::transform::{Rotate, Scale, Transform, TransformOperation}; pub use self::transform::{TransformOrigin, TransformStyle, Translate}; diff --git a/components/style/values/computed/text.rs b/components/style/values/computed/text.rs index 81f037843b0..3f9ffb2ad0f 100644 --- a/components/style/values/computed/text.rs +++ b/components/style/values/computed/text.rs @@ -19,10 +19,10 @@ use std::fmt::{self, Write}; use style_traits::{CssWriter, ToCss}; pub use crate::values::specified::TextAlignKeyword as TextAlign; +pub use crate::values::specified::TextUnderlinePosition; pub use crate::values::specified::{LineBreak, OverflowWrap, WordBreak}; pub use crate::values::specified::{TextDecorationLine, TextEmphasisPosition}; pub use crate::values::specified::{TextDecorationSkipInk, TextTransform}; -pub use crate::values::specified::TextUnderlinePosition; /// A computed value for the `initial-letter` property. pub type InitialLetter = GenericInitialLetter; diff --git a/components/style/values/specified/box.rs b/components/style/values/specified/box.rs index de6e8da1205..ad8602ac431 100644 --- a/components/style/values/specified/box.rs +++ b/components/style/values/specified/box.rs @@ -390,11 +390,9 @@ impl Display { Display::from3(DisplayOutside::Block, inside, self.is_list_item()) }, #[cfg(feature = "gecko")] - DisplayOutside::XUL => { - match self.inside() { - DisplayInside::MozInlineBox | DisplayInside::MozBox => Display::MozBox, - _ => Display::Block, - } + DisplayOutside::XUL => match self.inside() { + DisplayInside::MozInlineBox | DisplayInside::MozBox => Display::MozBox, + _ => Display::Block, }, DisplayOutside::Block | DisplayOutside::None => *self, #[cfg(any(feature = "servo-layout-2013", feature = "gecko"))] diff --git a/components/style/values/specified/font.rs b/components/style/values/specified/font.rs index 7ed6429c196..05a29c94087 100644 --- a/components/style/values/specified/font.rs +++ b/components/style/values/specified/font.rs @@ -961,7 +961,8 @@ impl FontSize { // others should reject negatives during parsing. But SMIL // allows parsing negatives, and relies on us _not_ doing that // clamping. That's so bonkers :( - calc.percentage_relative_to(base_size.resolve(context)).clamp_to_non_negative() + calc.percentage_relative_to(base_size.resolve(context)) + .clamp_to_non_negative() }, FontSize::Keyword(i) => { // As a specified keyword, this is keyword derived diff --git a/components/style/values/specified/gecko.rs b/components/style/values/specified/gecko.rs index bade419d71a..4c85d1df668 100644 --- a/components/style/values/specified/gecko.rs +++ b/components/style/values/specified/gecko.rs @@ -5,7 +5,7 @@ //! Specified types for legacy Gecko-only properties. use crate::parser::{Parse, ParserContext}; -use crate::values::computed::{self, LengthPercentage, Length}; +use crate::values::computed::{self, Length, LengthPercentage}; use crate::values::generics::rect::Rect; use cssparser::{Parser, Token}; use std::fmt; diff --git a/components/style/values/specified/length.rs b/components/style/values/specified/length.rs index f1f4b0eeec8..d9a51665ead 100644 --- a/components/style/values/specified/length.rs +++ b/components/style/values/specified/length.rs @@ -101,7 +101,11 @@ impl FontRelativeLength { } /// Computes the font-relative length. - pub fn to_computed_value(&self, context: &Context, base_size: FontBaseSize) -> computed::Length { + pub fn to_computed_value( + &self, + context: &Context, + base_size: FontBaseSize, + ) -> computed::Length { let (reference_size, length) = self.reference_font_size_and_length(context, base_size); reference_size * length } diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index 856a7f0ecea..7f3ecfb96b3 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -80,11 +80,11 @@ pub use self::svg::MozContextProperties; pub use self::svg::{SVGLength, SVGOpacity, SVGPaint}; pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth}; pub use self::svg_path::SVGPathData; +pub use self::text::TextUnderlinePosition; pub use self::text::{InitialLetter, LetterSpacing, LineBreak, LineHeight, TextAlign}; pub use self::text::{OverflowWrap, TextEmphasisPosition, TextEmphasisStyle, WordBreak}; pub use self::text::{TextAlignKeyword, TextDecorationLine, TextOverflow, WordSpacing}; pub use self::text::{TextDecorationLength, TextDecorationSkipInk, TextTransform}; -pub use self::text::TextUnderlinePosition; pub use self::time::Time; pub use self::transform::{Rotate, Scale, Transform}; pub use self::transform::{TransformOrigin, TransformStyle, Translate};