aboutsummaryrefslogtreecommitdiffstats
path: root/components/style
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-12-14 08:31:30 +0100
committerSimon Sapin <simon.sapin@exyr.org>2018-12-28 13:17:47 +0100
commitbe69f9c3e6a6f5efb5ba1edd50955cb12c111bf8 (patch)
treedb8be2dfee5cff6ef0c42e8d46c623eb87529e5a /components/style
parent82fc6d9f49a657e2857da3f1b22140e3b6efdf09 (diff)
downloadservo-be69f9c3e6a6f5efb5ba1edd50955cb12c111bf8.tar.gz
servo-be69f9c3e6a6f5efb5ba1edd50955cb12c111bf8.zip
Rustfmt has changed its default style :/
Diffstat (limited to 'components/style')
-rw-r--r--components/style/attr.rs2
-rw-r--r--components/style/bloom.rs2
-rw-r--r--components/style/build_gecko.rs3
-rw-r--r--components/style/context.rs2
-rw-r--r--components/style/custom_properties.rs2
-rw-r--r--components/style/dom.rs7
-rw-r--r--components/style/font_face.rs7
-rw-r--r--components/style/font_metrics.rs2
-rw-r--r--components/style/gecko/conversions.rs2
-rw-r--r--components/style/gecko/data.rs2
-rw-r--r--components/style/gecko/media_features.rs2
-rw-r--r--components/style/gecko/media_queries.rs4
-rw-r--r--components/style/gecko/selector_parser.rs55
-rw-r--r--components/style/gecko/values.rs2
-rw-r--r--components/style/gecko/wrapper.rs42
-rw-r--r--components/style/gecko_bindings/mod.rs7
-rw-r--r--components/style/gecko_bindings/sugar/ns_css_shadow_item.rs2
-rw-r--r--components/style/invalidation/element/element_wrapper.rs4
-rw-r--r--components/style/logical_geometry.rs11
-rw-r--r--components/style/matching.rs8
-rw-r--r--components/style/media_queries/media_feature.rs7
-rw-r--r--components/style/media_queries/media_feature_expression.rs11
-rw-r--r--components/style/media_queries/media_list.rs27
-rw-r--r--components/style/parallel.rs2
-rw-r--r--components/style/servo/media_queries.rs2
-rw-r--r--components/style/servo/selector_parser.rs2
-rw-r--r--components/style/shared_lock.rs4
-rw-r--r--components/style/sharing/mod.rs2
-rw-r--r--components/style/style_adjuster.rs31
-rw-r--r--components/style/stylesheets/font_feature_values_rule.rs24
-rw-r--r--components/style/stylesheets/keyframes_rule.rs8
-rw-r--r--components/style/stylesheets/rule_parser.rs7
-rw-r--r--components/style/stylesheets/supports_rule.rs7
-rw-r--r--components/style/stylesheets/viewport_rule.rs2
-rw-r--r--components/style/stylist.rs23
-rw-r--r--components/style/traversal.rs15
-rw-r--r--components/style/values/animated/mod.rs2
-rw-r--r--components/style/values/computed/border.rs2
-rw-r--r--components/style/values/computed/font.rs4
-rw-r--r--components/style/values/computed/length.rs2
-rw-r--r--components/style/values/generics/basic_shape.rs6
-rw-r--r--components/style/values/generics/font.rs2
-rw-r--r--components/style/values/generics/text.rs2
-rw-r--r--components/style/values/generics/transform.rs2
-rw-r--r--components/style/values/mod.rs5
-rw-r--r--components/style/values/specified/angle.rs2
-rw-r--r--components/style/values/specified/box.rs13
-rw-r--r--components/style/values/specified/calc.rs4
-rw-r--r--components/style/values/specified/counters.rs2
-rw-r--r--components/style/values/specified/font.rs4
-rw-r--r--components/style/values/specified/grid.rs6
-rw-r--r--components/style/values/specified/image.rs4
-rw-r--r--components/style/values/specified/length.rs42
-rw-r--r--components/style/values/specified/mod.rs4
-rw-r--r--components/style/values/specified/source_size_list.rs4
-rw-r--r--components/style/values/specified/text.rs3
-rw-r--r--components/style/values/specified/time.rs6
57 files changed, 205 insertions, 258 deletions
diff --git a/components/style/attr.rs b/components/style/attr.rs
index eb7fd9ece2a..780248a2221 100644
--- a/components/style/attr.rs
+++ b/components/style/attr.rs
@@ -6,7 +6,6 @@
//!
//! [attr]: https://dom.spec.whatwg.org/#interface-attr
-use app_units::Au;
use crate::properties::PropertyDeclarationBlock;
use crate::shared_lock::Locked;
use crate::str::str_join;
@@ -14,6 +13,7 @@ use crate::str::{read_exponent, read_fraction, HTML_SPACE_CHARACTERS};
use crate::str::{read_numbers, split_commas, split_html_space_chars};
use crate::values::specified::Length;
use crate::{Atom, LocalName, Namespace, Prefix};
+use app_units::Au;
use cssparser::{self, Color, RGBA};
use euclid::num::Zero;
use num_traits::ToPrimitive;
diff --git a/components/style/bloom.rs b/components/style/bloom.rs
index 077efa92011..92e6b2a48b4 100644
--- a/components/style/bloom.rs
+++ b/components/style/bloom.rs
@@ -7,8 +7,8 @@
#![deny(missing_docs)]
-use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use crate::dom::{SendElement, TElement};
+use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use owning_ref::OwningHandle;
use selectors::bloom::BloomFilter;
use servo_arc::Arc;
diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs
index 4b5d36232d5..9b627a4a82e 100644
--- a/components/style/build_gecko.rs
+++ b/components/style/build_gecko.rs
@@ -513,8 +513,7 @@ mod bindings {
"pub type nsTArrayBorrowed_{}<'a> = ",
"&'a mut ::gecko_bindings::structs::nsTArray<{}>;"
),
- cpp_type,
- rust_type
+ cpp_type, rust_type
))
})
.handle_str_items("servo-immutable-borrow-types", |b, ty| b.borrowed_type(ty))
diff --git a/components/style/context.rs b/components/style/context.rs
index 42e506777ab..aca1d24f2ea 100644
--- a/components/style/context.rs
+++ b/components/style/context.rs
@@ -4,7 +4,6 @@
//! The context within which style is calculated.
-use app_units::Au;
#[cfg(feature = "servo")]
use crate::animation::Animation;
use crate::bloom::StyleBloom;
@@ -29,6 +28,7 @@ use crate::thread_state::{self, ThreadState};
use crate::timer::Timer;
use crate::traversal::DomTraversal;
use crate::traversal_flags::TraversalFlags;
+use app_units::Au;
#[cfg(feature = "servo")]
use crossbeam_channel::Sender;
use euclid::Size2D;
diff --git a/components/style/custom_properties.rs b/components/style/custom_properties.rs
index 130c92b0e9b..6bc2b331e35 100644
--- a/components/style/custom_properties.rs
+++ b/components/style/custom_properties.rs
@@ -434,7 +434,7 @@ fn parse_declaration_value_block<'i, 't>(
return Ok((
TokenSerializationType::nothing(),
TokenSerializationType::nothing(),
- ))
+ ));
},
};
let first_token_type = token.serialization_type();
diff --git a/components/style/dom.rs b/components/style/dom.rs
index eee5b9d90ef..1c64543310c 100644
--- a/components/style/dom.rs
+++ b/components/style/dom.rs
@@ -7,7 +7,6 @@
#![allow(unsafe_code)]
#![deny(missing_docs)]
-use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use crate::applicable_declarations::ApplicableDeclarationBlock;
#[cfg(feature = "gecko")]
use crate::context::PostAnimationTasks;
@@ -23,6 +22,7 @@ use crate::shared_lock::Locked;
use crate::stylist::CascadeData;
use crate::traversal_flags::TraversalFlags;
use crate::{Atom, LocalName, Namespace, WeakAtom};
+use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use selectors::matching::{ElementSelectorFlags, QuirksMode, VisitedHandlingMode};
use selectors::sink::Push;
use selectors::Element as SelectorsElement;
@@ -42,10 +42,7 @@ use std::ops::Deref;
/// data structures. Also, layout code tends to be faster when the DOM is not being accessed, for
/// locality reasons. Using `OpaqueNode` enforces this invariant.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
-#[cfg_attr(
- feature = "servo",
- derive(MallocSizeOf, Deserialize, Serialize)
-)]
+#[cfg_attr(feature = "servo", derive(MallocSizeOf, Deserialize, Serialize))]
pub struct OpaqueNode(pub usize);
impl OpaqueNode {
diff --git a/components/style/font_face.rs b/components/style/font_face.rs
index 7b911cbb76c..38c4bb78833 100644
--- a/components/style/font_face.rs
+++ b/components/style/font_face.rs
@@ -336,9 +336,10 @@ impl<'a> FontFace<'a> {
// We support only opentype fonts and truetype is an alias for
// that format. Sources without format hints need to be
// downloaded in case we support them.
- hints.is_empty() || hints
- .iter()
- .any(|hint| hint == "truetype" || hint == "opentype" || hint == "woff")
+ hints.is_empty() ||
+ hints.iter().any(|hint| {
+ hint == "truetype" || hint == "opentype" || hint == "woff"
+ })
} else {
true
}
diff --git a/components/style/font_metrics.rs b/components/style/font_metrics.rs
index 031faa7c536..0c37a444658 100644
--- a/components/style/font_metrics.rs
+++ b/components/style/font_metrics.rs
@@ -6,12 +6,12 @@
#![deny(missing_docs)]
-use app_units::Au;
use crate::context::SharedStyleContext;
use crate::logical_geometry::WritingMode;
use crate::media_queries::Device;
use crate::properties::style_structs::Font;
use crate::Atom;
+use app_units::Au;
/// 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/conversions.rs b/components/style/gecko/conversions.rs
index 426d8c30ae9..c48d56f56e1 100644
--- a/components/style/gecko/conversions.rs
+++ b/components/style/gecko/conversions.rs
@@ -8,7 +8,6 @@
#![allow(unsafe_code)]
-use app_units::Au;
use crate::gecko::values::GeckoStyleCoordConvertible;
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs::RawGeckoGfxMatrix4x4;
@@ -27,6 +26,7 @@ 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 app_units::Au;
use std::f32::consts::PI;
impl From<CalcLengthOrPercentage> for nsStyleCoord_CalcValue {
diff --git a/components/style/gecko/data.rs b/components/style/gecko/data.rs
index 08ebd428b30..d4c976cc2a6 100644
--- a/components/style/gecko/data.rs
+++ b/components/style/gecko/data.rs
@@ -4,7 +4,6 @@
//! Data needed to style a Gecko document.
-use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use crate::context::QuirksMode;
use crate::dom::TElement;
use crate::gecko_bindings::bindings::{self, RawServoStyleSet};
@@ -19,6 +18,7 @@ use crate::selector_parser::SnapshotMap;
use crate::shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
use crate::stylesheets::{CssRule, Origin, StylesheetContents, StylesheetInDocument};
use crate::stylist::Stylist;
+use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use malloc_size_of::MallocSizeOfOps;
use servo_arc::Arc;
use std::fmt;
diff --git a/components/style/gecko/media_features.rs b/components/style/gecko/media_features.rs
index de37629ca28..25355c45d70 100644
--- a/components/style/gecko/media_features.rs
+++ b/components/style/gecko/media_features.rs
@@ -4,7 +4,6 @@
//! Gecko's media feature list and evaluator.
-use app_units::Au;
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs;
use crate::media_queries::media_feature::{AllowsRanges, ParsingRequirements};
@@ -14,6 +13,7 @@ use crate::media_queries::Device;
use crate::values::computed::CSSPixelLength;
use crate::values::computed::Resolution;
use crate::Atom;
+use app_units::Au;
use euclid::Size2D;
fn viewport_size(device: &Device) -> Size2D<Au> {
diff --git a/components/style/gecko/media_queries.rs b/components/style/gecko/media_queries.rs
index f7fb7e15f59..ab3f3a0de80 100644
--- a/components/style/gecko/media_queries.rs
+++ b/components/style/gecko/media_queries.rs
@@ -4,8 +4,6 @@
//! Gecko's media-query device and expression representation.
-use app_units::Au;
-use app_units::AU_PER_PX;
use crate::custom_properties::CssEnvironment;
use crate::gecko::values::{convert_nscolor_to_rgba, convert_rgba_to_nscolor};
use crate::gecko_bindings::bindings;
@@ -16,6 +14,8 @@ use crate::properties::ComputedValues;
use crate::string_cache::Atom;
use crate::values::computed::font::FontSize;
use crate::values::{CustomIdent, KeyframesName};
+use app_units::Au;
+use app_units::AU_PER_PX;
use cssparser::RGBA;
use euclid::Size2D;
use euclid::TypedScale;
diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs
index 330bf6057a2..b00cb4f909e 100644
--- a/components/style/gecko/selector_parser.rs
+++ b/components/style/gecko/selector_parser.rs
@@ -230,33 +230,34 @@ impl NonTSPseudoClass {
/// Returns true if the given pseudoclass should trigger style sharing cache
/// revalidation.
pub fn needs_cache_revalidation(&self) -> bool {
- self.state_flag().is_empty() && !matches!(*self,
- // :-moz-any is handled by the revalidation visitor walking
- // the things inside it; it does not need to cause
- // revalidation on its own.
- NonTSPseudoClass::MozAny(_) |
- // :dir() depends on state only, but doesn't use state_flag
- // because its semantics don't quite match. Nevertheless, it
- // doesn't need cache revalidation, because we already compare
- // states for elements and candidates.
- NonTSPseudoClass::Dir(_) |
- // :-moz-is-html only depends on the state of the document and
- // the namespace of the element; the former is invariant
- // across all the elements involved and the latter is already
- // checked for by our caching precondtions.
- NonTSPseudoClass::MozIsHTML |
- // :-moz-placeholder is parsed but never matches.
- NonTSPseudoClass::MozPlaceholder |
- // :-moz-locale-dir and :-moz-window-inactive depend only on
- // the state of the document, which is invariant across all
- // the elements involved in a given style cache.
- NonTSPseudoClass::MozLocaleDir(_) |
- NonTSPseudoClass::MozWindowInactive |
- // Similar for the document themes.
- NonTSPseudoClass::MozLWTheme |
- NonTSPseudoClass::MozLWThemeBrightText |
- NonTSPseudoClass::MozLWThemeDarkText
- )
+ self.state_flag().is_empty() &&
+ !matches!(*self,
+ // :-moz-any is handled by the revalidation visitor walking
+ // the things inside it; it does not need to cause
+ // revalidation on its own.
+ NonTSPseudoClass::MozAny(_) |
+ // :dir() depends on state only, but doesn't use state_flag
+ // because its semantics don't quite match. Nevertheless, it
+ // doesn't need cache revalidation, because we already compare
+ // states for elements and candidates.
+ NonTSPseudoClass::Dir(_) |
+ // :-moz-is-html only depends on the state of the document and
+ // the namespace of the element; the former is invariant
+ // across all the elements involved and the latter is already
+ // checked for by our caching precondtions.
+ NonTSPseudoClass::MozIsHTML |
+ // :-moz-placeholder is parsed but never matches.
+ NonTSPseudoClass::MozPlaceholder |
+ // :-moz-locale-dir and :-moz-window-inactive depend only on
+ // the state of the document, which is invariant across all
+ // the elements involved in a given style cache.
+ NonTSPseudoClass::MozLocaleDir(_) |
+ NonTSPseudoClass::MozWindowInactive |
+ // Similar for the document themes.
+ NonTSPseudoClass::MozLWTheme |
+ NonTSPseudoClass::MozLWThemeBrightText |
+ NonTSPseudoClass::MozLWThemeDarkText
+ )
}
/// Returns true if the evaluation of the pseudo-class depends on the
diff --git a/components/style/gecko/values.rs b/components/style/gecko/values.rs
index 77be7b52472..98dafcd070f 100644
--- a/components/style/gecko/values.rs
+++ b/components/style/gecko/values.rs
@@ -6,7 +6,6 @@
//! Different kind of helpers to interact with Gecko values.
-use app_units::Au;
use crate::counter_style::{Symbol, Symbols};
use crate::gecko_bindings::structs::{self, nsStyleCoord, CounterStylePtr};
use crate::gecko_bindings::structs::{StyleGridTrackBreadth, StyleShapeRadius};
@@ -29,6 +28,7 @@ use crate::values::generics::length::{MaxLength, MozLength};
use crate::values::generics::{CounterStyleOrNone, NonNegative};
use crate::values::{Auto, Either, None_, Normal};
use crate::Atom;
+use app_units::Au;
use cssparser::RGBA;
use nsstring::{nsACString, nsCStr};
use std::cmp::max;
diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs
index ca991b412d6..0768e9e26af 100644
--- a/components/style/gecko/wrapper.rs
+++ b/components/style/gecko/wrapper.rs
@@ -14,8 +14,6 @@
//! style system it's kind of pointless in the Stylo case, and only Servo forces
//! the separation between the style system implementation and everything else.
-use app_units::Au;
-use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use crate::applicable_declarations::ApplicableDeclarationBlock;
use crate::author_styles::AuthorStyles;
use crate::context::{PostAnimationTasks, QuirksMode, SharedStyleContext, UpdateAnimationsTasks};
@@ -72,6 +70,8 @@ use crate::shared_lock::Locked;
use crate::string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
use crate::stylist::CascadeData;
use crate::CaseSensitivityExt;
+use app_units::Au;
+use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use selectors::attr::{AttrSelectorOperation, AttrSelectorOperator};
use selectors::attr::{CaseSensitivity, NamespaceConstraint};
use selectors::matching::VisitedHandlingMode;
@@ -931,13 +931,14 @@ impl<'le> GeckoElement<'le> {
debug_assert_eq!(to.is_some(), from.is_some());
- combined_duration > 0.0f32 && from != to && from
- .unwrap()
- .animate(
- to.as_ref().unwrap(),
- Procedure::Interpolate { progress: 0.5 },
- )
- .is_ok()
+ combined_duration > 0.0f32 &&
+ from != to &&
+ from.unwrap()
+ .animate(
+ to.as_ref().unwrap(),
+ Procedure::Interpolate { progress: 0.5 },
+ )
+ .is_ok()
}
}
@@ -1241,10 +1242,11 @@ 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::nsIDocument == device
- .pres_context()
- .mDocument
- .raw::<structs::nsIDocument>()
+ self.as_node().owner_doc().0 as *const structs::nsIDocument ==
+ device
+ .pres_context()
+ .mDocument
+ .raw::<structs::nsIDocument>()
}
fn style_attribute(&self) -> Option<ArcBorrow<Locked<PropertyDeclarationBlock>>> {
@@ -1864,9 +1866,8 @@ impl<'le> TElement for GeckoElement<'le> {
.intersects(NonTSPseudoClass::Active.state_flag());
if active {
let declarations = unsafe { Gecko_GetActiveLinkAttrDeclarationBlock(self.0) };
- let declarations: Option<
- &RawOffsetArc<Locked<PropertyDeclarationBlock>>,
- > = declarations.and_then(|s| s.as_arc_opt());
+ let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>> =
+ declarations.and_then(|s| s.as_arc_opt());
if let Some(decl) = declarations {
hints.push(ApplicableDeclarationBlock::from_declarations(
decl.clone_arc(),
@@ -2081,11 +2082,10 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
return false;
}
- debug_assert!(
- self.as_node()
- .parent_node()
- .map_or(false, |p| p.is_document())
- );
+ debug_assert!(self
+ .as_node()
+ .parent_node()
+ .map_or(false, |p| p.is_document()));
unsafe { bindings::Gecko_IsRootElement(self.0) }
}
diff --git a/components/style/gecko_bindings/mod.rs b/components/style/gecko_bindings/mod.rs
index 75e045a4bbd..78fc8e3ae76 100644
--- a/components/style/gecko_bindings/mod.rs
+++ b/components/style/gecko_bindings/mod.rs
@@ -4,12 +4,7 @@
//! Gecko's C++ bindings, along with some rust helpers to ease its use.
-#[allow(
- dead_code,
- improper_ctypes,
- non_camel_case_types,
- missing_docs
-)]
+#[allow(dead_code, improper_ctypes, non_camel_case_types, missing_docs)]
pub mod bindings {
include!(concat!(env!("OUT_DIR"), "/gecko/bindings.rs"));
}
diff --git a/components/style/gecko_bindings/sugar/ns_css_shadow_item.rs b/components/style/gecko_bindings/sugar/ns_css_shadow_item.rs
index 4a17093ba07..03d68576dea 100644
--- a/components/style/gecko_bindings/sugar/ns_css_shadow_item.rs
+++ b/components/style/gecko_bindings/sugar/ns_css_shadow_item.rs
@@ -4,9 +4,9 @@
//! Rust helpers for Gecko's `nsCSSShadowItem`.
-use app_units::Au;
use crate::gecko_bindings::structs::nsCSSShadowItem;
use crate::values::computed::effects::{BoxShadow, SimpleShadow};
+use app_units::Au;
impl nsCSSShadowItem {
/// Sets this item from the given box shadow.
diff --git a/components/style/invalidation/element/element_wrapper.rs b/components/style/invalidation/element/element_wrapper.rs
index ca18c6d8e76..c794eb15c2c 100644
--- a/components/style/invalidation/element/element_wrapper.rs
+++ b/components/style/invalidation/element/element_wrapper.rs
@@ -208,10 +208,10 @@ where
// Instead, we use the `visited_handling` to determine if they
// match.
NonTSPseudoClass::Link => {
- return self.is_link() && context.visited_handling().matches_unvisited()
+ return self.is_link() && context.visited_handling().matches_unvisited();
},
NonTSPseudoClass::Visited => {
- return self.is_link() && context.visited_handling().matches_visited()
+ return self.is_link() && context.visited_handling().matches_visited();
},
#[cfg(feature = "gecko")]
diff --git a/components/style/logical_geometry.rs b/components/style/logical_geometry.rs
index 55ba76a60d5..b6cc9ef5bc6 100644
--- a/components/style/logical_geometry.rs
+++ b/components/style/logical_geometry.rs
@@ -1221,11 +1221,12 @@ impl<T: Copy + Add<T, Output = T> + Sub<T, Output = T>> LogicalRect<T> {
pub fn translate(&self, offset: &LogicalPoint<T>) -> LogicalRect<T> {
LogicalRect {
- start: self.start + LogicalSize {
- inline: offset.i,
- block: offset.b,
- debug_writing_mode: offset.debug_writing_mode,
- },
+ start: self.start +
+ LogicalSize {
+ inline: offset.i,
+ block: offset.b,
+ debug_writing_mode: offset.debug_writing_mode,
+ },
size: self.size,
debug_writing_mode: self.debug_writing_mode,
}
diff --git a/components/style/matching.rs b/components/style/matching.rs
index c7c547a3c61..b1240443dea 100644
--- a/components/style/matching.rs
+++ b/components/style/matching.rs
@@ -469,11 +469,9 @@ trait PrivateMatchMethods: TElement {
pseudo: Option<&PseudoElement>,
) -> ChildCascadeRequirement {
debug!("accumulate_damage_for: {:?}", self);
- debug_assert!(
- !shared_context
- .traversal_flags
- .contains(TraversalFlags::Forgetful)
- );
+ debug_assert!(!shared_context
+ .traversal_flags
+ .contains(TraversalFlags::Forgetful));
let difference = self.compute_style_difference(old_values, new_values, pseudo);
diff --git a/components/style/media_queries/media_feature.rs b/components/style/media_queries/media_feature.rs
index 69808242772..d5e015b3b07 100644
--- a/components/style/media_queries/media_feature.rs
+++ b/components/style/media_queries/media_feature.rs
@@ -30,9 +30,10 @@ type MediaFeatureEvaluator<T> = fn(
pub type KeywordSerializer = fn(KeywordDiscriminant) -> String;
/// Parses a given identifier.
-pub type KeywordParser =
- for<'a, 'i, 't> fn(context: &'a ParserContext, input: &'a mut Parser<'i, 't>)
- -> Result<KeywordDiscriminant, ParseError<'i>>;
+pub type KeywordParser = for<'a, 'i, 't> fn(
+ context: &'a ParserContext,
+ input: &'a mut Parser<'i, 't>,
+) -> Result<KeywordDiscriminant, ParseError<'i>>;
/// An evaluator for a given media feature.
///
diff --git a/components/style/media_queries/media_feature_expression.rs b/components/style/media_queries/media_feature_expression.rs
index 5144189778d..ec864510c72 100644
--- a/components/style/media_queries/media_feature_expression.rs
+++ b/components/style/media_queries/media_feature_expression.rs
@@ -134,10 +134,11 @@ impl RangeOrOperator {
match range_or_op {
RangeOrOperator::Range(range) => {
- cmp == Ordering::Equal || match range {
- Range::Min => cmp == Ordering::Greater,
- Range::Max => cmp == Ordering::Less,
- }
+ cmp == Ordering::Equal ||
+ match range {
+ Range::Min => cmp == Ordering::Greater,
+ Range::Max => cmp == Ordering::Less,
+ }
},
RangeOrOperator::Operator(op) => match op {
Operator::Equal => cmp == Ordering::Equal,
@@ -344,7 +345,7 @@ impl MediaFeatureExpression {
Err(()) => {
return Err(location.new_custom_error(
StyleParseErrorKind::MediaQueryExpectedFeatureName(ident.clone()),
- ))
+ ));
},
}
diff --git a/components/style/media_queries/media_list.rs b/components/style/media_queries/media_list.rs
index bd4125d5324..0acf4f1bdf9 100644
--- a/components/style/media_queries/media_list.rs
+++ b/components/style/media_queries/media_list.rs
@@ -74,21 +74,22 @@ impl MediaList {
pub fn evaluate(&self, device: &Device, quirks_mode: QuirksMode) -> bool {
// Check if it is an empty media query list or any queries match.
// https://drafts.csswg.org/mediaqueries-4/#mq-list
- self.media_queries.is_empty() || self.media_queries.iter().any(|mq| {
- let media_match = mq.media_type.matches(device.media_type());
+ self.media_queries.is_empty() ||
+ self.media_queries.iter().any(|mq| {
+ let media_match = mq.media_type.matches(device.media_type());
- // Check if the media condition match.
- let query_match = media_match && mq
- .condition
- .as_ref()
- .map_or(true, |c| c.matches(device, quirks_mode));
+ // Check if the media condition match.
+ let query_match = media_match &&
+ mq.condition
+ .as_ref()
+ .map_or(true, |c| c.matches(device, quirks_mode));
- // Apply the logical NOT qualifier to the result
- match mq.qualifier {
- Some(Qualifier::Not) => !query_match,
- _ => query_match,
- }
- })
+ // Apply the logical NOT qualifier to the result
+ match mq.qualifier {
+ Some(Qualifier::Not) => !query_match,
+ _ => query_match,
+ }
+ })
}
/// Whether this `MediaList` contains no media queries.
diff --git a/components/style/parallel.rs b/components/style/parallel.rs
index 1b9f80f5722..237453084df 100644
--- a/components/style/parallel.rs
+++ b/components/style/parallel.rs
@@ -22,11 +22,11 @@
#![deny(missing_docs)]
-use arrayvec::ArrayVec;
use crate::context::{StyleContext, ThreadLocalStyleContext};
use crate::dom::{OpaqueNode, SendNode, TElement};
use crate::scoped_tls::ScopedTLS;
use crate::traversal::{DomTraversal, PerLevelTraversalData};
+use arrayvec::ArrayVec;
use itertools::Itertools;
use rayon;
use smallvec::SmallVec;
diff --git a/components/style/servo/media_queries.rs b/components/style/servo/media_queries.rs
index d35e8dc3ccd..b3c99cf875a 100644
--- a/components/style/servo/media_queries.rs
+++ b/components/style/servo/media_queries.rs
@@ -4,7 +4,6 @@
//! Servo's media-query device and expression representation.
-use app_units::Au;
use crate::custom_properties::CssEnvironment;
use crate::media_queries::media_feature::{AllowsRanges, ParsingRequirements};
use crate::media_queries::media_feature::{Evaluator, MediaFeatureDescription};
@@ -14,6 +13,7 @@ use crate::properties::ComputedValues;
use crate::values::computed::font::FontSize;
use crate::values::computed::CSSPixelLength;
use crate::values::KeyframesName;
+use app_units::Au;
use cssparser::RGBA;
use euclid::{Size2D, TypedScale, TypedSize2D};
use std::sync::atomic::{AtomicBool, AtomicIsize, Ordering};
diff --git a/components/style/servo/selector_parser.rs b/components/style/servo/selector_parser.rs
index cd725228017..9abfe976919 100644
--- a/components/style/servo/selector_parser.rs
+++ b/components/style/servo/selector_parser.rs
@@ -457,7 +457,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
parser: &mut CssParser<'i, 't>,
) -> Result<NonTSPseudoClass, ParseError<'i>> {
use self::NonTSPseudoClass::*;
- let pseudo_class = match_ignore_ascii_case!{ &name,
+ let pseudo_class = match_ignore_ascii_case! { &name,
"lang" => {
Lang(parser.expect_ident_or_string()?.as_ref().into())
}
diff --git a/components/style/shared_lock.rs b/components/style/shared_lock.rs
index 57038f627fe..09bfa163503 100644
--- a/components/style/shared_lock.rs
+++ b/components/style/shared_lock.rs
@@ -4,10 +4,10 @@
//! Different objects protected by the same lock
-#[cfg(feature = "gecko")]
-use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use crate::str::{CssString, CssStringWriter};
use crate::stylesheets::Origin;
+#[cfg(feature = "gecko")]
+use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
#[cfg(feature = "servo")]
use parking_lot::RwLock;
use servo_arc::Arc;
diff --git a/components/style/sharing/mod.rs b/components/style/sharing/mod.rs
index 843fd76e2e6..c7be23572c6 100644
--- a/components/style/sharing/mod.rs
+++ b/components/style/sharing/mod.rs
@@ -64,7 +64,6 @@
//! selectors are effectively stripped off, so that matching them all against
//! elements makes sense.
-use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use crate::applicable_declarations::ApplicableDeclarationBlock;
use crate::bloom::StyleBloom;
use crate::context::{SelectorFlagsMap, SharedStyleContext, StyleContext};
@@ -75,6 +74,7 @@ use crate::rule_tree::StrongRuleNode;
use crate::style_resolver::{PrimaryStyle, ResolvedElementStyles};
use crate::stylist::Stylist;
use crate::Atom;
+use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use owning_ref::OwningHandle;
use selectors::matching::{ElementSelectorFlags, VisitedHandlingMode};
use selectors::NthIndexCache;
diff --git a/components/style/style_adjuster.rs b/components/style/style_adjuster.rs
index ea4e6a43d74..248d0ad0661 100644
--- a/components/style/style_adjuster.rs
+++ b/components/style/style_adjuster.rs
@@ -5,7 +5,6 @@
//! A struct to encapsulate all the style fixups and flags propagations
//! a computed style needs in order for it to adhere to the CSS spec.
-use app_units::Au;
use crate::dom::TElement;
use crate::properties::computed_value_flags::ComputedValueFlags;
use crate::properties::longhands::display::computed_value::T as Display;
@@ -13,6 +12,7 @@ use crate::properties::longhands::float::computed_value::T as Float;
use crate::properties::longhands::overflow_x::computed_value::T as Overflow;
use crate::properties::longhands::position::computed_value::T as Position;
use crate::properties::{self, ComputedValues, StyleBuilder};
+use app_units::Au;
/// A struct that implements all the adjustment methods.
///
@@ -190,12 +190,10 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
let is_root = self.style.pseudo.is_none() && element.map_or(false, |e| e.is_root());
blockify_if!(is_root);
if !self.skip_item_display_fixup(element) {
- blockify_if!(
- layout_parent_style
- .get_box()
- .clone_display()
- .is_item_container()
- );
+ blockify_if!(layout_parent_style
+ .get_box()
+ .clone_display()
+ .is_item_container());
}
let is_item_or_root = blockify;
@@ -220,11 +218,12 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
pub fn set_bits(&mut self) {
let display = self.style.get_box().clone_display();
- if !display.is_contents() && !self
- .style
- .get_text()
- .clone_text_decoration_line()
- .is_empty()
+ if !display.is_contents() &&
+ !self
+ .style
+ .get_text()
+ .clone_text_decoration_line()
+ .is_empty()
{
self.style
.flags
@@ -299,10 +298,10 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
#[cfg(feature = "gecko")]
fn adjust_for_text_in_ruby(&mut self) {
let parent_display = self.style.get_parent_box().clone_display();
- if parent_display.is_ruby_type() || self
- .style
- .get_parent_flags()
- .contains(ComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK)
+ if parent_display.is_ruby_type() ||
+ self.style
+ .get_parent_flags()
+ .contains(ComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK)
{
self.style
.flags
diff --git a/components/style/stylesheets/font_feature_values_rule.rs b/components/style/stylesheets/font_feature_values_rule.rs
index d7e7315d7be..a93ed43d475 100644
--- a/components/style/stylesheets/font_feature_values_rule.rs
+++ b/components/style/stylesheets/font_feature_values_rule.rs
@@ -70,11 +70,7 @@ impl Parse for SingleValue {
match *input.next()? {
Token::Number {
int_value: Some(v), ..
- }
- if v >= 0 =>
- {
- Ok(SingleValue(v as u32))
- },
+ } if v >= 0 => Ok(SingleValue(v as u32)),
ref t => Err(location.new_unexpected_token_error(t.clone())),
}
}
@@ -103,22 +99,14 @@ impl Parse for PairValues {
let first = match *input.next()? {
Token::Number {
int_value: Some(a), ..
- }
- if a >= 0 =>
- {
- a as u32
- },
+ } if a >= 0 => a as u32,
ref t => return Err(location.new_unexpected_token_error(t.clone())),
};
let location = input.current_source_location();
match input.next() {
Ok(&Token::Number {
int_value: Some(b), ..
- })
- if b >= 0 =>
- {
- Ok(PairValues(first, Some(b as u32)))
- },
+ }) if b >= 0 => Ok(PairValues(first, Some(b as u32))),
// It can't be anything other than number.
Ok(t) => Err(location.new_unexpected_token_error(t.clone())),
// It can be just one value.
@@ -157,11 +145,9 @@ impl Parse for VectorValues {
match input.next() {
Ok(&Token::Number {
int_value: Some(a), ..
- })
- if a >= 0 =>
- {
+ }) if a >= 0 => {
vec.push(a as u32);
- }
+ },
// It can't be anything other than number.
Ok(t) => return Err(location.new_unexpected_token_error(t.clone())),
Err(_) => break,
diff --git a/components/style/stylesheets/keyframes_rule.rs b/components/style/stylesheets/keyframes_rule.rs
index 59f015bf4ae..662bc9ae481 100644
--- a/components/style/stylesheets/keyframes_rule.rs
+++ b/components/style/stylesheets/keyframes_rule.rs
@@ -141,11 +141,7 @@ impl KeyframePercentage {
Token::Percentage {
unit_value: percentage,
..
- }
- if percentage >= 0. && percentage <= 1. =>
- {
- Ok(KeyframePercentage::new(percentage))
- },
+ } if percentage >= 0. && percentage <= 1. => Ok(KeyframePercentage::new(percentage)),
_ => Err(input.new_unexpected_token_error(token)),
}
}
@@ -600,7 +596,7 @@ impl<'a, 'b, 'i> DeclarationParser<'i> for KeyframeDeclarationParser<'a, 'b> {
let id = match PropertyId::parse(&name, self.context) {
Ok(id) => id,
Err(()) => {
- return Err(input.new_custom_error(StyleParseErrorKind::UnknownProperty(name)))
+ return Err(input.new_custom_error(StyleParseErrorKind::UnknownProperty(name)));
},
};
diff --git a/components/style/stylesheets/rule_parser.rs b/components/style/stylesheets/rule_parser.rs
index a2a062ba173..44943259b38 100644
--- a/components/style/stylesheets/rule_parser.rs
+++ b/components/style/stylesheets/rule_parser.rs
@@ -107,9 +107,10 @@ impl<'b> TopLevelRuleParser<'b> {
// If there's anything that isn't a namespace rule (or import rule, but
// we checked that already at the beginning), reject with a
// StateError.
- if new_state == State::Namespaces && ctx.rule_list[ctx.index..]
- .iter()
- .any(|r| !matches!(*r, CssRule::Namespace(..)))
+ if new_state == State::Namespaces &&
+ ctx.rule_list[ctx.index..]
+ .iter()
+ .any(|r| !matches!(*r, CssRule::Namespace(..)))
{
self.dom_error = Some(RulesMutateError::InvalidState);
return false;
diff --git a/components/style/stylesheets/supports_rule.rs b/components/style/stylesheets/supports_rule.rs
index e0d23ea0f5d..45f6f97812d 100644
--- a/components/style/stylesheets/supports_rule.rs
+++ b/components/style/stylesheets/supports_rule.rs
@@ -145,7 +145,7 @@ impl SupportsCondition {
function: &str,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
- match_ignore_ascii_case!{ function,
+ match_ignore_ascii_case! { function,
// Although this is an internal syntax, it is not necessary
// to check parsing context as far as we accept any
// unexpected token as future syntax, and evaluate it to
@@ -350,9 +350,8 @@ impl RawSelector {
use crate::selector_parser::PseudoElement;
use selectors::parser::Component;
- let has_any_unknown_webkit_pseudo = selector.has_pseudo_element() && selector
- .iter_raw_match_order()
- .any(|component| {
+ let has_any_unknown_webkit_pseudo = selector.has_pseudo_element() &&
+ selector.iter_raw_match_order().any(|component| {
matches!(
*component,
Component::PseudoElement(PseudoElement::UnknownWebkit(..))
diff --git a/components/style/stylesheets/viewport_rule.rs b/components/style/stylesheets/viewport_rule.rs
index d7b644114c6..4df576a15ab 100644
--- a/components/style/stylesheets/viewport_rule.rs
+++ b/components/style/stylesheets/viewport_rule.rs
@@ -7,7 +7,6 @@
//! [at]: https://drafts.csswg.org/css-device-adapt/#atviewport-rule
//! [meta]: https://drafts.csswg.org/css-device-adapt/#viewport-meta
-use app_units::Au;
use crate::context::QuirksMode;
use crate::error_reporting::ContextualParseError;
use crate::font_metrics::get_metrics_provider_for_product;
@@ -20,6 +19,7 @@ use crate::str::CssStringWriter;
use crate::stylesheets::{Origin, StylesheetInDocument};
use crate::values::computed::{Context, ToComputedValue};
use crate::values::specified::{LengthOrPercentageOrAuto, NoCalcLength, ViewportPercentageLength};
+use app_units::Au;
use cssparser::CowRcStr;
use cssparser::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
use euclid::TypedSize2D;
diff --git a/components/style/stylist.rs b/components/style/stylist.rs
index c5129520b29..592e4e81081 100644
--- a/components/style/stylist.rs
+++ b/components/style/stylist.rs
@@ -355,10 +355,7 @@ pub struct Stylist {
stylesheets: StylistStylesheetSet,
/// If true, the quirks-mode stylesheet is applied.
- #[cfg_attr(
- feature = "servo",
- ignore_malloc_size_of = "defined in selectors"
- )]
+ #[cfg_attr(feature = "servo", ignore_malloc_size_of = "defined in selectors")]
quirks_mode: QuirksMode,
/// Selector maps for all of the style sheets in the stylist, after
@@ -1570,9 +1567,8 @@ impl<'a> SelectorVisitor for StylistSelectorVisitor<'a> {
// Also, note that this call happens before we visit any of the simple
// selectors in the next ComplexSelector, so we can use this to skip
// looking at them.
- self.passed_rightmost_selector =
- self.passed_rightmost_selector ||
- !matches!(combinator, None | Some(Combinator::PseudoElement));
+ self.passed_rightmost_selector = self.passed_rightmost_selector ||
+ !matches!(combinator, None | Some(Combinator::PseudoElement));
true
}
@@ -1589,9 +1585,8 @@ impl<'a> SelectorVisitor for StylistSelectorVisitor<'a> {
}
fn visit_simple_selector(&mut self, s: &Component<SelectorImpl>) -> bool {
- self.needs_revalidation =
- self.needs_revalidation ||
- component_needs_revalidation(s, self.passed_rightmost_selector);
+ self.needs_revalidation = self.needs_revalidation ||
+ component_needs_revalidation(s, self.passed_rightmost_selector);
match *s {
Component::NonTSPseudoClass(ref p) => {
@@ -2024,10 +2019,10 @@ impl CascadeData {
debug!("Found valid keyframes rule: {:?}", *keyframes_rule);
// Don't let a prefixed keyframes animation override a non-prefixed one.
- let needs_insertion = keyframes_rule.vendor_prefix.is_none() || self
- .animations
- .get(keyframes_rule.name.as_atom())
- .map_or(true, |rule| rule.vendor_prefix.is_some());
+ let needs_insertion = keyframes_rule.vendor_prefix.is_none() ||
+ self.animations
+ .get(keyframes_rule.name.as_atom())
+ .map_or(true, |rule| rule.vendor_prefix.is_some());
if needs_insertion {
let animation = KeyframesAnimation::from_keyframes(
&keyframes_rule.keyframes,
diff --git a/components/style/traversal.rs b/components/style/traversal.rs
index 89cbfb83477..f1821900bb4 100644
--- a/components/style/traversal.rs
+++ b/components/style/traversal.rs
@@ -208,11 +208,11 @@ pub trait DomTraversal<E: TElement>: Sync {
// animation-only restyle hint or recascade.
if traversal_flags.for_animation_only() {
return data.map_or(false, |d| d.has_styles()) &&
- (el.has_animation_only_dirty_descendants() || data
- .as_ref()
- .unwrap()
- .hint
- .has_animation_hint_or_recascade());
+ (el.has_animation_only_dirty_descendants() ||
+ data.as_ref()
+ .unwrap()
+ .hint
+ .has_animation_hint_or_recascade());
}
// Non-incremental layout visits every node.
@@ -516,9 +516,8 @@ pub fn recalc_style_at<E, D, F>(
!child_cascade_requirement.can_skip_cascade() ||
is_servo_nonincremental_layout();
- traverse_children =
- traverse_children &&
- !traversal.should_cull_subtree(context, element, &data, is_initial_style);
+ traverse_children = traverse_children &&
+ !traversal.should_cull_subtree(context, element, &data, is_initial_style);
// Examine our children, and enqueue the appropriate ones for traversal.
if traverse_children {
diff --git a/components/style/values/animated/mod.rs b/components/style/values/animated/mod.rs
index 6711dcf3c83..38de8a359a1 100644
--- a/components/style/values/animated/mod.rs
+++ b/components/style/values/animated/mod.rs
@@ -8,13 +8,13 @@
//! computed values and need yet another intermediate representation. This
//! module's raison d'être is to ultimately contain all these types.
-use app_units::Au;
use crate::properties::PropertyId;
use crate::values::computed::length::CalcLengthOrPercentage;
use crate::values::computed::url::ComputedUrl;
use crate::values::computed::Angle as ComputedAngle;
use crate::values::computed::BorderCornerRadius as ComputedBorderCornerRadius;
use crate::values::CSSFloat;
+use app_units::Au;
use euclid::{Point2D, Size2D};
use smallvec::SmallVec;
use std::cmp;
diff --git a/components/style/values/computed/border.rs b/components/style/values/computed/border.rs
index 5a6e7082bd9..676e8c1b6be 100644
--- a/components/style/values/computed/border.rs
+++ b/components/style/values/computed/border.rs
@@ -4,7 +4,6 @@
//! Computed types for CSS values related to borders.
-use app_units::Au;
use crate::values::animated::ToAnimatedZero;
use crate::values::computed::length::{LengthOrPercentage, NonNegativeLength};
use crate::values::computed::{Number, NumberOrPercentage};
@@ -15,6 +14,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 app_units::Au;
pub use crate::values::specified::border::BorderImageRepeat;
diff --git a/components/style/values/computed/font.rs b/components/style/values/computed/font.rs
index 3c192b5dd38..ad795ff6b29 100644
--- a/components/style/values/computed/font.rs
+++ b/components/style/values/computed/font.rs
@@ -4,8 +4,6 @@
//! Computed values for font properties
-use app_units::Au;
-use byteorder::{BigEndian, ByteOrder};
#[cfg(feature = "gecko")]
use crate::gecko_bindings::sugar::refptr::RefPtr;
#[cfg(feature = "gecko")]
@@ -19,6 +17,8 @@ use crate::values::specified::font::{self as specified, MAX_FONT_WEIGHT, MIN_FON
use crate::values::specified::length::{FontBaseSize, NoCalcLength};
use crate::values::CSSFloat;
use crate::Atom;
+use app_units::Au;
+use byteorder::{BigEndian, ByteOrder};
use cssparser::{serialize_identifier, CssStringWriter, Parser};
#[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
diff --git a/components/style/values/computed/length.rs b/components/style/values/computed/length.rs
index 16e5b5df65b..96886e9096a 100644
--- a/components/style/values/computed/length.rs
+++ b/components/style/values/computed/length.rs
@@ -5,7 +5,6 @@
//! `<length>` computed values, and related ones.
use super::{Context, Number, Percentage, ToComputedValue};
-use app_units::Au;
use crate::values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
use crate::values::generics::length::MaxLength as GenericMaxLength;
@@ -15,6 +14,7 @@ use crate::values::generics::NonNegative;
use crate::values::specified::length::ViewportPercentageLength;
use crate::values::specified::length::{AbsoluteLength, FontBaseSize, FontRelativeLength};
use crate::values::{specified, Auto, CSSFloat, Either, IsAuto, Normal};
+use app_units::Au;
use ordered_float::NotNan;
use std::fmt::{self, Write};
use std::ops::{Add, Neg};
diff --git a/components/style/values/generics/basic_shape.rs b/components/style/values/generics/basic_shape.rs
index 4fbcc6e754f..cbcdadd055f 100644
--- a/components/style/values/generics/basic_shape.rs
+++ b/components/style/values/generics/basic_shape.rs
@@ -241,11 +241,7 @@ where
(
&ShapeSource::Shape(ref this, ref this_box),
&ShapeSource::Shape(ref other, ref other_box),
- )
- if this_box == other_box =>
- {
- this.compute_squared_distance(other)
- },
+ ) if this_box == other_box => this.compute_squared_distance(other),
(&ShapeSource::Path(ref this), &ShapeSource::Path(ref other))
if this.fill == other.fill =>
{
diff --git a/components/style/values/generics/font.rs b/components/style/values/generics/font.rs
index 0d5e6b21eee..ee14e15bfe5 100644
--- a/components/style/values/generics/font.rs
+++ b/components/style/values/generics/font.rs
@@ -4,9 +4,9 @@
//! Generic types for font stuff.
+use crate::parser::{Parse, ParserContext};
use app_units::Au;
use byteorder::{BigEndian, ReadBytesExt};
-use crate::parser::{Parse, ParserContext};
use cssparser::Parser;
use num_traits::One;
use std::fmt::{self, Write};
diff --git a/components/style/values/generics/text.rs b/components/style/values/generics/text.rs
index df0279c7121..090c3c1f687 100644
--- a/components/style/values/generics/text.rs
+++ b/components/style/values/generics/text.rs
@@ -4,10 +4,10 @@
//! Generic types for text properties.
-use app_units::Au;
use crate::parser::ParserContext;
use crate::values::animated::{Animate, Procedure, ToAnimatedZero};
use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
+use app_units::Au;
use cssparser::Parser;
use style_traits::ParseError;
diff --git a/components/style/values/generics/transform.rs b/components/style/values/generics/transform.rs
index 91af1355a27..158b7456c76 100644
--- a/components/style/values/generics/transform.rs
+++ b/components/style/values/generics/transform.rs
@@ -4,13 +4,13 @@
//! Generic types for CSS values that are related to transformations.
-use app_units::Au;
use crate::values::computed::length::Length as ComputedLength;
use crate::values::computed::length::LengthOrPercentage as ComputedLengthOrPercentage;
use crate::values::specified::angle::Angle as SpecifiedAngle;
use crate::values::specified::length::Length as SpecifiedLength;
use crate::values::specified::length::LengthOrPercentage as SpecifiedLengthOrPercentage;
use crate::values::{computed, CSSFloat};
+use app_units::Au;
use euclid::{self, Rect, Transform3D};
use num_traits::Zero;
use std::fmt::{self, Write};
diff --git a/components/style/values/mod.rs b/components/style/values/mod.rs
index 8a47220fd6a..659ff95b1a7 100644
--- a/components/style/values/mod.rs
+++ b/components/style/values/mod.rs
@@ -93,10 +93,7 @@ where
}
/// Convenience void type to disable some properties and values through types.
-#[cfg_attr(
- feature = "servo",
- derive(Deserialize, MallocSizeOf, Serialize)
-)]
+#[cfg_attr(feature = "servo", derive(Deserialize, MallocSizeOf, Serialize))]
#[derive(
Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToComputedValue, ToCss,
)]
diff --git a/components/style/values/specified/angle.rs b/components/style/values/specified/angle.rs
index 6e8cd059f35..35a0944aed5 100644
--- a/components/style/values/specified/angle.rs
+++ b/components/style/values/specified/angle.rs
@@ -193,7 +193,7 @@ impl Angle {
AllowUnitlessZeroAngle::No => Err(()),
},
Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {
- return input.parse_nested_block(|i| CalcNode::parse_angle(context, i))
+ return input.parse_nested_block(|i| CalcNode::parse_angle(context, i));
},
_ => Err(()),
}
diff --git a/components/style/values/specified/box.rs b/components/style/values/specified/box.rs
index 54030ba7139..c785fb0c0db 100644
--- a/components/style/values/specified/box.rs
+++ b/components/style/values/specified/box.rs
@@ -218,10 +218,7 @@ impl Display {
// Special handling for contents and list-item on the root
// element for Gecko.
#[cfg(feature = "gecko")]
- Display::Contents | Display::ListItem if _is_root_element =>
- {
- Display::Block
- },
+ Display::Contents | Display::ListItem if _is_root_element => Display::Block,
// These are not changed by blockification.
Display::None | Display::Block | Display::Flex | Display::ListItem | Display::Table => {
@@ -747,7 +744,9 @@ impl Parse for Contain {
let flag = match flag {
Some(flag) if !result.contains(flag) => flag,
_ => {
- return Err(input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name)))
+ return Err(
+ input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name))
+ );
},
};
result.insert(flag);
@@ -826,7 +825,7 @@ impl Parse for TransitionProperty {
location,
ident,
&["none"],
- )?))
+ )?));
},
};
@@ -1309,7 +1308,7 @@ impl BreakBetween {
Ok(v) => v,
Err(()) => {
return Err(location
- .new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone())))
+ .new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone())));
},
};
match break_value {
diff --git a/components/style/values/specified/calc.rs b/components/style/values/specified/calc.rs
index 6abb94b946c..2fe00ff8799 100644
--- a/components/style/values/specified/calc.rs
+++ b/components/style/values/specified/calc.rs
@@ -180,7 +180,7 @@ impl CalcNode {
) => {
return NoCalcLength::parse_dimension(context, value, unit)
.map(CalcNode::Length)
- .map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError))
+ .map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError));
},
(
&Token::Dimension {
@@ -204,7 +204,7 @@ impl CalcNode {
},
(&Token::Percentage { unit_value, .. }, CalcUnit::LengthOrPercentage) |
(&Token::Percentage { unit_value, .. }, CalcUnit::Percentage) => {
- return Ok(CalcNode::Percentage(unit_value))
+ return Ok(CalcNode::Percentage(unit_value));
},
(&Token::ParenthesisBlock, _) => {},
(&Token::Function(ref name), _) if name.eq_ignore_ascii_case("calc") => {},
diff --git a/components/style/values/specified/counters.rs b/components/style/values/specified/counters.rs
index b89d7ebafe0..6ee6575fc94 100644
--- a/components/style/values/specified/counters.rs
+++ b/components/style/values/specified/counters.rs
@@ -181,7 +181,7 @@ impl Parse for Content {
None => {
return Err(input.new_custom_error(
StyleParseErrorKind::UnexpectedFunction(name.clone()),
- ))
+ ));
},
}
},
diff --git a/components/style/values/specified/font.rs b/components/style/values/specified/font.rs
index 9cf97e2879c..e5699742b14 100644
--- a/components/style/values/specified/font.rs
+++ b/components/style/values/specified/font.rs
@@ -4,8 +4,6 @@
//! Specified values for font properties
-use app_units::Au;
-use byteorder::{BigEndian, ByteOrder};
#[cfg(feature = "gecko")]
use crate::gecko_bindings::bindings;
use crate::parser::{Parse, ParserContext};
@@ -22,6 +20,8 @@ use crate::values::specified::{AllowQuirks, Angle, Integer, LengthOrPercentage};
use crate::values::specified::{NoCalcLength, Number, Percentage};
use crate::values::CustomIdent;
use crate::Atom;
+use app_units::Au;
+use byteorder::{BigEndian, ByteOrder};
use cssparser::{Parser, Token};
#[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
diff --git a/components/style/values/specified/grid.rs b/components/style/values/specified/grid.rs
index cd879e26e48..8fdaf51b275 100644
--- a/components/style/values/specified/grid.rs
+++ b/components/style/values/specified/grid.rs
@@ -22,11 +22,7 @@ pub fn parse_flex<'i, 't>(input: &mut Parser<'i, 't>) -> Result<CSSFloat, ParseE
match *input.next()? {
Token::Dimension {
value, ref unit, ..
- }
- if unit.eq_ignore_ascii_case("fr") && value.is_sign_positive() =>
- {
- Ok(value)
- },
+ } if unit.eq_ignore_ascii_case("fr") && value.is_sign_positive() => Ok(value),
ref t => Err(location.new_unexpected_token_error(t.clone())),
}
}
diff --git a/components/style/values/specified/image.rs b/components/style/values/specified/image.rs
index 53d028e5711..d4ace9789a2 100644
--- a/components/style/values/specified/image.rs
+++ b/components/style/values/specified/image.rs
@@ -262,7 +262,7 @@ impl Parse for Gradient {
let (shape, repeating, mut compat_mode) = match result {
Some(result) => result,
None => {
- return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedFunction(func)))
+ return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedFunction(func)));
},
};
@@ -792,7 +792,7 @@ impl LineDirection {
CompatMode::WebKit if to_ident.is_ok() => {
return Err(
i.new_custom_error(SelectorParseErrorKind::UnexpectedIdent("to".into()))
- )
+ );
},
_ => {},
}
diff --git a/components/style/values/specified/length.rs b/components/style/values/specified/length.rs
index b615e56ea7e..13877dbe594 100644
--- a/components/style/values/specified/length.rs
+++ b/components/style/values/specified/length.rs
@@ -7,7 +7,6 @@
//! [length]: https://drafts.csswg.org/css-values/#lengths
use super::{AllowQuirks, Number, Percentage, ToComputedValue};
-use app_units::Au;
use crate::font_metrics::FontMetricsQueryResult;
use crate::parser::{Parse, ParserContext};
use crate::values::computed::{self, CSSPixelLength, Context, ExtremumLength};
@@ -17,6 +16,7 @@ use crate::values::generics::transform::IsZeroLength;
use crate::values::generics::NonNegative;
use crate::values::specified::calc::CalcNode;
use crate::values::{Auto, CSSFloat, Either, IsAuto, Normal};
+use app_units::Au;
use cssparser::{Parser, Token};
use euclid::Size2D;
use std::cmp;
@@ -601,12 +601,10 @@ impl Length {
match *token {
Token::Dimension {
value, ref unit, ..
- }
- if num_context.is_ok(context.parsing_mode, value) =>
- {
+ } if num_context.is_ok(context.parsing_mode, value) => {
return NoCalcLength::parse_dimension(context, value, unit)
.map(Length::NoCalc)
- .map_err(|()| location.new_unexpected_token_error(token.clone()))
+ .map_err(|()| location.new_unexpected_token_error(token.clone()));
},
Token::Number { value, .. } if num_context.is_ok(context.parsing_mode, value) => {
if value != 0. &&
@@ -790,20 +788,18 @@ impl LengthOrPercentage {
match *token {
Token::Dimension {
value, ref unit, ..
- }
- if num_context.is_ok(context.parsing_mode, value) =>
- {
+ } if num_context.is_ok(context.parsing_mode, value) => {
return NoCalcLength::parse_dimension(context, value, unit)
.map(LengthOrPercentage::Length)
- .map_err(|()| location.new_unexpected_token_error(token.clone()))
+ .map_err(|()| location.new_unexpected_token_error(token.clone()));
},
Token::Percentage { unit_value, .. }
if num_context.is_ok(context.parsing_mode, unit_value) =>
{
return Ok(LengthOrPercentage::Percentage(computed::Percentage(
unit_value,
- )))
- },
+ )));
+ }
Token::Number { value, .. } if num_context.is_ok(context.parsing_mode, value) => {
if value != 0. &&
!context.parsing_mode.allows_unitless_lengths() &&
@@ -922,20 +918,18 @@ impl LengthOrPercentageOrAuto {
match *token {
Token::Dimension {
value, ref unit, ..
- }
- if num_context.is_ok(context.parsing_mode, value) =>
- {
+ } if num_context.is_ok(context.parsing_mode, value) => {
return NoCalcLength::parse_dimension(context, value, unit)
.map(LengthOrPercentageOrAuto::Length)
- .map_err(|()| location.new_unexpected_token_error(token.clone()))
+ .map_err(|()| location.new_unexpected_token_error(token.clone()));
},
Token::Percentage { unit_value, .. }
if num_context.is_ok(context.parsing_mode, unit_value) =>
{
return Ok(LengthOrPercentageOrAuto::Percentage(computed::Percentage(
unit_value,
- )))
- },
+ )));
+ }
Token::Number { value, .. } if num_context.is_ok(context.parsing_mode, value) => {
if value != 0. &&
!context.parsing_mode.allows_unitless_lengths() &&
@@ -948,7 +942,7 @@ impl LengthOrPercentageOrAuto {
)));
},
Token::Ident(ref value) if value.eq_ignore_ascii_case("auto") => {
- return Ok(LengthOrPercentageOrAuto::Auto)
+ return Ok(LengthOrPercentageOrAuto::Auto);
},
Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {},
_ => return Err(location.new_unexpected_token_error(token.clone())),
@@ -1088,20 +1082,18 @@ impl LengthOrPercentageOrNone {
match *token {
Token::Dimension {
value, ref unit, ..
- }
- if num_context.is_ok(context.parsing_mode, value) =>
- {
+ } if num_context.is_ok(context.parsing_mode, value) => {
return NoCalcLength::parse_dimension(context, value, unit)
.map(LengthOrPercentageOrNone::Length)
- .map_err(|()| location.new_unexpected_token_error(token.clone()))
+ .map_err(|()| location.new_unexpected_token_error(token.clone()));
},
Token::Percentage { unit_value, .. }
if num_context.is_ok(context.parsing_mode, unit_value) =>
{
return Ok(LengthOrPercentageOrNone::Percentage(computed::Percentage(
unit_value,
- )))
- },
+ )));
+ }
Token::Number { value, .. } if num_context.is_ok(context.parsing_mode, value) => {
if value != 0. &&
!context.parsing_mode.allows_unitless_lengths() &&
@@ -1115,7 +1107,7 @@ impl LengthOrPercentageOrNone {
},
Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {},
Token::Ident(ref value) if value.eq_ignore_ascii_case("none") => {
- return Ok(LengthOrPercentageOrNone::None)
+ return Ok(LengthOrPercentageOrNone::None);
},
_ => return Err(location.new_unexpected_token_error(token.clone())),
}
diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs
index 3b8278c3287..d3df66a0eea 100644
--- a/components/style/values/specified/mod.rs
+++ b/components/style/values/specified/mod.rs
@@ -138,7 +138,7 @@ fn parse_number_with_clamping_mode<'i, 't>(
return Ok(Number {
value: value.min(f32::MAX).max(f32::MIN),
calc_clamping_mode: None,
- })
+ });
},
Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {},
ref t => return Err(location.new_unexpected_token_error(t.clone())),
@@ -808,7 +808,7 @@ impl Attr {
Some(ns) => ns,
None => {
return Err(location
- .new_custom_error(StyleParseErrorKind::UnspecifiedError))
+ .new_custom_error(StyleParseErrorKind::UnspecifiedError));
},
};
Some((prefix, ns))
diff --git a/components/style/values/specified/source_size_list.rs b/components/style/values/specified/source_size_list.rs
index fd07dc8007f..b27bc2875a6 100644
--- a/components/style/values/specified/source_size_list.rs
+++ b/components/style/values/specified/source_size_list.rs
@@ -4,13 +4,13 @@
//! https://html.spec.whatwg.org/multipage/#source-size-list
-use app_units::Au;
#[cfg(feature = "gecko")]
use crate::gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use crate::media_queries::{Device, MediaCondition};
use crate::parser::{Parse, ParserContext};
use crate::values::computed::{self, ToComputedValue};
use crate::values::specified::{Length, NoCalcLength, ViewportPercentageLength};
+use app_units::Au;
use cssparser::{Delimiter, Parser, Token};
use selectors::context::QuirksMode;
use style_traits::ParseError;
@@ -118,7 +118,7 @@ impl SourceSizeList {
return Self {
source_sizes,
value: Some(value),
- }
+ };
},
Ok(SourceSizeOrLength::SourceSize(source_size)) => {
source_sizes.push(source_size);
diff --git a/components/style/values/specified/text.rs b/components/style/values/specified/text.rs
index 4733864f7bd..3a5663c4bfd 100644
--- a/components/style/values/specified/text.rs
+++ b/components/style/values/specified/text.rs
@@ -91,8 +91,7 @@ impl Parse for LineHeight {
match ident {
ref ident if ident.eq_ignore_ascii_case("normal") => Ok(GenericLineHeight::Normal),
#[cfg(feature = "gecko")]
- ref ident if ident.eq_ignore_ascii_case("-moz-block-height") =>
- {
+ ref ident if ident.eq_ignore_ascii_case("-moz-block-height") => {
Ok(GenericLineHeight::MozBlockHeight)
},
ident => {
diff --git a/components/style/values/specified/time.rs b/components/style/values/specified/time.rs
index 22ef8053cca..740232f5cbc 100644
--- a/components/style/values/specified/time.rs
+++ b/components/style/values/specified/time.rs
@@ -92,12 +92,10 @@ impl Time {
// ParsingMode::DEFAULT directly.
Ok(&Token::Dimension {
value, ref unit, ..
- })
- if clamping_mode.is_ok(ParsingMode::DEFAULT, value) =>
- {
+ }) if clamping_mode.is_ok(ParsingMode::DEFAULT, value) => {
return Time::parse_dimension(value, unit, /* from_calc = */ false)
.map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError));
- }
+ },
Ok(&Token::Function(ref name)) if name.eq_ignore_ascii_case("calc") => {},
Ok(t) => return Err(location.new_unexpected_token_error(t.clone())),
Err(e) => return Err(e.into()),