mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Add a Zero trait that doesn't require Add, and use it in place of num_traits and IsZeroLength.
Use it to be consistent in InsetRect serialization and storage between Servo and Gecko. Differential Revision: https://phabricator.services.mozilla.com/D21493
This commit is contained in:
parent
4496411edc
commit
7d01114cbf
29 changed files with 179 additions and 186 deletions
|
@ -18,6 +18,7 @@ use crate::values::specified::position::{HorizontalPosition, Position, VerticalP
|
|||
use crate::values::specified::url::SpecifiedUrl;
|
||||
use crate::values::specified::SVGPathData;
|
||||
use crate::values::specified::{LengthPercentage, NonNegativeLengthPercentage};
|
||||
use crate::Zero;
|
||||
use cssparser::Parser;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
|
@ -202,9 +203,9 @@ impl InsetRect {
|
|||
) -> Result<Self, ParseError<'i>> {
|
||||
let rect = Rect::parse_with(context, input, LengthPercentage::parse)?;
|
||||
let round = if input.try(|i| i.expect_ident_matching("round")).is_ok() {
|
||||
Some(BorderRadius::parse(context, input)?)
|
||||
BorderRadius::parse(context, input)?
|
||||
} else {
|
||||
None
|
||||
BorderRadius::zero()
|
||||
};
|
||||
Ok(generic::InsetRect { rect, round })
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue