mirror of
https://github.com/servo/servo.git
synced 2025-06-12 10:24:43 +00:00
style: Rustfmt + build fix.
This commit is contained in:
parent
f429c28f23
commit
db2f6aa8ca
9 changed files with 33 additions and 28 deletions
|
@ -687,7 +687,10 @@ impl<H, T> Arc<HeaderSlice<H, [T]>> {
|
||||||
}
|
}
|
||||||
// We should have consumed the buffer exactly, maybe accounting
|
// We should have consumed the buffer exactly, maybe accounting
|
||||||
// for some padding from the alignment.
|
// for some padding from the alignment.
|
||||||
debug_assert!((buffer.offset(size as isize) as usize - current as *mut u8 as usize) < align_of::<Self>());
|
debug_assert!(
|
||||||
|
(buffer.offset(size as isize) as usize - current as *mut u8 as usize) <
|
||||||
|
align_of::<Self>()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
assert!(
|
assert!(
|
||||||
items.next().is_none(),
|
items.next().is_none(),
|
||||||
|
@ -792,7 +795,6 @@ pub struct ThinArc<H, T> {
|
||||||
phantom: PhantomData<(H, T)>,
|
phantom: PhantomData<(H, T)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<H: fmt::Debug, T: fmt::Debug> fmt::Debug for ThinArc<H, T> {
|
impl<H: fmt::Debug, T: fmt::Debug> fmt::Debug for ThinArc<H, T> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
fmt::Debug::fmt(self.deref(), f)
|
fmt::Debug::fmt(self.deref(), f)
|
||||||
|
@ -909,7 +911,10 @@ impl<H, T> Clone for ThinArc<H, T> {
|
||||||
impl<H, T> Drop for ThinArc<H, T> {
|
impl<H, T> Drop for ThinArc<H, T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
let _ = Arc::from_thin(ThinArc { ptr: self.ptr, phantom: PhantomData, });
|
let _ = Arc::from_thin(ThinArc {
|
||||||
|
ptr: self.ptr,
|
||||||
|
phantom: PhantomData,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -928,7 +933,9 @@ impl<H, T> Arc<HeaderSliceWithLength<H, [T]>> {
|
||||||
let thin_ptr = fat_ptr as *mut [usize] as *mut usize;
|
let thin_ptr = fat_ptr as *mut [usize] as *mut usize;
|
||||||
ThinArc {
|
ThinArc {
|
||||||
ptr: unsafe {
|
ptr: unsafe {
|
||||||
ptr::NonNull::new_unchecked(thin_ptr as *mut ArcInner<HeaderSliceWithLength<H, [T; 0]>>)
|
ptr::NonNull::new_unchecked(
|
||||||
|
thin_ptr as *mut ArcInner<HeaderSliceWithLength<H, [T; 0]>>,
|
||||||
|
)
|
||||||
},
|
},
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
}
|
}
|
||||||
|
|
|
@ -536,12 +536,10 @@ pub mod basic_shape {
|
||||||
StyleGeometryBox, StyleShapeSource, StyleShapeSourceType,
|
StyleGeometryBox, StyleShapeSource, StyleShapeSourceType,
|
||||||
};
|
};
|
||||||
use crate::gecko_bindings::sugar::refptr::RefPtr;
|
use crate::gecko_bindings::sugar::refptr::RefPtr;
|
||||||
use crate::values::computed::basic_shape::{
|
use crate::values::computed::basic_shape::{BasicShape, ClippingShape, FloatAreaShape};
|
||||||
BasicShape, ClippingShape, FloatAreaShape,
|
|
||||||
};
|
|
||||||
use crate::values::computed::motion::OffsetPath;
|
use crate::values::computed::motion::OffsetPath;
|
||||||
use crate::values::computed::url::ComputedUrl;
|
use crate::values::computed::url::ComputedUrl;
|
||||||
use crate::values::generics::basic_shape::{Path, GeometryBox, ShapeBox, ShapeSource};
|
use crate::values::generics::basic_shape::{GeometryBox, Path, ShapeBox, ShapeSource};
|
||||||
use crate::values::specified::SVGPathData;
|
use crate::values::specified::SVGPathData;
|
||||||
|
|
||||||
impl StyleShapeSource {
|
impl StyleShapeSource {
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
//! Different kind of helpers to interact with Gecko values.
|
//! Different kind of helpers to interact with Gecko values.
|
||||||
|
|
||||||
use crate::counter_style::{Symbol, Symbols};
|
use crate::counter_style::{Symbol, Symbols};
|
||||||
use crate::gecko_bindings::structs::{nsStyleCoord, CounterStylePtr};
|
|
||||||
use crate::gecko_bindings::structs::StyleGridTrackBreadth;
|
use crate::gecko_bindings::structs::StyleGridTrackBreadth;
|
||||||
|
use crate::gecko_bindings::structs::{nsStyleCoord, CounterStylePtr};
|
||||||
use crate::gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
|
use crate::gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
|
||||||
use crate::values::computed::{Angle, Length, LengthPercentage};
|
use crate::values::computed::{Angle, Length, LengthPercentage};
|
||||||
use crate::values::computed::{Number, NumberOrPercentage, Percentage};
|
use crate::values::computed::{Number, NumberOrPercentage, Percentage};
|
||||||
|
|
|
@ -680,5 +680,6 @@ ${helpers.predefined_type(
|
||||||
"Either::Second(None_)",
|
"Either::Second(None_)",
|
||||||
gecko_pref="layout.css.webkit-line-clamp.enabled",
|
gecko_pref="layout.css.webkit-line-clamp.enabled",
|
||||||
animation_value_type="Integer",
|
animation_value_type="Integer",
|
||||||
|
products="gecko",
|
||||||
spec="https://drafts.csswg.org/css-overflow-3/#line-clamp",
|
spec="https://drafts.csswg.org/css-overflow-3/#line-clamp",
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -298,7 +298,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<T> ToAnimatedValue for Box<[T]>
|
impl<T> ToAnimatedValue for Box<[T]>
|
||||||
where
|
where
|
||||||
T: ToAnimatedValue,
|
T: ToAnimatedValue,
|
||||||
|
@ -307,8 +306,7 @@ where
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_animated_value(self) -> Self::AnimatedValue {
|
fn to_animated_value(self) -> Self::AnimatedValue {
|
||||||
self
|
self.into_vec()
|
||||||
.into_vec()
|
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(T::to_animated_value)
|
.map(T::to_animated_value)
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
|
|
|
@ -352,12 +352,14 @@ impl Polygon {
|
||||||
})
|
})
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
let coordinates = input.parse_comma_separated(|i| {
|
let coordinates = input
|
||||||
Ok(PolygonCoord(
|
.parse_comma_separated(|i| {
|
||||||
LengthPercentage::parse(context, i)?,
|
Ok(PolygonCoord(
|
||||||
LengthPercentage::parse(context, i)?,
|
LengthPercentage::parse(context, i)?,
|
||||||
))
|
LengthPercentage::parse(context, i)?,
|
||||||
})?.into();
|
))
|
||||||
|
})?
|
||||||
|
.into();
|
||||||
|
|
||||||
Ok(Polygon { fill, coordinates })
|
Ok(Polygon { fill, coordinates })
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,7 @@ use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||||
pub struct SVGPathData(
|
pub struct SVGPathData(
|
||||||
// TODO(emilio): Should probably measure this somehow only from the
|
// TODO(emilio): Should probably measure this somehow only from the
|
||||||
// specified values.
|
// specified values.
|
||||||
#[ignore_malloc_size_of = "Arc"]
|
#[ignore_malloc_size_of = "Arc"] pub crate::ArcSlice<PathCommand>,
|
||||||
pub crate::ArcSlice<PathCommand>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
impl SVGPathData {
|
impl SVGPathData {
|
||||||
|
@ -103,7 +102,9 @@ impl Parse for SVGPathData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(SVGPathData(crate::ArcSlice::from_iter(path_parser.path.into_iter())))
|
Ok(SVGPathData(crate::ArcSlice::from_iter(
|
||||||
|
path_parser.path.into_iter(),
|
||||||
|
)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ const ARC_SLICE_CANARY: u32 = 0xf3f3f3f3;
|
||||||
/// cbindgen:derive-eq=false
|
/// cbindgen:derive-eq=false
|
||||||
/// cbindgen:derive-neq=false
|
/// cbindgen:derive-neq=false
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, ToShmem)]
|
#[derive(Clone, Debug, Eq, PartialEq, ToShmem)]
|
||||||
pub struct ArcSlice<T>(#[shmem(field_bound)] ThinArc<u32, T>);
|
pub struct ArcSlice<T>(#[shmem(field_bound)] ThinArc<u32, T>);
|
||||||
|
|
||||||
impl<T> Deref for ArcSlice<T> {
|
impl<T> Deref for ArcSlice<T> {
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
|
|
||||||
//! A replacement for `Box<[T]>` that cbindgen can understand.
|
//! A replacement for `Box<[T]>` that cbindgen can understand.
|
||||||
|
|
||||||
|
use malloc_size_of::{MallocShallowSizeOf, MallocSizeOf, MallocSizeOfOps};
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::{fmt, mem, slice};
|
|
||||||
use std::ptr::NonNull;
|
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use malloc_size_of::{MallocSizeOf, MallocShallowSizeOf, MallocSizeOfOps};
|
use std::ptr::NonNull;
|
||||||
|
use std::{fmt, mem, slice};
|
||||||
use to_shmem::{SharedMemoryBuilder, ToShmem};
|
use to_shmem::{SharedMemoryBuilder, ToShmem};
|
||||||
|
|
||||||
/// A struct that basically replaces a `Box<[T]>`, but which cbindgen can
|
/// A struct that basically replaces a `Box<[T]>`, but which cbindgen can
|
||||||
|
@ -86,9 +86,7 @@ impl<T: Sized> OwnedSlice<T> {
|
||||||
/// Convert the OwnedSlice into a Vec.
|
/// Convert the OwnedSlice into a Vec.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn into_vec(self) -> Vec<T> {
|
pub fn into_vec(self) -> Vec<T> {
|
||||||
let ret = unsafe {
|
let ret = unsafe { Vec::from_raw_parts(self.ptr.as_ptr(), self.len, self.len) };
|
||||||
Vec::from_raw_parts(self.ptr.as_ptr(), self.len, self.len)
|
|
||||||
};
|
|
||||||
mem::forget(self);
|
mem::forget(self);
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue