aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/selectors/builder.rs3
-rw-r--r--components/selectors/parser.rs63
-rw-r--r--components/selectors/tree.rs5
-rw-r--r--components/style/stylist.rs10
-rw-r--r--components/style/values/computed/mod.rs2
-rw-r--r--components/style/values/computed/text.rs2
-rw-r--r--components/style/values/specified/box.rs4
-rw-r--r--components/style/values/specified/image.rs28
-rw-r--r--components/style/values/specified/mod.rs2
-rw-r--r--components/style/values/specified/text.rs10
10 files changed, 73 insertions, 56 deletions
diff --git a/components/selectors/builder.rs b/components/selectors/builder.rs
index 73c1575371c..b548ceb83ce 100644
--- a/components/selectors/builder.rs
+++ b/components/selectors/builder.rs
@@ -270,8 +270,7 @@ where
Component::Combinator(..) => {
unreachable!("Found combinator in simple selectors vector?");
},
- Component::Part(..) |
- Component::PseudoElement(..) | Component::LocalName(..) => {
+ Component::Part(..) | Component::PseudoElement(..) | Component::LocalName(..) => {
specificity.element_selectors += 1
},
Component::Slotted(ref selector) => {
diff --git a/components/selectors/parser.rs b/components/selectors/parser.rs
index 45cbb56236f..a924bbc17d0 100644
--- a/components/selectors/parser.rs
+++ b/components/selectors/parser.rs
@@ -30,10 +30,14 @@ pub trait PseudoElement: Sized + ToCss {
/// Whether the pseudo-element supports a given state selector to the right
/// of it.
- fn accepts_state_pseudo_classes(&self) -> bool { false }
+ fn accepts_state_pseudo_classes(&self) -> bool {
+ false
+ }
/// Whether this pseudo-element is valid after a ::slotted(..) pseudo.
- fn valid_after_slotted(&self) -> bool { false }
+ fn valid_after_slotted(&self) -> bool {
+ false
+ }
}
/// A trait that represents a pseudo-class.
@@ -116,7 +120,10 @@ impl SelectorParsingState {
#[inline]
fn allows_non_functional_pseudo_classes(self) -> bool {
- !self.intersects(SelectorParsingState::AFTER_SLOTTED | SelectorParsingState::AFTER_NON_STATEFUL_PSEUDO_ELEMENT)
+ !self.intersects(
+ SelectorParsingState::AFTER_SLOTTED |
+ SelectorParsingState::AFTER_NON_STATEFUL_PSEUDO_ELEMENT,
+ )
}
#[inline]
@@ -1221,9 +1228,7 @@ impl ToCss for Combinator {
Combinator::Descendant => dest.write_str(" "),
Combinator::NextSibling => dest.write_str(" + "),
Combinator::LaterSibling => dest.write_str(" ~ "),
- Combinator::PseudoElement |
- Combinator::Part |
- Combinator::SlotAssignment => Ok(()),
+ Combinator::PseudoElement | Combinator::Part | Combinator::SlotAssignment => Ok(()),
}
}
}
@@ -1979,11 +1984,10 @@ where
let mut state = SelectorParsingState::empty();
loop {
- let parse_result =
- match parse_one_simple_selector(parser, input, state)? {
- None => break,
- Some(result) => result,
- };
+ let parse_result = match parse_one_simple_selector(parser, input, state)? {
+ None => break,
+ Some(result) => result,
+ };
empty = false;
@@ -2034,9 +2038,7 @@ where
Impl: SelectorImpl,
{
if !state.allows_functional_pseudo_classes() {
- return Err(input.new_custom_error(
- SelectorParseErrorKind::InvalidState
- ));
+ return Err(input.new_custom_error(SelectorParseErrorKind::InvalidState));
}
debug_assert!(state.allows_tree_structural_pseudo_classes());
match_ignore_ascii_case! { &name,
@@ -2102,7 +2104,7 @@ where
Err(..) => {
input.reset(&start);
return Ok(None);
- }
+ },
};
Ok(Some(match token {
@@ -2122,7 +2124,7 @@ where
Token::Ident(ref class) => class,
ref t => {
let e = SelectorParseErrorKind::ClassNeedsIdent(t.clone());
- return Err(location.new_custom_error(e))
+ return Err(location.new_custom_error(e));
},
};
let class = Component::Class(class.as_ref().into());
@@ -2149,8 +2151,7 @@ where
return Err(input.new_custom_error(e));
},
};
- let is_pseudo_element =
- !is_single_colon || is_css2_pseudo_element(&name);
+ let is_pseudo_element = !is_single_colon || is_css2_pseudo_element(&name);
if is_pseudo_element {
if state.intersects(SelectorParsingState::AFTER_PSEUDO_ELEMENT) {
return Err(input.new_custom_error(SelectorParseErrorKind::InvalidState));
@@ -2158,7 +2159,9 @@ where
let pseudo_element = if is_functional {
if P::parse_part(parser) && name.eq_ignore_ascii_case("part") {
if !state.allows_part() {
- return Err(input.new_custom_error(SelectorParseErrorKind::InvalidState));
+ return Err(
+ input.new_custom_error(SelectorParseErrorKind::InvalidState)
+ );
}
let name = input.parse_nested_block(|input| {
Ok(input.expect_ident()?.as_ref().into())
@@ -2167,7 +2170,9 @@ where
}
if P::parse_slotted(parser) && name.eq_ignore_ascii_case("slotted") {
if !state.allows_slotted() {
- return Err(input.new_custom_error(SelectorParseErrorKind::InvalidState));
+ return Err(
+ input.new_custom_error(SelectorParseErrorKind::InvalidState)
+ );
}
let selector = input.parse_nested_block(|input| {
parse_inner_compound_selector(parser, input)
@@ -2181,7 +2186,9 @@ where
P::parse_pseudo_element(parser, location, name)?
};
- if state.intersects(SelectorParsingState::AFTER_SLOTTED) && !pseudo_element.valid_after_slotted() {
+ if state.intersects(SelectorParsingState::AFTER_SLOTTED) &&
+ !pseudo_element.valid_after_slotted()
+ {
return Err(input.new_custom_error(SelectorParseErrorKind::InvalidState));
}
SimpleSelectorParseResult::PseudoElement(pseudo_element)
@@ -2198,7 +2205,7 @@ where
},
_ => {
input.reset(&start);
- return Ok(None)
+ return Ok(None);
},
}))
}
@@ -2234,7 +2241,9 @@ where
}
let pseudo_class = P::parse_non_ts_pseudo_class(parser, location, name)?;
- if state.intersects(SelectorParsingState::AFTER_PSEUDO_ELEMENT) && !pseudo_class.is_user_action_state() {
+ if state.intersects(SelectorParsingState::AFTER_PSEUDO_ELEMENT) &&
+ !pseudo_class.is_user_action_state()
+ {
return Err(location.new_custom_error(SelectorParseErrorKind::InvalidState));
}
Ok(Component::NonTSPseudoClass(pseudo_class))
@@ -2266,9 +2275,13 @@ pub mod tests {
impl parser::PseudoElement for PseudoElement {
type Impl = DummySelectorImpl;
- fn accepts_state_pseudo_classes(&self) -> bool { true }
+ fn accepts_state_pseudo_classes(&self) -> bool {
+ true
+ }
- fn valid_after_slotted(&self) -> bool { true }
+ fn valid_after_slotted(&self) -> bool {
+ true
+ }
}
impl parser::NonTSPseudoClass for PseudoClass {
diff --git a/components/selectors/tree.rs b/components/selectors/tree.rs
index b57876308a5..52599893d2f 100644
--- a/components/selectors/tree.rs
+++ b/components/selectors/tree.rs
@@ -110,10 +110,7 @@ pub trait Element: Sized + Clone + Debug {
case_sensitivity: CaseSensitivity,
) -> bool;
- fn is_part(
- &self,
- name: &<Self::Impl as SelectorImpl>::PartName,
- ) -> bool;
+ fn is_part(&self, name: &<Self::Impl as SelectorImpl>::PartName) -> bool;
/// Returns whether this element matches `:empty`.
///
diff --git a/components/style/stylist.rs b/components/style/stylist.rs
index 08f3cee0464..2953e3f0671 100644
--- a/components/style/stylist.rs
+++ b/components/style/stylist.rs
@@ -49,8 +49,8 @@ use selectors::NthIndexCache;
use servo_arc::{Arc, ArcBorrow};
use smallbitvec::SmallBitVec;
use smallvec::SmallVec;
-use std::{mem, ops};
use std::sync::Mutex;
+use std::{mem, ops};
use style_traits::viewport::ViewportConstraints;
/// The type of the stylesheets that the stylist contains.
@@ -271,12 +271,8 @@ impl DocumentCascadeData {
let origin_sheets = flusher.origin_sheets(Origin::UserAgent);
let _unused_cascade_datas = {
let mut ua_cache = UA_CASCADE_DATA_CACHE.lock().unwrap();
- self.user_agent = ua_cache.lookup(
- origin_sheets,
- device,
- quirks_mode,
- guards.ua_or_user,
- )?;
+ self.user_agent =
+ ua_cache.lookup(origin_sheets, device, quirks_mode, guards.ua_or_user)?;
debug!("User agent data cache size {:?}", ua_cache.len());
ua_cache.take_unused()
};
diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs
index 78384ea6b94..3eb0c16836c 100644
--- a/components/style/values/computed/mod.rs
+++ b/components/style/values/computed/mod.rs
@@ -86,8 +86,8 @@ pub use self::transform::{TransformOrigin, TransformStyle, Translate};
#[cfg(feature = "gecko")]
pub use self::ui::CursorImage;
pub use self::ui::{Cursor, MozForceBrokenImageIcon, UserSelect};
-pub use super::specified::{BorderStyle, TextDecorationLine};
pub use super::specified::TextTransform;
+pub use super::specified::{BorderStyle, TextDecorationLine};
pub use super::{Auto, Either, None_};
pub use app_units::Au;
diff --git a/components/style/values/computed/text.rs b/components/style/values/computed/text.rs
index b88ba850536..c29d3d45210 100644
--- a/components/style/values/computed/text.rs
+++ b/components/style/values/computed/text.rs
@@ -19,9 +19,9 @@ use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss};
pub use crate::values::specified::TextAlignKeyword as TextAlign;
+pub use crate::values::specified::TextTransform;
pub use crate::values::specified::{OverflowWrap, WordBreak};
pub use crate::values::specified::{TextDecorationLine, TextEmphasisPosition};
-pub use crate::values::specified::TextTransform;
/// A computed value for the `initial-letter` property.
pub type InitialLetter = GenericInitialLetter<CSSFloat, CSSInteger>;
diff --git a/components/style/values/specified/box.rs b/components/style/values/specified/box.rs
index 7b2c5a34648..31a79c141e1 100644
--- a/components/style/values/specified/box.rs
+++ b/components/style/values/specified/box.rs
@@ -280,7 +280,9 @@ impl Parse for VerticalAlign {
return Ok(GenericVerticalAlign::Length(lp));
}
- Ok(GenericVerticalAlign::Keyword(VerticalAlignKeyword::parse(input)?))
+ Ok(GenericVerticalAlign::Keyword(VerticalAlignKeyword::parse(
+ input,
+ )?))
}
}
diff --git a/components/style/values/specified/image.rs b/components/style/values/specified/image.rs
index a387d8e07c2..ad2ecb18086 100644
--- a/components/style/values/specified/image.rs
+++ b/components/style/values/specified/image.rs
@@ -510,13 +510,16 @@ impl Gradient {
items.sort_by(|a, b| {
match (a, b) {
(
- &generic::GradientItem::ComplexColorStop { position: ref a_position, .. },
- &generic::GradientItem::ComplexColorStop { position: ref b_position, .. },
+ &generic::GradientItem::ComplexColorStop {
+ position: ref a_position,
+ ..
+ },
+ &generic::GradientItem::ComplexColorStop {
+ position: ref b_position,
+ ..
+ },
) => match (a_position, b_position) {
- (
- &LengthPercentage::Percentage(a),
- &LengthPercentage::Percentage(b),
- ) => {
+ (&LengthPercentage::Percentage(a), &LengthPercentage::Percentage(b)) => {
return a.0.partial_cmp(&b.0).unwrap_or(Ordering::Equal);
},
_ => {},
@@ -786,7 +789,7 @@ impl LineDirection {
#[cfg(feature = "gecko")]
{
// `-moz-` prefixed linear gradient can be both Angle and Position.
- if *compat_mode == CompatMode::Moz && !simple_moz_gradient(){
+ if *compat_mode == CompatMode::Moz && !simple_moz_gradient() {
let position = i.try(|i| LegacyPosition::parse(context, i)).ok();
if _angle.is_none() {
_angle = i.try(|i| Angle::parse(context, i)).ok();
@@ -961,10 +964,13 @@ impl GradientItem {
if let Ok(multi_position) = input.try(|i| LengthPercentage::parse(context, i)) {
let stop_color = stop.color.clone();
items.push(stop.into_item());
- items.push(ColorStop {
- color: stop_color,
- position: Some(multi_position),
- }.into_item());
+ items.push(
+ ColorStop {
+ color: stop_color,
+ position: Some(multi_position),
+ }
+ .into_item(),
+ );
} else {
items.push(stop.into_item());
}
diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs
index 64a45231c03..7dbb93f6319 100644
--- a/components/style/values/specified/mod.rs
+++ b/components/style/values/specified/mod.rs
@@ -80,10 +80,10 @@ pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind};
pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth};
pub use self::svg_path::SVGPathData;
pub use self::table::XSpan;
+pub use self::text::TextTransform;
pub use self::text::{InitialLetter, LetterSpacing, LineHeight, TextAlign};
pub use self::text::{OverflowWrap, TextEmphasisPosition, TextEmphasisStyle, WordBreak};
pub use self::text::{TextAlignKeyword, TextDecorationLine, TextOverflow, WordSpacing};
-pub use self::text::TextTransform;
pub use self::time::Time;
pub use self::transform::{Rotate, Scale, Transform};
pub use self::transform::{TransformOrigin, TransformStyle, Translate};
diff --git a/components/style/values/specified/text.rs b/components/style/values/specified/text.rs
index 7f1b438ea24..6be20f58618 100644
--- a/components/style/values/specified/text.rs
+++ b/components/style/values/specified/text.rs
@@ -361,7 +361,8 @@ impl TextDecorationLine {
SpecifiedValueInfo,
ToComputedValue,
ToResolvedValue,
- ToShmem)]
+ ToShmem,
+)]
#[repr(C)]
/// Specified value of the text-transform property, stored in two parts:
/// the case-related transforms (mutually exclusive, only one may be in effect), and others (non-exclusive).
@@ -468,7 +469,8 @@ impl ToCss for TextTransform {
ToComputedValue,
ToCss,
ToResolvedValue,
- ToShmem)]
+ ToShmem,
+)]
#[repr(C)]
/// Specified keyword values for case transforms in the text-transform property. (These are exclusive.)
pub enum TextTransformCase {
@@ -563,7 +565,9 @@ pub enum TextAlignKeyword {
}
/// Specified value of text-align property.
-#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
+#[derive(
+ Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem,
+)]
pub enum TextAlign {
/// Keyword value of text-align property.
Keyword(TextAlignKeyword),