mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Centralize specified url value handling, and refcount urls.
This commit is contained in:
parent
89c46369a2
commit
5f2e7af864
22 changed files with 267 additions and 187 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue