style: Don't allow negative radii in radial gradients.

Mostly renaming for clarity, as the gradient parsing code is a bit hairy.

This also changes -webkit- gradients, which is, I think, the right thing to do
(otherwise I need to give up on the type system and sprinkle parse_non_negatives
around, which would be unfortunate).

I filed https://bugs.chromium.org/p/chromium/issues/detail?id=1008112 on
Chromium still accepting negative radii for those, so will wait to submit the
patch for review until they reply there with their intentions.

Differential Revision: https://phabricator.services.mozilla.com/D47141
This commit is contained in:
Emilio Cobos Álvarez 2019-10-01 21:44:41 +00:00
parent 19ddfd57d5
commit d43632c9f8
5 changed files with 61 additions and 46 deletions

View file

@ -704,14 +704,14 @@ impl Parse for NonNegativeLength {
impl From<NoCalcLength> for NonNegativeLength {
#[inline]
fn from(len: NoCalcLength) -> Self {
NonNegative::<Length>(Length::NoCalc(len))
NonNegative(Length::NoCalc(len))
}
}
impl From<Length> for NonNegativeLength {
#[inline]
fn from(len: Length) -> Self {
NonNegative::<Length>(len)
NonNegative(len)
}
}