mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
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.
This commit is contained in:
parent
3672856efa
commit
cd8f96cc9e
89 changed files with 873 additions and 533 deletions
|
@ -4,11 +4,11 @@
|
|||
|
||||
//! Helper types for the `@viewport` rule.
|
||||
|
||||
use {CSSPixel, PinchZoomFactor, ParseError, ToCss};
|
||||
use {CSSPixel, CssWriter, ParseError, PinchZoomFactor, ToCss};
|
||||
use cssparser::Parser;
|
||||
use euclid::TypedSize2D;
|
||||
#[allow(unused_imports)] use std::ascii::AsciiExt;
|
||||
use std::fmt;
|
||||
use std::fmt::{self, Write};
|
||||
|
||||
define_css_keyword_enum!(UserZoom:
|
||||
"zoom" => Zoom,
|
||||
|
@ -42,8 +42,9 @@ pub struct ViewportConstraints {
|
|||
}
|
||||
|
||||
impl ToCss for ViewportConstraints {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
|
||||
where W: fmt::Write
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
dest.write_str("@viewport { width: ")?;
|
||||
self.size.width.to_css(dest)?;
|
||||
|
@ -86,7 +87,7 @@ pub enum Zoom {
|
|||
}
|
||||
|
||||
impl ToCss for Zoom {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where W: fmt::Write,
|
||||
{
|
||||
match *self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue