Skip to content
Permalink
Browse files

style: Reformat recent changes.

  • Loading branch information...
emilio committed Mar 12, 2019
1 parent 9a8cee2 commit 5aeab7adb1bbad63e926e6736df78121aaf91f23
@@ -515,11 +515,7 @@ impl<'a> CustomPropertiesBuilder<'a> {
}

/// Cascade a given custom property declaration.
pub fn cascade(
&mut self,
declaration: &'a CustomDeclaration,
origin: Origin,
) {
pub fn cascade(&mut self, declaration: &'a CustomDeclaration, origin: Origin) {
let CustomDeclaration {
ref name,
ref value,
@@ -116,10 +116,7 @@ impl Device {
};

unsafe {
bindings::Gecko_AnimationNameMayBeReferencedFromStyle(
pc,
name.as_atom().as_ptr(),
)
bindings::Gecko_AnimationNameMayBeReferencedFromStyle(pc, name.as_atom().as_ptr())
}
}

@@ -169,7 +166,12 @@ impl Device {
#[inline]
pub fn pres_context(&self) -> Option<&structs::nsPresContext> {
unsafe {
self.document().mPresShell.as_ref()?.mPresContext.mRawPtr.as_ref()
self.document()
.mPresShell
.as_ref()?
.mPresContext
.mRawPtr
.as_ref()
}
}

@@ -268,9 +270,8 @@ impl Device {
if doc.mIsBeingUsedAsImage() {
return true;
}
let document_color_use = unsafe {
structs::StaticPrefs_sVarCache_browser_display_document_color_use
};
let document_color_use =
unsafe { structs::StaticPrefs_sVarCache_browser_display_document_color_use };
let prefs = self.pref_sheet_prefs();
match document_color_use {
1 => true,
@@ -1246,8 +1246,7 @@ 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::Document ==
device.document() as *const _
self.as_node().owner_doc().0 as *const structs::Document == device.document() as *const _
}

fn style_attribute(&self) -> Option<ArcBorrow<Locked<PropertyDeclarationBlock>>> {
@@ -5,8 +5,8 @@
//! Rust helpers for Gecko's `nsStyleCoord`.

use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs::{nsStyleCoord, nsStyleCoord_Calc, nsStyleCoord_CalcValue};
use crate::gecko_bindings::structs::nsStyleSides;
use crate::gecko_bindings::structs::{nsStyleCoord, nsStyleCoord_Calc, nsStyleCoord_CalcValue};
use crate::gecko_bindings::structs::{nsStyleUnion, nsStyleUnit, nscoord};
use std::mem;

@@ -11,7 +11,7 @@ use crate::applicable_declarations::ApplicableDeclarationList;
use crate::gecko::selector_parser::PseudoElement;
use crate::properties::{Importance, LonghandIdSet, PropertyDeclarationBlock};
use crate::shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
use crate::stylesheets::{StyleRule, Origin};
use crate::stylesheets::{Origin, StyleRule};
use crate::thread_state;
#[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
@@ -663,10 +663,8 @@ impl CascadeLevel {
#[inline]
pub fn origin(&self) -> Origin {
match *self {
CascadeLevel::UAImportant |
CascadeLevel::UANormal => Origin::UserAgent,
CascadeLevel::UserImportant |
CascadeLevel::UserNormal => Origin::User,
CascadeLevel::UAImportant | CascadeLevel::UANormal => Origin::UserAgent,
CascadeLevel::UserImportant | CascadeLevel::UserNormal => Origin::User,
CascadeLevel::PresHints |
CascadeLevel::InnerShadowNormal |
CascadeLevel::SameTreeAuthorNormal |
@@ -76,7 +76,11 @@ impl OriginSet {
/// See the `OriginSet` documentation for information about the order
/// origins are iterated.
pub fn iter(&self) -> OriginSetIterator {
OriginSetIterator { set: *self, cur: 0, rev: false }
OriginSetIterator {
set: *self,
cur: 0,
rev: false,
}
}
}

@@ -8,7 +8,7 @@ use super::{Animate, Procedure, ToAnimatedZero};
use crate::properties::animated_properties::ListAnimation;
use crate::values::animated::color::Color as AnimatedColor;
use crate::values::computed::url::ComputedUrl;
use crate::values::distance::{SquaredDistance, ComputeSquaredDistance};
use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
use crate::values::generics::svg::{SVGPaint, SVGStrokeDashArray};

/// Animated SVGPaint.
@@ -76,7 +76,7 @@ pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind};
pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth};
pub use self::table::XSpan;
pub use self::text::{InitialLetter, LetterSpacing, LineHeight};
pub use self::text::{OverflowWrap, TextOverflow, WordSpacing, WordBreak};
pub use self::text::{OverflowWrap, TextOverflow, WordBreak, WordSpacing};
pub use self::text::{TextAlign, TextEmphasisPosition, TextEmphasisStyle};
pub use self::time::Time;
pub use self::transform::{Rotate, Scale, Transform, TransformOperation};
@@ -57,9 +57,7 @@ impl SVGWidth {
/// `1px`.
pub fn one() -> Self {
use crate::values::generics::NonNegative;
generic::SVGLength::LengthPercentage(
NonNegative(LengthPercentage::one()),
)
generic::SVGLength::LengthPercentage(NonNegative(LengthPercentage::one()))
}
}

@@ -18,9 +18,9 @@ use crate::Zero;
use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss};

pub use crate::values::specified::{OverflowWrap, WordBreak};
pub use crate::values::specified::TextAlignKeyword as TextAlign;
pub use crate::values::specified::TextEmphasisPosition;
pub use crate::values::specified::{OverflowWrap, WordBreak};

/// A computed value for the `initial-letter` property.
pub type InitialLetter = GenericInitialLetter<CSSFloat, CSSInteger>;
@@ -592,9 +592,7 @@ impl Translate {
/// Convert Translate to TransformOperation.
pub fn from_transform_operation(operation: &TransformOperation) -> Translate {
match *operation {
generic::TransformOperation::Translate(tx, ty) => {
generic::Translate::Translate(tx, ty)
},
generic::TransformOperation::Translate(tx, ty) => generic::Translate::Translate(tx, ty),
generic::TransformOperation::Translate3D(tx, ty, tz) => {
generic::Translate::Translate3D(tx, ty, tz)
},
@@ -215,7 +215,19 @@ pub struct GreaterThanOrEqualToOne<T>(pub T);

/// A clip rect for clip and image-region
#[allow(missing_docs)]
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, ToComputedValue, ToCss)]
#[derive(
Clone,
ComputeSquaredDistance,
Copy,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToAnimatedValue,
ToAnimatedZero,
ToComputedValue,
ToCss,
)]
#[css(function = "rect", comma)]
pub struct ClipRect<LengthOrAuto> {
pub top: LengthOrAuto,
@@ -29,9 +29,7 @@ impl<N, I> InitialLetter<N, I> {
}

/// A generic spacing value for the `letter-spacing` and `word-spacing` properties.
#[derive(
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss,
)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
pub enum Spacing<Value> {
/// `normal`
Normal,
@@ -137,7 +137,10 @@ where
SkewY(Angle),
/// translate(x, y) or translate(x)
#[css(comma, function)]
Translate(LengthPercentage, #[css(skip_if = "Zero::is_zero")] LengthPercentage),
Translate(
LengthPercentage,
#[css(skip_if = "Zero::is_zero")] LengthPercentage,
),
/// translateX(x)
#[css(function = "translateX")]
TranslateX(LengthPercentage),
@@ -637,7 +640,14 @@ impl<Number: ToCss + PartialEq> ToCss for Scale<Number> {
}

#[derive(
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToAnimatedZero, ToComputedValue, ToCss
Clone,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToAnimatedZero,
ToComputedValue,
ToCss,
)]
/// A value of the `translate` property
///
@@ -660,7 +670,10 @@ where
/// 'none'
None,
/// '<length-percentage>' or '<length-percentage> <length-percentage>'
Translate(LengthPercentage, #[css(skip_if = "Zero::is_zero")] LengthPercentage),
Translate(
LengthPercentage,
#[css(skip_if = "Zero::is_zero")] LengthPercentage,
),
/// '<length-percentage> <length-percentage> <length>'
Translate3D(LengthPercentage, LengthPercentage, Length),
}
@@ -652,7 +652,12 @@ impl ClipRect {
left = parse_argument(context, input, allow_quirks)?;
}

Ok(ClipRect { top, right, bottom, left })
Ok(ClipRect {
top,
right,
bottom,
left,
})
})
}
}
@@ -6,9 +6,9 @@

use crate::parser::{Parse, ParserContext};
use crate::values::generics::svg as generic;
use crate::values::specified::AllowQuirks;
use crate::values::specified::color::Color;
use crate::values::specified::url::SpecifiedUrl;
use crate::values::specified::AllowQuirks;
use crate::values::specified::LengthPercentage;
use crate::values::specified::{NonNegativeLengthPercentage, Opacity};
use crate::values::CustomIdent;
@@ -52,10 +52,9 @@ macro_rules! parse_svg_length {
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
if let Ok(lp) = input.try(|i| {
<$lp>::parse_quirky(context, i, AllowQuirks::Always)
}) {
return Ok(generic::SVGLength::LengthPercentage(lp))
if let Ok(lp) = input.try(|i| <$lp>::parse_quirky(context, i, AllowQuirks::Always))
{
return Ok(generic::SVGLength::LengthPercentage(lp));
}

try_match_ident_ignore_ascii_case! { input,
@@ -65,7 +64,7 @@ macro_rules! parse_svg_length {
}
}
}
}
};
}

parse_svg_length!(SVGLength, LengthPercentage);
@@ -78,11 +77,7 @@ impl Parse for SVGStrokeDashArray {
) -> Result<Self, ParseError<'i>> {
if let Ok(values) = input.try(|i| {
CommaWithSpace::parse(i, |i| {
NonNegativeLengthPercentage::parse_quirky(
context,
i,
AllowQuirks::Always,
)
NonNegativeLengthPercentage::parse_quirky(context, i, AllowQuirks::Always)
})
}) {
return Ok(generic::SVGStrokeDashArray::Values(values));
@@ -70,9 +70,9 @@ pub fn propagate_clauses_to_output_type(
for bound in extra_bounds {
let ty = bound.bounded_ty;
let bounds = bound.bounds;
where_clause.predicates.push(
parse_quote!(<#ty as #trait_path>::#trait_output: #bounds),
)
where_clause
.predicates
.push(parse_quote!(<#ty as #trait_path>::#trait_output: #bounds))
}
}

0 comments on commit 5aeab7a

Please sign in to comment.
You can’t perform that action at this time.