Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: sync changes from mozilla-central #23503

Merged
merged 17 commits into from Jun 4, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

style: Rustfmt recent changes.

  • Loading branch information
emilio committed Jun 4, 2019
commit 665db792741a09587ec78b56b6ab50e3e8b16d6c
@@ -314,7 +314,11 @@ impl<T: ?Sized> Arc<T> {
fn record_drop(&self) {
#[cfg(feature = "gecko_refcount_logging")]
unsafe {
NS_LogDtor(self.ptr() as *const _, b"ServoArc\0".as_ptr() as *const _, 8);
NS_LogDtor(
self.ptr() as *const _,
b"ServoArc\0".as_ptr() as *const _,
8,
);
}
}

@@ -350,8 +354,16 @@ impl<T: ?Sized> Arc<T> {

#[cfg(feature = "gecko_refcount_logging")]
extern "C" {
fn NS_LogCtor(aPtr: *const std::os::raw::c_void, aTypeName: *const std::os::raw::c_char, aSize: u32);
fn NS_LogDtor(aPtr: *const std::os::raw::c_void, aTypeName: *const std::os::raw::c_char, aSize: u32);
fn NS_LogCtor(
aPtr: *const std::os::raw::c_void,
aTypeName: *const std::os::raw::c_char,
aSize: u32,
);
fn NS_LogDtor(
aPtr: *const std::os::raw::c_void,
aTypeName: *const std::os::raw::c_char,
aSize: u32,
);
}

impl<T: ?Sized> Clone for Arc<T> {
@@ -9,7 +9,7 @@ use crate::gecko_bindings::structs;
use crate::gecko_bindings::structs::nsStyleImageRequest;
use crate::gecko_bindings::sugar::refptr::RefPtr;
use crate::parser::{Parse, ParserContext};
use crate::stylesheets::{UrlExtraData, CorsMode};
use crate::stylesheets::{CorsMode, UrlExtraData};
use crate::values::computed::{Context, ToComputedValue};
use cssparser::Parser;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
@@ -68,15 +68,15 @@ impl CssUrl {
cors_mode: CorsMode,
) -> Result<Self, ParseError<'i>> {
let url = input.expect_url()?;
Ok(Self::parse_from_string(url.as_ref().to_owned(), context, cors_mode))
Ok(Self::parse_from_string(
url.as_ref().to_owned(),
context,
cors_mode,
))
}

/// Parse a URL from a string value that is a valid CSS token for a URL.
pub fn parse_from_string(
url: String,
context: &ParserContext,
cors_mode: CorsMode,
) -> Self {
pub fn parse_from_string(url: String, context: &ParserContext, cors_mode: CorsMode) -> Self {
CssUrl(Arc::new(CssUrlData {
serialization: url.into(),
extra_data: context.url_data.clone(),
@@ -261,7 +261,11 @@ pub struct SpecifiedImageUrl(pub SpecifiedUrl);
impl SpecifiedImageUrl {
/// Parse a URL from a string value that is a valid CSS token for a URL.
pub fn parse_from_string(url: String, context: &ParserContext) -> Self {
SpecifiedImageUrl(SpecifiedUrl::parse_from_string(url, context, CorsMode::None))
SpecifiedImageUrl(SpecifiedUrl::parse_from_string(
url,
context,
CorsMode::None,
))
}

/// Provides an alternate method for parsing that associates the URL
@@ -354,7 +358,8 @@ impl ToCss for ComputedImageUrl {
where
W: Write,
{
self.0.serialize_with(bindings::Gecko_GetComputedImageURLSpec, dest)
self.0
.serialize_with(bindings::Gecko_GetComputedImageURLSpec, dest)
}
}

@@ -704,8 +704,8 @@ impl<'le> GeckoElement<'le> {
.map(GeckoElement)
}
} else {
let binding_parent = unsafe { self.non_xul_xbl_binding_parent().as_ref() }
.map(GeckoElement);
let binding_parent =
unsafe { self.non_xul_xbl_binding_parent().as_ref() }.map(GeckoElement);

debug_assert!(
binding_parent ==
@@ -722,9 +722,8 @@ impl<'le> GeckoElement<'le> {
#[inline]
fn non_xul_xbl_binding_parent(&self) -> *mut RawGeckoElement {
debug_assert!(!self.is_xul_element());
self.extended_slots().map_or(ptr::null_mut(), |slots| {
slots._base.mBindingParent.mRawPtr
})
self.extended_slots()
.map_or(ptr::null_mut(), |slots| slots._base.mBindingParent.mRawPtr)
}

#[inline]
@@ -84,7 +84,11 @@ impl MallocSizeOf for RuleTree {
while let Some(node) = stack.pop() {
n += unsafe { ops.malloc_size_of(node.ptr()) };
stack.extend(unsafe {
(*node.ptr()).children.read().iter().map(|(_k, v)| v.clone())
(*node.ptr())
.children
.read()
.iter()
.map(|(_k, v)| v.clone())
});
}

@@ -958,9 +962,7 @@ impl StrongRuleNode {
}

match RwLockUpgradableReadGuard::upgrade(read_guard).entry(key) {
hash::map::Entry::Occupied(ref occupied) => {
occupied.get().upgrade()
}
hash::map::Entry::Occupied(ref occupied) => occupied.get().upgrade(),
hash::map::Entry::Vacant(vacant) => {
let new_node = StrongRuleNode::new(Box::new(RuleNode::new(
root,
@@ -972,7 +974,7 @@ impl StrongRuleNode {
vacant.insert(new_node.downgrade());

new_node
}
},
}
}

@@ -75,7 +75,9 @@ impl SharedRwLock {
#[cfg(feature = "gecko")]
pub fn new_leaked() -> Self {
SharedRwLock {
cell: Some(Arc::new_leaked(AtomicRefCell::new(SomethingZeroSizedButTyped))),
cell: Some(Arc::new_leaked(AtomicRefCell::new(
SomethingZeroSizedButTyped,
))),
}
}

@@ -19,8 +19,8 @@ use crate::stylesheets::keyframes_rule::parse_keyframe_list;
use crate::stylesheets::stylesheet::Namespaces;
use crate::stylesheets::supports_rule::SupportsCondition;
use crate::stylesheets::viewport_rule;
use crate::stylesheets::{CssRule, CssRuleType, CssRules, RulesMutateError, StylesheetLoader};
use crate::stylesheets::{CorsMode, DocumentRule, FontFeatureValuesRule, KeyframesRule, MediaRule};
use crate::stylesheets::{CssRule, CssRuleType, CssRules, RulesMutateError, StylesheetLoader};
use crate::stylesheets::{NamespaceRule, PageRule, StyleRule, SupportsRule, ViewportRule};
use crate::values::computed::font::FamilyName;
use crate::values::{CssUrl, CustomIdent, KeyframesName};
@@ -253,7 +253,6 @@ impl SystemColor {
}
}


#[cfg(feature = "gecko")]
mod gecko {
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)]
@@ -30,7 +30,8 @@ pub type BoxShadow =

/// A specified value for a single `filter`.
#[cfg(feature = "gecko")]
pub type SpecifiedFilter = GenericFilter<Angle, Factor, NonNegativeLength, SimpleShadow, SpecifiedUrl>;
pub type SpecifiedFilter =
GenericFilter<Angle, Factor, NonNegativeLength, SimpleShadow, SpecifiedUrl>;

/// A specified value for a single `filter`.
#[cfg(feature = "servo")]
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.