From 9d92667c39e938cc5963c3d09abdfaab1e23b82c Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Fri, 4 Aug 2017 04:31:19 -0500 Subject: [PATCH] servo: Merge #17971 - Always set mBgPos for LineDirection::Vertical (from upsuper:linear-gradient); r=canaltinova This fixes [bug 1385469](https://bugzilla.mozilla.org/show_bug.cgi?id=1385469). Source-Repo: https://github.com/servo/servo Source-Revision: 187254bf26fc9974c65d061a146bbbbfb484fbd3 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 3ac79946382f864940d986c11e184aaf4190c203 --- servo/components/style/gecko/conversions.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/servo/components/style/gecko/conversions.rs b/servo/components/style/gecko/conversions.rs index 8e962e4d7c63..5877e3917d8e 100644 --- a/servo/components/style/gecko/conversions.rs +++ b/servo/components/style/gecko/conversions.rs @@ -229,14 +229,18 @@ impl nsStyleImage { } }, LineDirection::Vertical(y) => { - // Y::Bottom (to bottom) is ignored because it is the default value. - if y == Y::Top { - unsafe { - (*gecko_gradient).mBgPosX - .set_value(CoordDataValue::Percent(0.5)); - (*gecko_gradient).mBgPosY - .set_value(CoordDataValue::Percent(0.0)); - } + // Although bottom is the default value, we can not ignore + // 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 { + (*gecko_gradient).mBgPosX + .set_value(CoordDataValue::Percent(0.5)); + (*gecko_gradient).mBgPosY + .set_value(CoordDataValue::Percent(y)); } }, LineDirection::Corner(horiz, vert) => {