aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/values/specified/gecko.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2019-01-27 01:03:44 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2019-02-10 07:11:46 +0100
commita68bc29b96ac1c42d3940434c6c3239ee0f42a7a (patch)
treea80b2b0d9122026d67a71805636fe469f4bd9986 /components/style/values/specified/gecko.rs
parent8dad956513eba5cea9ce895c6f5351ff9f95c835 (diff)
downloadservo-a68bc29b96ac1c42d3940434c6c3239ee0f42a7a.tar.gz
servo-a68bc29b96ac1c42d3940434c6c3239ee0f42a7a.zip
style: Derive more length stuff, and shrink MaxLength / MozLength's repr(C) representation.
This patch: * Makes LengthPercentageOrAuto generic, and removes a bunch of code fo LengthPercentageOrNone, which was used only for servo and now can use the normal MaxLength (with a cfg() guard for the ExtremumLength variant). * Shrinks MaxLength / MozLength's repr(C) reperesentation by reducing enum nesting. The shrinking is in preparation for using them from C++ too, though that'd be a different bug. * Moves NonNegative usage to the proper places so that stuff for them can be derived. I did this on top of bug 1523071 to prove both that it could be possible and that stuff wasn't too messy. It got a bit messy, but just because of a bug I had fixed in bindgen long time ago already, so this updates bindgen's patch version to grab a fix instead of ugly workarounds :) Differential Revision: https://phabricator.services.mozilla.com/D17762
Diffstat (limited to 'components/style/values/specified/gecko.rs')
-rw-r--r--components/style/values/specified/gecko.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/components/style/values/specified/gecko.rs b/components/style/values/specified/gecko.rs
index 8259430bf20..42ca5e3e2bf 100644
--- a/components/style/values/specified/gecko.rs
+++ b/components/style/values/specified/gecko.rs
@@ -5,8 +5,8 @@
//! Specified types for legacy Gecko-only properties.
use crate::parser::{Parse, ParserContext};
-use crate::values::computed::{self, LengthPercentage};
use crate::values::computed::length::CSSPixelLength;
+use crate::values::computed::{self, LengthPercentage};
use crate::values::generics::gecko::ScrollSnapPoint as GenericScrollSnapPoint;
use crate::values::generics::rect::Rect;
use crate::values::specified::length::LengthPercentage as SpecifiedLengthPercentage;
@@ -28,8 +28,8 @@ impl Parse for ScrollSnapPoint {
}
input.expect_function_matching("repeat")?;
// FIXME(emilio): This won't clamp properly when animating.
- let length =
- input.parse_nested_block(|i| SpecifiedLengthPercentage::parse_non_negative(context, i))?;
+ let length = input
+ .parse_nested_block(|i| SpecifiedLengthPercentage::parse_non_negative(context, i))?;
Ok(GenericScrollSnapPoint::Repeat(length))
}
}
@@ -49,9 +49,9 @@ fn parse_pixel_or_percent<'i, 't>(
_ => Err(()),
}
},
- Token::Percentage { unit_value, .. } => Ok(
- LengthPercentage::new_percent(computed::Percentage(unit_value))
- ),
+ Token::Percentage { unit_value, .. } => Ok(LengthPercentage::new_percent(
+ computed::Percentage(unit_value),
+ )),
_ => Err(()),
};
value.map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError))