Always set mBgPos for LineDirection::Vertical.

This commit is contained in:
Xidorn Quan 2017-08-04 19:29:01 +10:00
parent aef95cf195
commit f749aaee5e

View file

@ -229,14 +229,18 @@ impl nsStyleImage {
} }
}, },
LineDirection::Vertical(y) => { LineDirection::Vertical(y) => {
// Y::Bottom (to bottom) is ignored because it is the default value. // Although bottom is the default value, we can not ignore
if y == Y::Top { // it here, because the rendering code of Gecko relies on
// this to behave correctly for legacy mode.
let y = match y {
Y::Top => 0.0,
Y::Bottom => 1.0,
};
unsafe { unsafe {
(*gecko_gradient).mBgPosX (*gecko_gradient).mBgPosX
.set_value(CoordDataValue::Percent(0.5)); .set_value(CoordDataValue::Percent(0.5));
(*gecko_gradient).mBgPosY (*gecko_gradient).mBgPosY
.set_value(CoordDataValue::Percent(0.0)); .set_value(CoordDataValue::Percent(y));
}
} }
}, },
LineDirection::Corner(horiz, vert) => { LineDirection::Corner(horiz, vert) => {