mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +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,7 +7,7 @@
|
|||
//! https://drafts.csswg.org/css-align/
|
||||
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
use values::specified;
|
||||
|
||||
|
@ -26,7 +26,7 @@ pub struct JustifyItems {
|
|||
}
|
||||
|
||||
impl ToCss for JustifyItems {
|
||||
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,
|
||||
{
|
||||
self.computed.to_css(dest)
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
use properties::animated_properties::RepeatableListAnimatable;
|
||||
use properties::longhands::background_size::computed_value::T as BackgroundSizeList;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::animated::{ToAnimatedValue, ToAnimatedZero};
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
use values::computed::length::LengthOrPercentageOrAuto;
|
||||
|
@ -96,9 +96,9 @@ impl BackgroundRepeat {
|
|||
}
|
||||
|
||||
impl ToCss for BackgroundRepeat {
|
||||
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,
|
||||
W: Write,
|
||||
{
|
||||
match (self.0, self.1) {
|
||||
(RepeatKeyword::Repeat, RepeatKeyword::NoRepeat) => dest.write_str("repeat-x"),
|
||||
|
|
|
@ -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)?;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
use cssparser::{Color as CSSParserColor, RGBA};
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::animated::ToAnimatedValue;
|
||||
use values::animated::color::{Color as AnimatedColor, RGBA as AnimatedRGBA};
|
||||
|
||||
|
@ -138,7 +138,7 @@ impl From<RGBA> for Color {
|
|||
}
|
||||
|
||||
impl ToCss for Color {
|
||||
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: fmt::Write {
|
||||
if self.is_numeric() {
|
||||
self.color.to_css(dest)
|
||||
} else if self.is_currentcolor() {
|
||||
|
|
|
@ -19,7 +19,7 @@ use std::fmt::{self, Write};
|
|||
use std::hash::{Hash, Hasher};
|
||||
#[cfg(feature = "servo")]
|
||||
use std::slice;
|
||||
use style_traits::{ToCss, ParseError};
|
||||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
use values::CSSFloat;
|
||||
use values::animated::{ToAnimatedValue, ToAnimatedZero};
|
||||
use values::computed::{Context, NonNegativeLength, ToComputedValue};
|
||||
|
@ -201,7 +201,7 @@ impl FontSize {
|
|||
}
|
||||
|
||||
impl ToCss for FontSize {
|
||||
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: fmt::Write {
|
||||
self.size.to_css(dest)
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ impl MallocSizeOf for FontFamily {
|
|||
}
|
||||
|
||||
impl ToCss for FontFamily {
|
||||
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: fmt::Write {
|
||||
let mut iter = self.0.iter();
|
||||
iter.next().unwrap().to_css(dest)?;
|
||||
for family in iter {
|
||||
|
@ -279,7 +279,7 @@ pub struct FamilyName {
|
|||
}
|
||||
|
||||
impl ToCss for FamilyName {
|
||||
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: fmt::Write {
|
||||
match self.syntax {
|
||||
FamilyNameSyntax::Quoted => {
|
||||
dest.write_char('"')?;
|
||||
|
@ -488,7 +488,7 @@ impl SingleFontFamily {
|
|||
}
|
||||
|
||||
impl ToCss for SingleFontFamily {
|
||||
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: fmt::Write {
|
||||
match *self {
|
||||
SingleFontFamily::FamilyName(ref name) => name.to_css(dest),
|
||||
|
||||
|
@ -731,7 +731,7 @@ impl FontLanguageOverride {
|
|||
}
|
||||
|
||||
impl ToCss for FontLanguageOverride {
|
||||
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: fmt::Write {
|
||||
use std::str;
|
||||
|
||||
if self.0 == 0 {
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
use cssparser::RGBA;
|
||||
use std::f32::consts::PI;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::{Either, None_};
|
||||
use values::computed::{Angle, ComputedUrl, Context, Length, LengthOrPercentage, NumberOrPercentage, ToComputedValue};
|
||||
#[cfg(feature = "gecko")]
|
||||
|
@ -99,8 +99,13 @@ impl GenericLineDirection for LineDirection {
|
|||
}
|
||||
}
|
||||
|
||||
fn to_css<W>(&self, dest: &mut W, compat_mode: CompatMode) -> fmt::Result
|
||||
where W: fmt::Write
|
||||
fn to_css<W>(
|
||||
&self,
|
||||
dest: &mut CssWriter<W>,
|
||||
compat_mode: CompatMode,
|
||||
) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
match *self {
|
||||
LineDirection::Angle(ref angle) => angle.to_css(dest),
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
//! Computed values for inherited box
|
||||
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::specified::Angle;
|
||||
|
||||
/// An angle rounded and normalized per https://drafts.csswg.org/css-images/#propdef-image-orientation
|
||||
|
@ -31,7 +31,10 @@ impl Orientation {
|
|||
}
|
||||
|
||||
impl ToCss for Orientation {
|
||||
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,
|
||||
{
|
||||
// Should agree with Angle::to_css.
|
||||
match *self {
|
||||
Orientation::Angle0 => dest.write_str("0deg"),
|
||||
|
@ -60,7 +63,10 @@ impl ImageOrientation {
|
|||
}
|
||||
|
||||
impl ToCss for ImageOrientation {
|
||||
fn to_css<W: fmt::Write>(&self, dest: &mut W) -> fmt::Result {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
match *self {
|
||||
ImageOrientation::FromImage => dest.write_str("from-image"),
|
||||
ImageOrientation::AngleWithFlipped(angle, flipped) => {
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
use app_units::Au;
|
||||
use ordered_float::NotNaN;
|
||||
use std::fmt;
|
||||
use std::fmt::{self, Write};
|
||||
use std::ops::{Add, Neg};
|
||||
use style_traits::ToCss;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use style_traits::values::specified::AllowedNumericType;
|
||||
use super::{Number, ToComputedValue, Context, Percentage};
|
||||
use values::{Auto, CSSFloat, Either, ExtremumLength, None_, Normal, specified};
|
||||
|
@ -203,7 +203,10 @@ impl From<LengthOrPercentageOrNone> for Option<CalcLengthOrPercentage> {
|
|||
}
|
||||
|
||||
impl ToCss for CalcLengthOrPercentage {
|
||||
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,
|
||||
{
|
||||
use num_traits::Zero;
|
||||
|
||||
let (length, percentage) = match (self.length, self.percentage) {
|
||||
|
@ -738,7 +741,10 @@ impl CSSPixelLength {
|
|||
|
||||
impl ToCss for CSSPixelLength {
|
||||
#[inline]
|
||||
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,
|
||||
{
|
||||
self.0.to_css(dest)?;
|
||||
dest.write_str("px")
|
||||
}
|
||||
|
|
|
@ -15,11 +15,12 @@ use properties::{ComputedValues, LonghandId, StyleBuilder};
|
|||
use rule_cache::RuleCacheConditions;
|
||||
#[cfg(feature = "servo")]
|
||||
use servo_url::ServoUrl;
|
||||
use std::{f32, fmt};
|
||||
use std::cell::RefCell;
|
||||
use std::f32;
|
||||
use std::fmt::{self, Write};
|
||||
#[cfg(feature = "servo")]
|
||||
use std::sync::Arc;
|
||||
use style_traits::ToCss;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use style_traits::cursor::CursorKind;
|
||||
use super::{CSSFloat, CSSInteger};
|
||||
use super::generics::{GreaterThanOrEqualToOne, NonNegative};
|
||||
|
@ -531,7 +532,10 @@ pub struct ClipRect {
|
|||
}
|
||||
|
||||
impl ToCss for ClipRect {
|
||||
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("rect(")?;
|
||||
if let Some(top) = self.top {
|
||||
top.to_css(dest)?;
|
||||
|
@ -627,7 +631,10 @@ impl ComputedUrl {
|
|||
|
||||
#[cfg(feature = "servo")]
|
||||
impl ToCss for ComputedUrl {
|
||||
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,
|
||||
{
|
||||
let string = match *self {
|
||||
ComputedUrl::Valid(ref url) => url.as_str(),
|
||||
ComputedUrl::Invalid(ref invalid_string) => invalid_string,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//! Computed percentages.
|
||||
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::{CSSFloat, serialize_percentage};
|
||||
|
||||
/// A computed percentage.
|
||||
|
@ -35,7 +35,7 @@ impl Percentage {
|
|||
}
|
||||
|
||||
impl ToCss for Percentage {
|
||||
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,
|
||||
{
|
||||
|
|
|
@ -10,10 +10,10 @@ use cssparser::Parser;
|
|||
use parser::{Parse, ParserContext};
|
||||
use selectors::parser::SelectorParseErrorKind;
|
||||
#[cfg(feature = "gecko")]
|
||||
use std::fmt;
|
||||
use style_traits::ParseError;
|
||||
use std::fmt::{self, Write};
|
||||
#[cfg(feature = "gecko")]
|
||||
use style_traits::ToCss;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use style_traits::ParseError;
|
||||
use style_traits::cursor::CursorKind;
|
||||
|
||||
/// The computed value for the `cursor` property.
|
||||
|
@ -80,8 +80,9 @@ impl Parse for Cursor {
|
|||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl ToCss for Cursor {
|
||||
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,
|
||||
{
|
||||
for url in &*self.images {
|
||||
url.to_css(dest)?;
|
||||
|
@ -123,8 +124,9 @@ impl CursorImage {
|
|||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl ToCss for CursorImage {
|
||||
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,
|
||||
{
|
||||
self.url.to_css(dest)?;
|
||||
if let Some((x, y)) = self.hotspot {
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
//!
|
||||
//! [position]: https://drafts.csswg.org/css-backgrounds-3/#position
|
||||
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::computed::{LengthOrPercentage, Percentage};
|
||||
use values::generics::position::Position as GenericPosition;
|
||||
pub use values::specified::position::{GridAutoFlow, GridTemplateAreas};
|
||||
|
@ -40,7 +40,10 @@ impl Position {
|
|||
}
|
||||
|
||||
impl ToCss for Position {
|
||||
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,
|
||||
{
|
||||
self.horizontal.to_css(dest)?;
|
||||
dest.write_str(" ")?;
|
||||
self.vertical.to_css(dest)
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#[cfg(feature = "servo")]
|
||||
use properties::StyleBuilder;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::{CSSInteger, CSSFloat};
|
||||
use values::animated::ToAnimatedZero;
|
||||
use values::computed::{NonNegativeLength, NonNegativeNumber};
|
||||
|
@ -66,7 +66,10 @@ impl TextOverflow {
|
|||
}
|
||||
|
||||
impl ToCss for TextOverflow {
|
||||
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,
|
||||
{
|
||||
if self.sides_are_logical {
|
||||
debug_assert!(self.first == TextOverflowSide::Clip);
|
||||
self.second.to_css(dest)?;
|
||||
|
@ -80,7 +83,10 @@ impl ToCss for TextOverflow {
|
|||
}
|
||||
|
||||
impl ToCss for TextDecorationLine {
|
||||
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,
|
||||
{
|
||||
let mut has_any = false;
|
||||
|
||||
macro_rules! write_value {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
//! Computed time values.
|
||||
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::CSSFloat;
|
||||
|
||||
/// A computed `<time>` value.
|
||||
|
@ -36,9 +36,9 @@ impl Time {
|
|||
}
|
||||
|
||||
impl ToCss for Time {
|
||||
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,
|
||||
W: Write,
|
||||
{
|
||||
self.seconds().to_css(dest)?;
|
||||
dest.write_str("s")
|
||||
|
|
|
@ -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)?;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
//! Generic types for CSS values related to borders.
|
||||
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::generics::rect::Rect;
|
||||
use values::generics::size::Size;
|
||||
|
||||
|
@ -84,8 +84,9 @@ impl<N> From<N> for BorderImageSlice<N>
|
|||
impl<N> ToCss for BorderImageSlice<N>
|
||||
where N: PartialEq + ToCss,
|
||||
{
|
||||
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,
|
||||
{
|
||||
self.offsets.to_css(dest)?;
|
||||
if self.fill {
|
||||
|
@ -118,8 +119,13 @@ impl<L> BorderRadius<L>
|
|||
{
|
||||
/// Serialises two given rects following the syntax of the `border-radius``
|
||||
/// property.
|
||||
pub fn serialize_rects<W>(widths: Rect<&L>, heights: Rect<&L>, dest: &mut W) -> fmt::Result
|
||||
where W: fmt::Write,
|
||||
pub fn serialize_rects<W>(
|
||||
widths: Rect<&L>,
|
||||
heights: Rect<&L>,
|
||||
dest: &mut CssWriter<W>,
|
||||
) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
widths.to_css(dest)?;
|
||||
if widths.0 != heights.0 || widths.1 != heights.1 || widths.2 != heights.2 || widths.3 != heights.3 {
|
||||
|
@ -133,7 +139,10 @@ impl<L> BorderRadius<L>
|
|||
impl<L> ToCss for BorderRadius<L>
|
||||
where L: PartialEq + ToCss
|
||||
{
|
||||
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,
|
||||
{
|
||||
let BorderRadius {
|
||||
top_left: BorderCornerRadius(ref tl),
|
||||
top_right: BorderCornerRadius(ref tr),
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//! Generic types for counters-related CSS values.
|
||||
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::CustomIdent;
|
||||
|
||||
/// A generic value for the `counter-increment` property.
|
||||
|
@ -27,7 +27,7 @@ where
|
|||
I: ToCss,
|
||||
{
|
||||
#[inline]
|
||||
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,
|
||||
{
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
//! Generic types for CSS values related to effects.
|
||||
|
||||
use std::fmt;
|
||||
use style_traits::values::{SequenceWriter, ToCss};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::values::{CssWriter, SequenceWriter, ToCss};
|
||||
#[cfg(feature = "gecko")]
|
||||
use values::specified::url::SpecifiedUrl;
|
||||
|
||||
|
@ -88,9 +88,9 @@ where
|
|||
BlurShapeLength: ToCss,
|
||||
ShapeLength: ToCss,
|
||||
{
|
||||
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,
|
||||
W: Write,
|
||||
{
|
||||
{
|
||||
let mut writer = SequenceWriter::new(&mut *dest, " ");
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
|
||||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::{fmt, mem, usize};
|
||||
use style_traits::{ToCss, ParseError, StyleParseErrorKind};
|
||||
use std::{mem, usize};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use values::{CSSFloat, CustomIdent};
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
use values::specified;
|
||||
|
@ -49,7 +50,10 @@ impl<Integer> ToCss for GridLine<Integer>
|
|||
where
|
||||
Integer: ToCss,
|
||||
{
|
||||
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,
|
||||
{
|
||||
if self.is_auto() {
|
||||
return dest.write_str("auto")
|
||||
}
|
||||
|
@ -230,7 +234,10 @@ impl<L: PartialEq> TrackSize<L> {
|
|||
}
|
||||
|
||||
impl<L: ToCss> ToCss for TrackSize<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,
|
||||
{
|
||||
match *self {
|
||||
TrackSize::Breadth(ref breadth) => breadth.to_css(dest),
|
||||
TrackSize::Minmax(ref min, ref max) => {
|
||||
|
@ -315,10 +322,10 @@ pub fn concat_serialize_idents<W>(
|
|||
suffix: &str,
|
||||
slice: &[CustomIdent],
|
||||
sep: &str,
|
||||
dest: &mut W,
|
||||
dest: &mut CssWriter<W>,
|
||||
) -> fmt::Result
|
||||
where
|
||||
W: fmt::Write
|
||||
W: Write,
|
||||
{
|
||||
if let Some((ref first, rest)) = slice.split_first() {
|
||||
dest.write_str(prefix)?;
|
||||
|
@ -385,7 +392,10 @@ pub struct TrackRepeat<L, I> {
|
|||
}
|
||||
|
||||
impl<L: ToCss, I: ToCss> ToCss for TrackRepeat<L, I> {
|
||||
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("repeat(")?;
|
||||
self.count.to_css(dest)?;
|
||||
dest.write_str(", ")?;
|
||||
|
@ -503,7 +513,10 @@ pub struct TrackList<LengthOrPercentage, Integer> {
|
|||
}
|
||||
|
||||
impl<L: ToCss, I: ToCss> ToCss for TrackList<L, I> {
|
||||
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,
|
||||
{
|
||||
let auto_idx = match self.list_type {
|
||||
TrackListType::Auto(i) => i as usize,
|
||||
_ => usize::MAX,
|
||||
|
@ -614,7 +627,10 @@ impl Parse for LineNameList {
|
|||
}
|
||||
|
||||
impl ToCss for LineNameList {
|
||||
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("subgrid")?;
|
||||
let fill_idx = self.fill_idx.map(|v| v as usize).unwrap_or(usize::MAX);
|
||||
for (i, names) in self.names.iter().enumerate() {
|
||||
|
|
|
@ -10,8 +10,8 @@ use Atom;
|
|||
use cssparser::serialize_identifier;
|
||||
use custom_properties;
|
||||
use servo_arc::Arc;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
|
||||
/// An [image].
|
||||
///
|
||||
|
@ -143,7 +143,10 @@ pub struct PaintWorklet {
|
|||
trivial_to_computed_value!(PaintWorklet);
|
||||
|
||||
impl ToCss for PaintWorklet {
|
||||
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("paint(")?;
|
||||
serialize_identifier(&*self.name.to_string(), dest)?;
|
||||
for argument in &self.arguments {
|
||||
|
@ -169,17 +172,23 @@ pub struct MozImageRect<NumberOrPercentage, MozImageRectUrl> {
|
|||
}
|
||||
|
||||
impl<G, R, U> fmt::Debug for Image<G, R, U>
|
||||
where G: fmt::Debug, R: fmt::Debug, U: fmt::Debug + ToCss
|
||||
where
|
||||
G: ToCss,
|
||||
R: ToCss,
|
||||
U: ToCss,
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
self.to_css(f)
|
||||
self.to_css(&mut CssWriter::new(f))
|
||||
}
|
||||
}
|
||||
|
||||
impl<G, R, U> ToCss for Image<G, R, U>
|
||||
where G: ToCss, R: ToCss, U: ToCss
|
||||
{
|
||||
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,
|
||||
{
|
||||
match *self {
|
||||
Image::Url(ref url) => url.to_css(dest),
|
||||
Image::Gradient(ref gradient) => gradient.to_css(dest),
|
||||
|
@ -198,7 +207,10 @@ impl<G, R, U> ToCss for Image<G, R, U>
|
|||
impl<D, L, LoP, P, C, A> ToCss for Gradient<D, L, LoP, P, C, A>
|
||||
where D: LineDirection, L: ToCss, LoP: ToCss, P: ToCss, C: ToCss, A: ToCss
|
||||
{
|
||||
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,
|
||||
{
|
||||
match self.compat_mode {
|
||||
CompatMode::WebKit => dest.write_str("-webkit-")?,
|
||||
CompatMode::Moz => dest.write_str("-moz-")?,
|
||||
|
@ -272,17 +284,17 @@ pub trait LineDirection {
|
|||
fn points_downwards(&self, compat_mode: CompatMode) -> bool;
|
||||
|
||||
/// Serialises this direction according to the compatibility mode.
|
||||
fn to_css<W>(&self, dest: &mut W, compat_mode: CompatMode) -> fmt::Result
|
||||
where W: fmt::Write;
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>, compat_mode: CompatMode) -> fmt::Result
|
||||
where W: Write;
|
||||
}
|
||||
|
||||
impl<L> ToCss for Circle<L>
|
||||
where
|
||||
L: ToCss,
|
||||
{
|
||||
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,
|
||||
W: Write,
|
||||
{
|
||||
match *self {
|
||||
Circle::Extent(ShapeExtent::FarthestCorner) |
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
use counter_style::{Symbols, parse_counter_style_name};
|
||||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::fmt;
|
||||
use style_traits::{Comma, OneOrMoreSeparated, ParseError, StyleParseErrorKind, ToCss};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{Comma, CssWriter, OneOrMoreSeparated, ParseError};
|
||||
use style_traits::{StyleParseErrorKind, ToCss};
|
||||
use super::CustomIdent;
|
||||
|
||||
pub mod background;
|
||||
|
@ -144,7 +145,10 @@ impl<T> OneOrMoreSeparated for FontSettingTag<T> {
|
|||
}
|
||||
|
||||
impl<T: ToCss> ToCss for FontSettingTag<T> {
|
||||
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,
|
||||
{
|
||||
use byteorder::{BigEndian, ByteOrder};
|
||||
use std::str;
|
||||
|
||||
|
@ -231,7 +235,10 @@ pub struct FontSettingTagInt(pub u32);
|
|||
pub struct FontSettingTagFloat(pub f32);
|
||||
|
||||
impl ToCss for FontSettingTagInt {
|
||||
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,
|
||||
{
|
||||
match self.0 {
|
||||
1 => Ok(()),
|
||||
0 => dest.write_str(" off"),
|
||||
|
@ -273,7 +280,10 @@ impl Parse for FontSettingTagFloat {
|
|||
}
|
||||
|
||||
impl ToCss for FontSettingTagFloat {
|
||||
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(" ")?;
|
||||
self.0.to_css(dest)
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::fmt;
|
||||
use style_traits::{ToCss, ParseError};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
|
||||
/// A CSS value made of four components, where its `ToCss` impl will try to
|
||||
/// serialize as few components as possible, like for example in `border-width`.
|
||||
|
@ -68,8 +68,9 @@ impl<T> Parse for Rect<T>
|
|||
impl<T> ToCss for Rect<T>
|
||||
where T: PartialEq + ToCss
|
||||
{
|
||||
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,
|
||||
{
|
||||
self.0.to_css(dest)?;
|
||||
let same_vertical = self.0 == self.2;
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
use cssparser::Parser;
|
||||
use euclid::Size2D;
|
||||
use parser::ParserContext;
|
||||
use std::fmt;
|
||||
use style_traits::{ToCss, ParseError};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
use values::animated::ToAnimatedValue;
|
||||
|
||||
/// A generic size, for `border-*-radius` longhand properties, or
|
||||
|
@ -56,9 +56,9 @@ impl<L> ToCss for Size<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,
|
||||
{
|
||||
self.0.width.to_css(dest)?;
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::fmt;
|
||||
use style_traits::{ParseError, StyleParseErrorKind, ToCss};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use values::{Either, None_};
|
||||
use values::computed::NumberOrPercentage;
|
||||
use values::computed::length::LengthOrPercentage;
|
||||
|
@ -209,7 +209,10 @@ pub enum SVGStrokeDashArray<LengthType> {
|
|||
}
|
||||
|
||||
impl<LengthType> ToCss for SVGStrokeDashArray<LengthType> where LengthType: ToCss {
|
||||
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,
|
||||
{
|
||||
match self {
|
||||
&SVGStrokeDashArray::Values(ref values) => {
|
||||
let mut iter = values.iter();
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
use app_units::Au;
|
||||
use euclid::{self, Rect, Transform3D};
|
||||
use num_traits::Zero;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::{computed, CSSFloat};
|
||||
use values::computed::length::Length as ComputedLength;
|
||||
use values::computed::length::LengthOrPercentage as ComputedLengthOrPercentage;
|
||||
|
@ -136,9 +136,9 @@ where
|
|||
Integer: ToCss,
|
||||
Number: ToCss,
|
||||
{
|
||||
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,
|
||||
W: Write,
|
||||
{
|
||||
match *self {
|
||||
TimingFunction::Keyword(keyword) => keyword.to_css(dest),
|
||||
|
@ -546,7 +546,10 @@ impl<Angle: ToCss + Copy, Number: ToCss + Copy, Length: ToCss,
|
|||
Integer: ToCss + Copy, LengthOrNumber: ToCss, LengthOrPercentage: ToCss, LoPoNumber: ToCss>
|
||||
ToCss for
|
||||
TransformOperation<Angle, Number, Length, Integer, LengthOrNumber, LengthOrPercentage, LoPoNumber> {
|
||||
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,
|
||||
{
|
||||
match *self {
|
||||
TransformOperation::Matrix(ref m) => m.to_css(dest),
|
||||
TransformOperation::PrefixedMatrix(ref m) => m.to_css(dest),
|
||||
|
@ -653,9 +656,9 @@ impl<Angle: ToCss + Copy, Number: ToCss + Copy, Length: ToCss,
|
|||
}
|
||||
|
||||
impl<T: ToCss> ToCss for Transform<T> {
|
||||
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,
|
||||
W: Write,
|
||||
{
|
||||
if self.0.is_empty() {
|
||||
return dest.write_str("none");
|
||||
|
|
|
@ -13,9 +13,9 @@ pub use cssparser::{RGBA, Token, Parser, serialize_identifier, CowRcStr, SourceL
|
|||
use parser::{Parse, ParserContext};
|
||||
use selectors::parser::SelectorParseErrorKind;
|
||||
#[allow(unused_imports)] use std::ascii::AsciiExt;
|
||||
use std::fmt::{self, Debug};
|
||||
use std::fmt::{self, Debug, Write};
|
||||
use std::hash;
|
||||
use style_traits::{ToCss, ParseError, StyleParseErrorKind};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
|
||||
pub mod animated;
|
||||
pub mod computed;
|
||||
|
@ -34,8 +34,9 @@ define_keyword_type!(Auto, "auto");
|
|||
define_keyword_type!(Normal, "normal");
|
||||
|
||||
/// Serialize a normalized value into percentage.
|
||||
pub fn serialize_percentage<W>(value: CSSFloat, dest: &mut W)
|
||||
-> fmt::Result where W: fmt::Write
|
||||
pub fn serialize_percentage<W>(value: CSSFloat, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
(value * 100.).to_css(dest)?;
|
||||
dest.write_str("%")
|
||||
|
@ -109,7 +110,10 @@ impl CustomIdent {
|
|||
}
|
||||
|
||||
impl ToCss for CustomIdent {
|
||||
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,
|
||||
{
|
||||
serialize_identifier(&self.0.to_string(), dest)
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +184,10 @@ impl Parse for KeyframesName {
|
|||
}
|
||||
|
||||
impl ToCss for KeyframesName {
|
||||
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,
|
||||
{
|
||||
match *self {
|
||||
KeyframesName::Ident(ref ident) => ident.to_css(dest),
|
||||
KeyframesName::QuotedString(ref atom) => atom.to_string().to_css(dest),
|
||||
|
|
|
@ -11,8 +11,8 @@ use gecko_bindings::structs;
|
|||
use parser::{Parse, ParserContext};
|
||||
use selectors::parser::SelectorParseErrorKind;
|
||||
#[allow(unused_imports)] use std::ascii::AsciiExt;
|
||||
use std::fmt;
|
||||
use style_traits::{ToCss, ParseError, StyleParseErrorKind};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
|
||||
bitflags! {
|
||||
/// Constants shared by multiple CSS Box Alignment properties
|
||||
|
@ -71,7 +71,10 @@ bitflags! {
|
|||
}
|
||||
|
||||
impl ToCss for AlignFlags {
|
||||
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,
|
||||
{
|
||||
let s = match *self & !AlignFlags::FLAG_BITS {
|
||||
AlignFlags::AUTO => "auto",
|
||||
AlignFlags::NORMAL => "normal",
|
||||
|
@ -209,7 +212,10 @@ impl AlignJustifyContent {
|
|||
}
|
||||
|
||||
impl ToCss for AlignJustifyContent {
|
||||
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,
|
||||
{
|
||||
self.primary().to_css(dest)?;
|
||||
match self.fallback() {
|
||||
AlignFlags::AUTO => {}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
use cssparser::{Parser, Token};
|
||||
use parser::{ParserContext, Parse};
|
||||
#[allow(unused_imports)] use std::ascii::AsciiExt;
|
||||
use std::fmt;
|
||||
use style_traits::{ToCss, ParseError};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
use values::CSSFloat;
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
use values::computed::angle::Angle as ComputedAngle;
|
||||
|
@ -27,7 +27,10 @@ pub struct Angle {
|
|||
}
|
||||
|
||||
impl ToCss for Angle {
|
||||
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,
|
||||
{
|
||||
if self.was_calc {
|
||||
dest.write_str("calc(")?;
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::borrow::Cow;
|
||||
use std::fmt;
|
||||
use style_traits::{ToCss, ParseError, StyleParseErrorKind};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use values::computed::Percentage;
|
||||
use values::generics::basic_shape::{Circle as GenericCircle};
|
||||
use values::generics::basic_shape::{ClippingShape as GenericClippingShape, Ellipse as GenericEllipse};
|
||||
|
@ -171,7 +171,10 @@ impl Circle {
|
|||
}
|
||||
|
||||
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(")?;
|
||||
if GenericShapeRadius::ClosestSide != self.radius {
|
||||
self.radius.to_css(dest)?;
|
||||
|
@ -213,7 +216,10 @@ impl Ellipse {
|
|||
}
|
||||
|
||||
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 != ShapeRadius::default() || self.semiaxis_y != ShapeRadius::default() {
|
||||
self.semiaxis_x.to_css(dest)?;
|
||||
|
@ -248,8 +254,12 @@ impl Parse for ShapeRadius {
|
|||
/// are converted to percentages where possible. Only the two or four
|
||||
/// value forms are used. In case of two keyword-percentage pairs,
|
||||
/// the keywords are folded into the percentages
|
||||
fn serialize_basicshape_position<W>(position: &Position, dest: &mut W) -> fmt::Result
|
||||
where W: fmt::Write
|
||||
fn serialize_basicshape_position<W>(
|
||||
position: &Position,
|
||||
dest: &mut CssWriter<W>,
|
||||
) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
fn to_keyword_and_lop<S>(component: &PositionComponent<S>) -> (S, Cow<LengthOrPercentage>)
|
||||
where S: Copy + Side
|
||||
|
@ -289,8 +299,11 @@ fn serialize_basicshape_position<W>(position: &Position, dest: &mut W) -> fmt::R
|
|||
}
|
||||
}
|
||||
|
||||
fn write_pair<A, B, W>(a: &A, b: &B, dest: &mut W) -> fmt::Result
|
||||
where A: ToCss, B: ToCss, W: fmt::Write
|
||||
fn write_pair<A, B, W>(a: &A, b: &B, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
A: ToCss,
|
||||
B: ToCss,
|
||||
W: Write,
|
||||
{
|
||||
a.to_css(dest)?;
|
||||
dest.write_str(" ")?;
|
||||
|
|
|
@ -8,8 +8,8 @@ use Atom;
|
|||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use selectors::parser::SelectorParseErrorKind;
|
||||
use std::fmt;
|
||||
use style_traits::{ParseError, ToCss, StyleParseErrorKind};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use values::CustomIdent;
|
||||
use values::KeyframesName;
|
||||
use values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount;
|
||||
|
@ -289,9 +289,9 @@ impl AnimationName {
|
|||
}
|
||||
|
||||
impl ToCss for AnimationName {
|
||||
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,
|
||||
W: Write,
|
||||
{
|
||||
match self.0 {
|
||||
Some(ref name) => name.to_css(dest),
|
||||
|
@ -407,7 +407,10 @@ impl TouchAction {
|
|||
}
|
||||
|
||||
impl ToCss for TouchAction {
|
||||
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,
|
||||
{
|
||||
match *self {
|
||||
TouchAction::TOUCH_ACTION_NONE => dest.write_str("none"),
|
||||
TouchAction::TOUCH_ACTION_AUTO => dest.write_str("auto"),
|
||||
|
@ -497,7 +500,10 @@ bitflags! {
|
|||
}
|
||||
|
||||
impl ToCss for Contain {
|
||||
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,
|
||||
{
|
||||
if self.is_empty() {
|
||||
return dest.write_str("none")
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
use cssparser::{Parser, Token, NumberOrPercentage, AngleOrNumber};
|
||||
use parser::ParserContext;
|
||||
#[allow(unused_imports)] use std::ascii::AsciiExt;
|
||||
use std::fmt;
|
||||
use style_traits::{ToCss, ParseError, StyleParseErrorKind};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use style_traits::values::specified::AllowedNumericType;
|
||||
use values::{CSSInteger, CSSFloat};
|
||||
use values::computed;
|
||||
|
@ -89,7 +89,10 @@ impl ToCss for CalcLengthOrPercentage {
|
|||
///
|
||||
/// FIXME(emilio): Should this simplify away zeros?
|
||||
#[allow(unused_assignments)]
|
||||
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,
|
||||
{
|
||||
use num_traits::Zero;
|
||||
|
||||
let mut first_value = true;
|
||||
|
|
|
@ -12,9 +12,9 @@ use itoa;
|
|||
use parser::{ParserContext, Parse};
|
||||
#[cfg(feature = "gecko")]
|
||||
use properties::longhands::system_colors::SystemColor;
|
||||
use std::fmt;
|
||||
use std::io::Write;
|
||||
use style_traits::{ToCss, ParseError, StyleParseErrorKind, ValueParseErrorKind};
|
||||
use std::fmt::{self, Write};
|
||||
use std::io::Write as IoWrite;
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss, ValueParseErrorKind};
|
||||
use super::AllowQuirks;
|
||||
use values::computed::{Color as ComputedColor, Context, ToComputedValue};
|
||||
use values::specified::calc::CalcNode;
|
||||
|
@ -187,7 +187,10 @@ impl Parse for Color {
|
|||
}
|
||||
|
||||
impl ToCss for Color {
|
||||
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,
|
||||
{
|
||||
match *self {
|
||||
Color::CurrentColor => CSSParserColor::CurrentColor.to_css(dest),
|
||||
Color::Numeric { authored: Some(ref authored), .. } => dest.write_str(authored),
|
||||
|
|
|
@ -16,8 +16,8 @@ use parser::{Parse, ParserContext};
|
|||
use properties::longhands::system_font::SystemFont;
|
||||
#[allow(unused_imports)]
|
||||
use std::ascii::AsciiExt;
|
||||
use std::fmt;
|
||||
use style_traits::{ToCss, StyleParseErrorKind, ParseError};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use values::CustomIdent;
|
||||
use values::computed::{font as computed, Context, Length, NonNegativeLength, ToComputedValue};
|
||||
use values::computed::font::{SingleFontFamily, FontFamilyList, FamilyName};
|
||||
|
@ -144,7 +144,10 @@ pub enum FontSize {
|
|||
}
|
||||
|
||||
impl ToCss for FontSize {
|
||||
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,
|
||||
{
|
||||
match *self {
|
||||
FontSize::Length(ref lop) => lop.to_css(dest),
|
||||
FontSize::Keyword(info) => info.kw.to_css(dest),
|
||||
|
@ -243,7 +246,10 @@ impl MallocSizeOf for FontFamily {
|
|||
}
|
||||
|
||||
impl ToCss for FontFamily {
|
||||
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,
|
||||
{
|
||||
match *self {
|
||||
FontFamily::Values(ref v) => {
|
||||
let mut iter = v.iter();
|
||||
|
@ -408,7 +414,10 @@ impl Default for KeywordSize {
|
|||
}
|
||||
|
||||
impl ToCss for KeywordSize {
|
||||
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(match *self {
|
||||
KeywordSize::XXSmall => "xx-small",
|
||||
KeywordSize::XSmall => "x-small",
|
||||
|
@ -824,7 +833,10 @@ impl VariantAlternatesList {
|
|||
}
|
||||
|
||||
impl ToCss for VariantAlternatesList {
|
||||
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,
|
||||
{
|
||||
if self.0.is_empty() {
|
||||
return dest.write_str("normal");
|
||||
}
|
||||
|
@ -1031,7 +1043,10 @@ impl VariantEastAsian {
|
|||
}
|
||||
|
||||
impl ToCss for VariantEastAsian {
|
||||
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,
|
||||
{
|
||||
if self.is_empty() {
|
||||
return dest.write_str("normal")
|
||||
}
|
||||
|
@ -1265,7 +1280,10 @@ impl VariantLigatures {
|
|||
}
|
||||
|
||||
impl ToCss for VariantLigatures {
|
||||
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,
|
||||
{
|
||||
if self.is_empty() {
|
||||
return dest.write_str("normal")
|
||||
}
|
||||
|
@ -1506,7 +1524,10 @@ impl VariantNumeric {
|
|||
}
|
||||
|
||||
impl ToCss for VariantNumeric {
|
||||
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,
|
||||
{
|
||||
if self.is_empty() {
|
||||
return dest.write_str("normal")
|
||||
}
|
||||
|
@ -1801,7 +1822,10 @@ impl Parse for FontSynthesis {
|
|||
}
|
||||
|
||||
impl ToCss for FontSynthesis {
|
||||
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,
|
||||
{
|
||||
if self.weight && self.style {
|
||||
dest.write_str("weight style")
|
||||
} else if self.style {
|
||||
|
@ -1953,7 +1977,10 @@ impl Parse for XTextZoom {
|
|||
}
|
||||
|
||||
impl ToCss for XTextZoom {
|
||||
fn to_css<W>(&self, _: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
fn to_css<W>(&self, _: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -1981,7 +2008,10 @@ impl Parse for XLang {
|
|||
}
|
||||
|
||||
impl ToCss for XLang {
|
||||
fn to_css<W>(&self, _: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
fn to_css<W>(&self, _: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ use selectors::parser::SelectorParseErrorKind;
|
|||
use servo_url::ServoUrl;
|
||||
use std::cmp::Ordering;
|
||||
use std::f32::consts::PI;
|
||||
use std::fmt;
|
||||
use style_traits::{ToCss, ParseError, StyleParseErrorKind};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use values::{Either, None_};
|
||||
#[cfg(feature = "gecko")]
|
||||
use values::computed::{Context, Position as ComputedPosition, ToComputedValue};
|
||||
|
@ -659,8 +659,13 @@ impl GenericsLineDirection for LineDirection {
|
|||
}
|
||||
}
|
||||
|
||||
fn to_css<W>(&self, dest: &mut W, compat_mode: CompatMode) -> fmt::Result
|
||||
where W: fmt::Write
|
||||
fn to_css<W>(
|
||||
&self,
|
||||
dest: &mut CssWriter<W>,
|
||||
compat_mode: CompatMode,
|
||||
) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
match *self {
|
||||
LineDirection::Angle(angle) => {
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::f64::consts::PI;
|
||||
use std::fmt;
|
||||
use style_traits::{ParseError, StyleParseErrorKind, ToCss};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use values::computed;
|
||||
use values::computed::{Context, Orientation, ToComputedValue};
|
||||
use values::specified::Angle;
|
||||
|
@ -25,7 +25,10 @@ pub struct ImageOrientation {
|
|||
}
|
||||
|
||||
impl ToCss for ImageOrientation {
|
||||
fn to_css<W: fmt::Write>(&self, dest: &mut W) -> fmt::Result {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
if let Some(angle) = self.angle {
|
||||
angle.to_css(dest)?;
|
||||
if self.flipped {
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
use cssparser::{Parser, Token};
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::fmt;
|
||||
use style_traits::{ParseError, StyleParseErrorKind, ToCss};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use values::{Either, None_};
|
||||
#[cfg(feature = "gecko")]
|
||||
use values::CustomIdent;
|
||||
|
@ -114,7 +114,10 @@ impl Parse for ListStyleImage {
|
|||
pub struct Quotes(pub Box<[(Box<str>, Box<str>)]>);
|
||||
|
||||
impl ToCss for Quotes {
|
||||
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,
|
||||
{
|
||||
let mut iter = self.0.iter();
|
||||
|
||||
match iter.next() {
|
||||
|
|
|
@ -13,8 +13,8 @@ use parser::{ParserContext, Parse};
|
|||
use self::url::SpecifiedUrl;
|
||||
#[allow(unused_imports)] use std::ascii::AsciiExt;
|
||||
use std::f32;
|
||||
use std::fmt;
|
||||
use style_traits::{ToCss, ParseError, StyleParseErrorKind};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use style_traits::values::specified::AllowedNumericType;
|
||||
use super::{Auto, CSSFloat, CSSInteger, Either, None_};
|
||||
use super::computed::{Context, ToComputedValue};
|
||||
|
@ -250,8 +250,9 @@ impl ToComputedValue for Number {
|
|||
}
|
||||
|
||||
impl ToCss for Number {
|
||||
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,
|
||||
{
|
||||
if self.calc_clamping_mode.is_some() {
|
||||
dest.write_str("calc(")?;
|
||||
|
@ -476,8 +477,9 @@ impl ToComputedValue for Integer {
|
|||
}
|
||||
|
||||
impl ToCss for Integer {
|
||||
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,
|
||||
{
|
||||
if self.was_calc {
|
||||
dest.write_str("calc(")?;
|
||||
|
@ -560,7 +562,10 @@ pub struct ClipRect {
|
|||
|
||||
|
||||
impl ToCss for ClipRect {
|
||||
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("rect(")?;
|
||||
|
||||
if let Some(ref top) = self.top {
|
||||
|
@ -805,7 +810,10 @@ impl Attr {
|
|||
}
|
||||
|
||||
impl ToCss for Attr {
|
||||
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("attr(")?;
|
||||
if let Some(ref ns) = self.namespace {
|
||||
serialize_identifier(&ns.0.to_string(), dest)?;
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
use cssparser::{Parser, Token};
|
||||
use parser::{Parse, ParserContext};
|
||||
#[allow(unused_imports)] use std::ascii::AsciiExt;
|
||||
use std::fmt;
|
||||
use style_traits::{ParseError, ToCss};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
use style_traits::values::specified::AllowedNumericType;
|
||||
use values::{CSSFloat, serialize_percentage};
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
|
@ -29,8 +29,9 @@ pub struct Percentage {
|
|||
|
||||
|
||||
impl ToCss for Percentage {
|
||||
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,
|
||||
{
|
||||
if self.calc_clamping_mode.is_some() {
|
||||
dest.write_str("calc(")?;
|
||||
|
|
|
@ -11,10 +11,10 @@ use cssparser::Parser;
|
|||
use hash::FnvHashMap;
|
||||
use parser::{Parse, ParserContext};
|
||||
use selectors::parser::SelectorParseErrorKind;
|
||||
use std::fmt;
|
||||
use std::fmt::{self, Write};
|
||||
use std::ops::Range;
|
||||
use str::HTML_SPACE_CHARACTERS;
|
||||
use style_traits::{ToCss, StyleParseErrorKind, ParseError};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use values::{Either, None_};
|
||||
use values::computed::{CalcLengthOrPercentage, LengthOrPercentage as ComputedLengthOrPercentage};
|
||||
use values::computed::{Context, Percentage, ToComputedValue};
|
||||
|
@ -142,7 +142,10 @@ impl Position {
|
|||
}
|
||||
|
||||
impl ToCss for Position {
|
||||
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,
|
||||
{
|
||||
match (&self.horizontal, &self.vertical) {
|
||||
(x_pos @ &PositionComponent::Side(_, Some(_)), &PositionComponent::Length(ref y_lop)) => {
|
||||
x_pos.to_css(dest)?;
|
||||
|
@ -369,7 +372,10 @@ impl LegacyPosition {
|
|||
}
|
||||
|
||||
impl ToCss for LegacyPosition {
|
||||
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,
|
||||
{
|
||||
self.horizontal.to_css(dest)?;
|
||||
dest.write_str(" ")?;
|
||||
self.vertical.to_css(dest)
|
||||
|
@ -409,7 +415,10 @@ impl GridAutoFlow {
|
|||
}
|
||||
|
||||
impl ToCss for GridAutoFlow {
|
||||
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,
|
||||
{
|
||||
self.autoflow.to_css(dest)?;
|
||||
|
||||
if self.dense { dest.write_str(" dense")?; }
|
||||
|
@ -584,7 +593,10 @@ impl TemplateAreas {
|
|||
}
|
||||
|
||||
impl ToCss for TemplateAreas {
|
||||
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,
|
||||
{
|
||||
for (i, string) in self.strings.iter().enumerate() {
|
||||
if i != 0 {
|
||||
dest.write_str(" ")?;
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
|
||||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::fmt;
|
||||
use style_traits::{CommaWithSpace, ParseError, Separator, StyleParseErrorKind, ToCss};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CommaWithSpace, CssWriter, ParseError, Separator};
|
||||
use style_traits::{StyleParseErrorKind, ToCss};
|
||||
use values::CustomIdent;
|
||||
use values::generics::svg as generic;
|
||||
use values::specified::{LengthOrPercentage, NonNegativeLengthOrPercentage, NonNegativeNumber};
|
||||
|
@ -237,7 +238,10 @@ impl Parse for SVGPaintOrder {
|
|||
}
|
||||
|
||||
impl ToCss for SVGPaintOrder {
|
||||
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,
|
||||
{
|
||||
if self.0 == 0 {
|
||||
return dest.write_str("normal")
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::fmt;
|
||||
use style_traits::{ToCss, StyleParseErrorKind, ParseError};
|
||||
use style_traits::{CssWriter, ToCss, StyleParseErrorKind, ParseError};
|
||||
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
|
||||
/// span. for `<col span>` pres attr
|
||||
|
@ -21,7 +21,7 @@ impl Parse for XSpan {
|
|||
}
|
||||
|
||||
impl ToCss for XSpan {
|
||||
fn to_css<W>(&self, _: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
fn to_css<W>(&self, _: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ use cssparser::{Parser, Token};
|
|||
use parser::{Parse, ParserContext};
|
||||
use selectors::parser::SelectorParseErrorKind;
|
||||
#[allow(unused_imports)] use std::ascii::AsciiExt;
|
||||
use std::fmt;
|
||||
use style_traits::{ParseError, StyleParseErrorKind, ToCss};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
use values::computed::text::LineHeight as ComputedLineHeight;
|
||||
use values::computed::text::TextOverflow as ComputedTextOverflow;
|
||||
|
@ -440,7 +440,10 @@ impl Parse for TextAlign {
|
|||
}
|
||||
|
||||
impl ToCss for TextAlign {
|
||||
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,
|
||||
{
|
||||
match *self {
|
||||
TextAlign::Keyword(key) => key.to_css(dest),
|
||||
#[cfg(feature = "gecko")]
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
use cssparser::{Parser, Token};
|
||||
use parser::{ParserContext, Parse};
|
||||
#[allow(unused_imports)] use std::ascii::AsciiExt;
|
||||
use std::fmt;
|
||||
use style_traits::{ToCss, ParseError, StyleParseErrorKind};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use style_traits::values::specified::AllowedNumericType;
|
||||
use values::CSSFloat;
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
|
@ -133,9 +133,9 @@ impl Parse for Time {
|
|||
}
|
||||
|
||||
impl ToCss for Time {
|
||||
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,
|
||||
W: Write,
|
||||
{
|
||||
if self.was_calc {
|
||||
dest.write_str("calc(")?;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::fmt;
|
||||
use style_traits::{ParseError, StyleParseErrorKind, ToCss};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
|
||||
/// Specified value of `-moz-force-broken-image-icon`
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
|
||||
|
@ -36,7 +36,10 @@ impl Parse for MozForceBrokenImageIcon {
|
|||
}
|
||||
|
||||
impl ToCss for MozForceBrokenImageIcon {
|
||||
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(if self.0 { "1" } else { "0" })
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue