mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Reformat recent changes.
This commit is contained in:
parent
7c4f9bbf49
commit
8c004c0858
40 changed files with 571 additions and 212 deletions
|
@ -223,7 +223,9 @@ pub trait Parser<'i> {
|
|||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, ToShmem)]
|
||||
#[shmem(no_bounds)]
|
||||
pub struct SelectorList<Impl: SelectorImpl>(#[shmem(field_bound)] pub SmallVec<[Selector<Impl>; 1]>);
|
||||
pub struct SelectorList<Impl: SelectorImpl>(
|
||||
#[shmem(field_bound)] pub SmallVec<[Selector<Impl>; 1]>,
|
||||
);
|
||||
|
||||
impl<Impl: SelectorImpl> SelectorList<Impl> {
|
||||
/// Parse a comma-separated list of Selectors.
|
||||
|
@ -510,7 +512,9 @@ pub fn namespace_empty_string<Impl: SelectorImpl>() -> Impl::NamespaceUrl {
|
|||
/// handle it in to_css to make it invisible to serialization.
|
||||
#[derive(Clone, Eq, PartialEq, ToShmem)]
|
||||
#[shmem(no_bounds)]
|
||||
pub struct Selector<Impl: SelectorImpl>(#[shmem(field_bound)] ThinArc<SpecificityAndFlags, Component<Impl>>);
|
||||
pub struct Selector<Impl: SelectorImpl>(
|
||||
#[shmem(field_bound)] ThinArc<SpecificityAndFlags, Component<Impl>>,
|
||||
);
|
||||
|
||||
impl<Impl: SelectorImpl> Selector<Impl> {
|
||||
#[inline]
|
||||
|
@ -834,7 +838,10 @@ pub enum Component<Impl: SelectorImpl> {
|
|||
ExplicitAnyNamespace,
|
||||
ExplicitNoNamespace,
|
||||
DefaultNamespace(#[shmem(field_bound)] Impl::NamespaceUrl),
|
||||
Namespace(#[shmem(field_bound)] Impl::NamespacePrefix, #[shmem(field_bound)] Impl::NamespaceUrl),
|
||||
Namespace(
|
||||
#[shmem(field_bound)] Impl::NamespacePrefix,
|
||||
#[shmem(field_bound)] Impl::NamespaceUrl,
|
||||
),
|
||||
|
||||
ExplicitUniversalType,
|
||||
LocalName(LocalName<Impl>),
|
||||
|
|
|
@ -6,18 +6,22 @@
|
|||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use crate::selector_parser::SelectorImpl;
|
||||
use crate::stylesheets::UrlExtraData;
|
||||
use cssparser::{BasicParseErrorKind, ParseErrorKind, SourceLocation, Token};
|
||||
use selectors::SelectorList;
|
||||
use std::fmt;
|
||||
use style_traits::ParseError;
|
||||
use crate::selector_parser::{SelectorImpl};
|
||||
use selectors::SelectorList;
|
||||
|
||||
/// Errors that can be encountered while parsing CSS.
|
||||
#[derive(Debug)]
|
||||
pub enum ContextualParseError<'a> {
|
||||
/// A property declaration was not recognized.
|
||||
UnsupportedPropertyDeclaration(&'a str, ParseError<'a>, Option<&'a SelectorList<SelectorImpl>>),
|
||||
UnsupportedPropertyDeclaration(
|
||||
&'a str,
|
||||
ParseError<'a>,
|
||||
Option<&'a SelectorList<SelectorImpl>>,
|
||||
),
|
||||
/// A font face descriptor was not recognized.
|
||||
UnsupportedFontFaceDescriptor(&'a str, ParseError<'a>),
|
||||
/// A font feature values descriptor was not recognized.
|
||||
|
|
|
@ -43,7 +43,11 @@ pub trait FontMetricsProvider {
|
|||
}
|
||||
|
||||
/// Get default size of a given language and generic family.
|
||||
fn get_size(&self, font_name: &Atom, font_family: crate::values::computed::font::GenericFontFamily) -> Au;
|
||||
fn get_size(
|
||||
&self,
|
||||
font_name: &Atom,
|
||||
font_family: crate::values::computed::font::GenericFontFamily,
|
||||
) -> Au;
|
||||
|
||||
/// Construct from a shared style context
|
||||
fn create_from(context: &SharedStyleContext) -> Self
|
||||
|
|
|
@ -1108,9 +1108,9 @@ impl structs::FontSizePrefs {
|
|||
GenericFontFamily::Monospace => self.mDefaultMonospaceSize,
|
||||
GenericFontFamily::Cursive => self.mDefaultCursiveSize,
|
||||
GenericFontFamily::Fantasy => self.mDefaultFantasySize,
|
||||
GenericFontFamily::MozEmoji => {
|
||||
unreachable!("Should never get here, since this doesn't (yet) appear on font family")
|
||||
},
|
||||
GenericFontFamily::MozEmoji => unreachable!(
|
||||
"Should never get here, since this doesn't (yet) appear on font family"
|
||||
),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,11 @@ impl Borrow<WeakAtom> for Atom {
|
|||
|
||||
impl ToShmem for Atom {
|
||||
fn to_shmem(&self, _builder: &mut SharedMemoryBuilder) -> ManuallyDrop<Self> {
|
||||
assert!(self.is_static(), "ToShmem failed for Atom: must be a static atom: {}", self);
|
||||
assert!(
|
||||
self.is_static(),
|
||||
"ToShmem failed for Atom: must be a static atom: {}",
|
||||
self
|
||||
);
|
||||
|
||||
ManuallyDrop::new(Atom(self.0))
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::error_reporting::ContextualParseError;
|
|||
use crate::font_face::parse_font_face_block;
|
||||
use crate::media_queries::MediaList;
|
||||
use crate::parser::{Parse, ParserContext};
|
||||
use crate::properties::{parse_property_declaration_list};
|
||||
use crate::properties::parse_property_declaration_list;
|
||||
use crate::selector_parser::{SelectorImpl, SelectorParser};
|
||||
use crate::shared_lock::{Locked, SharedRwLock};
|
||||
use crate::str::starts_with_ignore_ascii_case;
|
||||
|
|
|
@ -14,7 +14,18 @@ use style_traits::{CssWriter, ToCss};
|
|||
|
||||
/// A computed angle in degrees.
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(Add, Animate, Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, ToAnimatedZero, ToResolvedValue)]
|
||||
#[derive(
|
||||
Add,
|
||||
Animate,
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
PartialOrd,
|
||||
ToAnimatedZero,
|
||||
ToResolvedValue,
|
||||
)]
|
||||
pub struct Angle(CSSFloat);
|
||||
|
||||
impl ToCss for Angle {
|
||||
|
|
|
@ -15,7 +15,9 @@ pub use crate::values::specified::box_::{AnimationName, Appearance, BreakBetween
|
|||
pub use crate::values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat};
|
||||
pub use crate::values::specified::box_::{Contain, Display, Overflow};
|
||||
pub use crate::values::specified::box_::{OverflowAnchor, OverflowClipBox, OverscrollBehavior};
|
||||
pub use crate::values::specified::box_::{ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStrictness, ScrollSnapType};
|
||||
pub use crate::values::specified::box_::{
|
||||
ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStrictness, ScrollSnapType,
|
||||
};
|
||||
pub use crate::values::specified::box_::{TouchAction, TransitionProperty, WillChange};
|
||||
|
||||
/// A computed value for the `vertical-align` property.
|
||||
|
|
|
@ -40,7 +40,9 @@ pub use crate::values::specified::font::{XLang, XTextZoom};
|
|||
/// https://drafts.csswg.org/css-fonts-4/#propdef-font-weight
|
||||
///
|
||||
/// This is effectively just a `Number`.
|
||||
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, ToCss, ToResolvedValue)]
|
||||
#[derive(
|
||||
Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, ToCss, ToResolvedValue,
|
||||
)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
pub struct FontWeight(pub Number);
|
||||
|
||||
|
@ -190,7 +192,9 @@ impl FontFamily {
|
|||
/// Get default font family as `serif` which is a generic font-family
|
||||
pub fn serif() -> Self {
|
||||
FontFamily {
|
||||
families: FontFamilyList::new(Box::new([SingleFontFamily::Generic(GenericFontFamily::Serif)])),
|
||||
families: FontFamilyList::new(Box::new([SingleFontFamily::Generic(
|
||||
GenericFontFamily::Serif,
|
||||
)])),
|
||||
is_system_font: false,
|
||||
}
|
||||
}
|
||||
|
@ -427,8 +431,10 @@ impl PartialEq for FontFamilyList {
|
|||
return false;
|
||||
}
|
||||
for (a, b) in self_list.mNames.iter().zip(other_list.mNames.iter()) {
|
||||
if a.mSyntax != b.mSyntax || a.mName.mRawPtr != b.mName.mRawPtr ||
|
||||
a.mGeneric != b.mGeneric {
|
||||
if a.mSyntax != b.mSyntax ||
|
||||
a.mName.mRawPtr != b.mName.mRawPtr ||
|
||||
a.mGeneric != b.mGeneric
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -459,19 +465,15 @@ impl FontFamilyList {
|
|||
|
||||
for family in families.iter() {
|
||||
match *family {
|
||||
SingleFontFamily::FamilyName(ref f) => {
|
||||
unsafe {
|
||||
SingleFontFamily::FamilyName(ref f) => unsafe {
|
||||
bindings::Gecko_nsTArray_FontFamilyName_AppendNamed(
|
||||
names,
|
||||
f.name.as_ptr(),
|
||||
f.syntax,
|
||||
);
|
||||
}
|
||||
},
|
||||
SingleFontFamily::Generic(family) => {
|
||||
unsafe {
|
||||
SingleFontFamily::Generic(family) => unsafe {
|
||||
bindings::Gecko_nsTArray_FontFamilyName_AppendGeneric(names, family);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -547,7 +549,17 @@ impl<'a> Iterator for FontFamilyNameIter<'a> {
|
|||
}
|
||||
|
||||
/// Preserve the readability of text when font fallback occurs
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, ToCss, ToResolvedValue)]
|
||||
#[derive(
|
||||
Animate,
|
||||
Clone,
|
||||
ComputeSquaredDistance,
|
||||
Copy,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
)]
|
||||
pub enum FontSizeAdjust {
|
||||
#[animation(error)]
|
||||
/// None variant
|
||||
|
@ -831,7 +843,9 @@ impl ToCss for FontStyle {
|
|||
/// A value for the font-stretch property per:
|
||||
///
|
||||
/// https://drafts.csswg.org/css-fonts-4/#propdef-font-stretch
|
||||
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, ToCss, ToResolvedValue)]
|
||||
#[derive(
|
||||
Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, ToCss, ToResolvedValue,
|
||||
)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
pub struct FontStretch(pub NonNegativePercentage);
|
||||
|
||||
|
|
|
@ -10,8 +10,7 @@ use crate::values::computed::NonNegativeNumber;
|
|||
use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
use crate::values::generics::length as generics;
|
||||
use crate::values::generics::length::{
|
||||
GenericLengthPercentageOrNormal, GenericLengthOrNumber,
|
||||
GenericMaxSize, GenericSize,
|
||||
GenericLengthOrNumber, GenericLengthPercentageOrNormal, GenericMaxSize, GenericSize,
|
||||
};
|
||||
use crate::values::generics::NonNegative;
|
||||
use crate::values::specified::length::ViewportPercentageLength;
|
||||
|
@ -783,7 +782,8 @@ impl From<NonNegativeLength> for Au {
|
|||
}
|
||||
|
||||
/// Either a computed NonNegativeLengthPercentage or the `normal` keyword.
|
||||
pub type NonNegativeLengthPercentageOrNormal = GenericLengthPercentageOrNormal<NonNegativeLengthPercentage>;
|
||||
pub type NonNegativeLengthPercentageOrNormal =
|
||||
GenericLengthPercentageOrNormal<NonNegativeLengthPercentage>;
|
||||
|
||||
/// Either a non-negative `<length>` or a `<number>`.
|
||||
pub type NonNegativeLengthOrNumber = GenericLengthOrNumber<NonNegativeLength, NonNegativeNumber>;
|
||||
|
|
|
@ -535,7 +535,9 @@ impl From<GreaterThanOrEqualToOneNumber> for CSSFloat {
|
|||
}
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, ToCss, ToResolvedValue)]
|
||||
#[derive(
|
||||
Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, ToCss, ToResolvedValue,
|
||||
)]
|
||||
#[repr(C, u8)]
|
||||
pub enum NumberOrPercentage {
|
||||
Percentage(Percentage),
|
||||
|
|
|
@ -75,7 +75,11 @@ pub use self::GenericBorderImageSlice as BorderImageSlice;
|
|||
ToShmem,
|
||||
)]
|
||||
#[repr(C)]
|
||||
pub struct GenericBorderCornerRadius<L>(#[css(field_bound)] #[shmem(field_bound)] pub Size2D<L>);
|
||||
pub struct GenericBorderCornerRadius<L>(
|
||||
#[css(field_bound)]
|
||||
#[shmem(field_bound)]
|
||||
pub Size2D<L>,
|
||||
);
|
||||
|
||||
pub use self::GenericBorderCornerRadius as BorderCornerRadius;
|
||||
|
||||
|
@ -114,7 +118,11 @@ impl<L: Zero> Zero for BorderCornerRadius<L> {
|
|||
ToShmem,
|
||||
)]
|
||||
#[repr(transparent)]
|
||||
pub struct BorderSpacing<L>(#[css(field_bound)] #[shmem(field_bound)] pub Size2D<L>);
|
||||
pub struct BorderSpacing<L>(
|
||||
#[css(field_bound)]
|
||||
#[shmem(field_bound)]
|
||||
pub Size2D<L>,
|
||||
);
|
||||
|
||||
impl<L> BorderSpacing<L> {
|
||||
/// Trivially create a `BorderCornerRadius`.
|
||||
|
|
|
@ -40,7 +40,7 @@ pub enum GenericColor<RGBA> {
|
|||
color: RGBA,
|
||||
/// The ratios of mixing between numeric and currentcolor.
|
||||
ratios: ComplexColorRatios,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
pub use self::GenericColor as Color;
|
||||
|
|
|
@ -15,7 +15,15 @@ use std::ops::Deref;
|
|||
|
||||
/// A name / value pair for counters.
|
||||
#[derive(
|
||||
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct CounterPair<Integer> {
|
||||
/// The name of the counter.
|
||||
|
|
|
@ -379,7 +379,9 @@ where
|
|||
/// The initial argument of the `repeat` function.
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-grid/#typedef-track-repeat>
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
)]
|
||||
pub enum RepeatCount<Integer> {
|
||||
/// A positive integer. This is allowed only for `<track-repeat>` and `<fixed-repeat>`
|
||||
Number(Integer),
|
||||
|
@ -414,7 +416,16 @@ impl Parse for RepeatCount<specified::Integer> {
|
|||
///
|
||||
/// It can also hold `repeat()` function parameters, which expands into the respective
|
||||
/// values in its computed form.
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
#[css(function = "repeat")]
|
||||
pub struct TrackRepeat<L, I> {
|
||||
/// The number of times for the value to be repeated (could also be `auto-fit` or `auto-fill`)
|
||||
|
|
|
@ -16,7 +16,9 @@ use style_traits::{CssWriter, ToCss};
|
|||
/// An [image].
|
||||
///
|
||||
/// [image]: https://drafts.csswg.org/css-images/#image-values
|
||||
#[derive(Clone, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem,
|
||||
)]
|
||||
pub enum Image<Gradient, MozImageRect, ImageUrl> {
|
||||
/// A `<url()>` image.
|
||||
Url(ImageUrl),
|
||||
|
@ -73,7 +75,9 @@ pub enum GradientKind<LineDirection, Length, LengthPercentage, Position, Angle>
|
|||
}
|
||||
|
||||
/// A radial gradient's ending shape.
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
)]
|
||||
pub enum EndingShape<Length, LengthPercentage> {
|
||||
/// A circular gradient.
|
||||
Circle(Circle<Length>),
|
||||
|
@ -91,7 +95,9 @@ pub enum Circle<Length> {
|
|||
}
|
||||
|
||||
/// An ellipse shape.
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
)]
|
||||
pub enum Ellipse<LengthPercentage> {
|
||||
/// An ellipse pair of radii.
|
||||
Radii(LengthPercentage, LengthPercentage),
|
||||
|
@ -103,7 +109,17 @@ pub enum Ellipse<LengthPercentage> {
|
|||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
MallocSizeOf,
|
||||
Parse,
|
||||
PartialEq,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub enum ShapeExtent {
|
||||
ClosestSide,
|
||||
|
@ -116,7 +132,9 @@ pub enum ShapeExtent {
|
|||
|
||||
/// A gradient item.
|
||||
/// <https://drafts.csswg.org/css-images-4/#color-stop-syntax>
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
)]
|
||||
pub enum GradientItem<Color, LengthPercentage> {
|
||||
/// A color stop.
|
||||
ColorStop(ColorStop<Color, LengthPercentage>),
|
||||
|
@ -126,7 +144,9 @@ pub enum GradientItem<Color, LengthPercentage> {
|
|||
|
||||
/// A color stop.
|
||||
/// <https://drafts.csswg.org/css-images/#typedef-color-stop-list>
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
)]
|
||||
pub struct ColorStop<Color, LengthPercentage> {
|
||||
/// The color of this stop.
|
||||
pub color: Color,
|
||||
|
@ -170,7 +190,15 @@ impl ToCss for PaintWorklet {
|
|||
#[allow(missing_docs)]
|
||||
#[css(comma, function)]
|
||||
#[derive(
|
||||
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct MozImageRect<NumberOrPercentage, MozImageRectUrl> {
|
||||
pub url: MozImageRectUrl,
|
||||
|
|
|
@ -44,7 +44,17 @@ pub mod url;
|
|||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
MallocSizeOf,
|
||||
Parse,
|
||||
PartialEq,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub enum SymbolsType {
|
||||
Cyclic,
|
||||
|
|
|
@ -38,9 +38,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, ToShmem,
|
||||
)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
|
||||
pub enum Spacing<Value> {
|
||||
/// `normal`
|
||||
Normal,
|
||||
|
@ -75,7 +73,8 @@ impl<Value> Spacing<Value> {
|
|||
#[cfg(feature = "gecko")]
|
||||
fn line_height_moz_block_height_enabled(context: &ParserContext) -> bool {
|
||||
use crate::gecko_bindings::structs;
|
||||
context.in_ua_sheet() || unsafe {
|
||||
context.in_ua_sheet() ||
|
||||
unsafe {
|
||||
structs::StaticPrefs_sVarCache_layout_css_line_height_moz_block_height_content_enabled
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,7 +132,15 @@ fn is_same<N: PartialEq>(x: &N, y: &N) -> bool {
|
|||
}
|
||||
|
||||
#[derive(
|
||||
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
/// A single operation in the list of a `transform` value
|
||||
pub enum TransformOperation<Angle, Number, Length, Integer, LengthPercentage>
|
||||
|
@ -239,7 +247,15 @@ where
|
|||
}
|
||||
|
||||
#[derive(
|
||||
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
/// A value of the `transform` property
|
||||
pub struct Transform<T>(#[css(if_empty = "none", iterable)] pub Vec<T>);
|
||||
|
|
|
@ -11,7 +11,16 @@ use values::specified::ui::CursorKind;
|
|||
/// A generic value for the `cursor` property.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-ui/#cursor
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct Cursor<Image> {
|
||||
/// The parsed images for the cursor.
|
||||
pub images: Box<[Image]>,
|
||||
|
@ -44,7 +53,16 @@ impl<Image: ToCss> ToCss for Cursor<Image> {
|
|||
}
|
||||
|
||||
/// A generic value for item of `image cursors`.
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct CursorImage<ImageUrl, Number> {
|
||||
/// The url to parse images from.
|
||||
pub url: ImageUrl,
|
||||
|
|
|
@ -96,7 +96,15 @@ where
|
|||
/// Convenience void type to disable some properties and values through types.
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, MallocSizeOf, Serialize))]
|
||||
#[derive(
|
||||
Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToComputedValue, ToCss, ToResolvedValue,
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToAnimatedValue,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
)]
|
||||
pub enum Impossible {}
|
||||
|
||||
|
@ -155,7 +163,16 @@ impl<A: Debug, B: Debug> Debug for Either<A, B> {
|
|||
|
||||
/// <https://drafts.csswg.org/css-values-4/#custom-idents>
|
||||
#[derive(
|
||||
Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Debug,
|
||||
Eq,
|
||||
Hash,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct CustomIdent(pub Atom);
|
||||
|
||||
|
@ -193,7 +210,9 @@ impl ToCss for CustomIdent {
|
|||
}
|
||||
|
||||
/// <https://drafts.csswg.org/css-animations/#typedef-keyframes-name>
|
||||
#[derive(Clone, Debug, MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone, Debug, MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem,
|
||||
)]
|
||||
pub enum KeyframesName {
|
||||
/// <custom-ident>
|
||||
Ident(CustomIdent),
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
//! Resolved values. These are almost always computed values, but in some cases
|
||||
//! there are used values.
|
||||
|
||||
use crate::properties::ComputedValues;
|
||||
use cssparser;
|
||||
use smallvec::SmallVec;
|
||||
use crate::properties::ComputedValues;
|
||||
|
||||
mod color;
|
||||
|
||||
|
@ -182,7 +182,9 @@ where
|
|||
|
||||
#[inline]
|
||||
fn to_resolved_value(self, context: &Context) -> Self::ResolvedValue {
|
||||
Vec::from(self).to_resolved_value(context).into_boxed_slice()
|
||||
Vec::from(self)
|
||||
.to_resolved_value(context)
|
||||
.into_boxed_slice()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -134,7 +134,18 @@ pub enum AxisDirection {
|
|||
/// Shared value for the `align-content` and `justify-content` properties.
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-align/#content-distribution>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
pub struct ContentDistribution {
|
||||
primary: AlignFlags,
|
||||
|
@ -247,7 +258,18 @@ impl ContentDistribution {
|
|||
/// Value for the `align-content` property.
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-align/#propdef-align-content>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct AlignContent(pub ContentDistribution);
|
||||
|
||||
impl Parse for AlignContent {
|
||||
|
@ -287,7 +309,18 @@ impl From<AlignContent> for u16 {
|
|||
/// Value for the `justify-content` property.
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-align/#propdef-justify-content>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct JustifyContent(pub ContentDistribution);
|
||||
|
||||
impl Parse for JustifyContent {
|
||||
|
@ -325,7 +358,18 @@ impl From<JustifyContent> for u16 {
|
|||
}
|
||||
|
||||
/// <https://drafts.csswg.org/css-align/#self-alignment>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct SelfAlignment(pub AlignFlags);
|
||||
|
||||
impl SelfAlignment {
|
||||
|
@ -385,7 +429,18 @@ impl SelfAlignment {
|
|||
/// The specified value of the align-self property.
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-align/#propdef-align-self>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct AlignSelf(pub SelfAlignment);
|
||||
|
||||
impl Parse for AlignSelf {
|
||||
|
@ -423,7 +478,18 @@ impl From<AlignSelf> for u8 {
|
|||
/// The specified value of the justify-self property.
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-align/#propdef-justify-self>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct JustifySelf(pub SelfAlignment);
|
||||
|
||||
impl Parse for JustifySelf {
|
||||
|
@ -461,7 +527,18 @@ impl From<JustifySelf> for u8 {
|
|||
/// Value of the `align-items` property
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-align/#propdef-align-items>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct AlignItems(pub AlignFlags);
|
||||
|
||||
impl AlignItems {
|
||||
|
|
|
@ -64,7 +64,16 @@ pub enum BackgroundRepeatKeyword {
|
|||
/// axes.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-backgrounds/#the-background-repeat
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct BackgroundRepeat(pub BackgroundRepeatKeyword, pub BackgroundRepeatKeyword);
|
||||
|
||||
impl BackgroundRepeat {
|
||||
|
|
|
@ -265,7 +265,15 @@ pub enum BorderImageRepeatKeyword {
|
|||
///
|
||||
/// https://drafts.csswg.org/css-backgrounds/#the-border-image-repeat
|
||||
#[derive(
|
||||
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct BorderImageRepeat(pub BorderImageRepeatKeyword, pub BorderImageRepeatKeyword);
|
||||
|
||||
|
|
|
@ -468,12 +468,17 @@ impl Parse for ScrollSnapType {
|
|||
_context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if input.try(|input| input.expect_ident_matching("none")).is_ok() {
|
||||
if input
|
||||
.try(|input| input.expect_ident_matching("none"))
|
||||
.is_ok()
|
||||
{
|
||||
return Ok(ScrollSnapType::none());
|
||||
}
|
||||
|
||||
let axis = ScrollSnapAxis::parse(input)?;
|
||||
let strictness = input.try(ScrollSnapStrictness::parse).unwrap_or(ScrollSnapStrictness::Proximity);
|
||||
let strictness = input
|
||||
.try(ScrollSnapStrictness::parse)
|
||||
.unwrap_or(ScrollSnapStrictness::Proximity);
|
||||
Ok(Self { axis, strictness })
|
||||
}
|
||||
}
|
||||
|
@ -524,7 +529,16 @@ pub enum ScrollSnapAlignKeyword {
|
|||
/// https://drafts.csswg.org/css-scroll-snap-1/#scroll-snap-align
|
||||
#[allow(missing_docs)]
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
#[repr(C)]
|
||||
pub struct ScrollSnapAlign {
|
||||
|
@ -637,7 +651,15 @@ pub enum OverflowClipBox {
|
|||
}
|
||||
|
||||
#[derive(
|
||||
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
/// Provides a rendering hint to the user agent,
|
||||
/// stating what kinds of changes the author expects
|
||||
|
@ -940,7 +962,9 @@ pub type Perspective = GenericPerspective<NonNegativeLength>;
|
|||
|
||||
/// A given transition property, that is either `All`, a longhand or shorthand
|
||||
/// property, or an unsupported or custom property.
|
||||
#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem,
|
||||
)]
|
||||
pub enum TransitionProperty {
|
||||
/// A shorthand.
|
||||
Shorthand(ShorthandId),
|
||||
|
@ -1035,17 +1059,7 @@ impl TransitionProperty {
|
|||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
Hash,
|
||||
MallocSizeOf,
|
||||
Parse,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToCss,
|
||||
ToShmem,
|
||||
Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem,
|
||||
)]
|
||||
/// https://drafts.csswg.org/css-box/#propdef-float
|
||||
pub enum Float {
|
||||
|
@ -1060,17 +1074,7 @@ pub enum Float {
|
|||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
Hash,
|
||||
MallocSizeOf,
|
||||
Parse,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToCss,
|
||||
ToShmem,
|
||||
Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem,
|
||||
)]
|
||||
/// https://drafts.csswg.org/css-box/#propdef-clear
|
||||
pub enum Clear {
|
||||
|
@ -1087,17 +1091,7 @@ pub enum Clear {
|
|||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
Hash,
|
||||
MallocSizeOf,
|
||||
Parse,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToCss,
|
||||
ToShmem,
|
||||
Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem,
|
||||
)]
|
||||
pub enum Resize {
|
||||
None,
|
||||
|
|
|
@ -407,7 +407,9 @@ impl ToComputedValue for MozFontSmoothingBackgroundColor {
|
|||
type ComputedValue = RGBA;
|
||||
|
||||
fn to_computed_value(&self, context: &Context) -> RGBA {
|
||||
self.0.to_computed_value(context).to_rgba(RGBA::transparent())
|
||||
self.0
|
||||
.to_computed_value(context)
|
||||
.to_rgba(RGBA::transparent())
|
||||
}
|
||||
|
||||
fn from_computed_value(computed: &RGBA) -> Self {
|
||||
|
|
|
@ -368,9 +368,7 @@ pub enum FontStretch {
|
|||
}
|
||||
|
||||
/// A keyword value for `font-stretch`.
|
||||
#[derive(
|
||||
Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem,
|
||||
)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum FontStretchKeyword {
|
||||
Normal,
|
||||
|
@ -532,7 +530,9 @@ impl FontFamily {
|
|||
/// Parse a specified font-family value
|
||||
pub fn parse_specified<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
let values = input.parse_comma_separated(SingleFontFamily::parse)?;
|
||||
Ok(FontFamily::Values(FontFamilyList::new(values.into_boxed_slice())))
|
||||
Ok(FontFamily::Values(FontFamilyList::new(
|
||||
values.into_boxed_slice(),
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -995,7 +995,9 @@ bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToResolvedValue, ToShmem,
|
||||
)]
|
||||
/// Set of variant alternates
|
||||
pub enum VariantAlternates {
|
||||
/// Enables display of stylistic alternates
|
||||
|
@ -1020,7 +1022,9 @@ pub enum VariantAlternates {
|
|||
HistoricalForms,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToResolvedValue, ToShmem,
|
||||
)]
|
||||
/// List of Variant Alternates
|
||||
pub struct VariantAlternatesList(
|
||||
#[css(if_empty = "normal", iterable)] pub Box<[VariantAlternates]>,
|
||||
|
@ -1858,7 +1862,15 @@ impl Parse for FontFeatureSettings {
|
|||
}
|
||||
|
||||
#[derive(
|
||||
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
/// Whether user agents are allowed to synthesize bold or oblique font faces
|
||||
/// when a font family lacks bold or italic faces
|
||||
|
@ -2178,7 +2190,15 @@ impl Parse for XTextZoom {
|
|||
}
|
||||
|
||||
#[derive(
|
||||
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
/// Internal property that reflects the lang attribute
|
||||
pub struct XLang(#[css(skip)] pub Atom);
|
||||
|
@ -2267,7 +2287,17 @@ impl Parse for MozScriptLevel {
|
|||
}
|
||||
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
/// Specifies the multiplier to be used to adjust font size
|
||||
/// due to changes in scriptlevel.
|
||||
///
|
||||
|
|
|
@ -13,8 +13,7 @@ use crate::properties::computed_value_flags::ComputedValueFlags;
|
|||
use crate::values::computed::{self, CSSPixelLength, Context};
|
||||
use crate::values::generics::length as generics;
|
||||
use crate::values::generics::length::{
|
||||
GenericLengthPercentageOrNormal, GenericLengthOrNumber,
|
||||
GenericMaxSize, GenericSize,
|
||||
GenericLengthOrNumber, GenericLengthPercentageOrNormal, GenericMaxSize, GenericSize,
|
||||
};
|
||||
use crate::values::generics::NonNegative;
|
||||
use crate::values::specified::calc::CalcNode;
|
||||
|
@ -958,7 +957,8 @@ impl NonNegativeLengthPercentageOrAuto {
|
|||
pub type NonNegativeLengthPercentage = NonNegative<LengthPercentage>;
|
||||
|
||||
/// Either a NonNegativeLengthPercentage or the `normal` keyword.
|
||||
pub type NonNegativeLengthPercentageOrNormal = GenericLengthPercentageOrNormal<NonNegativeLengthPercentage>;
|
||||
pub type NonNegativeLengthPercentageOrNormal =
|
||||
GenericLengthPercentageOrNormal<NonNegativeLengthPercentage>;
|
||||
|
||||
impl From<NoCalcLength> for NonNegativeLengthPercentage {
|
||||
#[inline]
|
||||
|
|
|
@ -16,7 +16,16 @@ use style_traits::{ParseError, StyleParseErrorKind};
|
|||
/// Specified and computed `list-style-type` property.
|
||||
#[cfg(feature = "gecko")]
|
||||
#[derive(
|
||||
Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Debug,
|
||||
Eq,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub enum ListStyleType {
|
||||
/// <counter-style> | none
|
||||
|
@ -77,7 +86,15 @@ impl Parse for ListStyleType {
|
|||
|
||||
/// A quote pair.
|
||||
#[derive(
|
||||
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct QuotePair {
|
||||
/// The opening quote.
|
||||
|
@ -89,7 +106,15 @@ pub struct QuotePair {
|
|||
|
||||
/// Specified and computed `quotes` property.
|
||||
#[derive(
|
||||
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct Quotes(
|
||||
#[css(iterable, if_empty = "none")]
|
||||
|
|
|
@ -709,7 +709,15 @@ impl AllowQuirks {
|
|||
///
|
||||
/// `[namespace? `|`]? ident`
|
||||
#[derive(
|
||||
Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Debug,
|
||||
Eq,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
#[css(function)]
|
||||
pub struct Attr {
|
||||
|
|
|
@ -571,7 +571,17 @@ impl From<GridAutoFlow> for u8 {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
/// https://drafts.csswg.org/css-grid/#named-grid-area
|
||||
pub struct TemplateAreas {
|
||||
/// `named area` containing for each template area
|
||||
|
@ -678,7 +688,15 @@ impl Parse for TemplateAreas {
|
|||
|
||||
/// Arc type for `Arc<TemplateAreas>`
|
||||
#[derive(
|
||||
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct TemplateAreasArc(#[ignore_malloc_size_of = "Arc"] pub Arc<TemplateAreas>);
|
||||
|
||||
|
|
|
@ -129,7 +129,15 @@ const PAINT_ORDER_MASK: u8 = 0b11;
|
|||
/// Higher priority values, i.e. the values specified first,
|
||||
/// will be painted first (and may be covered by paintings of lower priority)
|
||||
#[derive(
|
||||
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct SVGPaintOrder(pub u8);
|
||||
|
||||
|
@ -238,7 +246,15 @@ impl ToCss for SVGPaintOrder {
|
|||
/// Specified MozContextProperties value.
|
||||
/// Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-context-properties)
|
||||
#[derive(
|
||||
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct MozContextProperties(pub CustomIdent);
|
||||
|
||||
|
|
|
@ -512,9 +512,7 @@ impl TextEmphasisKeywordValue {
|
|||
}
|
||||
|
||||
/// Fill mode for the text-emphasis-style property
|
||||
#[derive(
|
||||
Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem,
|
||||
)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
|
||||
pub enum TextEmphasisFillMode {
|
||||
/// `filled`
|
||||
Filled,
|
||||
|
|
|
@ -57,7 +57,15 @@ impl Parse for CursorImage {
|
|||
|
||||
/// Specified value of `-moz-force-broken-image-icon`
|
||||
#[derive(
|
||||
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub struct MozForceBrokenImageIcon(pub bool);
|
||||
|
||||
|
|
|
@ -55,10 +55,7 @@ pub fn derive_to_value(
|
|||
let (to_body, from_body) = {
|
||||
let params = input.generics.type_params().collect::<Vec<_>>();
|
||||
for param in ¶ms {
|
||||
cg::add_predicate(
|
||||
&mut where_clause,
|
||||
parse_quote!(#param: #trait_path),
|
||||
);
|
||||
cg::add_predicate(&mut where_clause, parse_quote!(#param: #trait_path));
|
||||
}
|
||||
|
||||
let to_body = cg::fmap_match(&input, bind_style, |binding| {
|
||||
|
@ -80,20 +77,14 @@ pub fn derive_to_value(
|
|||
}
|
||||
call_to(&binding)
|
||||
});
|
||||
let from_body = cg::fmap_match(&input, bind_style, |binding| {
|
||||
call_from(&binding)
|
||||
});
|
||||
let from_body = cg::fmap_match(&input, bind_style, |binding| call_from(&binding));
|
||||
|
||||
(to_body, from_body)
|
||||
};
|
||||
|
||||
input.generics.where_clause = where_clause;
|
||||
let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();
|
||||
let computed_value_type = cg::fmap_trait_output(
|
||||
&input,
|
||||
&trait_path,
|
||||
&output_type_name,
|
||||
);
|
||||
let computed_value_type = cg::fmap_trait_output(&input, &trait_path, &output_type_name);
|
||||
|
||||
let impl_ = trait_impl(from_body, to_body);
|
||||
|
||||
|
|
|
@ -24,17 +24,17 @@ use smallvec::{Array, SmallVec};
|
|||
use std::alloc::Layout;
|
||||
#[cfg(debug_assertions)]
|
||||
use std::any::TypeId;
|
||||
use std::isize;
|
||||
#[cfg(debug_assertions)]
|
||||
use std::collections::HashSet;
|
||||
use std::ffi::CString;
|
||||
use std::isize;
|
||||
use std::marker::PhantomData;
|
||||
use std::mem::{self, ManuallyDrop};
|
||||
use std::num::Wrapping;
|
||||
use std::ops::Range;
|
||||
use std::os::raw::c_char;
|
||||
#[cfg(debug_assertions)]
|
||||
use std::os::raw::c_void;
|
||||
use std::os::raw::c_char;
|
||||
use std::ptr::{self, NonNull};
|
||||
use std::slice;
|
||||
use std::str;
|
||||
|
@ -205,7 +205,22 @@ macro_rules! impl_trivial_to_shmem {
|
|||
)*};
|
||||
}
|
||||
|
||||
impl_trivial_to_shmem!((), bool, f32, f64, i8, i16, i32, i64, u8, u16, u32, u64, isize, usize);
|
||||
impl_trivial_to_shmem!(
|
||||
(),
|
||||
bool,
|
||||
f32,
|
||||
f64,
|
||||
i8,
|
||||
i16,
|
||||
i32,
|
||||
i64,
|
||||
u8,
|
||||
u16,
|
||||
u32,
|
||||
u64,
|
||||
isize,
|
||||
usize
|
||||
);
|
||||
|
||||
impl_trivial_to_shmem!(cssparser::RGBA);
|
||||
impl_trivial_to_shmem!(cssparser::SourceLocation);
|
||||
|
@ -424,7 +439,9 @@ impl<T: 'static + ToShmem> ToShmem for Arc<T> {
|
|||
#[cfg(debug_assertions)]
|
||||
assert!(
|
||||
!builder.shared_values.contains(&self.heap_ptr()) ||
|
||||
builder.allowed_duplication_types.contains(&TypeId::of::<T>()),
|
||||
builder
|
||||
.allowed_duplication_types
|
||||
.contains(&TypeId::of::<T>()),
|
||||
"ToShmem failed for Arc<T>: encountered a value of type T with multiple references \
|
||||
and which has not been explicitly allowed with an add_allowed_duplication_type call",
|
||||
);
|
||||
|
@ -463,11 +480,7 @@ impl<H: 'static + ToShmem, T: 'static + ToShmem> ToShmem for ThinArc<H, T> {
|
|||
// Make a clone of the Arc-owned header and slice values with all of
|
||||
// their heap allocations placed in the shared memory buffer.
|
||||
let header = self.header.header.to_shmem(builder);
|
||||
let values: Vec<ManuallyDrop<T>> = self
|
||||
.slice
|
||||
.iter()
|
||||
.map(|v| v.to_shmem(builder))
|
||||
.collect();
|
||||
let values: Vec<ManuallyDrop<T>> = self.slice.iter().map(|v| v.to_shmem(builder)).collect();
|
||||
|
||||
// Create a new ThinArc with the shared value and have it place
|
||||
// its ArcInner in the shared memory buffer.
|
||||
|
@ -499,10 +512,11 @@ impl ToShmem for SmallBitVec {
|
|||
let src = vs.as_ptr() as *const usize;
|
||||
ptr::copy(src, dest, len);
|
||||
|
||||
let dest_slice = Box::from_raw(slice::from_raw_parts_mut(dest, len) as *mut [usize]);
|
||||
let dest_slice =
|
||||
Box::from_raw(slice::from_raw_parts_mut(dest, len) as *mut [usize]);
|
||||
InternalStorage::Spilled(dest_slice)
|
||||
}
|
||||
}
|
||||
},
|
||||
InternalStorage::Inline(x) => InternalStorage::Inline(x),
|
||||
};
|
||||
ManuallyDrop::new(unsafe { SmallBitVec::from_storage(storage) })
|
||||
|
|
|
@ -12,10 +12,7 @@ pub fn derive(mut input: syn::DeriveInput) -> TokenStream {
|
|||
let attrs = cg::parse_input_attrs::<ShmemInputAttrs>(&input);
|
||||
if !attrs.no_bounds {
|
||||
for param in input.generics.type_params() {
|
||||
cg::add_predicate(
|
||||
&mut where_clause,
|
||||
parse_quote!(#param: ::to_shmem::ToShmem),
|
||||
);
|
||||
cg::add_predicate(&mut where_clause, parse_quote!(#param: ::to_shmem::ToShmem));
|
||||
}
|
||||
}
|
||||
for variant in Structure::new(&input).variants() {
|
||||
|
@ -23,10 +20,7 @@ pub fn derive(mut input: syn::DeriveInput) -> TokenStream {
|
|||
let attrs = cg::parse_field_attrs::<ShmemFieldAttrs>(&binding.ast());
|
||||
if attrs.field_bound {
|
||||
let ty = &binding.ast().ty;
|
||||
cg::add_predicate(
|
||||
&mut where_clause,
|
||||
parse_quote!(#ty: ::to_shmem::ToShmem),
|
||||
)
|
||||
cg::add_predicate(&mut where_clause, parse_quote!(#ty: ::to_shmem::ToShmem))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue