mirror of
https://github.com/servo/servo.git
synced 2025-09-20 20:00:13 +01:00
style: Reformat recent style system changes.
This commit is contained in:
parent
87ec2cefc5
commit
81f40a57e4
13 changed files with 207 additions and 214 deletions
|
@ -474,10 +474,7 @@ pub struct CounterRange {
|
||||||
/// Empty represents 'auto'
|
/// Empty represents 'auto'
|
||||||
#[derive(Clone, Debug, ToShmem, ToCss)]
|
#[derive(Clone, Debug, ToShmem, ToCss)]
|
||||||
#[css(comma)]
|
#[css(comma)]
|
||||||
pub struct CounterRanges(
|
pub struct CounterRanges(#[css(iterable, if_empty = "auto")] pub crate::OwnedSlice<CounterRange>);
|
||||||
#[css(iterable, if_empty = "auto")]
|
|
||||||
pub crate::OwnedSlice<CounterRange>,
|
|
||||||
);
|
|
||||||
|
|
||||||
/// A bound found in `CounterRanges`.
|
/// A bound found in `CounterRanges`.
|
||||||
#[derive(Clone, Copy, Debug, ToCss, ToShmem)]
|
#[derive(Clone, Copy, Debug, ToCss, ToShmem)]
|
||||||
|
@ -503,13 +500,9 @@ impl Parse for CounterRanges {
|
||||||
let ranges = input.parse_comma_separated(|input| {
|
let ranges = input.parse_comma_separated(|input| {
|
||||||
let start = parse_bound(context, input)?;
|
let start = parse_bound(context, input)?;
|
||||||
let end = parse_bound(context, input)?;
|
let end = parse_bound(context, input)?;
|
||||||
if let (CounterBound::Integer(start), CounterBound::Integer(end)) =
|
if let (CounterBound::Integer(start), CounterBound::Integer(end)) = (start, end) {
|
||||||
(start, end)
|
|
||||||
{
|
|
||||||
if start > end {
|
if start > end {
|
||||||
return Err(
|
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
|
||||||
input.new_custom_error(StyleParseErrorKind::UnspecifiedError)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(CounterRange { start, end })
|
Ok(CounterRange { start, end })
|
||||||
|
|
|
@ -62,9 +62,8 @@ pub fn profiler_is_active() -> bool {
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::sync::atomic::{AtomicU32, Ordering};
|
use std::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
||||||
let active_and_features: &AtomicU32 = unsafe {
|
let active_and_features: &AtomicU32 =
|
||||||
mem::transmute(&detail::RacyFeatures_sActiveAndFeatures)
|
unsafe { mem::transmute(&detail::RacyFeatures_sActiveAndFeatures) };
|
||||||
};
|
|
||||||
(active_and_features.load(Ordering::Relaxed) & detail::RacyFeatures_Active) != 0
|
(active_and_features.load(Ordering::Relaxed) & detail::RacyFeatures_Active) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,9 +112,8 @@ macro_rules! define_keyword_type {
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! profiler_label {
|
macro_rules! profiler_label {
|
||||||
($label_type:ident) => {
|
($label_type:ident) => {
|
||||||
let mut _profiler_label: $crate::gecko_bindings::structs::AutoProfilerLabel = unsafe {
|
let mut _profiler_label: $crate::gecko_bindings::structs::AutoProfilerLabel =
|
||||||
::std::mem::uninitialized()
|
unsafe { ::std::mem::uninitialized() };
|
||||||
};
|
|
||||||
let _profiler_label = if $crate::gecko::profiler::profiler_is_active() {
|
let _profiler_label = if $crate::gecko::profiler::profiler_is_active() {
|
||||||
unsafe {
|
unsafe {
|
||||||
Some($crate::gecko::profiler::AutoProfilerLabel::new(
|
Some($crate::gecko::profiler::AutoProfilerLabel::new(
|
||||||
|
@ -125,12 +124,12 @@ macro_rules! profiler_label {
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// No-op when the Gecko profiler is not available.
|
/// No-op when the Gecko profiler is not available.
|
||||||
#[cfg(not(feature = "gecko_profiler"))]
|
#[cfg(not(feature = "gecko_profiler"))]
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! profiler_label {
|
macro_rules! profiler_label {
|
||||||
($label_type:ident) => {}
|
($label_type:ident) => {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,8 +105,7 @@ where
|
||||||
MatchingMode::Normal => element.rule_hash_target(),
|
MatchingMode::Normal => element.rule_hash_target(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let matches_user_and_author_rules =
|
let matches_user_and_author_rules = rule_hash_target.matches_user_and_author_rules();
|
||||||
rule_hash_target.matches_user_and_author_rules();
|
|
||||||
|
|
||||||
// Gecko definitely has pseudo-elements with style attributes, like
|
// Gecko definitely has pseudo-elements with style attributes, like
|
||||||
// ::-moz-color-swatch.
|
// ::-moz-color-swatch.
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
use crate::properties::PropertyId;
|
use crate::properties::PropertyId;
|
||||||
use crate::values::computed::length::LengthPercentage;
|
use crate::values::computed::length::LengthPercentage;
|
||||||
use crate::values::computed::url::{ComputedUrl, ComputedImageUrl};
|
use crate::values::computed::url::{ComputedImageUrl, ComputedUrl};
|
||||||
use crate::values::computed::Angle as ComputedAngle;
|
use crate::values::computed::Angle as ComputedAngle;
|
||||||
use crate::values::computed::Image;
|
use crate::values::computed::Image;
|
||||||
use crate::values::specified::SVGPathData;
|
use crate::values::specified::SVGPathData;
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
use crate::values::computed::length::{NonNegativeLength, NonNegativeLengthPercentage};
|
use crate::values::computed::length::{NonNegativeLength, NonNegativeLengthPercentage};
|
||||||
use crate::values::computed::{NonNegativeNumber, NonNegativeNumberOrPercentage};
|
use crate::values::computed::{NonNegativeNumber, NonNegativeNumberOrPercentage};
|
||||||
use crate::values::generics::border::BorderCornerRadius as GenericBorderCornerRadius;
|
use crate::values::generics::border::BorderCornerRadius as GenericBorderCornerRadius;
|
||||||
use crate::values::generics::border::GenericBorderImageSideWidth;
|
|
||||||
use crate::values::generics::border::BorderImageSlice as GenericBorderImageSlice;
|
use crate::values::generics::border::BorderImageSlice as GenericBorderImageSlice;
|
||||||
use crate::values::generics::border::BorderRadius as GenericBorderRadius;
|
use crate::values::generics::border::BorderRadius as GenericBorderRadius;
|
||||||
use crate::values::generics::border::BorderSpacing as GenericBorderSpacing;
|
use crate::values::generics::border::BorderSpacing as GenericBorderSpacing;
|
||||||
|
use crate::values::generics::border::GenericBorderImageSideWidth;
|
||||||
use crate::values::generics::rect::Rect;
|
use crate::values::generics::rect::Rect;
|
||||||
use crate::values::generics::size::Size2D;
|
use crate::values::generics::size::Size2D;
|
||||||
use crate::values::generics::NonNegative;
|
use crate::values::generics::NonNegative;
|
||||||
|
|
|
@ -455,10 +455,7 @@ where
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_computed_value(computed: &Self::ComputedValue) -> Self {
|
fn from_computed_value(computed: &Self::ComputedValue) -> Self {
|
||||||
computed
|
computed.iter().map(T::from_computed_value).collect()
|
||||||
.iter()
|
|
||||||
.map(T::from_computed_value)
|
|
||||||
.collect()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -240,16 +240,24 @@ where
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[css(comma, function = "interpolatematrix")]
|
#[css(comma, function = "interpolatematrix")]
|
||||||
InterpolateMatrix {
|
InterpolateMatrix {
|
||||||
from_list: GenericTransform<GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>,
|
from_list: GenericTransform<
|
||||||
to_list: GenericTransform<GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>,
|
GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>,
|
||||||
|
>,
|
||||||
|
to_list: GenericTransform<
|
||||||
|
GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>,
|
||||||
|
>,
|
||||||
progress: computed::Percentage,
|
progress: computed::Percentage,
|
||||||
},
|
},
|
||||||
/// A intermediate type for accumulation of mismatched transform lists.
|
/// A intermediate type for accumulation of mismatched transform lists.
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[css(comma, function = "accumulatematrix")]
|
#[css(comma, function = "accumulatematrix")]
|
||||||
AccumulateMatrix {
|
AccumulateMatrix {
|
||||||
from_list: GenericTransform<GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>,
|
from_list: GenericTransform<
|
||||||
to_list: GenericTransform<GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>,
|
GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>,
|
||||||
|
>,
|
||||||
|
to_list: GenericTransform<
|
||||||
|
GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>,
|
||||||
|
>,
|
||||||
count: Integer,
|
count: Integer,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,9 +140,7 @@ impl Parse for Quotes {
|
||||||
loop {
|
loop {
|
||||||
let location = input.current_source_location();
|
let location = input.current_source_location();
|
||||||
let opening = match input.next() {
|
let opening = match input.next() {
|
||||||
Ok(&Token::QuotedString(ref value)) => {
|
Ok(&Token::QuotedString(ref value)) => value.as_ref().to_owned().into(),
|
||||||
value.as_ref().to_owned().into()
|
|
||||||
},
|
|
||||||
Ok(t) => return Err(location.new_unexpected_token_error(t.clone())),
|
Ok(t) => return Err(location.new_unexpected_token_error(t.clone())),
|
||||||
Err(_) => break,
|
Err(_) => break,
|
||||||
};
|
};
|
||||||
|
|
|
@ -298,11 +298,7 @@ impl Parse for MozContextProperties {
|
||||||
return Ok(Self::default());
|
return Ok(Self::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
let ident = CustomIdent::from_ident(
|
let ident = CustomIdent::from_ident(location, ident, &["all", "none", "auto"])?;
|
||||||
location,
|
|
||||||
ident,
|
|
||||||
&["all", "none", "auto"],
|
|
||||||
)?;
|
|
||||||
|
|
||||||
if ident.0 == atom!("fill") {
|
if ident.0 == atom!("fill") {
|
||||||
bits.insert(ContextPropertyBits::FILL);
|
bits.insert(ContextPropertyBits::FILL);
|
||||||
|
|
|
@ -162,9 +162,9 @@ impl Parse for TextOverflowSide {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Token::QuotedString(ref v) => Ok(TextOverflowSide::String(
|
Token::QuotedString(ref v) => {
|
||||||
v.as_ref().to_owned().into(),
|
Ok(TextOverflowSide::String(v.as_ref().to_owned().into()))
|
||||||
)),
|
},
|
||||||
ref t => Err(location.new_unexpected_token_error(t.clone())),
|
ref t => Err(location.new_unexpected_token_error(t.clone())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,8 @@ impl Transform {
|
||||||
return Ok(generic::Transform::none());
|
return Ok(generic::Transform::none());
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(generic::Transform(Space::parse(input, |input| {
|
Ok(generic::Transform(
|
||||||
|
Space::parse(input, |input| {
|
||||||
let function = input.expect_function()?.clone();
|
let function = input.expect_function()?.clone();
|
||||||
input.parse_nested_block(|input| {
|
input.parse_nested_block(|input| {
|
||||||
let location = input.current_source_location();
|
let location = input.current_source_location();
|
||||||
|
@ -214,11 +215,14 @@ impl Transform {
|
||||||
_ => Err(()),
|
_ => Err(()),
|
||||||
};
|
};
|
||||||
result.map_err(|()| {
|
result.map_err(|()| {
|
||||||
location
|
location.new_custom_error(StyleParseErrorKind::UnexpectedFunction(
|
||||||
.new_custom_error(StyleParseErrorKind::UnexpectedFunction(function.clone()))
|
function.clone(),
|
||||||
|
))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})?.into()))
|
})?
|
||||||
|
.into(),
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
//! A thin atomically-reference-counted slice.
|
//! A thin atomically-reference-counted slice.
|
||||||
|
|
||||||
use servo_arc::ThinArc;
|
use servo_arc::ThinArc;
|
||||||
use std::{iter, mem};
|
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::ptr::NonNull;
|
use std::ptr::NonNull;
|
||||||
|
use std::{iter, mem};
|
||||||
|
|
||||||
/// A canary that we stash in ArcSlices.
|
/// A canary that we stash in ArcSlices.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue