style: Cleanup gradient parsing by removing the simple-moz-gradient parsing pref.

It looks like bug 1547939 will stick, given how fast the other regressions came
in for bug 1337655.

We haven't seen any regression from this, and it seems unlikely that we'd want
this code back.

This blocks further improvements to the style system. Simplifying this code
allows me to remove all the conversion code for gradients.

Let me know if you think it's premature and I'm happy to wait, but I really want
to see this code gone :)

Differential Revision: https://phabricator.services.mozilla.com/D33820
This commit is contained in:
Emilio Cobos Álvarez 2019-06-06 04:08:52 +00:00
parent e9b0d54a95
commit 3980dc31cd
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
5 changed files with 50 additions and 443 deletions

View file

@ -29,11 +29,11 @@ pub type Image = generic::Image<Gradient, MozImageRect, ComputedImageUrl>;
/// Computed values for a CSS gradient.
/// <https://drafts.csswg.org/css-images/#gradients>
pub type Gradient =
generic::Gradient<LineDirection, Length, LengthPercentage, Position, Color, Angle>;
generic::Gradient<LineDirection, Length, LengthPercentage, Position, Color>;
/// A computed gradient kind.
pub type GradientKind =
generic::GradientKind<LineDirection, Length, LengthPercentage, Position, Angle>;
generic::GradientKind<LineDirection, Length, LengthPercentage, Position>;
/// A computed gradient line direction.
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToResolvedValue)]
@ -46,9 +46,6 @@ pub enum LineDirection {
Vertical(Y),
/// A corner.
Corner(X, Y),
/// A Position and an Angle for legacy `-moz-` prefixed gradient.
#[cfg(feature = "gecko")]
MozPosition(Option<Position>, Option<Angle>),
}
/// A computed radial gradient ending shape.
@ -69,19 +66,6 @@ impl generic::LineDirection for LineDirection {
LineDirection::Angle(angle) => angle.radians() == PI,
LineDirection::Vertical(Y::Bottom) if compat_mode == CompatMode::Modern => true,
LineDirection::Vertical(Y::Top) if compat_mode != CompatMode::Modern => true,
LineDirection::Corner(..) => false,
#[cfg(feature = "gecko")]
LineDirection::MozPosition(
Some(Position {
ref vertical,
ref horizontal,
}),
None,
) => {
// `50% 0%` is the default value for line direction.
horizontal.as_percentage().map_or(false, |p| p.0 == 0.5) &&
vertical.as_percentage().map_or(false, |p| p.0 == 0.0)
},
_ => false,
}
}
@ -112,21 +96,6 @@ impl generic::LineDirection for LineDirection {
dest.write_str(" ")?;
y.to_css(dest)
},
#[cfg(feature = "gecko")]
LineDirection::MozPosition(position, angle) => {
let mut need_space = false;
if let Some(position) = position {
position.to_css(dest)?;
need_space = true;
}
if let Some(angle) = angle {
if need_space {
dest.write_str(" ")?;
}
angle.to_css(dest)?;
}
Ok(())
},
}
}
}
@ -142,13 +111,6 @@ impl ToComputedValue for SpecifiedLineDirection {
SpecifiedLineDirection::Horizontal(x) => LineDirection::Horizontal(x),
SpecifiedLineDirection::Vertical(y) => LineDirection::Vertical(y),
SpecifiedLineDirection::Corner(x, y) => LineDirection::Corner(x, y),
#[cfg(feature = "gecko")]
SpecifiedLineDirection::MozPosition(ref position, ref angle) => {
LineDirection::MozPosition(
position.to_computed_value(context),
angle.to_computed_value(context),
)
},
}
}
@ -160,13 +122,6 @@ impl ToComputedValue for SpecifiedLineDirection {
LineDirection::Horizontal(x) => SpecifiedLineDirection::Horizontal(x),
LineDirection::Vertical(y) => SpecifiedLineDirection::Vertical(y),
LineDirection::Corner(x, y) => SpecifiedLineDirection::Corner(x, y),
#[cfg(feature = "gecko")]
LineDirection::MozPosition(ref position, ref angle) => {
SpecifiedLineDirection::MozPosition(
ToComputedValue::from_computed_value(position),
ToComputedValue::from_computed_value(angle),
)
},
}
}
}