mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +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
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue