diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index dae60af0860..2b16f527e91 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -33,6 +33,85 @@ +// FIXME (Manishearth): Add computed_value_as_specified argument +// and handle the empty case correctly +<%doc> + To be used in cases where we have a grammar like + " [ , ]*", but only support a single value + in servo + +<%def name="gecko_autoarray_longhand(name, **kwargs)"> + <%call expr="longhand(name, **kwargs)"> + % if product == "gecko": + use cssparser::ToCss; + use std::fmt; + + pub mod single_value { + use cssparser::Parser; + use parser::{ParserContext, ParserContextExtraData}; + use properties::{CSSWideKeyword, DeclaredValue, Shorthand}; + use values::computed::{TContext, ToComputedValue}; + use values::{computed, specified}; + ${caller.body()} + } + pub mod computed_value { + use super::single_value; + #[derive(Debug, Clone, PartialEq)] + #[cfg_attr(feature = "servo", derive(HeapSizeOf))] + pub struct T(pub Vec); + } + + impl ToCss for computed_value::T { + fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + if !self.0.is_empty() { + try!(self.0[0].to_css(dest)); + } + for i in self.0.iter().skip(1) { + try!(dest.write_str(", ")); + try!(i.to_css(dest)); + } + Ok(()) + } + } + + #[derive(Debug, Clone, PartialEq)] + #[cfg_attr(feature = "servo", derive(HeapSizeOf))] + pub struct SpecifiedValue(pub Vec); + + impl ToCss for SpecifiedValue { + fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + if !self.0.is_empty() { + try!(self.0[0].to_css(dest)) + } + for i in self.0.iter().skip(1) { + try!(dest.write_str(", ")); + try!(i.to_css(dest)); + } + Ok(()) + } + } + pub fn get_initial_value() -> computed_value::T { + computed_value::T(vec![single_value::get_initial_value()]) + } + pub fn parse(context: &ParserContext, input: &mut Parser) -> Result { + input.parse_comma_separated(|parser| { + single_value::parse(context, parser) + }).map(|ok| SpecifiedValue(ok)) + } + impl ToComputedValue for SpecifiedValue { + type ComputedValue = computed_value::T; + + #[inline] + fn to_computed_value(&self, context: &Cx) -> computed_value::T { + computed_value::T(self.0.iter().map(|x| x.to_computed_value(context)).collect()) + } + } + % else: + ${caller.body()} + % endif + + + <%def name="raw_longhand(*args, **kwargs)"> <% property = data.declare_longhand(*args, **kwargs) diff --git a/components/style/properties/longhand/background.mako.rs b/components/style/properties/longhand/background.mako.rs index c2ed7d3da7e..f66e8d85af1 100644 --- a/components/style/properties/longhand/background.mako.rs +++ b/components/style/properties/longhand/background.mako.rs @@ -10,7 +10,7 @@ ${helpers.predefined_type("background-color", "CSSColor", "::cssparser::Color::RGBA(::cssparser::RGBA { red: 0., green: 0., blue: 0., alpha: 0. }) /* transparent */", animatable=True)} -<%helpers:longhand name="background-image" animatable="False"> +<%helpers:gecko_autoarray_longhand name="background-image" animatable="False"> use cssparser::ToCss; use std::fmt; use values::specified::Image; @@ -70,7 +70,7 @@ ${helpers.predefined_type("background-color", "CSSColor", } } } - + <%helpers:longhand name="background-position" animatable="True"> use cssparser::ToCss; diff --git a/ports/geckolib/gecko_bindings/bindings.rs b/ports/geckolib/gecko_bindings/bindings.rs index f983c039acc..b65b0bc4e16 100644 --- a/ports/geckolib/gecko_bindings/bindings.rs +++ b/ports/geckolib/gecko_bindings/bindings.rs @@ -1,6 +1,10 @@ /* automatically generated by rust-bindgen */ use heapsize::HeapSizeOf; +pub enum nsINode {} +pub enum nsIDocument {} +pub enum nsIPrincipal {} +pub enum nsIURI {} use structs::nsStyleFont; unsafe impl Send for nsStyleFont {} unsafe impl Sync for nsStyleFont {} @@ -113,6 +117,12 @@ use structs::nsStyleGradientStop; unsafe impl Send for nsStyleGradientStop {} unsafe impl Sync for nsStyleGradientStop {} impl HeapSizeOf for nsStyleGradientStop { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleImageLayers; +unsafe impl Send for nsStyleImageLayers {} +unsafe impl Sync for nsStyleImageLayers {} +impl HeapSizeOf for nsStyleImageLayers { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleImageLayers_Layer as Layer; +use structs::nsStyleImageLayers_LayerType as LayerType; use structs::SheetParsingMode; use structs::nsMainThreadPtrHandle; use structs::nsMainThreadPtrHolder; @@ -122,13 +132,9 @@ use structs::FontFamilyList; use structs::FontFamilyType; use structs::nsIAtom; -pub enum nsINode { } pub type RawGeckoNode = nsINode; -pub enum nsIPrincipal { } -pub enum nsIURI { } pub enum Element { } pub type RawGeckoElement = Element; -pub enum nsIDocument { } pub type RawGeckoDocument = nsIDocument; pub enum ServoNodeData { } pub enum ServoComputedValues { } @@ -243,6 +249,12 @@ extern "C" { pub fn Gecko_GetNodeFlags(node: *mut RawGeckoNode) -> u32; pub fn Gecko_SetNodeFlags(node: *mut RawGeckoNode, flags: u32); pub fn Gecko_UnsetNodeFlags(node: *mut RawGeckoNode, flags: u32); + pub fn Gecko_EnsureTArrayCapacity(array: *mut ::std::os::raw::c_void, + capacity: usize, elem_size: usize); + pub fn Gecko_EnsureImageLayersLength(layers: *mut nsStyleImageLayers, + len: usize); + pub fn Gecko_InitializeImageLayer(layer: *mut Layer, + layer_type: LayerType); pub fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8, length: u32, parsing_mode: SheetParsingMode, base: *mut ThreadSafeURIHolder, diff --git a/ports/geckolib/gecko_bindings/structs_debug.rs b/ports/geckolib/gecko_bindings/structs_debug.rs index 4797b2312d2..fa6293b17ed 100644 --- a/ports/geckolib/gecko_bindings/structs_debug.rs +++ b/ports/geckolib/gecko_bindings/structs_debug.rs @@ -188,8 +188,6 @@ pub const NS_ERROR_MODULE_BASE_OFFSET: ::std::os::raw::c_uint = 69; pub const MOZ_STRING_WITH_OBSOLETE_API: ::std::os::raw::c_uint = 1; pub const NSID_LENGTH: ::std::os::raw::c_uint = 39; pub const NS_NUMBER_OF_FLAGS_IN_REFCNT: ::std::os::raw::c_uint = 2; -pub const _STL_PAIR_H: ::std::os::raw::c_uint = 1; -pub const _GLIBCXX_UTILITY: ::std::os::raw::c_uint = 1; pub const DOM_USER_DATA: ::std::os::raw::c_uint = 1; pub const SMIL_MAPPED_ATTR_ANIMVAL: ::std::os::raw::c_uint = 2; pub const TWIPS_PER_POINT_INT: ::std::os::raw::c_uint = 20; @@ -1381,7 +1379,6 @@ pub enum nsresult { NS_ERROR_PHISHING_URI = -2141388769, NS_ERROR_TRACKING_URI = -2141388766, NS_ERROR_UNWANTED_URI = -2141388765, - NS_ERROR_FORBIDDEN_URI = -2141388764, NS_ERROR_BLOCKED_URI = -2141388763, NS_ERROR_SAVE_LINK_AS_TIMEOUT = -2141388768, NS_ERROR_PARSED_DATA_CACHED = -2141388767, @@ -2788,9 +2785,13 @@ pub enum Element { } pub enum Text { } pub enum TextOrElementOrDocument { } pub enum DOMPointInit { } +pub const NODE_IS_DIRTY_FOR_SERVO: nsINode_h_unnamed_8 = + nsINode_h_unnamed_8::NODE_SHARED_RESTYLE_BIT_1; +pub const NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO: nsINode_h_unnamed_8 = + nsINode_h_unnamed_8::NODE_SHARED_RESTYLE_BIT_2; #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum NodeFlags { +pub enum nsINode_h_unnamed_8 { NODE_HAS_LISTENERMANAGER = 4, NODE_HAS_PROPERTIES = 8, NODE_IS_ANONYMOUS_ROOT = 16, @@ -2814,8 +2815,8 @@ pub enum NodeFlags { NODE_ALL_DIRECTION_FLAGS = 1572864, NODE_CHROME_ONLY_ACCESS = 2097152, NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS = 4194304, - NODE_IS_DIRTY_FOR_SERVO = 8388608, - NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO = 16777216, + NODE_SHARED_RESTYLE_BIT_1 = 8388608, + NODE_SHARED_RESTYLE_BIT_2 = 16777216, NODE_TYPE_SPECIFIC_BITS_OFFSET = 23, } /** @@ -2840,7 +2841,7 @@ fn bindgen_test_layout_nsMutationGuard() { extern "C" { #[link_name = "_ZN15nsMutationGuard11sGenerationE"] pub static mut nsMutationGuard_consts_sGeneration: - ::std::os::raw::c_ulong; + ::std::os::raw::c_ulonglong; } pub type Float = f32; #[repr(i8)] @@ -3073,7 +3074,7 @@ pub type gfxImageFormat = SurfaceFormat; pub struct RectCorner; #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum RectCorner_Types_h_unnamed_10 { +pub enum RectCorner_Types_h_unnamed_11 { TopLeft = 0, TopRight = 1, BottomRight = 2, @@ -4304,14 +4305,14 @@ pub enum nsCSSUnit { #[derive(Debug)] pub struct nsCSSValue { pub mUnit: nsCSSUnit, - pub mValue: nsCSSValue_nsCSSValue_h_unnamed_12, + pub mValue: nsCSSValue_nsCSSValue_h_unnamed_13, } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum nsCSSValue_Serialization { eNormalized = 0, eAuthorSpecified = 1, } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsCSSValue_nsCSSValue_h_unnamed_12 { +pub struct nsCSSValue_nsCSSValue_h_unnamed_13 { pub mInt: __BindgenUnionField, pub mFloat: __BindgenUnionField, pub mString: __BindgenUnionField<*mut nsStringBuffer>, @@ -4334,15 +4335,15 @@ pub struct nsCSSValue_nsCSSValue_h_unnamed_12 { pub mFontFamilyList: __BindgenUnionField<*mut FontFamilyListRefCnt>, pub _bindgen_data_: u64, } -impl nsCSSValue_nsCSSValue_h_unnamed_12 { } -impl ::std::clone::Clone for nsCSSValue_nsCSSValue_h_unnamed_12 { +impl nsCSSValue_nsCSSValue_h_unnamed_13 { } +impl ::std::clone::Clone for nsCSSValue_nsCSSValue_h_unnamed_13 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsCSSValue_nsCSSValue_h_unnamed_12() { - assert_eq!(::std::mem::size_of::() , +fn bindgen_test_layout_nsCSSValue_nsCSSValue_h_unnamed_13() { + assert_eq!(::std::mem::size_of::() , 8usize); - assert_eq!(::std::mem::align_of::() , + assert_eq!(::std::mem::align_of::() , 8usize); } #[test] @@ -4663,7 +4664,7 @@ pub struct ArenaRefPtr { } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum gfxFontConstants_h_unnamed_13 { +pub enum gfxFontConstants_h_unnamed_14 { eFeatureAlternates_historical = 0, eFeatureAlternates_stylistic = 1, eFeatureAlternates_styleset = 2, @@ -4675,7 +4676,7 @@ pub enum gfxFontConstants_h_unnamed_13 { } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum gfxFontConstants_h_unnamed_14 { +pub enum gfxFontConstants_h_unnamed_15 { eFeatureEastAsian_jis78 = 0, eFeatureEastAsian_jis83 = 1, eFeatureEastAsian_jis90 = 2, @@ -4689,7 +4690,7 @@ pub enum gfxFontConstants_h_unnamed_14 { } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum gfxFontConstants_h_unnamed_15 { +pub enum gfxFontConstants_h_unnamed_16 { eFeatureLigatures_none = 0, eFeatureLigatures_common = 1, eFeatureLigatures_no_common = 2, @@ -4703,7 +4704,7 @@ pub enum gfxFontConstants_h_unnamed_15 { } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum gfxFontConstants_h_unnamed_16 { +pub enum gfxFontConstants_h_unnamed_17 { eFeatureNumeric_lining = 0, eFeatureNumeric_oldstyle = 1, eFeatureNumeric_proportional = 2, @@ -4790,22 +4791,22 @@ pub enum nsStyleUnit { } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsStyleCoord_h_unnamed_17 { +pub struct nsStyleCoord_h_unnamed_18 { pub mInt: __BindgenUnionField, pub mFloat: __BindgenUnionField, pub mPointer: __BindgenUnionField<*mut ::std::os::raw::c_void>, pub _bindgen_data_: u64, } -impl nsStyleCoord_h_unnamed_17 { } -impl ::std::clone::Clone for nsStyleCoord_h_unnamed_17 { +impl nsStyleCoord_h_unnamed_18 { } +impl ::std::clone::Clone for nsStyleCoord_h_unnamed_18 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsStyleCoord_h_unnamed_17() { - assert_eq!(::std::mem::size_of::() , 8usize); - assert_eq!(::std::mem::align_of::() , 8usize); +fn bindgen_test_layout_nsStyleCoord_h_unnamed_18() { + assert_eq!(::std::mem::size_of::() , 8usize); + assert_eq!(::std::mem::align_of::() , 8usize); } -pub type nsStyleUnion = nsStyleCoord_h_unnamed_17; +pub type nsStyleUnion = nsStyleCoord_h_unnamed_18; /** * Class that hold a single size specification used by the style * system. The size specification consists of two parts -- a number @@ -4998,27 +4999,27 @@ pub enum nsStyleImageType { pub struct nsStyleImage { pub mSubImages: u64, pub mType: nsStyleImageType, - pub nsStyleImage_nsStyleStruct_h_unnamed_20: nsStyleImage_nsStyleStruct_h_unnamed_20, + pub nsStyleImage_nsStyleStruct_h_unnamed_21: nsStyleImage_nsStyleStruct_h_unnamed_21, pub mCropRect: nsAutoPtr, pub mImageTracked: bool, } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsStyleImage_nsStyleStruct_h_unnamed_20 { +pub struct nsStyleImage_nsStyleStruct_h_unnamed_21 { pub mImage: __BindgenUnionField<*mut imgRequestProxy>, pub mGradient: __BindgenUnionField<*mut nsStyleGradient>, pub mElementId: __BindgenUnionField<*mut ::std::os::raw::c_ushort>, pub _bindgen_data_: u64, } -impl nsStyleImage_nsStyleStruct_h_unnamed_20 { } -impl ::std::clone::Clone for nsStyleImage_nsStyleStruct_h_unnamed_20 { +impl nsStyleImage_nsStyleStruct_h_unnamed_21 { } +impl ::std::clone::Clone for nsStyleImage_nsStyleStruct_h_unnamed_21 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsStyleImage_nsStyleStruct_h_unnamed_20() { - assert_eq!(::std::mem::size_of::() +fn bindgen_test_layout_nsStyleImage_nsStyleStruct_h_unnamed_21() { + assert_eq!(::std::mem::size_of::() , 8usize); - assert_eq!(::std::mem::align_of::() + assert_eq!(::std::mem::align_of::() , 8usize); } #[test] @@ -5068,7 +5069,7 @@ pub struct nsStyleImageLayers { } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum nsStyleImageLayers_nsStyleStruct_h_unnamed_21 { +pub enum nsStyleImageLayers_nsStyleStruct_h_unnamed_22 { shorthand = 0, color = 1, image = 2, @@ -5535,7 +5536,7 @@ fn bindgen_test_layout_nsStyleVisibility() { #[derive(Debug, Copy)] pub struct nsTimingFunction { pub mType: nsTimingFunction_Type, - pub nsTimingFunction_nsStyleStruct_h_unnamed_22: nsTimingFunction_nsStyleStruct_h_unnamed_22, + pub nsTimingFunction_nsStyleStruct_h_unnamed_23: nsTimingFunction_nsStyleStruct_h_unnamed_23, } #[repr(i32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] @@ -5562,56 +5563,56 @@ pub enum nsTimingFunction_StepSyntax { pub enum nsTimingFunction_Keyword { Implicit = 0, Explicit = 1, } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsTimingFunction_nsStyleStruct_h_unnamed_22 { - pub mFunc: __BindgenUnionField, - pub nsTimingFunction_nsStyleStruct_h_unnamed_22_nsStyleStruct_h_unnamed_24: __BindgenUnionField, +pub struct nsTimingFunction_nsStyleStruct_h_unnamed_23 { + pub mFunc: __BindgenUnionField, + pub nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_25: __BindgenUnionField, pub _bindgen_data_: [u32; 4usize], } -impl nsTimingFunction_nsStyleStruct_h_unnamed_22 { } -impl ::std::clone::Clone for nsTimingFunction_nsStyleStruct_h_unnamed_22 { +impl nsTimingFunction_nsStyleStruct_h_unnamed_23 { } +impl ::std::clone::Clone for nsTimingFunction_nsStyleStruct_h_unnamed_23 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsTimingFunction_nsStyleStruct_h_unnamed_22() { - assert_eq!(::std::mem::size_of::() +fn bindgen_test_layout_nsTimingFunction_nsStyleStruct_h_unnamed_23() { + assert_eq!(::std::mem::size_of::() , 16usize); - assert_eq!(::std::mem::align_of::() + assert_eq!(::std::mem::align_of::() , 4usize); } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsTimingFunction_nsStyleStruct_h_unnamed_22_nsStyleStruct_h_unnamed_23 { +pub struct nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_24 { pub mX1: f32, pub mY1: f32, pub mX2: f32, pub mY2: f32, } impl ::std::clone::Clone for - nsTimingFunction_nsStyleStruct_h_unnamed_22_nsStyleStruct_h_unnamed_23 { + nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_24 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsTimingFunction_nsStyleStruct_h_unnamed_22_nsStyleStruct_h_unnamed_23() { - assert_eq!(::std::mem::size_of::() +fn bindgen_test_layout_nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_24() { + assert_eq!(::std::mem::size_of::() , 16usize); - assert_eq!(::std::mem::align_of::() + assert_eq!(::std::mem::align_of::() , 4usize); } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsTimingFunction_nsStyleStruct_h_unnamed_22_nsStyleStruct_h_unnamed_24 { +pub struct nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_25 { pub mStepSyntax: nsTimingFunction_StepSyntax, pub mSteps: u32, } impl ::std::clone::Clone for - nsTimingFunction_nsStyleStruct_h_unnamed_22_nsStyleStruct_h_unnamed_24 { + nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_25 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsTimingFunction_nsStyleStruct_h_unnamed_22_nsStyleStruct_h_unnamed_24() { - assert_eq!(::std::mem::size_of::() +fn bindgen_test_layout_nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_25() { + assert_eq!(::std::mem::size_of::() , 8usize); - assert_eq!(::std::mem::align_of::() + assert_eq!(::std::mem::align_of::() , 4usize); } impl ::std::clone::Clone for nsTimingFunction { @@ -5756,26 +5757,26 @@ pub enum nsStyleContentType { #[derive(Debug)] pub struct nsStyleContentData { pub mType: nsStyleContentType, - pub mContent: nsStyleContentData_nsStyleStruct_h_unnamed_25, + pub mContent: nsStyleContentData_nsStyleStruct_h_unnamed_26, pub mImageTracked: bool, } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsStyleContentData_nsStyleStruct_h_unnamed_25 { +pub struct nsStyleContentData_nsStyleStruct_h_unnamed_26 { pub mString: __BindgenUnionField<*mut ::std::os::raw::c_ushort>, pub mImage: __BindgenUnionField<*mut imgRequestProxy>, pub mCounters: __BindgenUnionField<*mut Array>, pub _bindgen_data_: u64, } -impl nsStyleContentData_nsStyleStruct_h_unnamed_25 { } -impl ::std::clone::Clone for nsStyleContentData_nsStyleStruct_h_unnamed_25 { +impl nsStyleContentData_nsStyleStruct_h_unnamed_26 { } +impl ::std::clone::Clone for nsStyleContentData_nsStyleStruct_h_unnamed_26 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsStyleContentData_nsStyleStruct_h_unnamed_25() { - assert_eq!(::std::mem::size_of::() +fn bindgen_test_layout_nsStyleContentData_nsStyleStruct_h_unnamed_26() { + assert_eq!(::std::mem::size_of::() , 8usize); - assert_eq!(::std::mem::align_of::() + assert_eq!(::std::mem::align_of::() , 8usize); } #[test] @@ -5909,26 +5910,26 @@ pub enum nsStyleSVGOpacitySource { #[repr(C)] #[derive(Debug)] pub struct nsStyleSVGPaint { - pub mPaint: nsStyleSVGPaint_nsStyleStruct_h_unnamed_26, + pub mPaint: nsStyleSVGPaint_nsStyleStruct_h_unnamed_27, pub mType: nsStyleSVGPaintType, pub mFallbackColor: nscolor, } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsStyleSVGPaint_nsStyleStruct_h_unnamed_26 { +pub struct nsStyleSVGPaint_nsStyleStruct_h_unnamed_27 { pub mColor: __BindgenUnionField, pub mPaintServer: __BindgenUnionField<*mut nsIURI>, pub _bindgen_data_: u64, } -impl nsStyleSVGPaint_nsStyleStruct_h_unnamed_26 { } -impl ::std::clone::Clone for nsStyleSVGPaint_nsStyleStruct_h_unnamed_26 { +impl nsStyleSVGPaint_nsStyleStruct_h_unnamed_27 { } +impl ::std::clone::Clone for nsStyleSVGPaint_nsStyleStruct_h_unnamed_27 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsStyleSVGPaint_nsStyleStruct_h_unnamed_26() { - assert_eq!(::std::mem::size_of::() +fn bindgen_test_layout_nsStyleSVGPaint_nsStyleStruct_h_unnamed_27() { + assert_eq!(::std::mem::size_of::() , 8usize); - assert_eq!(::std::mem::align_of::() + assert_eq!(::std::mem::align_of::() , 8usize); } #[test] @@ -5963,7 +5964,7 @@ pub struct nsStyleSVG { } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum nsStyleSVG_nsStyleStruct_h_unnamed_27 { +pub enum nsStyleSVG_nsStyleStruct_h_unnamed_28 { FILL_OPACITY_SOURCE_MASK = 3, STROKE_OPACITY_SOURCE_MASK = 12, STROKE_DASHARRAY_CONTEXT = 16, @@ -6005,25 +6006,25 @@ fn bindgen_test_layout_nsStyleBasicShape() { #[derive(Debug)] pub struct nsStyleClipPath { pub mType: i32, - pub nsStyleClipPath_nsStyleStruct_h_unnamed_28: nsStyleClipPath_nsStyleStruct_h_unnamed_28, + pub nsStyleClipPath_nsStyleStruct_h_unnamed_29: nsStyleClipPath_nsStyleStruct_h_unnamed_29, pub mSizingBox: u8, } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsStyleClipPath_nsStyleStruct_h_unnamed_28 { +pub struct nsStyleClipPath_nsStyleStruct_h_unnamed_29 { pub mBasicShape: __BindgenUnionField<*mut nsStyleBasicShape>, pub mURL: __BindgenUnionField<*mut nsIURI>, pub _bindgen_data_: u64, } -impl nsStyleClipPath_nsStyleStruct_h_unnamed_28 { } -impl ::std::clone::Clone for nsStyleClipPath_nsStyleStruct_h_unnamed_28 { +impl nsStyleClipPath_nsStyleStruct_h_unnamed_29 { } +impl ::std::clone::Clone for nsStyleClipPath_nsStyleStruct_h_unnamed_29 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsStyleClipPath_nsStyleStruct_h_unnamed_28() { - assert_eq!(::std::mem::size_of::() +fn bindgen_test_layout_nsStyleClipPath_nsStyleStruct_h_unnamed_29() { + assert_eq!(::std::mem::size_of::() , 8usize); - assert_eq!(::std::mem::align_of::() + assert_eq!(::std::mem::align_of::() , 8usize); } #[test] @@ -6036,24 +6037,24 @@ fn bindgen_test_layout_nsStyleClipPath() { pub struct nsStyleFilter { pub mType: i32, pub mFilterParameter: nsStyleCoord, - pub nsStyleFilter_nsStyleStruct_h_unnamed_29: nsStyleFilter_nsStyleStruct_h_unnamed_29, + pub nsStyleFilter_nsStyleStruct_h_unnamed_30: nsStyleFilter_nsStyleStruct_h_unnamed_30, } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsStyleFilter_nsStyleStruct_h_unnamed_29 { +pub struct nsStyleFilter_nsStyleStruct_h_unnamed_30 { pub mURL: __BindgenUnionField<*mut nsIURI>, pub mDropShadow: __BindgenUnionField<*mut nsCSSShadowArray>, pub _bindgen_data_: u64, } -impl nsStyleFilter_nsStyleStruct_h_unnamed_29 { } -impl ::std::clone::Clone for nsStyleFilter_nsStyleStruct_h_unnamed_29 { +impl nsStyleFilter_nsStyleStruct_h_unnamed_30 { } +impl ::std::clone::Clone for nsStyleFilter_nsStyleStruct_h_unnamed_30 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsStyleFilter_nsStyleStruct_h_unnamed_29() { - assert_eq!(::std::mem::size_of::() +fn bindgen_test_layout_nsStyleFilter_nsStyleStruct_h_unnamed_30() { + assert_eq!(::std::mem::size_of::() , 8usize); - assert_eq!(::std::mem::align_of::() + assert_eq!(::std::mem::align_of::() , 8usize); } #[test] diff --git a/ports/geckolib/gecko_bindings/structs_release.rs b/ports/geckolib/gecko_bindings/structs_release.rs index 8ebcf846ab7..5a5b1829011 100644 --- a/ports/geckolib/gecko_bindings/structs_release.rs +++ b/ports/geckolib/gecko_bindings/structs_release.rs @@ -188,8 +188,6 @@ pub const NS_ERROR_MODULE_BASE_OFFSET: ::std::os::raw::c_uint = 69; pub const MOZ_STRING_WITH_OBSOLETE_API: ::std::os::raw::c_uint = 1; pub const NSID_LENGTH: ::std::os::raw::c_uint = 39; pub const NS_NUMBER_OF_FLAGS_IN_REFCNT: ::std::os::raw::c_uint = 2; -pub const _STL_PAIR_H: ::std::os::raw::c_uint = 1; -pub const _GLIBCXX_UTILITY: ::std::os::raw::c_uint = 1; pub const DOM_USER_DATA: ::std::os::raw::c_uint = 1; pub const SMIL_MAPPED_ATTR_ANIMVAL: ::std::os::raw::c_uint = 2; pub const TWIPS_PER_POINT_INT: ::std::os::raw::c_uint = 20; @@ -1381,7 +1379,6 @@ pub enum nsresult { NS_ERROR_PHISHING_URI = -2141388769, NS_ERROR_TRACKING_URI = -2141388766, NS_ERROR_UNWANTED_URI = -2141388765, - NS_ERROR_FORBIDDEN_URI = -2141388764, NS_ERROR_BLOCKED_URI = -2141388763, NS_ERROR_SAVE_LINK_AS_TIMEOUT = -2141388768, NS_ERROR_PARSED_DATA_CACHED = -2141388767, @@ -2767,9 +2764,13 @@ pub enum Element { } pub enum Text { } pub enum TextOrElementOrDocument { } pub enum DOMPointInit { } +pub const NODE_IS_DIRTY_FOR_SERVO: nsINode_h_unnamed_8 = + nsINode_h_unnamed_8::NODE_SHARED_RESTYLE_BIT_1; +pub const NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO: nsINode_h_unnamed_8 = + nsINode_h_unnamed_8::NODE_SHARED_RESTYLE_BIT_2; #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum NodeFlags { +pub enum nsINode_h_unnamed_8 { NODE_HAS_LISTENERMANAGER = 4, NODE_HAS_PROPERTIES = 8, NODE_IS_ANONYMOUS_ROOT = 16, @@ -2793,8 +2794,8 @@ pub enum NodeFlags { NODE_ALL_DIRECTION_FLAGS = 1572864, NODE_CHROME_ONLY_ACCESS = 2097152, NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS = 4194304, - NODE_IS_DIRTY_FOR_SERVO = 8388608, - NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO = 16777216, + NODE_SHARED_RESTYLE_BIT_1 = 8388608, + NODE_SHARED_RESTYLE_BIT_2 = 16777216, NODE_TYPE_SPECIFIC_BITS_OFFSET = 23, } /** @@ -2819,7 +2820,7 @@ fn bindgen_test_layout_nsMutationGuard() { extern "C" { #[link_name = "_ZN15nsMutationGuard11sGenerationE"] pub static mut nsMutationGuard_consts_sGeneration: - ::std::os::raw::c_ulong; + ::std::os::raw::c_ulonglong; } pub type Float = f32; #[repr(i8)] @@ -3052,7 +3053,7 @@ pub type gfxImageFormat = SurfaceFormat; pub struct RectCorner; #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum RectCorner_Types_h_unnamed_10 { +pub enum RectCorner_Types_h_unnamed_11 { TopLeft = 0, TopRight = 1, BottomRight = 2, @@ -4283,14 +4284,14 @@ pub enum nsCSSUnit { #[derive(Debug)] pub struct nsCSSValue { pub mUnit: nsCSSUnit, - pub mValue: nsCSSValue_nsCSSValue_h_unnamed_12, + pub mValue: nsCSSValue_nsCSSValue_h_unnamed_13, } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum nsCSSValue_Serialization { eNormalized = 0, eAuthorSpecified = 1, } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsCSSValue_nsCSSValue_h_unnamed_12 { +pub struct nsCSSValue_nsCSSValue_h_unnamed_13 { pub mInt: __BindgenUnionField, pub mFloat: __BindgenUnionField, pub mString: __BindgenUnionField<*mut nsStringBuffer>, @@ -4313,15 +4314,15 @@ pub struct nsCSSValue_nsCSSValue_h_unnamed_12 { pub mFontFamilyList: __BindgenUnionField<*mut FontFamilyListRefCnt>, pub _bindgen_data_: u64, } -impl nsCSSValue_nsCSSValue_h_unnamed_12 { } -impl ::std::clone::Clone for nsCSSValue_nsCSSValue_h_unnamed_12 { +impl nsCSSValue_nsCSSValue_h_unnamed_13 { } +impl ::std::clone::Clone for nsCSSValue_nsCSSValue_h_unnamed_13 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsCSSValue_nsCSSValue_h_unnamed_12() { - assert_eq!(::std::mem::size_of::() , +fn bindgen_test_layout_nsCSSValue_nsCSSValue_h_unnamed_13() { + assert_eq!(::std::mem::size_of::() , 8usize); - assert_eq!(::std::mem::align_of::() , + assert_eq!(::std::mem::align_of::() , 8usize); } #[test] @@ -4642,7 +4643,7 @@ pub struct ArenaRefPtr { } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum gfxFontConstants_h_unnamed_13 { +pub enum gfxFontConstants_h_unnamed_14 { eFeatureAlternates_historical = 0, eFeatureAlternates_stylistic = 1, eFeatureAlternates_styleset = 2, @@ -4654,7 +4655,7 @@ pub enum gfxFontConstants_h_unnamed_13 { } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum gfxFontConstants_h_unnamed_14 { +pub enum gfxFontConstants_h_unnamed_15 { eFeatureEastAsian_jis78 = 0, eFeatureEastAsian_jis83 = 1, eFeatureEastAsian_jis90 = 2, @@ -4668,7 +4669,7 @@ pub enum gfxFontConstants_h_unnamed_14 { } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum gfxFontConstants_h_unnamed_15 { +pub enum gfxFontConstants_h_unnamed_16 { eFeatureLigatures_none = 0, eFeatureLigatures_common = 1, eFeatureLigatures_no_common = 2, @@ -4682,7 +4683,7 @@ pub enum gfxFontConstants_h_unnamed_15 { } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum gfxFontConstants_h_unnamed_16 { +pub enum gfxFontConstants_h_unnamed_17 { eFeatureNumeric_lining = 0, eFeatureNumeric_oldstyle = 1, eFeatureNumeric_proportional = 2, @@ -4769,22 +4770,22 @@ pub enum nsStyleUnit { } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsStyleCoord_h_unnamed_17 { +pub struct nsStyleCoord_h_unnamed_18 { pub mInt: __BindgenUnionField, pub mFloat: __BindgenUnionField, pub mPointer: __BindgenUnionField<*mut ::std::os::raw::c_void>, pub _bindgen_data_: u64, } -impl nsStyleCoord_h_unnamed_17 { } -impl ::std::clone::Clone for nsStyleCoord_h_unnamed_17 { +impl nsStyleCoord_h_unnamed_18 { } +impl ::std::clone::Clone for nsStyleCoord_h_unnamed_18 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsStyleCoord_h_unnamed_17() { - assert_eq!(::std::mem::size_of::() , 8usize); - assert_eq!(::std::mem::align_of::() , 8usize); +fn bindgen_test_layout_nsStyleCoord_h_unnamed_18() { + assert_eq!(::std::mem::size_of::() , 8usize); + assert_eq!(::std::mem::align_of::() , 8usize); } -pub type nsStyleUnion = nsStyleCoord_h_unnamed_17; +pub type nsStyleUnion = nsStyleCoord_h_unnamed_18; /** * Class that hold a single size specification used by the style * system. The size specification consists of two parts -- a number @@ -4977,26 +4978,26 @@ pub enum nsStyleImageType { pub struct nsStyleImage { pub mSubImages: u64, pub mType: nsStyleImageType, - pub nsStyleImage_nsStyleStruct_h_unnamed_20: nsStyleImage_nsStyleStruct_h_unnamed_20, + pub nsStyleImage_nsStyleStruct_h_unnamed_21: nsStyleImage_nsStyleStruct_h_unnamed_21, pub mCropRect: nsAutoPtr, } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsStyleImage_nsStyleStruct_h_unnamed_20 { +pub struct nsStyleImage_nsStyleStruct_h_unnamed_21 { pub mImage: __BindgenUnionField<*mut imgRequestProxy>, pub mGradient: __BindgenUnionField<*mut nsStyleGradient>, pub mElementId: __BindgenUnionField<*mut ::std::os::raw::c_ushort>, pub _bindgen_data_: u64, } -impl nsStyleImage_nsStyleStruct_h_unnamed_20 { } -impl ::std::clone::Clone for nsStyleImage_nsStyleStruct_h_unnamed_20 { +impl nsStyleImage_nsStyleStruct_h_unnamed_21 { } +impl ::std::clone::Clone for nsStyleImage_nsStyleStruct_h_unnamed_21 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsStyleImage_nsStyleStruct_h_unnamed_20() { - assert_eq!(::std::mem::size_of::() +fn bindgen_test_layout_nsStyleImage_nsStyleStruct_h_unnamed_21() { + assert_eq!(::std::mem::size_of::() , 8usize); - assert_eq!(::std::mem::align_of::() + assert_eq!(::std::mem::align_of::() , 8usize); } #[test] @@ -5046,7 +5047,7 @@ pub struct nsStyleImageLayers { } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum nsStyleImageLayers_nsStyleStruct_h_unnamed_21 { +pub enum nsStyleImageLayers_nsStyleStruct_h_unnamed_22 { shorthand = 0, color = 1, image = 2, @@ -5513,7 +5514,7 @@ fn bindgen_test_layout_nsStyleVisibility() { #[derive(Debug, Copy)] pub struct nsTimingFunction { pub mType: nsTimingFunction_Type, - pub nsTimingFunction_nsStyleStruct_h_unnamed_22: nsTimingFunction_nsStyleStruct_h_unnamed_22, + pub nsTimingFunction_nsStyleStruct_h_unnamed_23: nsTimingFunction_nsStyleStruct_h_unnamed_23, } #[repr(i32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] @@ -5540,56 +5541,56 @@ pub enum nsTimingFunction_StepSyntax { pub enum nsTimingFunction_Keyword { Implicit = 0, Explicit = 1, } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsTimingFunction_nsStyleStruct_h_unnamed_22 { - pub mFunc: __BindgenUnionField, - pub nsTimingFunction_nsStyleStruct_h_unnamed_22_nsStyleStruct_h_unnamed_24: __BindgenUnionField, +pub struct nsTimingFunction_nsStyleStruct_h_unnamed_23 { + pub mFunc: __BindgenUnionField, + pub nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_25: __BindgenUnionField, pub _bindgen_data_: [u32; 4usize], } -impl nsTimingFunction_nsStyleStruct_h_unnamed_22 { } -impl ::std::clone::Clone for nsTimingFunction_nsStyleStruct_h_unnamed_22 { +impl nsTimingFunction_nsStyleStruct_h_unnamed_23 { } +impl ::std::clone::Clone for nsTimingFunction_nsStyleStruct_h_unnamed_23 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsTimingFunction_nsStyleStruct_h_unnamed_22() { - assert_eq!(::std::mem::size_of::() +fn bindgen_test_layout_nsTimingFunction_nsStyleStruct_h_unnamed_23() { + assert_eq!(::std::mem::size_of::() , 16usize); - assert_eq!(::std::mem::align_of::() + assert_eq!(::std::mem::align_of::() , 4usize); } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsTimingFunction_nsStyleStruct_h_unnamed_22_nsStyleStruct_h_unnamed_23 { +pub struct nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_24 { pub mX1: f32, pub mY1: f32, pub mX2: f32, pub mY2: f32, } impl ::std::clone::Clone for - nsTimingFunction_nsStyleStruct_h_unnamed_22_nsStyleStruct_h_unnamed_23 { + nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_24 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsTimingFunction_nsStyleStruct_h_unnamed_22_nsStyleStruct_h_unnamed_23() { - assert_eq!(::std::mem::size_of::() +fn bindgen_test_layout_nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_24() { + assert_eq!(::std::mem::size_of::() , 16usize); - assert_eq!(::std::mem::align_of::() + assert_eq!(::std::mem::align_of::() , 4usize); } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsTimingFunction_nsStyleStruct_h_unnamed_22_nsStyleStruct_h_unnamed_24 { +pub struct nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_25 { pub mStepSyntax: nsTimingFunction_StepSyntax, pub mSteps: u32, } impl ::std::clone::Clone for - nsTimingFunction_nsStyleStruct_h_unnamed_22_nsStyleStruct_h_unnamed_24 { + nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_25 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsTimingFunction_nsStyleStruct_h_unnamed_22_nsStyleStruct_h_unnamed_24() { - assert_eq!(::std::mem::size_of::() +fn bindgen_test_layout_nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_25() { + assert_eq!(::std::mem::size_of::() , 8usize); - assert_eq!(::std::mem::align_of::() + assert_eq!(::std::mem::align_of::() , 4usize); } impl ::std::clone::Clone for nsTimingFunction { @@ -5734,25 +5735,25 @@ pub enum nsStyleContentType { #[derive(Debug)] pub struct nsStyleContentData { pub mType: nsStyleContentType, - pub mContent: nsStyleContentData_nsStyleStruct_h_unnamed_25, + pub mContent: nsStyleContentData_nsStyleStruct_h_unnamed_26, } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsStyleContentData_nsStyleStruct_h_unnamed_25 { +pub struct nsStyleContentData_nsStyleStruct_h_unnamed_26 { pub mString: __BindgenUnionField<*mut ::std::os::raw::c_ushort>, pub mImage: __BindgenUnionField<*mut imgRequestProxy>, pub mCounters: __BindgenUnionField<*mut Array>, pub _bindgen_data_: u64, } -impl nsStyleContentData_nsStyleStruct_h_unnamed_25 { } -impl ::std::clone::Clone for nsStyleContentData_nsStyleStruct_h_unnamed_25 { +impl nsStyleContentData_nsStyleStruct_h_unnamed_26 { } +impl ::std::clone::Clone for nsStyleContentData_nsStyleStruct_h_unnamed_26 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsStyleContentData_nsStyleStruct_h_unnamed_25() { - assert_eq!(::std::mem::size_of::() +fn bindgen_test_layout_nsStyleContentData_nsStyleStruct_h_unnamed_26() { + assert_eq!(::std::mem::size_of::() , 8usize); - assert_eq!(::std::mem::align_of::() + assert_eq!(::std::mem::align_of::() , 8usize); } #[test] @@ -5886,26 +5887,26 @@ pub enum nsStyleSVGOpacitySource { #[repr(C)] #[derive(Debug)] pub struct nsStyleSVGPaint { - pub mPaint: nsStyleSVGPaint_nsStyleStruct_h_unnamed_26, + pub mPaint: nsStyleSVGPaint_nsStyleStruct_h_unnamed_27, pub mType: nsStyleSVGPaintType, pub mFallbackColor: nscolor, } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsStyleSVGPaint_nsStyleStruct_h_unnamed_26 { +pub struct nsStyleSVGPaint_nsStyleStruct_h_unnamed_27 { pub mColor: __BindgenUnionField, pub mPaintServer: __BindgenUnionField<*mut nsIURI>, pub _bindgen_data_: u64, } -impl nsStyleSVGPaint_nsStyleStruct_h_unnamed_26 { } -impl ::std::clone::Clone for nsStyleSVGPaint_nsStyleStruct_h_unnamed_26 { +impl nsStyleSVGPaint_nsStyleStruct_h_unnamed_27 { } +impl ::std::clone::Clone for nsStyleSVGPaint_nsStyleStruct_h_unnamed_27 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsStyleSVGPaint_nsStyleStruct_h_unnamed_26() { - assert_eq!(::std::mem::size_of::() +fn bindgen_test_layout_nsStyleSVGPaint_nsStyleStruct_h_unnamed_27() { + assert_eq!(::std::mem::size_of::() , 8usize); - assert_eq!(::std::mem::align_of::() + assert_eq!(::std::mem::align_of::() , 8usize); } #[test] @@ -5940,7 +5941,7 @@ pub struct nsStyleSVG { } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum nsStyleSVG_nsStyleStruct_h_unnamed_27 { +pub enum nsStyleSVG_nsStyleStruct_h_unnamed_28 { FILL_OPACITY_SOURCE_MASK = 3, STROKE_OPACITY_SOURCE_MASK = 12, STROKE_DASHARRAY_CONTEXT = 16, @@ -5982,25 +5983,25 @@ fn bindgen_test_layout_nsStyleBasicShape() { #[derive(Debug)] pub struct nsStyleClipPath { pub mType: i32, - pub nsStyleClipPath_nsStyleStruct_h_unnamed_28: nsStyleClipPath_nsStyleStruct_h_unnamed_28, + pub nsStyleClipPath_nsStyleStruct_h_unnamed_29: nsStyleClipPath_nsStyleStruct_h_unnamed_29, pub mSizingBox: u8, } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsStyleClipPath_nsStyleStruct_h_unnamed_28 { +pub struct nsStyleClipPath_nsStyleStruct_h_unnamed_29 { pub mBasicShape: __BindgenUnionField<*mut nsStyleBasicShape>, pub mURL: __BindgenUnionField<*mut nsIURI>, pub _bindgen_data_: u64, } -impl nsStyleClipPath_nsStyleStruct_h_unnamed_28 { } -impl ::std::clone::Clone for nsStyleClipPath_nsStyleStruct_h_unnamed_28 { +impl nsStyleClipPath_nsStyleStruct_h_unnamed_29 { } +impl ::std::clone::Clone for nsStyleClipPath_nsStyleStruct_h_unnamed_29 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsStyleClipPath_nsStyleStruct_h_unnamed_28() { - assert_eq!(::std::mem::size_of::() +fn bindgen_test_layout_nsStyleClipPath_nsStyleStruct_h_unnamed_29() { + assert_eq!(::std::mem::size_of::() , 8usize); - assert_eq!(::std::mem::align_of::() + assert_eq!(::std::mem::align_of::() , 8usize); } #[test] @@ -6013,24 +6014,24 @@ fn bindgen_test_layout_nsStyleClipPath() { pub struct nsStyleFilter { pub mType: i32, pub mFilterParameter: nsStyleCoord, - pub nsStyleFilter_nsStyleStruct_h_unnamed_29: nsStyleFilter_nsStyleStruct_h_unnamed_29, + pub nsStyleFilter_nsStyleStruct_h_unnamed_30: nsStyleFilter_nsStyleStruct_h_unnamed_30, } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsStyleFilter_nsStyleStruct_h_unnamed_29 { +pub struct nsStyleFilter_nsStyleStruct_h_unnamed_30 { pub mURL: __BindgenUnionField<*mut nsIURI>, pub mDropShadow: __BindgenUnionField<*mut nsCSSShadowArray>, pub _bindgen_data_: u64, } -impl nsStyleFilter_nsStyleStruct_h_unnamed_29 { } -impl ::std::clone::Clone for nsStyleFilter_nsStyleStruct_h_unnamed_29 { +impl nsStyleFilter_nsStyleStruct_h_unnamed_30 { } +impl ::std::clone::Clone for nsStyleFilter_nsStyleStruct_h_unnamed_30 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsStyleFilter_nsStyleStruct_h_unnamed_29() { - assert_eq!(::std::mem::size_of::() +fn bindgen_test_layout_nsStyleFilter_nsStyleStruct_h_unnamed_30() { + assert_eq!(::std::mem::size_of::() , 8usize); - assert_eq!(::std::mem::align_of::() + assert_eq!(::std::mem::align_of::() , 8usize); } #[test] diff --git a/ports/geckolib/gecko_bindings/sugar/mod.rs b/ports/geckolib/gecko_bindings/sugar/mod.rs index 17d1e9209c2..9c1e4637249 100644 --- a/ports/geckolib/gecko_bindings/sugar/mod.rs +++ b/ports/geckolib/gecko_bindings/sugar/mod.rs @@ -2,4 +2,5 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +mod ns_style_auto_array; mod ns_t_array; diff --git a/ports/geckolib/gecko_bindings/sugar/ns_style_auto_array.rs b/ports/geckolib/gecko_bindings/sugar/ns_style_auto_array.rs new file mode 100644 index 00000000000..43728fd979d --- /dev/null +++ b/ports/geckolib/gecko_bindings/sugar/ns_style_auto_array.rs @@ -0,0 +1,28 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use std::iter::{once, Chain, Once, IntoIterator}; +use std::slice::IterMut; +use structs::nsStyleAutoArray; + +impl nsStyleAutoArray { + pub fn iter_mut(&mut self) -> Chain, IterMut> { + once(&mut self.mFirstElement).chain(self.mOtherElements.iter_mut()) + } + + // Note that often structs containing autoarrays will have + // additional member fields that contain the length, which must be kept + // in sync + pub fn len(&self) -> usize { + 1 + self.mOtherElements.len() + } +} + +impl<'a, T> IntoIterator for &'a mut nsStyleAutoArray { + type Item = &'a mut T; + type IntoIter = Chain, IterMut<'a, T>>; + fn into_iter(self) -> Self::IntoIter { + self.iter_mut() + } +} diff --git a/ports/geckolib/gecko_bindings/sugar/ns_t_array.rs b/ports/geckolib/gecko_bindings/sugar/ns_t_array.rs index 57b6495b040..ec6b72d5c16 100644 --- a/ports/geckolib/gecko_bindings/sugar/ns_t_array.rs +++ b/ports/geckolib/gecko_bindings/sugar/ns_t_array.rs @@ -2,8 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use bindings::Gecko_EnsureTArrayCapacity; use std::mem; use std::ops::{Deref, DerefMut}; +use std::os::raw::c_void; use std::slice; use structs::{nsTArray, nsTArrayHeader}; @@ -33,10 +35,33 @@ impl nsTArray { debug_assert!(!self.mBuffer.is_null()); unsafe { mem::transmute(self.mBuffer) } } + // unsafe, since header may be in shared static or something + unsafe fn header_mut<'a>(&'a mut self) -> &'a mut nsTArrayHeader { + debug_assert!(!self.mBuffer.is_null()); + mem::transmute(self.mBuffer) + } #[inline] unsafe fn slice_begin(&self) -> *mut T { debug_assert!(!self.mBuffer.is_null()); (self.mBuffer as *const nsTArrayHeader).offset(1) as *mut _ } + + fn ensure_capacity(&mut self, cap: usize) { + unsafe { + Gecko_EnsureTArrayCapacity(self as *mut nsTArray as *mut c_void, cap, mem::size_of::()) + } + } + + // unsafe because the array may contain uninits + // This will not call constructors, either manually + // add bindings or run the typed ensurecapacity call + // on the gecko side + pub unsafe fn set_len(&mut self, len: u32) { + // this can leak + debug_assert!(len >= self.len() as u32); + self.ensure_capacity(len as usize); + let mut header = self.header_mut(); + header.mLength = len; + } } diff --git a/ports/geckolib/gecko_bindings/tools/regen.py b/ports/geckolib/gecko_bindings/tools/regen.py index 1a80939b266..82897ffdb8d 100755 --- a/ports/geckolib/gecko_bindings/tools/regen.py +++ b/ports/geckolib/gecko_bindings/tools/regen.py @@ -118,12 +118,16 @@ COMPILATION_TARGETS = { "nsStyleMargin", "nsStylePadding", "nsStyleBorder", "nsStyleOutline", "nsStyleXUL", "nsStyleSVGReset", "nsStyleColumn", "nsStyleEffects", "nsStyleImage", "nsStyleGradient", - "nsStyleCoord", "nsStyleGradientStop", + "nsStyleCoord", "nsStyleGradientStop", "nsStyleImageLayers", + "nsStyleImageLayers::Layer", "nsStyleImageLayers::LayerType", "SheetParsingMode", "nsMainThreadPtrHandle", "nsMainThreadPtrHolder", "nscolor", "nsFont", "FontFamilyList", "FontFamilyType", "nsIAtom", ], + "void_types": [ + "nsINode", "nsIDocument", "nsIPrincipal", "nsIURI", + ] } } @@ -226,23 +230,33 @@ def build(objdir, target_name, kind_name=None, for ty in current_target["opaque_types"]: flags.append("-opaque-type") flags.append(ty) + if "void_types" in current_target: + for ty in current_target["void_types"]: + flags.append("-raw-line") + flags.append("pub enum {} {{}}".format(ty)) if "structs_types" in current_target: for ty in current_target["structs_types"]: + ty_fragments = ty.split("::") + mangled_name = ty.replace("::", "_") flags.append("-blacklist-type") - flags.append(ty) + flags.append(ty_fragments[-1]) flags.append("-raw-line") - flags.append("use structs::{};".format(ty)) + if len(ty_fragments) > 1: + flags.append("use structs::{} as {};".format(mangled_name, ty_fragments[-1])) + else: + flags.append("use structs::{};".format(mangled_name)) # TODO: this is hacky, figure out a better way to do it without # hardcoding everything... - if ty.startswith("nsStyle"): + if ty_fragments[-1].startswith("nsStyle"): flags.extend([ "-raw-line", - "unsafe impl Send for {} {{}}".format(ty), + "unsafe impl Send for {} {{}}".format(ty_fragments[-1]), "-raw-line", - "unsafe impl Sync for {} {{}}".format(ty), + "unsafe impl Sync for {} {{}}".format(ty_fragments[-1]), "-raw-line", - "impl HeapSizeOf for {} {{ fn heap_size_of_children(&self) -> usize {{ 0 }} }}".format(ty) + "impl HeapSizeOf for {} {{ fn heap_size_of_children(&self) -> usize {{ 0 }} }}" + .format(ty_fragments[-1]) ]) flags.append("-o") diff --git a/ports/geckolib/properties.mako.rs b/ports/geckolib/properties.mako.rs index 9c458602c7d..891e655d84f 100644 --- a/ports/geckolib/properties.mako.rs +++ b/ports/geckolib/properties.mako.rs @@ -19,10 +19,10 @@ use gecko_bindings::bindings::Gecko_Destroy_${style_struct.gecko_ffi_name}; use gecko_bindings::bindings::{Gecko_CopyMozBindingFrom, Gecko_CopyListStyleTypeFrom}; use gecko_bindings::bindings::{Gecko_SetMozBinding, Gecko_SetListStyleType}; use gecko_bindings::bindings::{Gecko_SetNullImageValue, Gecko_SetGradientImageValue}; -use gecko_bindings::bindings::{Gecko_CreateGradient}; +use gecko_bindings::bindings::{Gecko_EnsureImageLayersLength, Gecko_CreateGradient}; use gecko_bindings::bindings::{Gecko_CopyImageValueFrom, Gecko_CopyFontFamilyFrom}; use gecko_bindings::bindings::{Gecko_FontFamilyList_AppendGeneric, Gecko_FontFamilyList_AppendNamed}; -use gecko_bindings::bindings::{Gecko_FontFamilyList_Clear}; +use gecko_bindings::bindings::{Gecko_FontFamilyList_Clear, Gecko_InitializeImageLayer}; use gecko_bindings::structs; use glue::ArcHelpers; use std::fmt::{self, Debug}; @@ -946,7 +946,8 @@ fn static_assert() { } } - fn set_background_image(&mut self, image: longhands::background_image::computed_value::T) { + fn set_background_image(&mut self, images: longhands::background_image::computed_value::T) { + use gecko_bindings::structs::nsStyleImageLayers_LayerType as LayerType; use gecko_bindings::structs::{NS_STYLE_GRADIENT_SHAPE_LINEAR, NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER}; use gecko_bindings::structs::nsStyleCoord; use style::values::computed::Image; @@ -955,76 +956,88 @@ fn static_assert() { unsafe { // Prevent leaking of the last element we did set - Gecko_SetNullImageValue(&mut self.gecko.mImage.mLayers.mFirstElement.mImage); + for image in &mut self.gecko.mImage.mLayers { + Gecko_SetNullImageValue(&mut image.mImage) + } + Gecko_EnsureImageLayersLength(&mut self.gecko.mImage, images.0.len()); + for image in &mut self.gecko.mImage.mLayers { + Gecko_InitializeImageLayer(image, LayerType::Background); + } } - self.gecko.mImage.mImageCount = cmp::max(1, self.gecko.mImage.mImageCount); - if let Some(image) = image.0 { - match image { - Image::LinearGradient(ref gradient) => { - let stop_count = gradient.stops.len(); - if stop_count >= ::std::u32::MAX as usize { - warn!("stylo: Prevented overflow due to too many gradient stops"); - return; - } + self.gecko.mImage.mImageCount = cmp::max(self.gecko.mImage.mLayers.len() as u32, + self.gecko.mImage.mImageCount); - let gecko_gradient = unsafe { - Gecko_CreateGradient(NS_STYLE_GRADIENT_SHAPE_LINEAR as u8, - NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER as u8, - /* repeating = */ false, - /* legacy_syntax = */ false, - stop_count as u32) - }; - - // TODO: figure out what gecko does in the `corner` case. - if let AngleOrCorner::Angle(angle) = gradient.angle_or_corner { - unsafe { - (*gecko_gradient).mAngle.set(angle); + // TODO: pre-grow the nsTArray to the right capacity + // otherwise the below code won't work + for (image, geckoimage) in images.0.into_iter().zip(self.gecko.mImage.mLayers.iter_mut()) { + if let Some(image) = image.0 { + match image { + Image::LinearGradient(ref gradient) => { + let stop_count = gradient.stops.len(); + if stop_count >= ::std::u32::MAX as usize { + warn!("stylo: Prevented overflow due to too many gradient stops"); + return; } - } - let mut coord: nsStyleCoord = unsafe { uninitialized() }; - for (index, stop) in gradient.stops.iter().enumerate() { - // NB: stops are guaranteed to be none in the gecko side by - // default. - coord.set(stop.position); - let color = match stop.color { - CSSColor::CurrentColor => { - // TODO(emilio): gecko just stores an nscolor, - // and it doesn't seem to support currentColor - // as value in a gradient. - // - // Double-check it and either remove - // currentColor for servo or see how gecko - // handles this. - 0 - }, - CSSColor::RGBA(ref rgba) => convert_rgba_to_nscolor(rgba), + let gecko_gradient = unsafe { + Gecko_CreateGradient(NS_STYLE_GRADIENT_SHAPE_LINEAR as u8, + NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER as u8, + /* repeating = */ false, + /* legacy_syntax = */ false, + stop_count as u32) }; - let mut stop = unsafe { - &mut (*gecko_gradient).mStops[index] - }; + // TODO: figure out what gecko does in the `corner` case. + if let AngleOrCorner::Angle(angle) = gradient.angle_or_corner { + unsafe { + (*gecko_gradient).mAngle.set(angle); + } + } - stop.mColor = color; - stop.mIsInterpolationHint = false; - stop.mLocation.copy_from(&coord); - } + let mut coord: nsStyleCoord = unsafe { uninitialized() }; + for (index, stop) in gradient.stops.iter().enumerate() { + // NB: stops are guaranteed to be none in the gecko side by + // default. + coord.set(stop.position); + let color = match stop.color { + CSSColor::CurrentColor => { + // TODO(emilio): gecko just stores an nscolor, + // and it doesn't seem to support currentColor + // as value in a gradient. + // + // Double-check it and either remove + // currentColor for servo or see how gecko + // handles this. + 0 + }, + CSSColor::RGBA(ref rgba) => convert_rgba_to_nscolor(rgba), + }; - unsafe { - Gecko_SetGradientImageValue(&mut self.gecko.mImage.mLayers.mFirstElement.mImage, - gecko_gradient); + let mut stop = unsafe { + &mut (*gecko_gradient).mStops[index] + }; + + stop.mColor = color; + stop.mIsInterpolationHint = false; + stop.mLocation.copy_from(&coord); + } + + unsafe { + Gecko_SetGradientImageValue(&mut geckoimage.mImage, gecko_gradient); + } + }, + Image::Url(_) => { + // let utf8_bytes = url.as_bytes(); + // Gecko_SetUrlImageValue(&mut self.gecko.mImage.mLayers.mFirstElement, + // utf8_bytes.as_ptr() as *const _, + // utf8_bytes.len()); + warn!("stylo: imgRequestProxies are not threadsafe in gecko, \ + background-image: url() not yet implemented"); } - }, - Image::Url(_) => { - // let utf8_bytes = url.as_bytes(); - // Gecko_SetUrlImageValue(&mut self.gecko.mImage.mLayers.mFirstElement, - // utf8_bytes.as_ptr() as *const _, - // utf8_bytes.len()); - warn!("stylo: imgRequestProxies are not threadsafe in gecko, \ - background-image: url() not yet implemented"); } } + } } diff --git a/ports/geckolib/wrapper.rs b/ports/geckolib/wrapper.rs index a30044315ef..0dbba6ceca1 100644 --- a/ports/geckolib/wrapper.rs +++ b/ports/geckolib/wrapper.rs @@ -24,6 +24,7 @@ use gecko_bindings::bindings::{Gecko_IsUnvisitedLink, Gecko_IsVisitedLink}; use gecko_bindings::bindings::{Gecko_LocalName, Gecko_Namespace, Gecko_NodeIsElement, Gecko_SetNodeData}; use gecko_bindings::bindings::{RawGeckoDocument, RawGeckoElement, RawGeckoNode}; use gecko_bindings::structs::nsIAtom; +use gecko_bindings::structs::{NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO, NODE_IS_DIRTY_FOR_SERVO}; use glue::GeckoDeclarationBlock; use libc::uintptr_t; use properties::GeckoComputedValues; @@ -184,7 +185,6 @@ impl<'ln> TNode for GeckoNode<'ln> { } fn is_dirty(&self) -> bool { - use gecko_bindings::structs::NodeFlags::*; // Return true unconditionally if we're not yet styled. This is a hack // and should go away soon. if unsafe { Gecko_GetNodeData(self.node) }.is_null() { @@ -196,7 +196,6 @@ impl<'ln> TNode for GeckoNode<'ln> { } unsafe fn set_dirty(&self, value: bool) { - use gecko_bindings::structs::NodeFlags::*; if value { Gecko_SetNodeFlags(self.node, NODE_IS_DIRTY_FOR_SERVO as u32) } else { @@ -205,7 +204,6 @@ impl<'ln> TNode for GeckoNode<'ln> { } fn has_dirty_descendants(&self) -> bool { - use gecko_bindings::structs::NodeFlags::*; // Return true unconditionally if we're not yet styled. This is a hack // and should go away soon. if unsafe { Gecko_GetNodeData(self.node) }.is_null() { @@ -216,7 +214,6 @@ impl<'ln> TNode for GeckoNode<'ln> { } unsafe fn set_dirty_descendants(&self, value: bool) { - use gecko_bindings::structs::NodeFlags::*; if value { Gecko_SetNodeFlags(self.node, NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32) } else {