mirror of
https://github.com/servo/servo.git
synced 2025-08-18 11:55:39 +01:00
style: Use a more similar representation in Rust and C++ for grid lines.
Option<> is not FFI-safe, so if we want to use the same representation everywhere we need to get rid of it. This also makes it take the same amount of memory as the C++ representation, and it's not very complex, I'd think. Differential Revision: https://phabricator.services.mozilla.com/D35195
This commit is contained in:
parent
323221051f
commit
98091243a7
6 changed files with 58 additions and 60 deletions
|
@ -144,6 +144,7 @@
|
|||
products="gecko">
|
||||
use crate::values::specified::GridLine;
|
||||
use crate::parser::Parse;
|
||||
use crate::Zero;
|
||||
|
||||
// NOTE: Since both the shorthands have the same code, we should (re-)use code from one to implement
|
||||
// the other. This might not be a big deal for now, but we should consider looking into this in the future
|
||||
|
@ -157,8 +158,8 @@
|
|||
GridLine::parse(context, input)?
|
||||
} else {
|
||||
let mut line = GridLine::auto();
|
||||
if start.line_num.is_none() && !start.is_span {
|
||||
line.ident = start.ident.clone(); // ident from start value should be taken
|
||||
if start.line_num.is_zero() && !start.is_span {
|
||||
line.ident = start.ident.clone(); // ident from start value should be taken
|
||||
}
|
||||
|
||||
line
|
||||
|
@ -186,6 +187,7 @@
|
|||
products="gecko">
|
||||
use crate::values::specified::GridLine;
|
||||
use crate::parser::Parse;
|
||||
use crate::Zero;
|
||||
|
||||
// The code is the same as `grid-{row,column}` except that this can have four values at most.
|
||||
pub fn parse_value<'i, 't>(
|
||||
|
@ -194,7 +196,7 @@
|
|||
) -> Result<Longhands, ParseError<'i>> {
|
||||
fn line_with_ident_from(other: &GridLine) -> GridLine {
|
||||
let mut this = GridLine::auto();
|
||||
if other.line_num.is_none() && !other.is_span {
|
||||
if other.line_num.is_zero() && !other.is_span {
|
||||
this.ident = other.ident.clone();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue