style: Share custom property declarations if they don't contain variable references.

This commit is contained in:
Emilio Cobos Álvarez 2017-10-08 23:31:46 +02:00
parent 7e143372bd
commit a6eaa0812a
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
8 changed files with 180 additions and 135 deletions

View file

@ -26,3 +26,4 @@ selectors = { path = "../selectors" }
serde = {version = "1.0", optional = true}
webrender_api = {git = "https://github.com/servo/webrender", optional = true}
servo_atoms = {path = "../atoms", optional = true}
servo_arc = {path = "../servo_arc" }

View file

@ -24,6 +24,7 @@ extern crate euclid;
extern crate selectors;
#[cfg(feature = "servo")] #[macro_use] extern crate serde;
#[cfg(feature = "servo")] extern crate webrender_api;
extern crate servo_arc;
#[cfg(feature = "servo")] extern crate servo_atoms;
#[cfg(feature = "servo")] pub use webrender_api::DevicePixel;

View file

@ -7,6 +7,7 @@
use app_units::Au;
use cssparser::{BasicParseError, ParseError, Parser, Token, UnicodeRange, serialize_string};
use cssparser::ToCss as CssparserToCss;
use servo_arc::Arc;
use std::fmt::{self, Write};
/// Serialises a value according to its CSS representation.
@ -343,6 +344,14 @@ impl<T> ToCss for Box<T> where T: ?Sized + ToCss {
}
}
impl<T> ToCss for Arc<T> where T: ?Sized + ToCss {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
where W: Write,
{
(**self).to_css(dest)
}
}
impl ToCss for Au {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: Write {
self.to_f64_px().to_css(dest)?;