style: Add support for 'flex-basis:content' in the style system.

Bug: 1105111
Reviewed-by: xidorn
MozReview-Commit-ID: 5WhgHJJ0mDB
This commit is contained in:
Emilio Cobos Álvarez 2018-03-28 23:40:01 -07:00
parent 3532f64b32
commit 744809a8b2
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
13 changed files with 197 additions and 142 deletions

View file

@ -4,34 +4,13 @@
//! Generic types for CSS values related to flexbox.
use values::computed::Percentage;
/// A generic value for the `flex-basis` property.
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
pub enum FlexBasis<LengthOrPercentage> {
/// `auto`
Auto,
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq)]
#[derive(ToAnimatedValue, ToAnimatedZero, ToComputedValue, ToCss)]
pub enum FlexBasis<Width> {
/// `content`
Content,
/// `<length-percentage>`
Length(LengthOrPercentage),
}
impl<L> FlexBasis<L> {
/// Returns `auto`.
#[inline]
pub fn auto() -> Self {
FlexBasis::Auto
}
}
impl<L> FlexBasis<L>
where Percentage: Into<L>,
{
/// Returns `0%`.
#[inline]
pub fn zero_percent() -> Self {
FlexBasis::Length(Percentage(0.).into())
}
/// `<width>`
Width(Width),
}