style: Move represents_keyword to the css attributes.

Bug: 1457635
Reviewed-by: xidorn
MozReview-Commit-ID: 21yuU4h34AQ
This commit is contained in:
Emilio Cobos Álvarez 2018-04-29 04:48:47 +02:00
parent a375baf84b
commit c508d8576d
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
8 changed files with 24 additions and 69 deletions

View file

@ -23,12 +23,13 @@ pub enum BorderImageSideWidth<LengthOrPercentage, Number> {
/// A generic value for the `border-image-slice` property.
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
ToComputedValue)]
ToComputedValue, ToCss)]
pub struct BorderImageSlice<NumberOrPercentage> {
/// The offsets.
#[css(field_bound)]
pub offsets: Rect<NumberOrPercentage>,
/// Whether to fill the middle part.
#[value_info(represents_keyword)]
#[css(represents_keyword)]
pub fill: bool,
}
@ -86,22 +87,6 @@ where
}
}
impl<N> ToCss for BorderImageSlice<N>
where
N: PartialEq + ToCss,
{
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: Write,
{
self.offsets.to_css(dest)?;
if self.fill {
dest.write_str(" fill")?;
}
Ok(())
}
}
impl<L> BorderRadius<L> {
/// Returns a new `BorderRadius<L>`.
#[inline]

View file

@ -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(())
}
}

View file

@ -1947,11 +1947,11 @@ pub struct FontSynthesis {
/// If a `font-weight` is requested that the font family does not contain,
/// the user agent may synthesize the requested weight from the weights
/// that do exist in the font family.
#[value_info(represents_keyword)]
#[css(represents_keyword)]
pub weight: bool,
/// If a font-style is requested that the font family does not contain,
/// the user agent may synthesize the requested style from the normal face in the font family.
#[value_info(represents_keyword)]
#[css(represents_keyword)]
pub style: bool,
}

View file

@ -424,14 +424,14 @@ pub enum AutoFlow {
}
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo,
ToComputedValue)]
ToComputedValue, ToCss)]
/// Controls how the auto-placement algorithm works
/// specifying exactly how auto-placed items get flowed into the grid
pub struct GridAutoFlow {
/// Specifiy how auto-placement algorithm fills each `row` or `column` in turn
pub autoflow: AutoFlow,
/// Specify use `dense` packing algorithm or not
#[value_info(represents_keyword)]
#[css(represents_keyword)]
pub dense: bool,
}
@ -446,20 +446,6 @@ impl GridAutoFlow {
}
}
impl ToCss for GridAutoFlow {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: Write,
{
self.autoflow.to_css(dest)?;
if self.dense {
dest.write_str(" dense")?;
}
Ok(())
}
}
impl Parse for GridAutoFlow {
/// [ row | column ] || dense
fn parse<'i, 't>(