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:
Emilio Cobos Álvarez 2019-06-26 21:21:06 +00:00
parent 323221051f
commit 98091243a7
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
6 changed files with 58 additions and 60 deletions

View file

@ -17,9 +17,9 @@ use crate::context::QuirksMode;
use crate::parser::{Parse, ParserContext};
use crate::values::serialize_atom_identifier;
use crate::values::specified::calc::CalcNode;
use crate::{Atom, Namespace, Prefix};
use crate::{Atom, Namespace, Prefix, Zero};
use cssparser::{Parser, Token};
use num_traits::{One, Zero};
use num_traits::One;
use std::f32;
use std::fmt::{self, Write};
use std::ops::Add;
@ -449,6 +449,18 @@ pub struct Integer {
was_calc: bool,
}
impl Zero for Integer {
#[inline]
fn zero() -> Self {
Self::new(0)
}
#[inline]
fn is_zero(&self) -> bool {
self.value() == 0
}
}
impl One for Integer {
#[inline]
fn one() -> Self {