mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Use CustomIdent in GridLine
This commit is contained in:
parent
ad79a19587
commit
9f03553ed5
2 changed files with 7 additions and 9 deletions
|
@ -1190,8 +1190,8 @@ fn static_assert() {
|
|||
pub fn set_${value.name}(&mut self, v: longhands::${value.name}::computed_value::T) {
|
||||
use gecko_bindings::structs::{nsStyleGridLine_kMinLine, nsStyleGridLine_kMaxLine};
|
||||
|
||||
let ident = v.ident.unwrap_or(String::new());
|
||||
self.gecko.${value.gecko}.mLineName.assign_utf8(&ident);
|
||||
let ident = v.ident.as_ref().map_or(&[] as &[_], |ident| ident.0.as_slice());
|
||||
self.gecko.${value.gecko}.mLineName.assign(ident);
|
||||
self.gecko.${value.gecko}.mHasSpan = v.is_span;
|
||||
self.gecko.${value.gecko}.mInteger = v.line_num.map(|i| {
|
||||
// clamping the integer between a range
|
||||
|
|
|
@ -24,7 +24,7 @@ pub struct GridLine {
|
|||
/// A custom identifier for named lines.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#grid-placement-slot
|
||||
pub ident: Option<String>,
|
||||
pub ident: Option<CustomIdent>,
|
||||
/// Denotes the nth grid line from grid item's placement.
|
||||
pub line_num: Option<Integer>,
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ impl ToCss for GridLine {
|
|||
|
||||
if let Some(ref s) = self.ident {
|
||||
dest.write_str(" ")?;
|
||||
serialize_identifier(s, dest)?;
|
||||
s.to_css(dest)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -100,12 +100,10 @@ impl Parse for GridLine {
|
|||
|
||||
grid_line.line_num = Some(i);
|
||||
} else if let Ok(name) = input.try(|i| i.expect_ident()) {
|
||||
if val_before_span || grid_line.ident.is_some() ||
|
||||
CustomIdent::from_ident((&*name).into(), &[]).is_err() {
|
||||
return Err(StyleParseError::UnspecifiedError.into())
|
||||
if val_before_span || grid_line.ident.is_some() {
|
||||
return Err(StyleParseError::UnspecifiedError.into());
|
||||
}
|
||||
|
||||
grid_line.ident = Some(name.into_owned());
|
||||
grid_line.ident = Some(CustomIdent::from_ident(name, &[])?);
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue