style: Centralize specified url value handling, and refcount urls.

This commit is contained in:
Emilio Cobos Álvarez 2016-10-16 15:08:30 +02:00
parent 89c46369a2
commit 5f2e7af864
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
22 changed files with 267 additions and 187 deletions

View file

@ -3,9 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use app_units::Au;
use cssparser::CssStringWriter;
use std::fmt::{self, Write};
use url::Url;
use std::fmt;
/// The real ToCss trait can't be implemented for types in crates that don't
/// depend on each other.
@ -30,15 +28,6 @@ impl ToCss for Au {
}
}
impl ToCss for Url {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
try!(dest.write_str("url(\""));
try!(write!(CssStringWriter::new(dest), "{}", self));
try!(dest.write_str("\")"));
Ok(())
}
}
macro_rules! impl_to_css_for_predefined_type {
($name: ty) => {
impl<'a> ToCss for $name {