mirror of
https://github.com/servo/servo
synced 2026-04-30 03:17:15 +02:00
style: Centralize specified url value handling, and refcount urls.
This commit is contained in:
@@ -10,17 +10,16 @@
|
||||
use properties::shorthands::serialize_four_sides;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use url::Url;
|
||||
use values::computed::{BorderRadiusSize, LengthOrPercentage};
|
||||
use values::computed::UrlExtraData;
|
||||
use values::computed::position::Position;
|
||||
use values::specified::url::SpecifiedUrl;
|
||||
|
||||
pub use values::specified::basic_shape::{FillRule, GeometryBox, ShapeBox};
|
||||
|
||||
#[derive(Clone, PartialEq, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum ShapeSource<T> {
|
||||
Url(Url, UrlExtraData),
|
||||
Url(SpecifiedUrl),
|
||||
Shape(BasicShape, Option<T>),
|
||||
Box(T),
|
||||
None,
|
||||
@@ -35,7 +34,7 @@ impl<T> Default for ShapeSource<T> {
|
||||
impl<T: ToCss> ToCss for ShapeSource<T> {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
ShapeSource::Url(ref url, _) => url.to_css(dest),
|
||||
ShapeSource::Url(ref url) => url.to_css(dest),
|
||||
ShapeSource::Shape(ref shape, Some(ref reference)) => {
|
||||
try!(shape.to_css(dest));
|
||||
try!(dest.write_str(" "));
|
||||
|
||||
Reference in New Issue
Block a user