style: Move will-change outside of mako

This commit is contained in:
CYBAI 2017-12-16 18:19:18 +08:00 committed by Emilio Cobos Álvarez
parent 09a3db8657
commit 2eb396613b
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
6 changed files with 64 additions and 64 deletions

View file

@ -9,6 +9,7 @@ use cssparser::Parser;
use parser::{Parse, ParserContext};
use std::fmt;
use style_traits::{ParseError, ToCss};
use values::CustomIdent;
use values::KeyframesName;
use values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount;
use values::generics::box_::VerticalAlign as GenericVerticalAlign;
@ -130,3 +131,49 @@ define_css_keyword_enum! { OverflowClipBox:
"content-box" => ContentBox,
}
add_impls_for_keyword_enum!(OverflowClipBox);
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
/// Provides a rendering hint to the user agent,
/// stating what kinds of changes the author expects
/// to perform on the element
///
/// <https://drafts.csswg.org/css-will-change/#will-change>
pub enum WillChange {
/// Expresses no particular intent
Auto,
#[css(comma, iterable)]
/// <custom-ident>
AnimateableFeatures(Box<[CustomIdent]>),
}
impl WillChange {
#[inline]
/// Get default value of `will-change` as `auto`
pub fn auto() -> WillChange {
WillChange::Auto
}
}
impl Parse for WillChange {
/// auto | <animateable-feature>#
fn parse<'i, 't>(
_context: &ParserContext,
input: &mut Parser<'i, 't>
) -> Result<WillChange, ParseError<'i>> {
if input.try(|input| input.expect_ident_matching("auto")).is_ok() {
return Ok(WillChange::Auto);
}
let custom_idents = input.parse_comma_separated(|i| {
let location = i.current_source_location();
CustomIdent::from_ident(location, i.expect_ident()?, &[
"will-change",
"none",
"all",
"auto",
])
})?;
Ok(WillChange::AnimateableFeatures(custom_idents.into_boxed_slice()))
}
}