style: Miscellaneous Servo build fixes.

This commit is contained in:
Emilio Cobos Álvarez 2020-02-10 16:50:40 +01:00
parent 18cda1567a
commit e227715aee
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
12 changed files with 59 additions and 10 deletions

View file

@ -378,6 +378,19 @@ impl LengthPercentage {
}
}
/// Converts to a `<percentage>` if possible.
#[inline]
pub fn to_percentage(&self) -> Option<Percentage> {
match self.unpack() {
Unpacked::Length(..) => None,
Unpacked::Percentage(p) => Some(p),
Unpacked::Calc(ref c) => {
debug_assert!(!c.length.is_zero());
None
}
}
}
/// Return the specified percentage if any.
#[inline]
pub fn specified_percentage(&self) -> Option<Percentage> {
@ -405,7 +418,7 @@ impl LengthPercentage {
/// Convert the computed value into used value.
#[inline]
fn maybe_to_used_value(&self, container_len: Option<Length>) -> Option<Au> {
pub fn maybe_to_used_value(&self, container_len: Option<Length>) -> Option<Au> {
self.maybe_percentage_relative_to(container_len).map(Au::from)
}