mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Re-use Url serialization in values::specified::Image.
This commit is contained in:
parent
44bdbed989
commit
e75b1c3b32
1 changed files with 4 additions and 6 deletions
|
@ -90,13 +90,13 @@ pub const FONT_MEDIUM_PX: i32 = 16;
|
||||||
|
|
||||||
pub mod specified {
|
pub mod specified {
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use cssparser::{self, CssStringWriter, Parser, ToCss, Token};
|
use cssparser::{self, Parser, ToCss, Token};
|
||||||
use euclid::size::Size2D;
|
use euclid::size::Size2D;
|
||||||
use parser::ParserContext;
|
use parser::ParserContext;
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use std::fmt::{self, Write};
|
use std::fmt;
|
||||||
use std::ops::Mul;
|
use std::ops::Mul;
|
||||||
use style_traits::values::specified::AllowedNumericType;
|
use style_traits::values::specified::AllowedNumericType;
|
||||||
use super::AuExtensionMethods;
|
use super::AuExtensionMethods;
|
||||||
|
@ -1224,12 +1224,10 @@ pub mod specified {
|
||||||
|
|
||||||
impl ToCss for Image {
|
impl ToCss for Image {
|
||||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||||
|
use values::LocalToCss;
|
||||||
match *self {
|
match *self {
|
||||||
Image::Url(ref url) => {
|
Image::Url(ref url) => {
|
||||||
try!(dest.write_str("url(\""));
|
url.to_css(dest)
|
||||||
try!(write!(&mut CssStringWriter::new(dest), "{}", url));
|
|
||||||
try!(dest.write_str("\")"));
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
Image::LinearGradient(ref gradient) => gradient.to_css(dest)
|
Image::LinearGradient(ref gradient) => gradient.to_css(dest)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue