Add bindings for setting grid nsTArrays

This commit is contained in:
Ravi Shankar 2017-05-05 11:43:24 +05:30
parent 10badb3efd
commit 3011c7cadc
2 changed files with 20 additions and 3 deletions

View file

@ -662,7 +662,8 @@ mod bindings {
.header(add_include("mozilla/ServoBindings.h")) .header(add_include("mozilla/ServoBindings.h"))
.hide_type("nsACString_internal") .hide_type("nsACString_internal")
.hide_type("nsAString_internal") .hide_type("nsAString_internal")
.raw_line("pub use nsstring::{nsACString, nsAString, nsString};") .raw_line("pub use nsstring::{nsACString, nsAString, nsString, nsStringRepr};")
.raw_line("use gecko_bindings::structs::nsTArray;")
.raw_line("type nsACString_internal = nsACString;") .raw_line("type nsACString_internal = nsACString;")
.raw_line("type nsAString_internal = nsAString;") .raw_line("type nsAString_internal = nsAString;")
.whitelisted_function("Servo_.*") .whitelisted_function("Servo_.*")
@ -859,7 +860,13 @@ mod bindings {
// type with zero_size_type. If we ever introduce immutable borrow types // type with zero_size_type. If we ever introduce immutable borrow types
// which _do_ need to be opaque, we'll need a separate mode. // which _do_ need to be opaque, we'll need a separate mode.
} }
write_binding_file(builder, BINDINGS_FILE, &Vec::new()); let fixups = vec![
Fixup { // hack for gecko-owned string
pat: "<nsString".into(),
rep: "<nsStringRepr".into()
},
];
write_binding_file(builder, BINDINGS_FILE, &fixups);
} }
fn generate_atoms() { fn generate_atoms() {

View file

@ -1,6 +1,7 @@
/* automatically generated by rust-bindgen */ /* automatically generated by rust-bindgen */
pub use nsstring::{nsACString, nsAString, nsString}; pub use nsstring::{nsACString, nsAString, nsString, nsStringRepr};
use gecko_bindings::structs::nsTArray;
type nsACString_internal = nsACString; type nsACString_internal = nsACString;
type nsAString_internal = nsAString; type nsAString_internal = nsAString;
use gecko_bindings::structs::mozilla::css::GridTemplateAreasValue; use gecko_bindings::structs::mozilla::css::GridTemplateAreasValue;
@ -943,6 +944,15 @@ extern "C" {
extern "C" { extern "C" {
pub fn Gecko_DropElementSnapshot(snapshot: ServoElementSnapshotOwned); pub fn Gecko_DropElementSnapshot(snapshot: ServoElementSnapshotOwned);
} }
extern "C" {
pub fn Gecko_ResizeTArrayForStrings(array: *mut nsTArray<nsStringRepr>,
length: u32);
}
extern "C" {
pub fn Gecko_SetStyleGridTemplateArrayLengths(grid_template:
*mut nsStyleGridTemplate,
track_sizes: u32);
}
extern "C" { extern "C" {
pub fn Gecko_CopyStyleGridTemplateValues(grid_template: pub fn Gecko_CopyStyleGridTemplateValues(grid_template:
*mut nsStyleGridTemplate, *mut nsStyleGridTemplate,