aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-07-05 17:35:25 +0530
committerManish Goregaokar <manishsmail@gmail.com>2016-07-14 12:34:44 +0530
commit5be15e55db58b4066420fbab7bf72fd7bf199c3f (patch)
treed372a4488f4396301e643b0cf444a257c135f94c
parent154bfb0b0f1760e34603de3324ca35a1d27d02c5 (diff)
downloadservo-5be15e55db58b4066420fbab7bf72fd7bf199c3f.tar.gz
servo-5be15e55db58b4066420fbab7bf72fd7bf199c3f.zip
Pre-set length to desired value in image setter
-rw-r--r--ports/geckolib/gecko_bindings/bindings.rs6
-rwxr-xr-xports/geckolib/gecko_bindings/tools/regen.py2
-rw-r--r--ports/geckolib/properties.mako.rs7
3 files changed, 13 insertions, 2 deletions
diff --git a/ports/geckolib/gecko_bindings/bindings.rs b/ports/geckolib/gecko_bindings/bindings.rs
index 49365492493..5fa8a94ba34 100644
--- a/ports/geckolib/gecko_bindings/bindings.rs
+++ b/ports/geckolib/gecko_bindings/bindings.rs
@@ -113,6 +113,10 @@ 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::SheetParsingMode;
use structs::nsMainThreadPtrHandle;
use structs::nsMainThreadPtrHolder;
@@ -245,6 +249,8 @@ extern "C" {
pub fn Gecko_UnsetNodeFlags(node: *mut RawGeckoNode, flags: u32);
pub fn Gecko_ArrayEnsureCapacity(array: *mut ::std::os::raw::c_void,
capacity: usize, size: usize);
+ pub fn Gecko_ImageLayers_EnsureLength(layers: *mut nsStyleImageLayers,
+ len: usize);
pub fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8, length: u32,
parsing_mode: SheetParsingMode,
base: *mut ThreadSafeURIHolder,
diff --git a/ports/geckolib/gecko_bindings/tools/regen.py b/ports/geckolib/gecko_bindings/tools/regen.py
index 1a80939b266..a2a02b857f9 100755
--- a/ports/geckolib/gecko_bindings/tools/regen.py
+++ b/ports/geckolib/gecko_bindings/tools/regen.py
@@ -118,7 +118,7 @@ COMPILATION_TARGETS = {
"nsStyleMargin", "nsStylePadding", "nsStyleBorder",
"nsStyleOutline", "nsStyleXUL", "nsStyleSVGReset", "nsStyleColumn",
"nsStyleEffects", "nsStyleImage", "nsStyleGradient",
- "nsStyleCoord", "nsStyleGradientStop",
+ "nsStyleCoord", "nsStyleGradientStop", "nsStyleImageLayers",
"SheetParsingMode", "nsMainThreadPtrHandle",
"nsMainThreadPtrHolder", "nscolor", "nsFont", "FontFamilyList",
diff --git a/ports/geckolib/properties.mako.rs b/ports/geckolib/properties.mako.rs
index e8f6af0ab95..22f7899ba81 100644
--- a/ports/geckolib/properties.mako.rs
+++ b/ports/geckolib/properties.mako.rs
@@ -19,7 +19,7 @@ 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_ImageLayers_EnsureLength, 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};
@@ -960,6 +960,11 @@ fn static_assert() {
}
}
+
+ unsafe {
+ Gecko_ImageLayers_EnsureLength(&mut self.gecko.mImage, images.0.len());
+ }
+
self.gecko.mImage.mImageCount = cmp::max(self.gecko.mImage.mLayers.len() as u32,
self.gecko.mImage.mImageCount);