mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
style: Move represents_keyword to the css attributes.
Bug: 1457635 Reviewed-by: xidorn MozReview-Commit-ID: 21yuU4h34AQ
This commit is contained in:
parent
a375baf84b
commit
c508d8576d
8 changed files with 24 additions and 69 deletions
|
@ -4,14 +4,12 @@
|
|||
|
||||
//! Generic types for CSS values related to effects.
|
||||
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::values::{CssWriter, SequenceWriter, ToCss};
|
||||
#[cfg(feature = "gecko")]
|
||||
use values::specified::url::SpecifiedUrl;
|
||||
|
||||
/// A generic value for a single `box-shadow`.
|
||||
#[derive(Animate, Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToAnimatedValue, ToAnimatedZero)]
|
||||
ToAnimatedValue, ToAnimatedZero, ToCss)]
|
||||
pub struct BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength> {
|
||||
/// The base shadow.
|
||||
pub base: SimpleShadow<Color, SizeLength, BlurShapeLength>,
|
||||
|
@ -19,7 +17,7 @@ pub struct BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength> {
|
|||
pub spread: ShapeLength,
|
||||
/// Whether this is an inset box shadow.
|
||||
#[animation(constant)]
|
||||
#[value_info(represents_keyword)]
|
||||
#[css(represents_keyword)]
|
||||
pub inset: bool,
|
||||
}
|
||||
|
||||
|
@ -80,27 +78,3 @@ pub struct SimpleShadow<Color, SizeLength, ShapeLength> {
|
|||
/// Blur radius.
|
||||
pub blur: ShapeLength,
|
||||
}
|
||||
|
||||
impl<Color, SizeLength, BlurShapeLength, ShapeLength> ToCss
|
||||
for BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength>
|
||||
where
|
||||
Color: ToCss,
|
||||
SizeLength: ToCss,
|
||||
BlurShapeLength: ToCss,
|
||||
ShapeLength: ToCss,
|
||||
{
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
{
|
||||
let mut writer = SequenceWriter::new(&mut *dest, " ");
|
||||
writer.item(&self.base)?;
|
||||
writer.item(&self.spread)?;
|
||||
}
|
||||
if self.inset {
|
||||
dest.write_str(" inset")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue