Loading servo/components/style/gecko/conversions.rs +10 −10 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ impl nsStyleImage { image_rect.left, ); } } }, GenericImage::Element(ref element) => unsafe { bindings::Gecko_SetImageElement(self, element.as_ptr()); }, Loading Loading @@ -76,16 +76,16 @@ impl nsStyleImage { left: rect.3, }))) } } }, nsStyleImageType::eStyleImageType_Gradient => { let gradient: &Gradient = &**self.__bindgen_anon_1.mGradient.as_ref(); Some(GenericImage::Gradient(Box::new(gradient.clone()))) } }, nsStyleImageType::eStyleImageType_Element => { use crate::gecko_string_cache::Atom; let atom = bindings::Gecko_GetImageElement(self); Some(GenericImage::Element(Atom::from_raw(atom))) } }, } } Loading Loading @@ -128,13 +128,13 @@ pub mod basic_shape { Some(self.mReferenceBox.into()) }; Some(ShapeSource::Shape(shape, reference_box)) } }, StyleShapeSourceType::Image => None, StyleShapeSourceType::Path => { let path = self.to_svg_path().expect("expect an SVGPathData"); let fill = unsafe { &*self.__bindgen_anon_1.mSVGPath.as_ref().mPtr }.mFillRule; Some(ShapeSource::Path(Path { fill, path })) } }, } } Loading @@ -144,7 +144,7 @@ pub mod basic_shape { StyleShapeSourceType::Path => { let gecko_path = unsafe { &*self.__bindgen_anon_1.mSVGPath.as_ref().mPtr }; Some(SVGPathData(gecko_path.mPath.clone())) } }, _ => None, } } Loading Loading @@ -193,9 +193,9 @@ pub mod basic_shape { other.to_svg_path().expect("Cannot convert to SVGPathData"), ), StyleShapeSourceType::None => OffsetPath::none(), StyleShapeSourceType::Shape | StyleShapeSourceType::Box | StyleShapeSourceType::Image => unreachable!("Unsupported offset-path type"), StyleShapeSourceType::Shape | StyleShapeSourceType::Box | StyleShapeSourceType::Image => unreachable!("Unsupported offset-path type"), } } } Loading servo/components/style/gecko/wrapper.rs +5 −8 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ use crate::gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentLWThe use crate::gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags}; use crate::gecko_bindings::structs; use crate::gecko_bindings::structs::nsChangeHint; #[cfg(feature = "moz_xbl")] use crate::gecko_bindings::structs::nsXBLBinding as RawGeckoXBLBinding; use crate::gecko_bindings::structs::Document_DocumentTheme as DocumentTheme; use crate::gecko_bindings::structs::EffectCompositor_CascadeLevel as CascadeLevel; use crate::gecko_bindings::structs::ELEMENT_HANDLED_SNAPSHOT; Loading @@ -53,13 +55,7 @@ use crate::gecko_bindings::structs::ELEMENT_HAS_SNAPSHOT; use crate::gecko_bindings::structs::NODE_DESCENDANTS_NEED_FRAMES; use crate::gecko_bindings::structs::NODE_NEEDS_FRAME; use crate::gecko_bindings::structs::{nsAtom, nsIContent, nsINode_BooleanFlag}; use crate::gecko_bindings::structs::{ nsINode as RawGeckoNode, Element as RawGeckoElement, }; #[cfg(feature = "moz_xbl")] use crate::gecko_bindings::structs::nsXBLBinding as RawGeckoXBLBinding; #[cfg(not(feature = "moz_xbl"))] use values::Impossible; use crate::gecko_bindings::structs::{nsINode as RawGeckoNode, Element as RawGeckoElement}; use crate::gecko_bindings::sugar::ownership::{HasArcFFI, HasSimpleFFI}; use crate::global_style_data::GLOBAL_STYLE_DATA; use crate::hash::FxHashMap; Loading Loading @@ -90,6 +86,8 @@ use std::fmt; use std::hash::{Hash, Hasher}; use std::mem; use std::ptr; #[cfg(not(feature = "moz_xbl"))] use values::Impossible; #[inline] fn elements_with_id<'a, 'le>( Loading Loading @@ -568,7 +566,6 @@ pub struct GeckoXBLBinding<'lb>(&'lb Impossible); #[cfg(not(feature = "moz_xbl"))] impl<'lb> GeckoXBLBinding<'lb> { #[inline] fn anon_content(&self) -> *const nsIContent { match *self.0 {} Loading servo/components/style/values/computed/image.rs +4 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,10 @@ use crate::values::computed::position::Position; use crate::values::computed::url::ComputedImageUrl; use crate::values::computed::{Angle, Color, Context}; use crate::values::computed::{LengthPercentage, NonNegativeLength, NonNegativeLengthPercentage, NumberOrPercentage, ToComputedValue}; use crate::values::computed::{ LengthPercentage, NonNegativeLength, NonNegativeLengthPercentage, NumberOrPercentage, ToComputedValue, }; use crate::values::generics::image::{self as generic, GradientCompatMode}; use crate::values::specified::image::LineDirection as SpecifiedLineDirection; use crate::values::specified::position::{HorizontalPositionKeyword, VerticalPositionKeyword}; Loading servo/components/style/values/computed/length.rs +2 −10 Original line number Diff line number Diff line Loading @@ -124,11 +124,7 @@ impl LengthPercentage { /// Returns a new `LengthPercentage`. #[inline] pub fn new(length: Length, percentage: Option<Percentage>) -> Self { Self::with_clamping_mode( length, percentage, AllowedNumericType::All, ) Self::with_clamping_mode(length, percentage, AllowedNumericType::All) } /// Returns a new `LengthPercentage` with zero length and some percentage. Loading Loading @@ -384,11 +380,7 @@ impl LengthPercentage { ); } return Self::with_clamping_mode( self.length, Some(p), AllowedNumericType::NonNegative, ) return Self::with_clamping_mode(self.length, Some(p), AllowedNumericType::NonNegative); } Self::with_clamping_mode( Loading servo/components/style/values/generics/image.rs +16 −3 Original line number Diff line number Diff line Loading @@ -82,7 +82,12 @@ pub struct GenericGradient< Color, > { /// Gradients can be linear or radial. pub kind: GenericGradientKind<LineDirection, NonNegativeLength, NonNegativeLengthPercentage, Position>, pub kind: GenericGradientKind< LineDirection, NonNegativeLength, NonNegativeLengthPercentage, Position, >, /// The color stops and interpolation hints. pub items: crate::OwnedSlice<GenericGradientItem<Color, LengthPercentage>>, /// True if this is a repeating gradient. Loading @@ -108,11 +113,19 @@ pub enum GradientCompatMode { /// A gradient kind. #[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)] #[repr(C, u8)] pub enum GenericGradientKind<LineDirection, NonNegativeLength, NonNegativeLengthPercentage, Position> { pub enum GenericGradientKind< LineDirection, NonNegativeLength, NonNegativeLengthPercentage, Position, > { /// A linear gradient. Linear(LineDirection), /// A radial gradient. Radial(GenericEndingShape<NonNegativeLength, NonNegativeLengthPercentage>, Position), Radial( GenericEndingShape<NonNegativeLength, NonNegativeLengthPercentage>, Position, ), } pub use self::GenericGradientKind as GradientKind; Loading Loading
servo/components/style/gecko/conversions.rs +10 −10 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ impl nsStyleImage { image_rect.left, ); } } }, GenericImage::Element(ref element) => unsafe { bindings::Gecko_SetImageElement(self, element.as_ptr()); }, Loading Loading @@ -76,16 +76,16 @@ impl nsStyleImage { left: rect.3, }))) } } }, nsStyleImageType::eStyleImageType_Gradient => { let gradient: &Gradient = &**self.__bindgen_anon_1.mGradient.as_ref(); Some(GenericImage::Gradient(Box::new(gradient.clone()))) } }, nsStyleImageType::eStyleImageType_Element => { use crate::gecko_string_cache::Atom; let atom = bindings::Gecko_GetImageElement(self); Some(GenericImage::Element(Atom::from_raw(atom))) } }, } } Loading Loading @@ -128,13 +128,13 @@ pub mod basic_shape { Some(self.mReferenceBox.into()) }; Some(ShapeSource::Shape(shape, reference_box)) } }, StyleShapeSourceType::Image => None, StyleShapeSourceType::Path => { let path = self.to_svg_path().expect("expect an SVGPathData"); let fill = unsafe { &*self.__bindgen_anon_1.mSVGPath.as_ref().mPtr }.mFillRule; Some(ShapeSource::Path(Path { fill, path })) } }, } } Loading @@ -144,7 +144,7 @@ pub mod basic_shape { StyleShapeSourceType::Path => { let gecko_path = unsafe { &*self.__bindgen_anon_1.mSVGPath.as_ref().mPtr }; Some(SVGPathData(gecko_path.mPath.clone())) } }, _ => None, } } Loading Loading @@ -193,9 +193,9 @@ pub mod basic_shape { other.to_svg_path().expect("Cannot convert to SVGPathData"), ), StyleShapeSourceType::None => OffsetPath::none(), StyleShapeSourceType::Shape | StyleShapeSourceType::Box | StyleShapeSourceType::Image => unreachable!("Unsupported offset-path type"), StyleShapeSourceType::Shape | StyleShapeSourceType::Box | StyleShapeSourceType::Image => unreachable!("Unsupported offset-path type"), } } } Loading
servo/components/style/gecko/wrapper.rs +5 −8 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ use crate::gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentLWThe use crate::gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags}; use crate::gecko_bindings::structs; use crate::gecko_bindings::structs::nsChangeHint; #[cfg(feature = "moz_xbl")] use crate::gecko_bindings::structs::nsXBLBinding as RawGeckoXBLBinding; use crate::gecko_bindings::structs::Document_DocumentTheme as DocumentTheme; use crate::gecko_bindings::structs::EffectCompositor_CascadeLevel as CascadeLevel; use crate::gecko_bindings::structs::ELEMENT_HANDLED_SNAPSHOT; Loading @@ -53,13 +55,7 @@ use crate::gecko_bindings::structs::ELEMENT_HAS_SNAPSHOT; use crate::gecko_bindings::structs::NODE_DESCENDANTS_NEED_FRAMES; use crate::gecko_bindings::structs::NODE_NEEDS_FRAME; use crate::gecko_bindings::structs::{nsAtom, nsIContent, nsINode_BooleanFlag}; use crate::gecko_bindings::structs::{ nsINode as RawGeckoNode, Element as RawGeckoElement, }; #[cfg(feature = "moz_xbl")] use crate::gecko_bindings::structs::nsXBLBinding as RawGeckoXBLBinding; #[cfg(not(feature = "moz_xbl"))] use values::Impossible; use crate::gecko_bindings::structs::{nsINode as RawGeckoNode, Element as RawGeckoElement}; use crate::gecko_bindings::sugar::ownership::{HasArcFFI, HasSimpleFFI}; use crate::global_style_data::GLOBAL_STYLE_DATA; use crate::hash::FxHashMap; Loading Loading @@ -90,6 +86,8 @@ use std::fmt; use std::hash::{Hash, Hasher}; use std::mem; use std::ptr; #[cfg(not(feature = "moz_xbl"))] use values::Impossible; #[inline] fn elements_with_id<'a, 'le>( Loading Loading @@ -568,7 +566,6 @@ pub struct GeckoXBLBinding<'lb>(&'lb Impossible); #[cfg(not(feature = "moz_xbl"))] impl<'lb> GeckoXBLBinding<'lb> { #[inline] fn anon_content(&self) -> *const nsIContent { match *self.0 {} Loading
servo/components/style/values/computed/image.rs +4 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,10 @@ use crate::values::computed::position::Position; use crate::values::computed::url::ComputedImageUrl; use crate::values::computed::{Angle, Color, Context}; use crate::values::computed::{LengthPercentage, NonNegativeLength, NonNegativeLengthPercentage, NumberOrPercentage, ToComputedValue}; use crate::values::computed::{ LengthPercentage, NonNegativeLength, NonNegativeLengthPercentage, NumberOrPercentage, ToComputedValue, }; use crate::values::generics::image::{self as generic, GradientCompatMode}; use crate::values::specified::image::LineDirection as SpecifiedLineDirection; use crate::values::specified::position::{HorizontalPositionKeyword, VerticalPositionKeyword}; Loading
servo/components/style/values/computed/length.rs +2 −10 Original line number Diff line number Diff line Loading @@ -124,11 +124,7 @@ impl LengthPercentage { /// Returns a new `LengthPercentage`. #[inline] pub fn new(length: Length, percentage: Option<Percentage>) -> Self { Self::with_clamping_mode( length, percentage, AllowedNumericType::All, ) Self::with_clamping_mode(length, percentage, AllowedNumericType::All) } /// Returns a new `LengthPercentage` with zero length and some percentage. Loading Loading @@ -384,11 +380,7 @@ impl LengthPercentage { ); } return Self::with_clamping_mode( self.length, Some(p), AllowedNumericType::NonNegative, ) return Self::with_clamping_mode(self.length, Some(p), AllowedNumericType::NonNegative); } Self::with_clamping_mode( Loading
servo/components/style/values/generics/image.rs +16 −3 Original line number Diff line number Diff line Loading @@ -82,7 +82,12 @@ pub struct GenericGradient< Color, > { /// Gradients can be linear or radial. pub kind: GenericGradientKind<LineDirection, NonNegativeLength, NonNegativeLengthPercentage, Position>, pub kind: GenericGradientKind< LineDirection, NonNegativeLength, NonNegativeLengthPercentage, Position, >, /// The color stops and interpolation hints. pub items: crate::OwnedSlice<GenericGradientItem<Color, LengthPercentage>>, /// True if this is a repeating gradient. Loading @@ -108,11 +113,19 @@ pub enum GradientCompatMode { /// A gradient kind. #[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)] #[repr(C, u8)] pub enum GenericGradientKind<LineDirection, NonNegativeLength, NonNegativeLengthPercentage, Position> { pub enum GenericGradientKind< LineDirection, NonNegativeLength, NonNegativeLengthPercentage, Position, > { /// A linear gradient. Linear(LineDirection), /// A radial gradient. Radial(GenericEndingShape<NonNegativeLength, NonNegativeLengthPercentage>, Position), Radial( GenericEndingShape<NonNegativeLength, NonNegativeLengthPercentage>, Position, ), } pub use self::GenericGradientKind as GradientKind; Loading