Auto merge of #18042 - upsuper:grid-template, r=canaltinova

Make nsStylePosition::mGridTemplate{Columns,Rows} a UniquePtr.

This is the Servo side change of [bug 1388255](https://bugzilla.mozilla.org/show_bug.cgi?id=1388255).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18042)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-08-11 06:32:44 -05:00 committed by GitHub
commit 58e8a3126a
4 changed files with 272 additions and 112 deletions

View file

@ -16,6 +16,7 @@ use gecko_bindings::structs::mozilla::css::URLValue;
use gecko_bindings::structs::mozilla::css::URLValueData; use gecko_bindings::structs::mozilla::css::URLValueData;
use gecko_bindings::structs::mozilla::MallocSizeOf; use gecko_bindings::structs::mozilla::MallocSizeOf;
use gecko_bindings::structs::mozilla::Side; use gecko_bindings::structs::mozilla::Side;
use gecko_bindings::structs::mozilla::UniquePtr;
use gecko_bindings::structs::nsIContent; use gecko_bindings::structs::nsIContent;
use gecko_bindings::structs::nsIDocument; use gecko_bindings::structs::nsIDocument;
use gecko_bindings::structs::nsIDocument_DocumentTheme; use gecko_bindings::structs::nsIDocument_DocumentTheme;
@ -1121,18 +1122,17 @@ extern "C" {
length: u32); length: u32);
} }
extern "C" { extern "C" {
pub fn Gecko_SetStyleGridTemplateArrayLengths(grid_template: pub fn Gecko_SetStyleGridTemplate(grid_template:
*mut nsStyleGridTemplate, *mut UniquePtr<nsStyleGridTemplate>,
track_sizes: u32); value: *mut nsStyleGridTemplate);
} }
extern "C" { extern "C" {
pub fn Gecko_SetGridTemplateLineNamesLength(grid_template: pub fn Gecko_CreateStyleGridTemplate(track_sizes: u32, name_size: u32)
*mut nsStyleGridTemplate, -> *mut nsStyleGridTemplate;
track_sizes: u32);
} }
extern "C" { extern "C" {
pub fn Gecko_CopyStyleGridTemplateValues(grid_template: pub fn Gecko_CopyStyleGridTemplateValues(grid_template:
*mut nsStyleGridTemplate, *mut UniquePtr<nsStyleGridTemplate>,
other: other:
*const nsStyleGridTemplate); *const nsStyleGridTemplate);
} }

View file

@ -5195,7 +5195,7 @@ pub mod root {
} }
#[test] #[test]
fn bindgen_test_layout_GeckoPosition() { fn bindgen_test_layout_GeckoPosition() {
assert_eq!(::std::mem::size_of::<GeckoPosition>() , 520usize , assert_eq!(::std::mem::size_of::<GeckoPosition>() , 440usize ,
concat ! ( "Size of: " , stringify ! ( GeckoPosition ) concat ! ( "Size of: " , stringify ! ( GeckoPosition )
)); ));
assert_eq! (::std::mem::align_of::<GeckoPosition>() , 8usize , assert_eq! (::std::mem::align_of::<GeckoPosition>() , 8usize ,
@ -14055,8 +14055,8 @@ pub mod root {
pub mFlexGrow: f32, pub mFlexGrow: f32,
pub mFlexShrink: f32, pub mFlexShrink: f32,
pub mZIndex: root::nsStyleCoord, pub mZIndex: root::nsStyleCoord,
pub mGridTemplateColumns: root::nsStyleGridTemplate, pub mGridTemplateColumns: root::mozilla::UniquePtr<root::nsStyleGridTemplate>,
pub mGridTemplateRows: root::nsStyleGridTemplate, pub mGridTemplateRows: root::mozilla::UniquePtr<root::nsStyleGridTemplate>,
pub mGridTemplateAreas: root::RefPtr<root::mozilla::css::GridTemplateAreasValue>, pub mGridTemplateAreas: root::RefPtr<root::mozilla::css::GridTemplateAreasValue>,
pub mGridColumnStart: root::nsStyleGridLine, pub mGridColumnStart: root::nsStyleGridLine,
pub mGridColumnEnd: root::nsStyleGridLine, pub mGridColumnEnd: root::nsStyleGridLine,
@ -14068,7 +14068,7 @@ pub mod root {
pub const nsStylePosition_kHasFinishStyle: bool = false; pub const nsStylePosition_kHasFinishStyle: bool = false;
#[test] #[test]
fn bindgen_test_layout_nsStylePosition() { fn bindgen_test_layout_nsStylePosition() {
assert_eq!(::std::mem::size_of::<nsStylePosition>() , 520usize , assert_eq!(::std::mem::size_of::<nsStylePosition>() , 440usize ,
concat ! ( "Size of: " , stringify ! ( nsStylePosition ) concat ! ( "Size of: " , stringify ! ( nsStylePosition )
)); ));
assert_eq! (::std::mem::align_of::<nsStylePosition>() , 8usize , assert_eq! (::std::mem::align_of::<nsStylePosition>() , 8usize ,
@ -14232,45 +14232,45 @@ pub mod root {
"::" , stringify ! ( mGridTemplateColumns ) )); "::" , stringify ! ( mGridTemplateColumns ) ));
assert_eq! (unsafe { assert_eq! (unsafe {
& ( * ( 0 as * const nsStylePosition ) ) . & ( * ( 0 as * const nsStylePosition ) ) .
mGridTemplateRows as * const _ as usize } , 336usize , mGridTemplateRows as * const _ as usize } , 296usize ,
concat ! ( concat ! (
"Alignment of field: " , stringify ! ( nsStylePosition ) , "Alignment of field: " , stringify ! ( nsStylePosition ) ,
"::" , stringify ! ( mGridTemplateRows ) )); "::" , stringify ! ( mGridTemplateRows ) ));
assert_eq! (unsafe { assert_eq! (unsafe {
& ( * ( 0 as * const nsStylePosition ) ) . & ( * ( 0 as * const nsStylePosition ) ) .
mGridTemplateAreas as * const _ as usize } , 384usize , mGridTemplateAreas as * const _ as usize } , 304usize ,
concat ! ( concat ! (
"Alignment of field: " , stringify ! ( nsStylePosition ) , "Alignment of field: " , stringify ! ( nsStylePosition ) ,
"::" , stringify ! ( mGridTemplateAreas ) )); "::" , stringify ! ( mGridTemplateAreas ) ));
assert_eq! (unsafe { assert_eq! (unsafe {
& ( * ( 0 as * const nsStylePosition ) ) . & ( * ( 0 as * const nsStylePosition ) ) .
mGridColumnStart as * const _ as usize } , 392usize , mGridColumnStart as * const _ as usize } , 312usize ,
concat ! ( concat ! (
"Alignment of field: " , stringify ! ( nsStylePosition ) , "Alignment of field: " , stringify ! ( nsStylePosition ) ,
"::" , stringify ! ( mGridColumnStart ) )); "::" , stringify ! ( mGridColumnStart ) ));
assert_eq! (unsafe { assert_eq! (unsafe {
& ( * ( 0 as * const nsStylePosition ) ) . mGridColumnEnd & ( * ( 0 as * const nsStylePosition ) ) . mGridColumnEnd
as * const _ as usize } , 416usize , concat ! ( as * const _ as usize } , 336usize , concat ! (
"Alignment of field: " , stringify ! ( nsStylePosition ) , "Alignment of field: " , stringify ! ( nsStylePosition ) ,
"::" , stringify ! ( mGridColumnEnd ) )); "::" , stringify ! ( mGridColumnEnd ) ));
assert_eq! (unsafe { assert_eq! (unsafe {
& ( * ( 0 as * const nsStylePosition ) ) . mGridRowStart & ( * ( 0 as * const nsStylePosition ) ) . mGridRowStart
as * const _ as usize } , 440usize , concat ! ( as * const _ as usize } , 360usize , concat ! (
"Alignment of field: " , stringify ! ( nsStylePosition ) , "Alignment of field: " , stringify ! ( nsStylePosition ) ,
"::" , stringify ! ( mGridRowStart ) )); "::" , stringify ! ( mGridRowStart ) ));
assert_eq! (unsafe { assert_eq! (unsafe {
& ( * ( 0 as * const nsStylePosition ) ) . mGridRowEnd as & ( * ( 0 as * const nsStylePosition ) ) . mGridRowEnd as
* const _ as usize } , 464usize , concat ! ( * const _ as usize } , 384usize , concat ! (
"Alignment of field: " , stringify ! ( nsStylePosition ) , "Alignment of field: " , stringify ! ( nsStylePosition ) ,
"::" , stringify ! ( mGridRowEnd ) )); "::" , stringify ! ( mGridRowEnd ) ));
assert_eq! (unsafe { assert_eq! (unsafe {
& ( * ( 0 as * const nsStylePosition ) ) . mGridColumnGap & ( * ( 0 as * const nsStylePosition ) ) . mGridColumnGap
as * const _ as usize } , 488usize , concat ! ( as * const _ as usize } , 408usize , concat ! (
"Alignment of field: " , stringify ! ( nsStylePosition ) , "Alignment of field: " , stringify ! ( nsStylePosition ) ,
"::" , stringify ! ( mGridColumnGap ) )); "::" , stringify ! ( mGridColumnGap ) ));
assert_eq! (unsafe { assert_eq! (unsafe {
& ( * ( 0 as * const nsStylePosition ) ) . mGridRowGap as & ( * ( 0 as * const nsStylePosition ) ) . mGridRowGap as
* const _ as usize } , 504usize , concat ! ( * const _ as usize } , 424usize , concat ! (
"Alignment of field: " , stringify ! ( nsStylePosition ) , "Alignment of field: " , stringify ! ( nsStylePosition ) ,
"::" , stringify ! ( mGridRowGap ) )); "::" , stringify ! ( mGridRowGap ) ));
} }
@ -33750,6 +33750,50 @@ pub mod root {
root::nsCOMPtr<root::nsIAtom> ) )); root::nsCOMPtr<root::nsIAtom> ) ));
} }
#[test] #[test]
fn __bindgen_test_layout_UniquePtr_open0_nsStyleGridTemplate_DefaultDelete_open1_nsStyleGridTemplate_close1_close0_instantiation() {
assert_eq!(::std::mem::size_of::<root::mozilla::UniquePtr<root::nsStyleGridTemplate>>()
, 8usize , concat ! (
"Size of template specialization: " , stringify ! (
root::mozilla::UniquePtr<root::nsStyleGridTemplate> ) ));
assert_eq!(::std::mem::align_of::<root::mozilla::UniquePtr<root::nsStyleGridTemplate>>()
, 8usize , concat ! (
"Alignment of template specialization: " , stringify ! (
root::mozilla::UniquePtr<root::nsStyleGridTemplate> ) ));
}
#[test]
fn __bindgen_test_layout_DefaultDelete_open0_nsStyleGridTemplate_close0_instantiation() {
assert_eq!(::std::mem::size_of::<root::mozilla::DefaultDelete>() ,
1usize , concat ! (
"Size of template specialization: " , stringify ! (
root::mozilla::DefaultDelete ) ));
assert_eq!(::std::mem::align_of::<root::mozilla::DefaultDelete>() ,
1usize , concat ! (
"Alignment of template specialization: " , stringify ! (
root::mozilla::DefaultDelete ) ));
}
#[test]
fn __bindgen_test_layout_UniquePtr_open0_nsStyleGridTemplate_DefaultDelete_open1_nsStyleGridTemplate_close1_close0_instantiation_1() {
assert_eq!(::std::mem::size_of::<root::mozilla::UniquePtr<root::nsStyleGridTemplate>>()
, 8usize , concat ! (
"Size of template specialization: " , stringify ! (
root::mozilla::UniquePtr<root::nsStyleGridTemplate> ) ));
assert_eq!(::std::mem::align_of::<root::mozilla::UniquePtr<root::nsStyleGridTemplate>>()
, 8usize , concat ! (
"Alignment of template specialization: " , stringify ! (
root::mozilla::UniquePtr<root::nsStyleGridTemplate> ) ));
}
#[test]
fn __bindgen_test_layout_DefaultDelete_open0_nsStyleGridTemplate_close0_instantiation_1() {
assert_eq!(::std::mem::size_of::<root::mozilla::DefaultDelete>() ,
1usize , concat ! (
"Size of template specialization: " , stringify ! (
root::mozilla::DefaultDelete ) ));
assert_eq!(::std::mem::align_of::<root::mozilla::DefaultDelete>() ,
1usize , concat ! (
"Alignment of template specialization: " , stringify ! (
root::mozilla::DefaultDelete ) ));
}
#[test]
fn __bindgen_test_layout_RefPtr_open0_GridTemplateAreasValue_close0_instantiation() { fn __bindgen_test_layout_RefPtr_open0_GridTemplateAreasValue_close0_instantiation() {
assert_eq!(::std::mem::size_of::<root::RefPtr<root::mozilla::css::GridTemplateAreasValue>>() assert_eq!(::std::mem::size_of::<root::RefPtr<root::mozilla::css::GridTemplateAreasValue>>()
, 8usize , concat ! ( , 8usize , concat ! (
@ -37769,6 +37813,50 @@ pub mod root {
root::nsTArray<::nsstring::nsStringRepr> ) )); root::nsTArray<::nsstring::nsStringRepr> ) ));
} }
#[test] #[test]
fn __bindgen_test_layout_UniquePtr_open0_nsStyleGridTemplate_DefaultDelete_open1_nsStyleGridTemplate_close1_close0_instantiation_2() {
assert_eq!(::std::mem::size_of::<root::mozilla::UniquePtr<root::nsStyleGridTemplate>>()
, 8usize , concat ! (
"Size of template specialization: " , stringify ! (
root::mozilla::UniquePtr<root::nsStyleGridTemplate> ) ));
assert_eq!(::std::mem::align_of::<root::mozilla::UniquePtr<root::nsStyleGridTemplate>>()
, 8usize , concat ! (
"Alignment of template specialization: " , stringify ! (
root::mozilla::UniquePtr<root::nsStyleGridTemplate> ) ));
}
#[test]
fn __bindgen_test_layout_DefaultDelete_open0_nsStyleGridTemplate_close0_instantiation_2() {
assert_eq!(::std::mem::size_of::<root::mozilla::DefaultDelete>() ,
1usize , concat ! (
"Size of template specialization: " , stringify ! (
root::mozilla::DefaultDelete ) ));
assert_eq!(::std::mem::align_of::<root::mozilla::DefaultDelete>() ,
1usize , concat ! (
"Alignment of template specialization: " , stringify ! (
root::mozilla::DefaultDelete ) ));
}
#[test]
fn __bindgen_test_layout_UniquePtr_open0_nsStyleGridTemplate_DefaultDelete_open1_nsStyleGridTemplate_close1_close0_instantiation_3() {
assert_eq!(::std::mem::size_of::<root::mozilla::UniquePtr<root::nsStyleGridTemplate>>()
, 8usize , concat ! (
"Size of template specialization: " , stringify ! (
root::mozilla::UniquePtr<root::nsStyleGridTemplate> ) ));
assert_eq!(::std::mem::align_of::<root::mozilla::UniquePtr<root::nsStyleGridTemplate>>()
, 8usize , concat ! (
"Alignment of template specialization: " , stringify ! (
root::mozilla::UniquePtr<root::nsStyleGridTemplate> ) ));
}
#[test]
fn __bindgen_test_layout_DefaultDelete_open0_nsStyleGridTemplate_close0_instantiation_3() {
assert_eq!(::std::mem::size_of::<root::mozilla::DefaultDelete>() ,
1usize , concat ! (
"Size of template specialization: " , stringify ! (
root::mozilla::DefaultDelete ) ));
assert_eq!(::std::mem::align_of::<root::mozilla::DefaultDelete>() ,
1usize , concat ! (
"Alignment of template specialization: " , stringify ! (
root::mozilla::DefaultDelete ) ));
}
#[test]
fn __bindgen_test_layout_RefPtr_open0_RawServoMediaList_close0_instantiation() { fn __bindgen_test_layout_RefPtr_open0_RawServoMediaList_close0_instantiation() {
assert_eq!(::std::mem::size_of::<root::RefPtr<root::RawServoMediaList>>() assert_eq!(::std::mem::size_of::<root::RefPtr<root::RawServoMediaList>>()
, 8usize , concat ! ( , 8usize , concat ! (

View file

@ -5083,7 +5083,7 @@ pub mod root {
} }
#[test] #[test]
fn bindgen_test_layout_GeckoPosition() { fn bindgen_test_layout_GeckoPosition() {
assert_eq!(::std::mem::size_of::<GeckoPosition>() , 520usize , assert_eq!(::std::mem::size_of::<GeckoPosition>() , 440usize ,
concat ! ( "Size of: " , stringify ! ( GeckoPosition ) concat ! ( "Size of: " , stringify ! ( GeckoPosition )
)); ));
assert_eq! (::std::mem::align_of::<GeckoPosition>() , 8usize , assert_eq! (::std::mem::align_of::<GeckoPosition>() , 8usize ,
@ -13846,8 +13846,8 @@ pub mod root {
pub mFlexGrow: f32, pub mFlexGrow: f32,
pub mFlexShrink: f32, pub mFlexShrink: f32,
pub mZIndex: root::nsStyleCoord, pub mZIndex: root::nsStyleCoord,
pub mGridTemplateColumns: root::nsStyleGridTemplate, pub mGridTemplateColumns: root::mozilla::UniquePtr<root::nsStyleGridTemplate>,
pub mGridTemplateRows: root::nsStyleGridTemplate, pub mGridTemplateRows: root::mozilla::UniquePtr<root::nsStyleGridTemplate>,
pub mGridTemplateAreas: root::RefPtr<root::mozilla::css::GridTemplateAreasValue>, pub mGridTemplateAreas: root::RefPtr<root::mozilla::css::GridTemplateAreasValue>,
pub mGridColumnStart: root::nsStyleGridLine, pub mGridColumnStart: root::nsStyleGridLine,
pub mGridColumnEnd: root::nsStyleGridLine, pub mGridColumnEnd: root::nsStyleGridLine,
@ -13859,7 +13859,7 @@ pub mod root {
pub const nsStylePosition_kHasFinishStyle: bool = false; pub const nsStylePosition_kHasFinishStyle: bool = false;
#[test] #[test]
fn bindgen_test_layout_nsStylePosition() { fn bindgen_test_layout_nsStylePosition() {
assert_eq!(::std::mem::size_of::<nsStylePosition>() , 520usize , assert_eq!(::std::mem::size_of::<nsStylePosition>() , 440usize ,
concat ! ( "Size of: " , stringify ! ( nsStylePosition ) concat ! ( "Size of: " , stringify ! ( nsStylePosition )
)); ));
assert_eq! (::std::mem::align_of::<nsStylePosition>() , 8usize , assert_eq! (::std::mem::align_of::<nsStylePosition>() , 8usize ,
@ -14023,45 +14023,45 @@ pub mod root {
"::" , stringify ! ( mGridTemplateColumns ) )); "::" , stringify ! ( mGridTemplateColumns ) ));
assert_eq! (unsafe { assert_eq! (unsafe {
& ( * ( 0 as * const nsStylePosition ) ) . & ( * ( 0 as * const nsStylePosition ) ) .
mGridTemplateRows as * const _ as usize } , 336usize , mGridTemplateRows as * const _ as usize } , 296usize ,
concat ! ( concat ! (
"Alignment of field: " , stringify ! ( nsStylePosition ) , "Alignment of field: " , stringify ! ( nsStylePosition ) ,
"::" , stringify ! ( mGridTemplateRows ) )); "::" , stringify ! ( mGridTemplateRows ) ));
assert_eq! (unsafe { assert_eq! (unsafe {
& ( * ( 0 as * const nsStylePosition ) ) . & ( * ( 0 as * const nsStylePosition ) ) .
mGridTemplateAreas as * const _ as usize } , 384usize , mGridTemplateAreas as * const _ as usize } , 304usize ,
concat ! ( concat ! (
"Alignment of field: " , stringify ! ( nsStylePosition ) , "Alignment of field: " , stringify ! ( nsStylePosition ) ,
"::" , stringify ! ( mGridTemplateAreas ) )); "::" , stringify ! ( mGridTemplateAreas ) ));
assert_eq! (unsafe { assert_eq! (unsafe {
& ( * ( 0 as * const nsStylePosition ) ) . & ( * ( 0 as * const nsStylePosition ) ) .
mGridColumnStart as * const _ as usize } , 392usize , mGridColumnStart as * const _ as usize } , 312usize ,
concat ! ( concat ! (
"Alignment of field: " , stringify ! ( nsStylePosition ) , "Alignment of field: " , stringify ! ( nsStylePosition ) ,
"::" , stringify ! ( mGridColumnStart ) )); "::" , stringify ! ( mGridColumnStart ) ));
assert_eq! (unsafe { assert_eq! (unsafe {
& ( * ( 0 as * const nsStylePosition ) ) . mGridColumnEnd & ( * ( 0 as * const nsStylePosition ) ) . mGridColumnEnd
as * const _ as usize } , 416usize , concat ! ( as * const _ as usize } , 336usize , concat ! (
"Alignment of field: " , stringify ! ( nsStylePosition ) , "Alignment of field: " , stringify ! ( nsStylePosition ) ,
"::" , stringify ! ( mGridColumnEnd ) )); "::" , stringify ! ( mGridColumnEnd ) ));
assert_eq! (unsafe { assert_eq! (unsafe {
& ( * ( 0 as * const nsStylePosition ) ) . mGridRowStart & ( * ( 0 as * const nsStylePosition ) ) . mGridRowStart
as * const _ as usize } , 440usize , concat ! ( as * const _ as usize } , 360usize , concat ! (
"Alignment of field: " , stringify ! ( nsStylePosition ) , "Alignment of field: " , stringify ! ( nsStylePosition ) ,
"::" , stringify ! ( mGridRowStart ) )); "::" , stringify ! ( mGridRowStart ) ));
assert_eq! (unsafe { assert_eq! (unsafe {
& ( * ( 0 as * const nsStylePosition ) ) . mGridRowEnd as & ( * ( 0 as * const nsStylePosition ) ) . mGridRowEnd as
* const _ as usize } , 464usize , concat ! ( * const _ as usize } , 384usize , concat ! (
"Alignment of field: " , stringify ! ( nsStylePosition ) , "Alignment of field: " , stringify ! ( nsStylePosition ) ,
"::" , stringify ! ( mGridRowEnd ) )); "::" , stringify ! ( mGridRowEnd ) ));
assert_eq! (unsafe { assert_eq! (unsafe {
& ( * ( 0 as * const nsStylePosition ) ) . mGridColumnGap & ( * ( 0 as * const nsStylePosition ) ) . mGridColumnGap
as * const _ as usize } , 488usize , concat ! ( as * const _ as usize } , 408usize , concat ! (
"Alignment of field: " , stringify ! ( nsStylePosition ) , "Alignment of field: " , stringify ! ( nsStylePosition ) ,
"::" , stringify ! ( mGridColumnGap ) )); "::" , stringify ! ( mGridColumnGap ) ));
assert_eq! (unsafe { assert_eq! (unsafe {
& ( * ( 0 as * const nsStylePosition ) ) . mGridRowGap as & ( * ( 0 as * const nsStylePosition ) ) . mGridRowGap as
* const _ as usize } , 504usize , concat ! ( * const _ as usize } , 424usize , concat ! (
"Alignment of field: " , stringify ! ( nsStylePosition ) , "Alignment of field: " , stringify ! ( nsStylePosition ) ,
"::" , stringify ! ( mGridRowGap ) )); "::" , stringify ! ( mGridRowGap ) ));
} }
@ -33258,6 +33258,50 @@ pub mod root {
root::nsCOMPtr ) )); root::nsCOMPtr ) ));
} }
#[test] #[test]
fn __bindgen_test_layout_UniquePtr_open0_nsStyleGridTemplate_DefaultDelete_open1_nsStyleGridTemplate_close1_close0_instantiation() {
assert_eq!(::std::mem::size_of::<root::mozilla::UniquePtr<root::nsStyleGridTemplate>>()
, 8usize , concat ! (
"Size of template specialization: " , stringify ! (
root::mozilla::UniquePtr<root::nsStyleGridTemplate> ) ));
assert_eq!(::std::mem::align_of::<root::mozilla::UniquePtr<root::nsStyleGridTemplate>>()
, 8usize , concat ! (
"Alignment of template specialization: " , stringify ! (
root::mozilla::UniquePtr<root::nsStyleGridTemplate> ) ));
}
#[test]
fn __bindgen_test_layout_DefaultDelete_open0_nsStyleGridTemplate_close0_instantiation() {
assert_eq!(::std::mem::size_of::<root::mozilla::DefaultDelete>() ,
1usize , concat ! (
"Size of template specialization: " , stringify ! (
root::mozilla::DefaultDelete ) ));
assert_eq!(::std::mem::align_of::<root::mozilla::DefaultDelete>() ,
1usize , concat ! (
"Alignment of template specialization: " , stringify ! (
root::mozilla::DefaultDelete ) ));
}
#[test]
fn __bindgen_test_layout_UniquePtr_open0_nsStyleGridTemplate_DefaultDelete_open1_nsStyleGridTemplate_close1_close0_instantiation_1() {
assert_eq!(::std::mem::size_of::<root::mozilla::UniquePtr<root::nsStyleGridTemplate>>()
, 8usize , concat ! (
"Size of template specialization: " , stringify ! (
root::mozilla::UniquePtr<root::nsStyleGridTemplate> ) ));
assert_eq!(::std::mem::align_of::<root::mozilla::UniquePtr<root::nsStyleGridTemplate>>()
, 8usize , concat ! (
"Alignment of template specialization: " , stringify ! (
root::mozilla::UniquePtr<root::nsStyleGridTemplate> ) ));
}
#[test]
fn __bindgen_test_layout_DefaultDelete_open0_nsStyleGridTemplate_close0_instantiation_1() {
assert_eq!(::std::mem::size_of::<root::mozilla::DefaultDelete>() ,
1usize , concat ! (
"Size of template specialization: " , stringify ! (
root::mozilla::DefaultDelete ) ));
assert_eq!(::std::mem::align_of::<root::mozilla::DefaultDelete>() ,
1usize , concat ! (
"Alignment of template specialization: " , stringify ! (
root::mozilla::DefaultDelete ) ));
}
#[test]
fn __bindgen_test_layout_RefPtr_open0_GridTemplateAreasValue_close0_instantiation() { fn __bindgen_test_layout_RefPtr_open0_GridTemplateAreasValue_close0_instantiation() {
assert_eq!(::std::mem::size_of::<root::RefPtr<root::mozilla::css::GridTemplateAreasValue>>() assert_eq!(::std::mem::size_of::<root::RefPtr<root::mozilla::css::GridTemplateAreasValue>>()
, 8usize , concat ! ( , 8usize , concat ! (
@ -37264,6 +37308,50 @@ pub mod root {
root::nsTArray<::nsstring::nsStringRepr> ) )); root::nsTArray<::nsstring::nsStringRepr> ) ));
} }
#[test] #[test]
fn __bindgen_test_layout_UniquePtr_open0_nsStyleGridTemplate_DefaultDelete_open1_nsStyleGridTemplate_close1_close0_instantiation_2() {
assert_eq!(::std::mem::size_of::<root::mozilla::UniquePtr<root::nsStyleGridTemplate>>()
, 8usize , concat ! (
"Size of template specialization: " , stringify ! (
root::mozilla::UniquePtr<root::nsStyleGridTemplate> ) ));
assert_eq!(::std::mem::align_of::<root::mozilla::UniquePtr<root::nsStyleGridTemplate>>()
, 8usize , concat ! (
"Alignment of template specialization: " , stringify ! (
root::mozilla::UniquePtr<root::nsStyleGridTemplate> ) ));
}
#[test]
fn __bindgen_test_layout_DefaultDelete_open0_nsStyleGridTemplate_close0_instantiation_2() {
assert_eq!(::std::mem::size_of::<root::mozilla::DefaultDelete>() ,
1usize , concat ! (
"Size of template specialization: " , stringify ! (
root::mozilla::DefaultDelete ) ));
assert_eq!(::std::mem::align_of::<root::mozilla::DefaultDelete>() ,
1usize , concat ! (
"Alignment of template specialization: " , stringify ! (
root::mozilla::DefaultDelete ) ));
}
#[test]
fn __bindgen_test_layout_UniquePtr_open0_nsStyleGridTemplate_DefaultDelete_open1_nsStyleGridTemplate_close1_close0_instantiation_3() {
assert_eq!(::std::mem::size_of::<root::mozilla::UniquePtr<root::nsStyleGridTemplate>>()
, 8usize , concat ! (
"Size of template specialization: " , stringify ! (
root::mozilla::UniquePtr<root::nsStyleGridTemplate> ) ));
assert_eq!(::std::mem::align_of::<root::mozilla::UniquePtr<root::nsStyleGridTemplate>>()
, 8usize , concat ! (
"Alignment of template specialization: " , stringify ! (
root::mozilla::UniquePtr<root::nsStyleGridTemplate> ) ));
}
#[test]
fn __bindgen_test_layout_DefaultDelete_open0_nsStyleGridTemplate_close0_instantiation_3() {
assert_eq!(::std::mem::size_of::<root::mozilla::DefaultDelete>() ,
1usize , concat ! (
"Size of template specialization: " , stringify ! (
root::mozilla::DefaultDelete ) ));
assert_eq!(::std::mem::align_of::<root::mozilla::DefaultDelete>() ,
1usize , concat ! (
"Alignment of template specialization: " , stringify ! (
root::mozilla::DefaultDelete ) ));
}
#[test]
fn __bindgen_test_layout_RefPtr_open0_RawServoMediaList_close0_instantiation() { fn __bindgen_test_layout_RefPtr_open0_RawServoMediaList_close0_instantiation() {
assert_eq!(::std::mem::size_of::<root::RefPtr<root::RawServoMediaList>>() assert_eq!(::std::mem::size_of::<root::RefPtr<root::RawServoMediaList>>()
, 8usize , concat ! ( , 8usize , concat ! (

View file

@ -1712,15 +1712,22 @@ fn static_assert() {
} }
} }
// Set defaults
${self_grid}.mRepeatAutoIndex = -1;
${self_grid}.set_mIsAutoFill(false);
${self_grid}.set_mIsSubgrid(false);
let max_lines = nsStyleGridLine_kMaxLine as usize - 1; // for accounting the final <line-names> let max_lines = nsStyleGridLine_kMaxLine as usize - 1; // for accounting the final <line-names>
match v { let result = match v {
GridTemplateComponent::None => ptr::null_mut(),
GridTemplateComponent::TrackList(track) => { GridTemplateComponent::TrackList(track) => {
let mut num_values = track.values.len();
if let Auto(_) = track.list_type {
num_values += 1;
}
num_values = cmp::min(num_values, max_lines);
let value = unsafe {
bindings::Gecko_CreateStyleGridTemplate(num_values as u32,
(num_values + 1) as u32).as_mut().unwrap()
};
let mut auto_idx = usize::MAX; let mut auto_idx = usize::MAX;
let mut auto_track_size = None; let mut auto_track_size = None;
if let Auto(idx) = track.list_type { if let Auto(idx) = track.list_type {
@ -1728,100 +1735,83 @@ fn static_assert() {
let auto_repeat = track.auto_repeat.as_ref().expect("expected <auto-track-repeat> value"); let auto_repeat = track.auto_repeat.as_ref().expect("expected <auto-track-repeat> value");
if auto_repeat.count == RepeatCount::AutoFill { if auto_repeat.count == RepeatCount::AutoFill {
${self_grid}.set_mIsAutoFill(true); value.set_mIsAutoFill(true);
} }
${self_grid}.mRepeatAutoIndex = idx as i16; value.mRepeatAutoIndex = idx as i16;
// NOTE: Gecko supports only one set of values in <auto-repeat> // NOTE: Gecko supports only one set of values in <auto-repeat>
// i.e., it can only take repeat(auto-fill, [a] 10px [b]), and no more. // i.e., it can only take repeat(auto-fill, [a] 10px [b]), and no more.
set_line_names(&auto_repeat.line_names[0], &mut ${self_grid}.mRepeatAutoLineNameListBefore); set_line_names(&auto_repeat.line_names[0], &mut value.mRepeatAutoLineNameListBefore);
set_line_names(&auto_repeat.line_names[1], &mut ${self_grid}.mRepeatAutoLineNameListAfter); set_line_names(&auto_repeat.line_names[1], &mut value.mRepeatAutoLineNameListAfter);
auto_track_size = Some(auto_repeat.track_sizes.get(0).unwrap().clone()); auto_track_size = Some(auto_repeat.track_sizes.get(0).unwrap().clone());
} else { } else {
unsafe { unsafe {
bindings::Gecko_ResizeTArrayForStrings( bindings::Gecko_ResizeTArrayForStrings(
&mut ${self_grid}.mRepeatAutoLineNameListBefore, 0); &mut value.mRepeatAutoLineNameListBefore, 0);
bindings::Gecko_ResizeTArrayForStrings( bindings::Gecko_ResizeTArrayForStrings(
&mut ${self_grid}.mRepeatAutoLineNameListAfter, 0); &mut value.mRepeatAutoLineNameListAfter, 0);
} }
} }
let mut num_values = track.values.len();
if auto_track_size.is_some() {
num_values += 1;
}
num_values = cmp::min(num_values, max_lines);
unsafe {
bindings::Gecko_SetStyleGridTemplateArrayLengths(&mut ${self_grid}, num_values as u32);
}
let mut line_names = track.line_names.into_iter(); let mut line_names = track.line_names.into_iter();
let mut values_iter = track.values.into_iter(); let mut values_iter = track.values.into_iter();
let min_max_iter = ${self_grid}.mMinTrackSizingFunctions.iter_mut() {
.zip(${self_grid}.mMaxTrackSizingFunctions.iter_mut()); let min_max_iter = value.mMinTrackSizingFunctions.iter_mut()
.zip(value.mMaxTrackSizingFunctions.iter_mut());
for (i, (gecko_min, gecko_max)) in min_max_iter.enumerate().take(max_lines) {
let name_list = line_names.next().expect("expected line-names");
set_line_names(&name_list, &mut value.mLineNameLists[i]);
if i == auto_idx {
let track_size = auto_track_size.take()
.expect("expected <track-size> for <auto-track-repeat>");
track_size.to_gecko_style_coords(gecko_min, gecko_max);
continue
}
for (i, (gecko_min, gecko_max)) in min_max_iter.enumerate().take(max_lines) { let track_size = values_iter.next().expect("expected <track-size> value");
let name_list = line_names.next().expect("expected line-names");
set_line_names(&name_list, &mut ${self_grid}.mLineNameLists[i]);
if i == auto_idx {
let track_size = auto_track_size.take().expect("expected <track-size> for <auto-track-repeat>");
track_size.to_gecko_style_coords(gecko_min, gecko_max); track_size.to_gecko_style_coords(gecko_min, gecko_max);
continue
} }
let track_size = values_iter.next().expect("expected <track-size> value");
track_size.to_gecko_style_coords(gecko_min, gecko_max);
} }
let final_names = line_names.next().unwrap(); let final_names = line_names.next().unwrap();
set_line_names(&final_names, ${self_grid}.mLineNameLists.last_mut().unwrap()); set_line_names(&final_names, value.mLineNameLists.last_mut().unwrap());
},
GridTemplateComponent::None => { value
unsafe {
bindings::Gecko_SetStyleGridTemplateArrayLengths(&mut ${self_grid}, 0);
bindings::Gecko_ResizeTArrayForStrings(
&mut ${self_grid}.mRepeatAutoLineNameListBefore, 0);
bindings::Gecko_ResizeTArrayForStrings(
&mut ${self_grid}.mRepeatAutoLineNameListAfter, 0);
}
}, },
GridTemplateComponent::Subgrid(list) => { GridTemplateComponent::Subgrid(list) => {
${self_grid}.set_mIsSubgrid(true);
let names_length = match list.fill_idx { let names_length = match list.fill_idx {
Some(_) => list.names.len() - 1, Some(_) => list.names.len() - 1,
None => list.names.len(), None => list.names.len(),
}; };
let num_values = cmp::min(names_length, max_lines + 1); let num_values = cmp::min(names_length, max_lines + 1);
let value = unsafe {
unsafe { bindings::Gecko_CreateStyleGridTemplate(0, num_values as u32).as_mut().unwrap()
bindings::Gecko_SetStyleGridTemplateArrayLengths(&mut ${self_grid}, 0); };
bindings::Gecko_SetGridTemplateLineNamesLength(&mut ${self_grid}, num_values as u32); value.set_mIsSubgrid(true);
bindings::Gecko_ResizeTArrayForStrings(
&mut ${self_grid}.mRepeatAutoLineNameListBefore, 0);
bindings::Gecko_ResizeTArrayForStrings(
&mut ${self_grid}.mRepeatAutoLineNameListAfter, 0);
}
let mut names = list.names.into_vec(); let mut names = list.names.into_vec();
if let Some(idx) = list.fill_idx { if let Some(idx) = list.fill_idx {
${self_grid}.set_mIsAutoFill(true); value.set_mIsAutoFill(true);
${self_grid}.mRepeatAutoIndex = idx as i16; value.mRepeatAutoIndex = idx as i16;
set_line_names(&names.swap_remove(idx as usize), set_line_names(&names.swap_remove(idx as usize),
&mut ${self_grid}.mRepeatAutoLineNameListBefore); &mut value.mRepeatAutoLineNameListBefore);
} }
for (servo_names, gecko_names) in names.iter().zip(${self_grid}.mLineNameLists.iter_mut()) { for (servo_names, gecko_names) in names.iter().zip(value.mLineNameLists.iter_mut()) {
set_line_names(servo_names, gecko_names); set_line_names(servo_names, gecko_names);
} }
value
}, },
} };
unsafe { bindings::Gecko_SetStyleGridTemplate(&mut ${self_grid}, result); }
} }
pub fn copy_grid_template_${kind}_from(&mut self, other: &Self) { pub fn copy_grid_template_${kind}_from(&mut self, other: &Self) {
unsafe { unsafe {
bindings::Gecko_CopyStyleGridTemplateValues(&mut ${self_grid}, bindings::Gecko_CopyStyleGridTemplateValues(&mut ${self_grid},
&other.gecko.mGridTemplate${kind.title()}); other.gecko.mGridTemplate${kind.title()}.mPtr);
} }
} }
@ -1838,16 +1828,10 @@ fn static_assert() {
use values::generics::grid::{GridTemplateComponent, LineNameList, RepeatCount}; use values::generics::grid::{GridTemplateComponent, LineNameList, RepeatCount};
use values::generics::grid::{TrackList, TrackListType, TrackRepeat, TrackSize}; use values::generics::grid::{TrackList, TrackListType, TrackRepeat, TrackSize};
if ${self_grid}.mRepeatAutoLineNameListBefore.len() == 0 && let value = match unsafe { ${self_grid}.mPtr.as_ref() } {
${self_grid}.mRepeatAutoLineNameListAfter.len() == 0 && None => return GridTemplateComponent::None,
${self_grid}.mMinTrackSizingFunctions.len() == 0 && Some(value) => value,
${self_grid}.mMaxTrackSizingFunctions.len() == 0 && };
${self_grid}.mLineNameLists.len() == 0 &&
${self_grid}.mRepeatAutoIndex == -1 &&
!${self_grid}.mIsAutoFill() &&
!${self_grid}.mIsSubgrid() {
return GridTemplateComponent::None;
}
#[inline] #[inline]
fn to_boxed_customident_slice(gecko_names: &nsTArray<nsStringRepr>) -> Box<[CustomIdent]> { fn to_boxed_customident_slice(gecko_names: &nsTArray<nsStringRepr>) -> Box<[CustomIdent]> {
@ -1865,13 +1849,13 @@ fn static_assert() {
}).collect() }).collect()
} }
let repeat_auto_index = ${self_grid}.mRepeatAutoIndex as usize; let repeat_auto_index = value.mRepeatAutoIndex as usize;
if ${self_grid}.mIsSubgrid() { if value.mIsSubgrid() {
let mut names_vec = to_line_names_vec(&${self_grid}.mLineNameLists); let mut names_vec = to_line_names_vec(&value.mLineNameLists);
let fill_idx = if ${self_grid}.mIsAutoFill() { let fill_idx = if value.mIsAutoFill() {
names_vec.insert( names_vec.insert(
repeat_auto_index, repeat_auto_index,
to_boxed_customident_slice(&${self_grid}.mRepeatAutoLineNameListBefore)); to_boxed_customident_slice(&value.mRepeatAutoLineNameListBefore));
Some(repeat_auto_index as u32) Some(repeat_auto_index as u32)
} else { } else {
None None
@ -1882,18 +1866,18 @@ fn static_assert() {
} else { } else {
let mut auto_repeat = None; let mut auto_repeat = None;
let mut list_type = TrackListType::Normal; let mut list_type = TrackListType::Normal;
let line_names = to_line_names_vec(&${self_grid}.mLineNameLists).into_boxed_slice(); let line_names = to_line_names_vec(&value.mLineNameLists).into_boxed_slice();
let mut values = Vec::with_capacity(${self_grid}.mMinTrackSizingFunctions.len()); let mut values = Vec::with_capacity(value.mMinTrackSizingFunctions.len());
let min_max_iter = ${self_grid}.mMinTrackSizingFunctions.iter() let min_max_iter = value.mMinTrackSizingFunctions.iter()
.zip(${self_grid}.mMaxTrackSizingFunctions.iter()); .zip(value.mMaxTrackSizingFunctions.iter());
for (i, (gecko_min, gecko_max)) in min_max_iter.enumerate() { for (i, (gecko_min, gecko_max)) in min_max_iter.enumerate() {
let track_size = TrackSize::from_gecko_style_coords(gecko_min, gecko_max); let track_size = TrackSize::from_gecko_style_coords(gecko_min, gecko_max);
if i == repeat_auto_index { if i == repeat_auto_index {
list_type = TrackListType::Auto(repeat_auto_index as u16); list_type = TrackListType::Auto(repeat_auto_index as u16);
let count = if ${self_grid}.mIsAutoFill() { let count = if value.mIsAutoFill() {
RepeatCount::AutoFill RepeatCount::AutoFill
} else { } else {
RepeatCount::AutoFit RepeatCount::AutoFit
@ -1902,9 +1886,9 @@ fn static_assert() {
let line_names = { let line_names = {
let mut vec: Vec<Box<[CustomIdent]>> = Vec::with_capacity(2); let mut vec: Vec<Box<[CustomIdent]>> = Vec::with_capacity(2);
vec.push(to_boxed_customident_slice( vec.push(to_boxed_customident_slice(
&${self_grid}.mRepeatAutoLineNameListBefore)); &value.mRepeatAutoLineNameListBefore));
vec.push(to_boxed_customident_slice( vec.push(to_boxed_customident_slice(
&${self_grid}.mRepeatAutoLineNameListAfter)); &value.mRepeatAutoLineNameListAfter));
vec.into_boxed_slice() vec.into_boxed_slice()
}; };