mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
stylo: Don't leak nsStyleCoord::Calc objects when setting gradients.
This commit is contained in:
parent
47ebeaa95c
commit
5531e38c22
2 changed files with 11 additions and 2 deletions
|
@ -297,10 +297,10 @@ impl nsStyleImage {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut coord: nsStyleCoord = nsStyleCoord::null();
|
|
||||||
for (index, stop) in gradient.stops.iter().enumerate() {
|
for (index, stop) in gradient.stops.iter().enumerate() {
|
||||||
// NB: stops are guaranteed to be none in the gecko side by
|
// NB: stops are guaranteed to be none in the gecko side by
|
||||||
// default.
|
// default.
|
||||||
|
let mut coord: nsStyleCoord = nsStyleCoord::null();
|
||||||
coord.set(stop.position);
|
coord.set(stop.position);
|
||||||
let color = match stop.color {
|
let color = match stop.color {
|
||||||
CSSColor::CurrentColor => {
|
CSSColor::CurrentColor => {
|
||||||
|
@ -322,7 +322,7 @@ impl nsStyleImage {
|
||||||
|
|
||||||
stop.mColor = color;
|
stop.mColor = color;
|
||||||
stop.mIsInterpolationHint = false;
|
stop.mIsInterpolationHint = false;
|
||||||
stop.mLocation.copy_from(&coord);
|
stop.mLocation.move_from(coord);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -264,6 +264,15 @@ pub trait CoordDataMut : CoordData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
/// Moves the unit and value from another `CoordData` type.
|
||||||
|
fn move_from<T: CoordData>(&mut self, other: T) {
|
||||||
|
unsafe {
|
||||||
|
self.reset();
|
||||||
|
self.copy_from_unchecked(&other);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
/// Copies the unit and value from another `CoordData` type without checking
|
/// Copies the unit and value from another `CoordData` type without checking
|
||||||
/// the type of the value (so refcounted values like calc may leak).
|
/// the type of the value (so refcounted values like calc may leak).
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue