Generate a fragment for an empty elements with borders or padding

This commit is contained in:
Matt Brubeck 2016-04-15 15:57:24 -07:00
parent fbef2724bf
commit 1807fd3cc5
3 changed files with 66 additions and 4 deletions

View file

@ -1662,9 +1662,22 @@ pub mod computed {
}
impl LengthOrPercentage {
#[inline]
pub fn zero() -> LengthOrPercentage {
LengthOrPercentage::Length(Au(0))
}
/// Returns true if the computed value is absolute 0 or 0%.
///
/// (Returns false for calc() values, even if ones that may resolve to zero.)
#[inline]
pub fn is_definitely_zero(&self) -> bool {
use self::LengthOrPercentage::*;
match *self {
Length(Au(0)) | Percentage(0.0) => true,
Length(_) | Percentage(_) | Calc(_) => false
}
}
}
impl fmt::Debug for LengthOrPercentage {