mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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
|
@ -5,8 +5,8 @@
|
|||
//! CSS handling for the [`basic-shape`](https://drafts.csswg.org/css-shapes/#typedef-basic-shape)
|
||||
//! types that are generic over their `ToCss` implementations.
|
||||
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::animated::{Animate, Procedure, ToAnimatedZero};
|
||||
use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
use values::generics::border::BorderRadius;
|
||||
|
@ -152,7 +152,10 @@ impl<B, T, U> ToAnimatedZero for ShapeSource<B, T, U> {
|
|||
impl<L> ToCss for InsetRect<L>
|
||||
where L: ToCss + PartialEq
|
||||
{
|
||||
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("inset(")?;
|
||||
self.rect.to_css(dest)?;
|
||||
if let Some(ref radius) = self.round {
|
||||
|
@ -210,7 +213,10 @@ where
|
|||
}
|
||||
|
||||
impl<L: ToCss> ToCss for Polygon<L> {
|
||||
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("polygon(")?;
|
||||
if self.fill != FillRule::default() {
|
||||
self.fill.to_css(dest)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue