mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Derive ToCss for TemplateAreas
This commit is contained in:
parent
46ad9f2a30
commit
92f116a95c
1 changed files with 4 additions and 16 deletions
|
@ -509,14 +509,17 @@ impl From<GridAutoFlow> for u8 {
|
|||
}
|
||||
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
/// https://drafts.csswg.org/css-grid/#named-grid-area
|
||||
pub struct TemplateAreas {
|
||||
/// `named area` containing for each template area
|
||||
#[css(skip)]
|
||||
pub areas: Box<[NamedArea]>,
|
||||
/// The original CSS string value of each template area
|
||||
#[css(iterable)]
|
||||
pub strings: Box<[Box<str>]>,
|
||||
/// The number of columns of the grid.
|
||||
#[css(skip)]
|
||||
pub width: u32,
|
||||
}
|
||||
|
||||
|
@ -596,21 +599,6 @@ impl TemplateAreas {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToCss for TemplateAreas {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
for (i, string) in self.strings.iter().enumerate() {
|
||||
if i != 0 {
|
||||
dest.write_str(" ")?;
|
||||
}
|
||||
string.to_css(dest)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for TemplateAreas {
|
||||
fn parse<'i, 't>(
|
||||
_context: &ParserContext,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue