commit 70a4e7824b0453fc89c09638173c525bf4956644
parent 5d8322b1d0ba235094e5824470a7a11531b967e2
Author: Nico Burns <nico@nicoburns.com>
Date: Mon, 15 Dec 2025 19:03:58 +0000
Bug 2005254: Apply rustfmt to stylo (r=firefox-style-system-reviewers,dshin)
Differential Revision: https://phabricator.services.mozilla.com/D275845
Diffstat:
9 files changed, 54 insertions(+), 40 deletions(-)
diff --git a/servo/components/selectors/parser.rs b/servo/components/selectors/parser.rs
@@ -3430,7 +3430,9 @@ where
Impl: SelectorImpl,
{
debug_assert!(parser.parse_has());
- if state.intersects(SelectorParsingState::DISALLOW_RELATIVE_SELECTOR | SelectorParsingState::AFTER_PSEUDO) {
+ if state.intersects(
+ SelectorParsingState::DISALLOW_RELATIVE_SELECTOR | SelectorParsingState::AFTER_PSEUDO,
+ ) {
return Err(input.new_custom_error(SelectorParseErrorKind::InvalidState));
}
// Nested `:has()` is disallowed, mark it as such.
diff --git a/servo/components/style/gecko/selector_parser.rs b/servo/components/style/gecko/selector_parser.rs
@@ -218,7 +218,10 @@ impl NonTSPseudoClass {
/// Returns whether the pseudo-class is enabled in content sheets.
#[inline]
fn is_enabled_in_content(&self) -> bool {
- if matches!(*self, Self::ActiveViewTransition | Self::ActiveViewTransitionType(..)) {
+ if matches!(
+ *self,
+ Self::ActiveViewTransition | Self::ActiveViewTransitionType(..)
+ ) {
return static_prefs::pref!("dom.viewTransitions.enabled");
}
if matches!(*self, Self::Heading(..)) {
diff --git a/servo/components/style/gecko/wrapper.rs b/servo/components/style/gecko/wrapper.rs
@@ -2097,9 +2097,13 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
},
NonTSPseudoClass::Dir(ref dir) => self.state().intersects(dir.element_state()),
NonTSPseudoClass::ActiveViewTransitionType(ref types) => {
- self.state().intersects(pseudo_class.state_flag()) && unsafe {
- bindings::Gecko_HasActiveViewTransitionTypes(self.as_node().owner_doc().0, types)
- }
+ self.state().intersects(pseudo_class.state_flag())
+ && unsafe {
+ bindings::Gecko_HasActiveViewTransitionTypes(
+ self.as_node().owner_doc().0,
+ types,
+ )
+ }
},
NonTSPseudoClass::AnyLink => self.is_link(),
NonTSPseudoClass::Link => {
diff --git a/servo/components/style/invalidation/element/invalidator.rs b/servo/components/style/invalidation/element/invalidator.rs
@@ -1189,7 +1189,9 @@ where
invalidation_kind,
DependencyInvalidationKind::Normal(NormalDependencyInvalidationKind::Element)
) || (matches!(invalidation_kind, DependencyInvalidationKind::Scope(_))
- && cur_dependency.selector.is_rightmost(cur_dependency.selector_offset))
+ && cur_dependency
+ .selector
+ .is_rightmost(cur_dependency.selector_offset))
{
// Add to dependency stack to process its next dependencies.
to_process.push(cur_dependency);
diff --git a/servo/components/style/matching.rs b/servo/components/style/matching.rs
@@ -868,8 +868,7 @@ trait PrivateMatchMethods: TElement {
let old_justify_items = old_values.get_position().clone_justify_items();
let new_justify_items = new_values.get_position().clone_justify_items();
- let was_legacy_justify_items =
- old_justify_items.computed.contains(AlignFlags::LEGACY);
+ let was_legacy_justify_items = old_justify_items.computed.contains(AlignFlags::LEGACY);
let is_legacy_justify_items = new_justify_items.computed.contains(AlignFlags::LEGACY);
diff --git a/servo/components/style/style_adjuster.rs b/servo/components/style/style_adjuster.rs
@@ -277,17 +277,17 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
.add_flags(ComputedValueFlags::IS_IN_OPACITY_ZERO_SUBTREE);
}
} else if self
+ .style
+ .get_parent_box()
+ .clone_display()
+ .is_item_container()
+ || self
.style
- .get_parent_box()
- .clone_display()
- .is_item_container()
- || self
- .style
- .get_parent_flags()
- .contains(ComputedValueFlags::DIPLAY_CONTENTS_IN_ITEM_CONTAINER)
+ .get_parent_flags()
+ .contains(ComputedValueFlags::DIPLAY_CONTENTS_IN_ITEM_CONTAINER)
{
- self.style
- .add_flags(ComputedValueFlags::DIPLAY_CONTENTS_IN_ITEM_CONTAINER);
+ self.style
+ .add_flags(ComputedValueFlags::DIPLAY_CONTENTS_IN_ITEM_CONTAINER);
}
if self.style.pseudo.is_some_and(|p| p.is_first_line()) {
diff --git a/servo/components/style/stylist.rs b/servo/components/style/stylist.rs
@@ -3821,8 +3821,9 @@ impl CascadeData {
let ancestor_selectors = containing_rule_state.ancestor_selector_lists.last();
let collect_replaced_selectors =
has_nested_rules && ancestor_selectors.is_some();
- let mut inner_dependencies: Option<Vec<Dependency>> =
- containing_rule_state.scope_is_effective().then(|| Vec::new());
+ let mut inner_dependencies: Option<Vec<Dependency>> = containing_rule_state
+ .scope_is_effective()
+ .then(|| Vec::new());
self.add_styles(
&style_rule.selectors,
&style_rule.block,
@@ -3863,8 +3864,9 @@ impl CascadeData {
NestedDeclarationsContext::Style => ancestor_selectors,
NestedDeclarationsContext::Scope => &*IMPLICIT_SCOPE,
};
- let mut inner_dependencies: Option<Vec<Dependency>> =
- containing_rule_state.scope_is_effective().then(|| Vec::new());
+ let mut inner_dependencies: Option<Vec<Dependency>> = containing_rule_state
+ .scope_is_effective()
+ .then(|| Vec::new());
self.add_styles(
selectors,
decls,
diff --git a/servo/components/style/values/specified/align.rs b/servo/components/style/values/specified/align.rs
@@ -386,20 +386,20 @@ impl SelfAlignment {
AlignFlags::SELF_START => AlignFlags::SELF_END,
AlignFlags::SELF_END => AlignFlags::SELF_START,
- AlignFlags::AUTO |
- AlignFlags::NORMAL |
- AlignFlags::BASELINE |
- AlignFlags::LAST_BASELINE |
- AlignFlags::STRETCH |
- AlignFlags::CENTER |
- AlignFlags::SPACE_BETWEEN |
- AlignFlags::SPACE_AROUND |
- AlignFlags::SPACE_EVENLY |
- AlignFlags::ANCHOR_CENTER => return self,
+ AlignFlags::AUTO
+ | AlignFlags::NORMAL
+ | AlignFlags::BASELINE
+ | AlignFlags::LAST_BASELINE
+ | AlignFlags::STRETCH
+ | AlignFlags::CENTER
+ | AlignFlags::SPACE_BETWEEN
+ | AlignFlags::SPACE_AROUND
+ | AlignFlags::SPACE_EVENLY
+ | AlignFlags::ANCHOR_CENTER => return self,
_ => {
debug_assert!(false, "Unexpected alignment enumeration value");
return self;
- }
+ },
};
self.with_value(flipped_value)
}
diff --git a/servo/components/style/values/specified/calc.rs b/servo/components/style/values/specified/calc.rs
@@ -575,14 +575,16 @@ impl GenericAnchorSizeFunction<Box<CalcNode>> {
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}
GenericAnchorSizeFunction::parse_inner(context, input, |i| {
- Ok(Box::new(CalcNode::parse_argument(
- context,
- i,
- AllowParse::new(CalcUnits::LENGTH_PERCENTAGE),
- )?
- .into_length_or_percentage(AllowedNumericType::All)
- .map_err(|_| i.new_custom_error(StyleParseErrorKind::UnspecifiedError))?
- .node))
+ Ok(Box::new(
+ CalcNode::parse_argument(
+ context,
+ i,
+ AllowParse::new(CalcUnits::LENGTH_PERCENTAGE),
+ )?
+ .into_length_or_percentage(AllowedNumericType::All)
+ .map_err(|_| i.new_custom_error(StyleParseErrorKind::UnspecifiedError))?
+ .node,
+ ))
})
}
}