style: Use NonNegative more in the border code.

This ended up not being so small of a patch as I'd have thought, since it
propagated a bit. But most of it is mechanical. Interesting part is
NonNegativeNumberOrPercentage and the actual uses of the NonNegative stuff and
during parsing.

This looks like it'd fix a few correctness issues during interpolation for all
the types except for BorderRadius and co (which handled it manually).

I should write tests for those in a different patch.

Differential Revision: https://phabricator.services.mozilla.com/D14673
This commit is contained in:
Emilio Cobos Álvarez 2018-12-17 21:35:14 +00:00
parent 19035590ce
commit ca1ad003bd
14 changed files with 161 additions and 106 deletions

View file

@ -45,6 +45,8 @@ pub struct BorderImageSlice<NumberOrPercentage> {
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToAnimatedValue,
ToAnimatedZero,
ToComputedValue,
ToCss,
)]
@ -106,19 +108,6 @@ pub struct BorderRadius<LengthOrPercentage> {
pub bottom_left: BorderCornerRadius<LengthOrPercentage>,
}
impl<N> From<N> for BorderImageSlice<N>
where
N: Clone,
{
#[inline]
fn from(value: N) -> Self {
Self {
offsets: Rect::all(value),
fill: false,
}
}
}
impl<L> BorderRadius<L> {
/// Returns a new `BorderRadius<L>`.
#[inline]