mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +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
|
@ -7,8 +7,8 @@
|
|||
//!
|
||||
//! [basic-shape]: https://drafts.csswg.org/css-shapes/#typedef-basic-shape
|
||||
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::computed::{LengthOrPercentage, ComputedUrl, Image};
|
||||
use values::generics::basic_shape::{BasicShape as GenericBasicShape};
|
||||
use values::generics::basic_shape::{Circle as GenericCircle, ClippingShape as GenericClippingShape};
|
||||
|
@ -37,7 +37,10 @@ pub type Ellipse = GenericEllipse<LengthOrPercentage, LengthOrPercentage, Length
|
|||
pub type ShapeRadius = GenericShapeRadius<LengthOrPercentage>;
|
||||
|
||||
impl ToCss for Circle {
|
||||
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("circle(")?;
|
||||
self.radius.to_css(dest)?;
|
||||
dest.write_str(" at ")?;
|
||||
|
@ -47,7 +50,10 @@ impl ToCss for Circle {
|
|||
}
|
||||
|
||||
impl ToCss for Ellipse {
|
||||
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("ellipse(")?;
|
||||
if (self.semiaxis_x, self.semiaxis_y) != Default::default() {
|
||||
self.semiaxis_x.to_css(dest)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue