mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
stylo: Remove unneeded null-check, and isolate unsafe code
Gecko's allocs are infallible by default.
This commit is contained in:
parent
33829b470a
commit
8220eaab9b
1 changed files with 8 additions and 11 deletions
|
@ -778,11 +778,7 @@ fn static_assert() {
|
||||||
stop_count as u32)
|
stop_count as u32)
|
||||||
};
|
};
|
||||||
|
|
||||||
if gecko_gradient.is_null() {
|
// TODO: figure out what gecko does in the `corner` case.
|
||||||
warn!("stylo: Couldn't allocate gradient");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let AngleOrCorner::Angle(angle) = gradient.angle_or_corner {
|
if let AngleOrCorner::Angle(angle) = gradient.angle_or_corner {
|
||||||
unsafe {
|
unsafe {
|
||||||
(*gecko_gradient).mAngle.set(angle);
|
(*gecko_gradient).mAngle.set(angle);
|
||||||
|
@ -808,13 +804,14 @@ fn static_assert() {
|
||||||
CSSColor::RGBA(ref rgba) => convert_rgba_to_nscolor(rgba),
|
CSSColor::RGBA(ref rgba) => convert_rgba_to_nscolor(rgba),
|
||||||
};
|
};
|
||||||
|
|
||||||
unsafe {
|
let mut stop = unsafe {
|
||||||
let mut stop = &mut (*gecko_gradient).mStops[index as u32];
|
&mut (*gecko_gradient).mStops[index as u32]
|
||||||
|
};
|
||||||
|
|
||||||
stop.mColor = color;
|
stop.mColor = color;
|
||||||
stop.mIsInterpolationHint = false;
|
stop.mIsInterpolationHint = false;
|
||||||
stop.mLocation.copy_from(&coord);
|
stop.mLocation.copy_from(&coord);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_SetGradientImageValue(&mut self.gecko.mImage.mLayers.mFirstElement.mImage,
|
Gecko_SetGradientImageValue(&mut self.gecko.mImage.mLayers.mFirstElement.mImage,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue