diff --git a/layout/style/ServoBindings.cpp b/layout/style/ServoBindings.cpp index a000ef881291..8f9203bcf9a6 100644 --- a/layout/style/ServoBindings.cpp +++ b/layout/style/ServoBindings.cpp @@ -802,16 +802,16 @@ Gecko_CopyStyleContentsFrom(nsStyleContent* aContent, const nsStyleContent* aOth } void -Gecko_EnsureImageLayersLength(nsStyleImageLayers* aLayers, size_t aLen) +Gecko_EnsureImageLayersLength(nsStyleImageLayers* aLayers, size_t aLen, + nsStyleImageLayers::LayerType aLayerType) { - aLayers->mLayers.EnsureLengthAtLeast(aLen); -} + size_t oldLength = aLayers->mLayers.Length(); -void -Gecko_InitializeImageLayer(nsStyleImageLayers::Layer* aLayer, - nsStyleImageLayers::LayerType aLayerType) -{ - aLayer->Initialize(aLayerType); + aLayers->mLayers.EnsureLengthAtLeast(aLen); + + for (size_t i = oldLength; i < aLen; ++i) { + aLayers->mLayers[i].Initialize(aLayerType); + } } void diff --git a/layout/style/ServoBindings.h b/layout/style/ServoBindings.h index 8d67342ffa60..47606234d392 100644 --- a/layout/style/ServoBindings.h +++ b/layout/style/ServoBindings.h @@ -300,10 +300,8 @@ void Gecko_ClearPODTArray(void* array, size_t elem_size, size_t elem_align); void Gecko_ClearStyleContents(nsStyleContent* content); void Gecko_CopyStyleContentsFrom(nsStyleContent* content, const nsStyleContent* other); -void Gecko_EnsureImageLayersLength(nsStyleImageLayers* layers, size_t len); - -void Gecko_InitializeImageLayer(nsStyleImageLayers::Layer* layer, - nsStyleImageLayers::LayerType layer_type); +void Gecko_EnsureImageLayersLength(nsStyleImageLayers* layers, size_t len, + nsStyleImageLayers::LayerType layer_type); // Clean up pointer-based coordinates void Gecko_ResetStyleCoord(nsStyleUnit* unit, nsStyleUnion* value);