Format style component.

This commit is contained in:
chansuke 2018-09-09 16:24:45 +02:00 committed by Emilio Cobos Álvarez
parent 31fc6cd565
commit 8dab4d659a
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
120 changed files with 2207 additions and 1417 deletions

View file

@ -151,8 +151,20 @@ fn parse_number_with_clamping_mode<'i, 't>(
// FIXME(emilio): Should move to border.rs
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Ord, Parse, PartialEq,
PartialOrd, SpecifiedValueInfo, ToComputedValue, ToCss)]
#[derive(
Clone,
Copy,
Debug,
Eq,
MallocSizeOf,
Ord,
Parse,
PartialEq,
PartialOrd,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
)]
pub enum BorderStyle {
None = -1,
Solid = 6,
@ -330,8 +342,7 @@ impl Parse for GreaterThanOrEqualToOneNumber {
///
/// FIXME(emilio): Should probably use Either.
#[allow(missing_docs)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
pub enum NumberOrPercentage {
Percentage(Percentage),
Number(Number),
@ -369,8 +380,7 @@ impl Parse for NumberOrPercentage {
}
#[allow(missing_docs)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd,
SpecifiedValueInfo, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, SpecifiedValueInfo, ToCss)]
pub struct Opacity(Number);
impl Parse for Opacity {
@ -630,13 +640,16 @@ impl ToComputedValue for ClipRect {
fn to_computed_value(&self, context: &Context) -> super::computed::ClipRect {
super::computed::ClipRect {
top: self.top.as_ref().map(|top| top.to_computed_value(context)),
right: self.right
right: self
.right
.as_ref()
.map(|right| right.to_computed_value(context)),
bottom: self.bottom
bottom: self
.bottom
.as_ref()
.map(|bottom| bottom.to_computed_value(context)),
left: self.left
left: self
.left
.as_ref()
.map(|left| left.to_computed_value(context)),
}
@ -760,8 +773,7 @@ impl AllowQuirks {
/// An attr(...) rule
///
/// `[namespace? `|`]? ident`
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo,
ToComputedValue)]
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)]
#[css(function)]
pub struct Attr {
/// Optional namespace prefix and URL.
@ -814,7 +826,10 @@ impl Attr {
let prefix = Prefix::from(ns.as_ref());
let ns = match get_namespace_for_prefix(&prefix, context) {
Some(ns) => ns,
None => return Err(location.new_custom_error(StyleParseErrorKind::UnspecifiedError)),
None => {
return Err(location
.new_custom_error(StyleParseErrorKind::UnspecifiedError))
},
};
Some((prefix, ns))
} else {