Format remaining files

This commit is contained in:
Pyfisch 2018-11-06 13:01:35 +01:00
parent bf47f90da6
commit cb07debcb6
252 changed files with 5944 additions and 3744 deletions

View file

@ -113,13 +113,15 @@ impl From<nsStyleCoord_CalcValue> for NonNegativeLengthOrPercentageOrAuto {
use style_traits::values::specified::AllowedNumericType;
use values::generics::NonNegative;
NonNegative(if other.mLength < 0 || other.mPercent < 0. {
LengthOrPercentageOrAuto::Calc(
CalcLengthOrPercentage::with_clamping_mode(
Au(other.mLength).into(),
if other.mHasPercent { Some(Percentage(other.mPercent)) } else { None },
AllowedNumericType::NonNegative,
)
)
LengthOrPercentageOrAuto::Calc(CalcLengthOrPercentage::with_clamping_mode(
Au(other.mLength).into(),
if other.mHasPercent {
Some(Percentage(other.mPercent))
} else {
None
},
AllowedNumericType::NonNegative,
))
} else {
other.into()
})
@ -625,7 +627,8 @@ impl nsStyleImage {
position: LengthOrPercentage::from_gecko_style_coord(&stop.mLocation),
})
}
}).collect();
})
.collect();
let compat_mode = if gecko_gradient.mMozLegacySyntax {
CompatMode::Moz
@ -718,7 +721,8 @@ pub mod basic_shape {
match other.mType {
StyleShapeSourceType::URL => unsafe {
let shape_image = &*other.__bindgen_anon_1.mShapeImage.as_ref().mPtr;
let other_url = RefPtr::new(*shape_image.__bindgen_anon_1.mURLValue.as_ref() as *mut _);
let other_url =
RefPtr::new(*shape_image.__bindgen_anon_1.mURLValue.as_ref() as *mut _);
let url = ComputedUrl::from_url_value(other_url);
ShapeSource::ImageOrUrl(url)
},

View file

@ -305,15 +305,15 @@ bitflags! {
}
fn primary_pointer_capabilities(device: &Device) -> PointerCapabilities {
PointerCapabilities::from_bits_truncate(
unsafe { bindings::Gecko_MediaFeatures_PrimaryPointerCapabilities(device.document()) }
)
PointerCapabilities::from_bits_truncate(unsafe {
bindings::Gecko_MediaFeatures_PrimaryPointerCapabilities(device.document())
})
}
fn all_pointer_capabilities(device: &Device) -> PointerCapabilities {
PointerCapabilities::from_bits_truncate(
unsafe { bindings::Gecko_MediaFeatures_AllPointerCapabilities(device.document()) }
)
PointerCapabilities::from_bits_truncate(unsafe {
bindings::Gecko_MediaFeatures_AllPointerCapabilities(device.document())
})
}
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]

View file

@ -3,29 +3,29 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* This file contains a helper macro includes all supported non-tree-structural
* pseudo-classes.
*
* This file contains a helper macro includes all supported non-tree-structural
* pseudo-classes.
*
* FIXME: Find a way to autogenerate this file.
*
* Expected usage is as follows:
* ```
* macro_rules! pseudo_class_macro{
* ([$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*]) => {
* // do stuff
* }
* }
* apply_non_ts_list!(pseudo_class_macro)
* ```
*
* $gecko_type can be either "_" or an ident in Gecko's CSSPseudoClassType.
* $state can be either "_" or an expression of type ElementState. If present,
* the semantics are that the pseudo-class matches if any of the bits in
* $state are set on the element.
* $flags can be either "_" or an expression of type NonTSPseudoClassFlag,
* see selector_parser.rs for more details.
*/
* FIXME: Find a way to autogenerate this file.
*
* Expected usage is as follows:
* ```
* macro_rules! pseudo_class_macro{
* ([$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*]) => {
* // do stuff
* }
* }
* apply_non_ts_list!(pseudo_class_macro)
* ```
*
* $gecko_type can be either "_" or an ident in Gecko's CSSPseudoClassType.
* $state can be either "_" or an expression of type ElementState. If present,
* the semantics are that the pseudo-class matches if any of the bits in
* $state are set on the element.
* $flags can be either "_" or an expression of type NonTSPseudoClassFlag,
* see selector_parser.rs for more details.
*/
macro_rules! apply_non_ts_list {
($apply_macro:ident) => {

View file

@ -123,10 +123,7 @@ impl SpecifiedUrl {
fn from_css_url_with_cors(url: CssUrl, cors: CORSMode) -> Self {
let url_value = unsafe {
let ptr = bindings::Gecko_URLValue_Create(
url.0.clone().into_strong(),
cors,
);
let ptr = bindings::Gecko_URLValue_Create(url.0.clone().into_strong(), cors);
// We do not expect Gecko_URLValue_Create returns null.
debug_assert!(!ptr.is_null());
RefPtr::from_addrefed(ptr)
@ -261,11 +258,7 @@ impl ToCss for ComputedUrl {
where
W: Write,
{
serialize_computed_url(
&self.0.url_value,
dest,
bindings::Gecko_GetComputedURLSpec,
)
serialize_computed_url(&self.0.url_value, dest, bindings::Gecko_GetComputedURLSpec)
}
}

View file

@ -537,7 +537,8 @@ impl CounterStyleOrNone {
.map(|symbol| match *symbol {
Symbol::String(ref s) => nsCStr::from(s),
Symbol::Ident(_) => unreachable!("Should not have identifier in symbols()"),
}).collect();
})
.collect();
let symbols: Vec<_> = symbols
.iter()
.map(|symbol| symbol as &nsACString as *const _)

View file

@ -937,7 +937,8 @@ impl<'le> GeckoElement<'le> {
.animate(
to.as_ref().unwrap(),
Procedure::Interpolate { progress: 0.5 },
).is_ok()
)
.is_ok()
}
}
@ -1278,7 +1279,8 @@ impl<'le> TElement for GeckoElement<'le> {
Some(
Locked::<PropertyDeclarationBlock>::as_arc(
&*(&raw as *const &structs::RawServoDeclarationBlock),
).borrow_arc(),
)
.borrow_arc(),
)
}
}