aboutsummaryrefslogtreecommitdiffstats
path: root/components/style_traits/cursor.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2018-01-22 19:58:01 +0100
committerAnthony Ramine <n.oxyde@gmail.com>2018-01-23 10:41:42 +0100
commitcd8f96cc9edd5debbb738ffa3124e3d46c5d8bcf (patch)
tree5c6f46a882b529a5de7b792d44b0ee432ee327bd /components/style_traits/cursor.rs
parent3672856efa31195aaa89b007f790df925474001a (diff)
downloadservo-cd8f96cc9edd5debbb738ffa3124e3d46c5d8bcf.tar.gz
servo-cd8f96cc9edd5debbb738ffa3124e3d46c5d8bcf.zip
Change ToCss to take a CssWriter<W>
This more concrete wrapper type can write a prefix the very first time something is written to it. This allows removing plenty of useless monomorphisations caused by the former W/SequenceWriter<W> pair of types.
Diffstat (limited to 'components/style_traits/cursor.rs')
-rw-r--r--components/style_traits/cursor.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/components/style_traits/cursor.rs b/components/style_traits/cursor.rs
index ca40c4aed79..3ffd2814382 100644
--- a/components/style_traits/cursor.rs
+++ b/components/style_traits/cursor.rs
@@ -4,7 +4,7 @@
//! A list of common mouse cursors per CSS3-UI § 8.1.1.
-use super::ToCss;
+use super::{CssWriter, ToCss};
macro_rules! define_cursor {
(
@@ -46,10 +46,14 @@ macro_rules! define_cursor {
}
impl ToCss for CursorKind {
- fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result where W: ::std::fmt::Write {
+ fn to_css<W>(&self, dest: &mut CssWriter<W>) -> ::std::fmt::Result where W: ::std::fmt::Write {
match *self {
- $( CursorKind::$c_variant => dest.write_str($c_css), )+
- $( #[cfg(feature = "gecko")] CursorKind::$g_variant => dest.write_str($g_css), )+
+ $(CursorKind::$c_variant => {
+ ::std::fmt::Write::write_str(dest, $c_css)
+ })+
+ $(#[cfg(feature = "gecko")] CursorKind::$g_variant => {
+ ::std::fmt::Write::write_str(dest, $g_css)
+ })+
}
}
}