mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Run rustfmt on selectors, servo_arc, and style.
This was generated with: ./mach cargo fmt --package selectors && ./mach cargo fmt --package servo_arc && ./mach cargo fmt --package style Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
This commit is contained in:
parent
f7ae1a37e3
commit
c99bcdd4b8
181 changed files with 9981 additions and 7933 deletions
|
@ -8,14 +8,14 @@ use byteorder::{BigEndian, WriteBytesExt};
|
|||
use computed_values::{font_stretch, font_style, font_weight};
|
||||
use counter_style::{self, CounterBound};
|
||||
use cssparser::UnicodeRange;
|
||||
use font_face::{Source, FontDisplay, FontWeight};
|
||||
use font_face::{FontDisplay, FontWeight, Source};
|
||||
use gecko_bindings::structs::{self, nsCSSValue};
|
||||
use gecko_bindings::sugar::ns_css_value::ToNsCssValue;
|
||||
use properties::longhands::font_language_override;
|
||||
use std::str;
|
||||
use values::computed::font::FamilyName;
|
||||
use values::generics::font::FontTag;
|
||||
use values::specified::font::{SpecifiedFontVariationSettings, SpecifiedFontFeatureSettings};
|
||||
use values::specified::font::{SpecifiedFontFeatureSettings, SpecifiedFontVariationSettings};
|
||||
|
||||
impl<'a> ToNsCssValue for &'a FamilyName {
|
||||
fn convert(self, nscssvalue: &mut nsCSSValue) {
|
||||
|
@ -32,10 +32,8 @@ impl ToNsCssValue for font_weight::T {
|
|||
impl<'a> ToNsCssValue for &'a FontWeight {
|
||||
fn convert(self, nscssvalue: &mut nsCSSValue) {
|
||||
match *self {
|
||||
FontWeight::Normal =>
|
||||
nscssvalue.set_enum(structs::NS_FONT_WEIGHT_NORMAL as i32),
|
||||
FontWeight::Bold =>
|
||||
nscssvalue.set_enum(structs::NS_FONT_WEIGHT_BOLD as i32),
|
||||
FontWeight::Normal => nscssvalue.set_enum(structs::NS_FONT_WEIGHT_NORMAL as i32),
|
||||
FontWeight::Bold => nscssvalue.set_enum(structs::NS_FONT_WEIGHT_BOLD as i32),
|
||||
FontWeight::Weight(weight) => nscssvalue.set_integer(weight.0 as i32),
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +81,9 @@ impl<'a> ToNsCssValue for &'a font_language_override::SpecifiedValue {
|
|||
fn convert(self, nscssvalue: &mut nsCSSValue) {
|
||||
match *self {
|
||||
font_language_override::SpecifiedValue::Normal => nscssvalue.set_normal(),
|
||||
font_language_override::SpecifiedValue::Override(ref lang) => nscssvalue.set_string(&*lang),
|
||||
font_language_override::SpecifiedValue::Override(ref lang) => {
|
||||
nscssvalue.set_string(&*lang)
|
||||
},
|
||||
// This path is unreachable because the descriptor is only specified by the user.
|
||||
font_language_override::SpecifiedValue::System(_) => unreachable!(),
|
||||
}
|
||||
|
@ -139,11 +139,17 @@ impl<'a> ToNsCssValue for &'a Vec<Source> {
|
|||
Source::Local(_) => 1,
|
||||
}
|
||||
});
|
||||
let mut target_srcs =
|
||||
nscssvalue.set_array(src_len as i32).as_mut_slice().iter_mut();
|
||||
macro_rules! next { () => {
|
||||
target_srcs.next().expect("Length of target_srcs should be enough")
|
||||
} }
|
||||
let mut target_srcs = nscssvalue
|
||||
.set_array(src_len as i32)
|
||||
.as_mut_slice()
|
||||
.iter_mut();
|
||||
macro_rules! next {
|
||||
() => {
|
||||
target_srcs
|
||||
.next()
|
||||
.expect("Length of target_srcs should be enough")
|
||||
};
|
||||
}
|
||||
for src in self.iter() {
|
||||
match *src {
|
||||
Source::Url(ref url) => {
|
||||
|
@ -151,10 +157,10 @@ impl<'a> ToNsCssValue for &'a Vec<Source> {
|
|||
for hint in url.format_hints.iter() {
|
||||
next!().set_font_format(&hint);
|
||||
}
|
||||
}
|
||||
},
|
||||
Source::Local(ref family) => {
|
||||
next!().set_local_font(&family.name);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
debug_assert!(target_srcs.next().is_none(), "Should have filled all slots");
|
||||
|
@ -165,7 +171,8 @@ impl<'a> ToNsCssValue for &'a Vec<UnicodeRange> {
|
|||
fn convert(self, nscssvalue: &mut nsCSSValue) {
|
||||
let target_ranges = nscssvalue
|
||||
.set_array((self.len() * 2) as i32)
|
||||
.as_mut_slice().chunks_mut(2);
|
||||
.as_mut_slice()
|
||||
.chunks_mut(2);
|
||||
for (range, target) in self.iter().zip(target_ranges) {
|
||||
target[0].set_integer(range.start as i32);
|
||||
target[1].set_integer(range.end as i32);
|
||||
|
@ -194,20 +201,22 @@ impl<'a> ToNsCssValue for &'a counter_style::System {
|
|||
Alphabetic => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SYSTEM_ALPHABETIC as i32),
|
||||
Symbolic => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SYSTEM_SYMBOLIC as i32),
|
||||
Additive => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SYSTEM_ADDITIVE as i32),
|
||||
Fixed { ref first_symbol_value } => {
|
||||
Fixed {
|
||||
ref first_symbol_value,
|
||||
} => {
|
||||
let mut a = nsCSSValue::null();
|
||||
let mut b = nsCSSValue::null();
|
||||
a.set_enum(structs::NS_STYLE_COUNTER_SYSTEM_FIXED as i32);
|
||||
b.set_integer(first_symbol_value.map_or(1, |v| v.value()));
|
||||
nscssvalue.set_pair(&a, &b);
|
||||
}
|
||||
},
|
||||
Extends(ref other) => {
|
||||
let mut a = nsCSSValue::null();
|
||||
let mut b = nsCSSValue::null();
|
||||
a.set_enum(structs::NS_STYLE_COUNTER_SYSTEM_EXTENDS as i32);
|
||||
b.set_atom_ident(other.0.clone());
|
||||
nscssvalue.set_pair(&a, &b);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue