diff --git a/components/style/gecko/conversions.rs b/components/style/gecko/conversions.rs index e077a9f9666e..266ebbd750ad 100644 --- a/components/style/gecko/conversions.rs +++ b/components/style/gecko/conversions.rs @@ -24,11 +24,11 @@ use crate::values::computed::{Angle, CalcLengthOrPercentage, Gradient, Image}; use crate::values::computed::{Integer, LengthOrPercentage}; use crate::values::computed::{LengthOrPercentageOrAuto, NonNegativeLengthOrPercentageOrAuto}; use crate::values::computed::{Percentage, TextAlign}; -use crate::values::generics::NonNegative; use crate::values::generics::box_::VerticalAlign; use crate::values::generics::grid::{TrackListValue, TrackSize}; use crate::values::generics::image::{CompatMode, GradientItem, Image as GenericImage}; use crate::values::generics::rect::Rect; +use crate::values::generics::NonNegative; use app_units::Au; use std::f32::consts::PI; @@ -677,11 +677,11 @@ pub mod basic_shape { use crate::values::generics::basic_shape::{ BasicShape as GenericBasicShape, InsetRect, Polygon, }; - use crate::values::generics::NonNegative; use crate::values::generics::basic_shape::{Circle, Ellipse, Path, PolygonCoord}; use crate::values::generics::basic_shape::{GeometryBox, ShapeBox, ShapeSource}; use crate::values::generics::border::BorderRadius as GenericBorderRadius; use crate::values::generics::rect::Rect; + use crate::values::generics::NonNegative; use crate::values::specified::SVGPathData; use std::borrow::Borrow; @@ -841,10 +841,17 @@ pub mod basic_shape { fn from(other: &'a nsStyleCorners) -> Self { let get_corner = |index| { BorderCornerRadius::new( - NonNegative(LengthOrPercentage::from_gecko_style_coord(&other.data_at(index)) - .expect(" should be a length, percentage, or calc value")), - NonNegative(LengthOrPercentage::from_gecko_style_coord(&other.data_at(index + 1)) - .expect(" should be a length, percentage, or calc value")), + NonNegative( + LengthOrPercentage::from_gecko_style_coord(&other.data_at(index)).expect( + " should be a length, percentage, or calc value", + ), + ), + NonNegative( + LengthOrPercentage::from_gecko_style_coord(&other.data_at(index + 1)) + .expect( + " should be a length, percentage, or calc value", + ), + ), ) }; diff --git a/components/style/gecko/data.rs b/components/style/gecko/data.rs index af98f116afb5..80e34fe2e7ed 100644 --- a/components/style/gecko/data.rs +++ b/components/style/gecko/data.rs @@ -7,8 +7,8 @@ use crate::context::QuirksMode; use crate::dom::TElement; use crate::gecko_bindings::bindings::{self, RawServoStyleSet}; -use crate::gecko_bindings::structs::{StyleSheet as DomStyleSheet, StyleSheetInfo}; use crate::gecko_bindings::structs::{RawGeckoPresContextBorrowed, ServoStyleSetSizes}; +use crate::gecko_bindings::structs::{StyleSheet as DomStyleSheet, StyleSheetInfo}; use crate::gecko_bindings::sugar::ownership::{HasArcFFI, HasBoxFFI, HasFFI, HasSimpleFFI}; use crate::invalidation::media_queries::{MediaListKey, ToMediaListKey}; use crate::media_queries::{Device, MediaList}; @@ -150,8 +150,7 @@ impl PerDocumentStyleData { // right now not always honored, see bug 1405543... // // Should we just force XBL Stylists to be NoQuirks? - let quirks_mode = - unsafe { (*device.pres_context().mDocument.mRawPtr).mCompatMode }; + let quirks_mode = unsafe { (*device.pres_context().mDocument.mRawPtr).mCompatMode }; PerDocumentStyleData(AtomicRefCell::new(PerDocumentStyleDataImpl { stylist: Stylist::new(device, quirks_mode.into()), @@ -192,12 +191,7 @@ impl PerDocumentStyleDataImpl { /// Returns whether visited styles are enabled. #[inline] pub fn visited_styles_enabled(&self) -> bool { - let doc = self - .stylist - .device() - .pres_context() - .mDocument - .mRawPtr; + let doc = self.stylist.device().pres_context().mDocument.mRawPtr; unsafe { bindings::Gecko_VisitedStylesEnabled(doc) } } diff --git a/components/style/gecko/media_features.rs b/components/style/gecko/media_features.rs index 29f5b61816f6..82613c9e245e 100644 --- a/components/style/gecko/media_features.rs +++ b/components/style/gecko/media_features.rs @@ -320,8 +320,7 @@ fn eval_overflow_block(device: &Device, query_value: Option) -> b }; match query_value { - OverflowBlock::None | - OverflowBlock::OptionalPaged => false, + OverflowBlock::None | OverflowBlock::OptionalPaged => false, OverflowBlock::Scroll => scrolling, OverflowBlock::Paged => !scrolling, } diff --git a/components/style/gecko/values.rs b/components/style/gecko/values.rs index b22f68cd05d0..39a5ac2de89b 100644 --- a/components/style/gecko/values.rs +++ b/components/style/gecko/values.rs @@ -286,9 +286,7 @@ impl GeckoStyleCoordConvertible for ComputedShapeRadius { None } }, - _ => { - GeckoStyleCoordConvertible::from_gecko_style_coord(coord).map(ShapeRadius::Length) - }, + _ => GeckoStyleCoordConvertible::from_gecko_style_coord(coord).map(ShapeRadius::Length), } } } diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index b169ee947fa8..0c8bbb9f9a74 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -45,8 +45,8 @@ use crate::gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentLWThe use crate::gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags}; use crate::gecko_bindings::structs; use crate::gecko_bindings::structs::nsChangeHint; -use crate::gecko_bindings::structs::Document_DocumentTheme as DocumentTheme; use crate::gecko_bindings::structs::nsRestyleHint; +use crate::gecko_bindings::structs::Document_DocumentTheme as DocumentTheme; use crate::gecko_bindings::structs::EffectCompositor_CascadeLevel as CascadeLevel; use crate::gecko_bindings::structs::ELEMENT_HANDLED_SNAPSHOT; use crate::gecko_bindings::structs::ELEMENT_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO; @@ -1243,10 +1243,7 @@ impl<'le> TElement for GeckoElement<'le> { fn owner_doc_matches_for_testing(&self, device: &Device) -> bool { self.as_node().owner_doc().0 as *const structs::Document == - device - .pres_context() - .mDocument - .mRawPtr + device.pres_context().mDocument.mRawPtr } fn style_attribute(&self) -> Option>> { diff --git a/components/style/gecko_bindings/sugar/origin_flags.rs b/components/style/gecko_bindings/sugar/origin_flags.rs index 409b145f1e92..e0f0981c5d80 100644 --- a/components/style/gecko_bindings/sugar/origin_flags.rs +++ b/components/style/gecko_bindings/sugar/origin_flags.rs @@ -10,7 +10,10 @@ use crate::stylesheets::OriginSet; /// Checks that the values for OriginFlags are the ones we expect. pub fn assert_flags_match() { use crate::stylesheets::origin::*; - debug_assert_eq!(OriginFlags::UserAgent.0, OriginSet::ORIGIN_USER_AGENT.bits()); + debug_assert_eq!( + OriginFlags::UserAgent.0, + OriginSet::ORIGIN_USER_AGENT.bits() + ); debug_assert_eq!(OriginFlags::Author.0, OriginSet::ORIGIN_AUTHOR.bits()); debug_assert_eq!(OriginFlags::User.0, OriginSet::ORIGIN_USER.bits()); } diff --git a/components/style/invalidation/element/restyle_hints.rs b/components/style/invalidation/element/restyle_hints.rs index 2cb8e222e466..de84fe56c852 100644 --- a/components/style/invalidation/element/restyle_hints.rs +++ b/components/style/invalidation/element/restyle_hints.rs @@ -205,13 +205,17 @@ impl From for RestyleHint { hint.insert(RestyleHint::RESTYLE_SELF); } - if (raw.0 & (nsRestyleHint::eRestyle_Subtree.0 | nsRestyleHint::eRestyle_SomeDescendants.0)) != 0 { + if (raw.0 & (nsRestyleHint::eRestyle_Subtree.0 | nsRestyleHint::eRestyle_SomeDescendants.0)) != + 0 + { raw.0 &= !nsRestyleHint::eRestyle_Subtree.0; raw.0 &= !nsRestyleHint::eRestyle_SomeDescendants.0; hint.insert(RestyleHint::RESTYLE_DESCENDANTS); } - if (raw.0 & (nsRestyleHint::eRestyle_ForceDescendants.0 | nsRestyleHint::eRestyle_Force.0)) != 0 { + if (raw.0 & (nsRestyleHint::eRestyle_ForceDescendants.0 | nsRestyleHint::eRestyle_Force.0)) != + 0 + { raw.0 &= !nsRestyleHint::eRestyle_Force.0; hint.insert(RestyleHint::RECASCADE_SELF); } diff --git a/components/style/rule_collector.rs b/components/style/rule_collector.rs index 6304a1af2d7e..ba602ddca834 100644 --- a/components/style/rule_collector.rs +++ b/components/style/rule_collector.rs @@ -260,8 +260,7 @@ where let cascade_data = containing_shadow.style_data(); let host = containing_shadow.host(); - if let Some(map) = cascade_data.and_then(|data| data.normal_rules(self.pseudo_element)) - { + if let Some(map) = cascade_data.and_then(|data| data.normal_rules(self.pseudo_element)) { self.collect_rules_in_shadow_tree(host, map, CascadeLevel::SameTreeAuthorNormal); } } diff --git a/components/style/stylist.rs b/components/style/stylist.rs index 3815a8a3da6a..74b055e099b1 100644 --- a/components/style/stylist.rs +++ b/components/style/stylist.rs @@ -17,7 +17,7 @@ use crate::media_queries::Device; use crate::properties::{self, CascadeMode, ComputedValues}; use crate::properties::{AnimationRules, PropertyDeclarationBlock}; use crate::rule_cache::{RuleCache, RuleCacheConditions}; -use crate::rule_collector::{RuleCollector, containing_shadow_ignoring_svg_use}; +use crate::rule_collector::{containing_shadow_ignoring_svg_use, RuleCollector}; use crate::rule_tree::{CascadeLevel, RuleTree, ShadowCascadeOrder, StrongRuleNode, StyleSource}; use crate::selector_map::{PrecomputedHashMap, PrecomputedHashSet, SelectorMap, SelectorMapEntry}; use crate::selector_parser::{PerPseudoElementMap, PseudoElement, SelectorImpl, SnapshotMap}; diff --git a/components/style/values/animated/mod.rs b/components/style/values/animated/mod.rs index bd0a7af1f95b..a7c947f810a6 100644 --- a/components/style/values/animated/mod.rs +++ b/components/style/values/animated/mod.rs @@ -13,8 +13,8 @@ use crate::values::computed::length::CalcLengthOrPercentage; use crate::values::computed::url::ComputedUrl; use crate::values::computed::Angle as ComputedAngle; use crate::values::computed::Image; -use crate::values::CSSFloat; use crate::values::specified::SVGPathData; +use crate::values::CSSFloat; use app_units::Au; use euclid::{Point2D, Size2D}; use smallvec::SmallVec; diff --git a/components/style/values/computed/border.rs b/components/style/values/computed/border.rs index 09dcfbe117ad..c6ab4abc5a54 100644 --- a/components/style/values/computed/border.rs +++ b/components/style/values/computed/border.rs @@ -4,8 +4,7 @@ //! Computed types for CSS values related to borders. -use crate::values::generics::NonNegative; -use crate::values::computed::length::{NonNegativeLengthOrPercentage, NonNegativeLength}; +use crate::values::computed::length::{NonNegativeLength, NonNegativeLengthOrPercentage}; use crate::values::computed::{NonNegativeNumber, NonNegativeNumberOrPercentage}; use crate::values::generics::border::BorderCornerRadius as GenericBorderCornerRadius; use crate::values::generics::border::BorderImageSideWidth as GenericBorderImageSideWidth; @@ -14,6 +13,7 @@ use crate::values::generics::border::BorderRadius as GenericBorderRadius; use crate::values::generics::border::BorderSpacing as GenericBorderSpacing; use crate::values::generics::rect::Rect; use crate::values::generics::size::Size; +use crate::values::generics::NonNegative; use app_units::Au; pub use crate::values::specified::border::BorderImageRepeat; @@ -22,7 +22,8 @@ pub use crate::values::specified::border::BorderImageRepeat; pub type BorderImageWidth = Rect; /// A computed value for a single side of a `border-image-width` property. -pub type BorderImageSideWidth = GenericBorderImageSideWidth; +pub type BorderImageSideWidth = + GenericBorderImageSideWidth; /// A computed value for the `border-image-slice` property. pub type BorderImageSlice = GenericBorderImageSlice; diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index 7ee151a40782..4051511e28e8 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -546,7 +546,9 @@ pub enum NumberOrPercentage { impl NumberOrPercentage { fn clamp_to_non_negative(self) -> Self { match self { - NumberOrPercentage::Percentage(p) => NumberOrPercentage::Percentage(p.clamp_to_non_negative()), + NumberOrPercentage::Percentage(p) => { + NumberOrPercentage::Percentage(p.clamp_to_non_negative()) + }, NumberOrPercentage::Number(n) => NumberOrPercentage::Number(n.max(0.)), } } diff --git a/components/style/values/specified/basic_shape.rs b/components/style/values/specified/basic_shape.rs index 20c7ad6eeb40..84624671ffed 100644 --- a/components/style/values/specified/basic_shape.rs +++ b/components/style/values/specified/basic_shape.rs @@ -16,8 +16,8 @@ use crate::values::specified::border::BorderRadius; use crate::values::specified::image::Image; use crate::values::specified::position::{HorizontalPosition, Position, VerticalPosition}; use crate::values::specified::url::SpecifiedUrl; -use crate::values::specified::{LengthOrPercentage, NonNegativeLengthOrPercentage}; use crate::values::specified::SVGPathData; +use crate::values::specified::{LengthOrPercentage, NonNegativeLengthOrPercentage}; use cssparser::Parser; use std::fmt::{self, Write}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; diff --git a/components/style/values/specified/border.rs b/components/style/values/specified/border.rs index ee0b491f027c..acd38ea5ba4f 100644 --- a/components/style/values/specified/border.rs +++ b/components/style/values/specified/border.rs @@ -13,7 +13,7 @@ use crate::values::generics::border::BorderRadius as GenericBorderRadius; use crate::values::generics::border::BorderSpacing as GenericBorderSpacing; use crate::values::generics::rect::Rect; use crate::values::generics::size::Size; -use crate::values::specified::length::{NonNegativeLengthOrPercentage, NonNegativeLength}; +use crate::values::specified::length::{NonNegativeLength, NonNegativeLengthOrPercentage}; use crate::values::specified::{AllowQuirks, NonNegativeNumber, NonNegativeNumberOrPercentage}; use cssparser::Parser; use std::fmt::{self, Write}; @@ -78,7 +78,8 @@ pub enum BorderSideWidth { pub type BorderImageWidth = Rect; /// A specified value for a single side of a `border-image-width` property. -pub type BorderImageSideWidth = GenericBorderImageSideWidth; +pub type BorderImageSideWidth = + GenericBorderImageSideWidth; /// A specified value for the `border-image-slice` property. pub type BorderImageSlice = GenericBorderImageSlice; @@ -116,8 +117,7 @@ impl BorderSideWidth { input: &mut Parser<'i, 't>, allow_quirks: AllowQuirks, ) -> Result> { - if let Ok(length) = - input.try(|i| NonNegativeLength::parse_quirky(context, i, allow_quirks)) + if let Ok(length) = input.try(|i| NonNegativeLength::parse_quirky(context, i, allow_quirks)) { return Ok(BorderSideWidth::Length(length)); } diff --git a/components/style/values/specified/length.rs b/components/style/values/specified/length.rs index dce643a754f2..e64385472a0e 100644 --- a/components/style/values/specified/length.rs +++ b/components/style/values/specified/length.rs @@ -725,7 +725,11 @@ impl NonNegativeLength { input: &mut Parser<'i, 't>, allow_quirks: AllowQuirks, ) -> Result> { - Ok(NonNegative(Length::parse_non_negative_quirky(context, input, allow_quirks)?)) + Ok(NonNegative(Length::parse_non_negative_quirky( + context, + input, + allow_quirks, + )?)) } } diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index a73252bbeb67..17d1ea04186a 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -375,7 +375,9 @@ impl Parse for NonNegativeNumberOrPercentage { context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result> { - Ok(NonNegative(NumberOrPercentage::parse_non_negative(context, input)?)) + Ok(NonNegative(NumberOrPercentage::parse_non_negative( + context, input, + )?)) } }