1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
5 //! Specified types for CSS borders.
6 
7 use cssparser::Parser;
8 use parser::ParserContext;
9 use style_traits::ParseError;
10 use values::generics::rect::Rect;
11 use values::specified::length::LengthOrNumber;
12 
13 /// A specified rectangle made of four `<length-or-number>` values.
14 pub type LengthOrNumberRect = Rect<LengthOrNumber>;
15 
16 impl LengthOrNumberRect {
17     /// Parses a `LengthOrNumberRect`, rejecting negative values.
18     #[inline]
parse_non_negative<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>>19     pub fn parse_non_negative<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
20                                       -> Result<Self, ParseError<'i>> {
21         Rect::parse_with(context, input, LengthOrNumber::parse_non_negative)
22     }
23 }
24