tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

inherited_svg.mako.rs (1255B)


      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 https://mozilla.org/MPL/2.0/. */
      4 
      5 <%namespace name="helpers" file="/helpers.mako.rs" />
      6 
      7 <%helpers:shorthand
      8    name="marker"
      9    engines="gecko"
     10    sub_properties="marker-start marker-end marker-mid"
     11    spec="https://svgwg.org/svg2-draft/painting.html#MarkerShorthand"
     12 >
     13    use crate::values::specified::url::UrlOrNone;
     14 
     15    pub fn parse_value<'i, 't>(
     16        context: &ParserContext,
     17        input: &mut Parser<'i, 't>,
     18    ) -> Result<Longhands, ParseError<'i>> {
     19        use crate::parser::Parse;
     20        let url = UrlOrNone::parse(context, input)?;
     21 
     22        Ok(expanded! {
     23            marker_start: url.clone(),
     24            marker_mid: url.clone(),
     25            marker_end: url,
     26        })
     27    }
     28 
     29    impl<'a> ToCss for LonghandsToSerialize<'a>  {
     30        fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
     31            if self.marker_start == self.marker_mid && self.marker_mid == self.marker_end {
     32                self.marker_start.to_css(dest)
     33            } else {
     34                Ok(())
     35            }
     36        }
     37    }
     38 </%helpers:shorthand>