mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Fix the integer setting of the GridLine struct
GridLine line_num shouldn't be set if it's not parsed. So we can determine if it's set or not for serialization.
This commit is contained in:
parent
46780ceb0d
commit
638a306168
2 changed files with 5 additions and 6 deletions
|
@ -1319,10 +1319,11 @@ fn static_assert() {
|
||||||
let ident = v.ident.as_ref().map_or(&[] as &[_], |ident| ident.0.as_slice());
|
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}.mLineName.assign(ident);
|
||||||
self.gecko.${value.gecko}.mHasSpan = v.is_span;
|
self.gecko.${value.gecko}.mHasSpan = v.is_span;
|
||||||
self.gecko.${value.gecko}.mInteger = v.line_num.map(|i| {
|
if let Some(integer) = v.line_num {
|
||||||
// clamping the integer between a range
|
// clamping the integer between a range
|
||||||
cmp::max(nsStyleGridLine_kMinLine, cmp::min(i.value(), nsStyleGridLine_kMaxLine))
|
self.gecko.${value.gecko}.mInteger = cmp::max(nsStyleGridLine_kMinLine,
|
||||||
}).unwrap_or(0);
|
cmp::min(integer.value(), nsStyleGridLine_kMaxLine));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn copy_${value.name}_from(&mut self, other: &Self) {
|
pub fn copy_${value.name}_from(&mut self, other: &Self) {
|
||||||
|
|
|
@ -119,9 +119,7 @@ impl Parse for GridLine {
|
||||||
if i.value() <= 0 { // disallow negative integers for grid spans
|
if i.value() <= 0 { // disallow negative integers for grid spans
|
||||||
return Err(StyleParseError::UnspecifiedError.into())
|
return Err(StyleParseError::UnspecifiedError.into())
|
||||||
}
|
}
|
||||||
} else if grid_line.ident.is_some() { // integer could be omitted
|
} else if grid_line.ident.is_none() { // integer could be omitted
|
||||||
grid_line.line_num = Some(Integer::new(1));
|
|
||||||
} else {
|
|
||||||
return Err(StyleParseError::UnspecifiedError.into())
|
return Err(StyleParseError::UnspecifiedError.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue