mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Move will-change outside of mako
This commit is contained in:
parent
09a3db8657
commit
2eb396613b
6 changed files with 64 additions and 64 deletions
|
@ -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()))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue