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

@ -22,4 +22,3 @@ heapsize_derive = {version = "0.1", optional = true}
rustc-serialize = "0.3"
serde = {version = "0.8", optional = true}
serde_derive = {version = "0.8", optional = true}
url = "1.2"

View file

@ -23,7 +23,6 @@ extern crate euclid;
extern crate rustc_serialize;
#[cfg(feature = "servo")] extern crate serde;
#[cfg(feature = "servo")] #[macro_use] extern crate serde_derive;
extern crate url;
/// Opaque type stored in type-unsafe work queues for parallel layout.
/// Must be transmutable to and from TNode.

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 {