mirror of
https://github.com/servo/servo.git
synced 2025-08-08 15:05:35 +01:00
Derive ToCss for TransitionProperty
This commit is contained in:
parent
83a2312867
commit
13c40f4fb8
2 changed files with 23 additions and 17 deletions
|
@ -26,10 +26,9 @@ use properties::{LonghandId, ShorthandId};
|
|||
use servo_arc::Arc;
|
||||
use smallvec::SmallVec;
|
||||
use std::{cmp, ptr};
|
||||
use std::fmt::{self, Write};
|
||||
use std::mem::{self, ManuallyDrop};
|
||||
#[cfg(feature = "gecko")] use hash::FnvHashMap;
|
||||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
use style_traits::ParseError;
|
||||
use super::ComputedValues;
|
||||
use values::{CSSFloat, CustomIdent, Either};
|
||||
use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
|
||||
|
@ -79,7 +78,7 @@ pub fn nscsspropertyid_is_animatable(property: nsCSSPropertyID) -> bool {
|
|||
/// a shorthand with at least one transitionable longhand component, or an unsupported property.
|
||||
// NB: This needs to be here because it needs all the longhands generated
|
||||
// beforehand.
|
||||
#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToCss)]
|
||||
pub enum TransitionProperty {
|
||||
/// A shorthand.
|
||||
Shorthand(ShorthandId),
|
||||
|
@ -90,19 +89,6 @@ pub enum TransitionProperty {
|
|||
Unsupported(CustomIdent),
|
||||
}
|
||||
|
||||
impl ToCss for TransitionProperty {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
match *self {
|
||||
TransitionProperty::Shorthand(ref id) => dest.write_str(id.name()),
|
||||
TransitionProperty::Longhand(ref id) => dest.write_str(id.name()),
|
||||
TransitionProperty::Unsupported(ref id) => id.to_css(dest),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trivial_to_computed_value!(TransitionProperty);
|
||||
|
||||
impl TransitionProperty {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue