зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #14089 - Make use of Servo-specific ToCss everywhere! (from Wafflespeanut:tocss); r=SimonSapin
<!-- Please describe your changes on the following line: --> This will allow types to be generic over our local `ToCss` --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors <!-- Either: --> - [x] These changes do not require tests because it's a refactor <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: f48b3fe2197a59b29bc711fb1b5496cbb97bd330
This commit is contained in:
Родитель
2636ac4d46
Коммит
fec4250721
|
@ -34,7 +34,7 @@ use style::properties::longhands::{display, position};
|
|||
use style::properties::style_structs;
|
||||
use style::selector_impl::PseudoElement;
|
||||
use style::selector_matching::Stylist;
|
||||
use style::values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use style_traits::cursor::Cursor;
|
||||
use wrapper::{LayoutNodeHelpers, LayoutNodeLayoutData};
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use cssparser::ToCss;
|
||||
use dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::{self, CSSStyleDeclarationMethods};
|
||||
use dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||
use dom::bindings::inheritance::Castable;
|
||||
|
@ -20,6 +19,7 @@ use style::parser::ParserContextExtraData;
|
|||
use style::properties::{Shorthand, Importance, PropertyDeclarationBlock};
|
||||
use style::properties::{is_supported_property, parse_one_declaration, parse_style_attribute};
|
||||
use style::selector_impl::PseudoElement;
|
||||
use style_traits::ToCss;
|
||||
|
||||
// http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface
|
||||
#[dom_struct]
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use cssparser::ToCss;
|
||||
use dom::bindings::cell::DOMRefCell;
|
||||
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
|
||||
use dom::bindings::codegen::Bindings::EventListenerBinding::EventListener;
|
||||
|
@ -22,7 +21,7 @@ use std::cell::Cell;
|
|||
use std::rc::Rc;
|
||||
use style;
|
||||
use style::media_queries::{Device, MediaType};
|
||||
use style_traits::{PagePx, ViewportPx};
|
||||
use style_traits::{PagePx, ToCss, ViewportPx};
|
||||
|
||||
pub enum MediaQueryListMatchState {
|
||||
Same(bool),
|
||||
|
|
|
@ -2429,6 +2429,7 @@ dependencies = [
|
|||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -7,13 +7,14 @@
|
|||
//! [custom]: https://drafts.csswg.org/css-variables/
|
||||
|
||||
use Atom;
|
||||
use cssparser::{Delimiter, Parser, SourcePosition, ToCss, Token, TokenSerializationType};
|
||||
use cssparser::{Delimiter, Parser, SourcePosition, Token, TokenSerializationType};
|
||||
use properties::DeclaredValue;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
use style_traits::ToCss;
|
||||
|
||||
// Does not include the `--` prefix
|
||||
pub type Name = Atom;
|
||||
|
|
|
@ -132,9 +132,9 @@ pub mod values;
|
|||
pub mod viewport;
|
||||
pub mod workqueue;
|
||||
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
use style_traits::ToCss;
|
||||
|
||||
#[cfg(feature = "gecko")] pub use gecko_string_cache as string_cache;
|
||||
#[cfg(feature = "gecko")] pub use gecko_string_cache::Atom;
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
|
||||
use Atom;
|
||||
use app_units::Au;
|
||||
use cssparser::{Delimiter, Parser, ToCss, Token};
|
||||
use cssparser::{Delimiter, Parser, Token};
|
||||
use euclid::size::{Size2D, TypedSize2D};
|
||||
use properties::longhands;
|
||||
use serialize_comma_separated_list;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::ViewportPx;
|
||||
use style_traits::{ToCss, ViewportPx};
|
||||
use values::specified;
|
||||
|
||||
|
||||
|
|
|
@ -2,13 +2,14 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use cssparser::{DeclarationListParser, parse_important, ToCss};
|
||||
use cssparser::{DeclarationListParser, parse_important};
|
||||
use cssparser::{Parser, AtRuleParser, DeclarationParser, Delimiter};
|
||||
use error_reporting::ParseErrorReporter;
|
||||
use parser::{ParserContext, ParserContextExtraData, log_css_error};
|
||||
use std::ascii::AsciiExt;
|
||||
use std::boxed::Box as StdBox;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use stylesheets::Origin;
|
||||
use super::*;
|
||||
use url::Url;
|
||||
|
|
|
@ -54,9 +54,9 @@
|
|||
<%def name="vector_longhand(name, gecko_only=False, allow_empty=False, **kwargs)">
|
||||
<%call expr="longhand(name, **kwargs)">
|
||||
% if product == "gecko" or not gecko_only:
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::HasViewportPercentage;
|
||||
use style_traits::ToCss;
|
||||
|
||||
impl HasViewportPercentage for SpecifiedValue {
|
||||
fn has_viewport_percentage(&self) -> bool {
|
||||
|
@ -324,6 +324,7 @@
|
|||
<%def name="inner_body()">
|
||||
pub use self::computed_value::T as SpecifiedValue;
|
||||
pub mod computed_value {
|
||||
use style_traits::ToCss;
|
||||
define_css_keyword_enum! { T:
|
||||
% for value in data.longhands_by_name[name].keyword.values_for(product):
|
||||
"${value}" => ${to_rust_ident(value)},
|
||||
|
@ -370,8 +371,8 @@
|
|||
use values::NoViewportPercentage;
|
||||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
pub mod computed_value {
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
@ -438,10 +439,11 @@
|
|||
% if shorthand:
|
||||
pub mod ${shorthand.ident} {
|
||||
#[allow(unused_imports)]
|
||||
use cssparser::{Parser, ToCss};
|
||||
use cssparser::Parser;
|
||||
use parser::ParserContext;
|
||||
use properties::{longhands, PropertyDeclaration, DeclaredValue, Shorthand};
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
||||
pub struct Longhands {
|
||||
% for sub_property in shorthand.sub_properties:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use app_units::Au;
|
||||
use cssparser::{Color as CSSParserColor, Parser, RGBA, ToCss};
|
||||
use cssparser::{Color as CSSParserColor, Parser, RGBA};
|
||||
use euclid::{Point2D, Size2D};
|
||||
use properties::PropertyDeclaration;
|
||||
use properties::longhands;
|
||||
|
@ -20,6 +20,7 @@ use properties::longhands::visibility::computed_value::T as Visibility;
|
|||
use properties::longhands::z_index::computed_value::T as ZIndex;
|
||||
use std::cmp;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use super::ComputedValues;
|
||||
use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
||||
use values::computed::{BorderRadiusSize, LengthOrNone};
|
||||
|
|
|
@ -12,10 +12,9 @@ ${helpers.predefined_type("background-color", "CSSColor",
|
|||
|
||||
<%helpers:vector_longhand name="background-image" animatable="False"
|
||||
has_uncacheable_values="${product == 'gecko'}">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::specified::Image;
|
||||
use values::LocalToCss;
|
||||
use values::NoViewportPercentage;
|
||||
|
||||
pub mod computed_value {
|
||||
|
@ -88,9 +87,8 @@ ${helpers.predefined_type("background-color", "CSSColor",
|
|||
</%helpers:vector_longhand>
|
||||
|
||||
<%helpers:vector_longhand name="background-position" animatable="True">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
use values::specified::position::Position;
|
||||
|
||||
|
@ -149,9 +147,10 @@ ${helpers.single_keyword("background-origin",
|
|||
animatable=False)}
|
||||
|
||||
<%helpers:vector_longhand name="background-size" animatable="True">
|
||||
use cssparser::{ToCss, Token};
|
||||
use cssparser::Token;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
|
||||
pub mod computed_value {
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
% for side in ["top", "right", "bottom", "left"]:
|
||||
<%helpers:longhand name="border-${side}-width" animatable="True">
|
||||
use app_units::Au;
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
use values::specified::BorderWidth;
|
||||
|
||||
|
@ -67,9 +67,8 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
|
|||
|
||||
// https://drafts.csswg.org/css-backgrounds-3/#border-image-source
|
||||
<%helpers:longhand name="border-image-source" products="gecko" animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use values::NoViewportPercentage;
|
||||
use values::specified::Image;
|
||||
|
||||
|
@ -139,10 +138,9 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
|
|||
|
||||
// https://drafts.csswg.org/css-backgrounds-3/#border-image-outset
|
||||
<%helpers:longhand name="border-image-outset" products="gecko" animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
use values::LocalToCss;
|
||||
use values::specified::LengthOrNumber;
|
||||
|
||||
impl HasViewportPercentage for SpecifiedValue {
|
||||
|
@ -253,9 +251,8 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
|
|||
|
||||
// https://drafts.csswg.org/css-backgrounds-3/#border-image-repeat
|
||||
<%helpers:longhand name="border-image-repeat" products="gecko" animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use values::NoViewportPercentage;
|
||||
|
||||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
|
@ -327,9 +324,8 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
|
|||
|
||||
// https://drafts.csswg.org/css-backgrounds-3/#border-image-width
|
||||
<%helpers:longhand name="border-image-width" products="gecko" animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
use values::specified::{LengthOrPercentage, Number};
|
||||
|
||||
|
@ -523,9 +519,8 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
|
|||
|
||||
// https://drafts.csswg.org/css-backgrounds-3/#border-image-slice
|
||||
<%helpers:longhand name="border-image-slice" products="gecko" animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use values::NoViewportPercentage;
|
||||
use values::specified::{Number, Percentage};
|
||||
|
||||
|
|
|
@ -27,11 +27,12 @@
|
|||
%>
|
||||
pub use self::computed_value::T as SpecifiedValue;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
|
||||
use style_traits::ToCss;
|
||||
use values::NoViewportPercentage;
|
||||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
|
||||
pub mod computed_value {
|
||||
use style_traits::ToCss;
|
||||
#[allow(non_camel_case_types)]
|
||||
#[derive(Clone, Eq, PartialEq, Copy, Hash, RustcEncodable, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
|
||||
|
@ -41,7 +42,7 @@
|
|||
% endfor
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for T {
|
||||
impl ToCss for T {
|
||||
fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result
|
||||
where W: ::std::fmt::Write {
|
||||
match *self {
|
||||
|
@ -148,8 +149,9 @@ ${helpers.single_keyword("clear", "none left right both",
|
|||
|
||||
<%helpers:longhand name="vertical-align"
|
||||
animatable="True">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
|
||||
<% vertical_align = data.longhands_by_name["vertical-align"] %>
|
||||
<% vertical_align.keyword = Keyword("vertical-align",
|
||||
|
@ -157,7 +159,6 @@ ${helpers.single_keyword("clear", "none left right both",
|
|||
extra_gecko_values="middle-with-baseline") %>
|
||||
<% vertical_align_keywords = vertical_align.keyword.values_for(product) %>
|
||||
|
||||
use values::HasViewportPercentage;
|
||||
impl HasViewportPercentage for SpecifiedValue {
|
||||
fn has_viewport_percentage(&self) -> bool {
|
||||
match *self {
|
||||
|
@ -204,7 +205,7 @@ ${helpers.single_keyword("clear", "none left right both",
|
|||
pub mod computed_value {
|
||||
use app_units::Au;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use values::{CSSFloat, computed};
|
||||
#[allow(non_camel_case_types)]
|
||||
#[derive(PartialEq, Copy, Clone, Debug)]
|
||||
|
@ -215,7 +216,7 @@ ${helpers.single_keyword("clear", "none left right both",
|
|||
% endfor
|
||||
LengthOrPercentage(computed::LengthOrPercentage),
|
||||
}
|
||||
impl ::cssparser::ToCss for T {
|
||||
impl ToCss for T {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
% for keyword in vertical_align_keywords:
|
||||
|
@ -282,13 +283,13 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
|
|||
animatable="False">
|
||||
use super::overflow_x;
|
||||
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
use values::NoViewportPercentage;
|
||||
|
||||
pub use self::computed_value::T as SpecifiedValue;
|
||||
|
||||
use values::NoViewportPercentage;
|
||||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
|
||||
impl ToCss for SpecifiedValue {
|
||||
|
@ -327,8 +328,8 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
|
|||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
|
||||
pub mod computed_value {
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
|
||||
pub use values::computed::Time as SingleComputedValue;
|
||||
|
@ -426,9 +427,9 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
|
|||
TransitionTimingFunction::Steps(1, StartEnd::End);
|
||||
|
||||
pub mod computed_value {
|
||||
use cssparser::ToCss;
|
||||
use euclid::point::Point2D;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
|
||||
pub use self::TransitionTimingFunction as SingleComputedValue;
|
||||
|
@ -581,8 +582,8 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
|
|||
pub use self::computed_value::T as SpecifiedValue;
|
||||
|
||||
pub mod computed_value {
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
// NB: Can't generate the type here because it needs all the longhands
|
||||
// generated beforehand.
|
||||
pub use properties::animated_properties::TransitionProperty;
|
||||
|
@ -646,9 +647,9 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
|
|||
use values::NoViewportPercentage;
|
||||
|
||||
pub mod computed_value {
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use Atom;
|
||||
use style_traits::ToCss;
|
||||
|
||||
pub use Atom as SingleComputedValue;
|
||||
|
||||
|
@ -732,8 +733,8 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
|
|||
use values::NoViewportPercentage;
|
||||
|
||||
pub mod computed_value {
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
||||
pub use self::AnimationIterationCount as SingleComputedValue;
|
||||
|
||||
|
@ -842,9 +843,8 @@ ${helpers.keyword_list("animation-fill-mode",
|
|||
</%helpers:longhand>
|
||||
|
||||
<%helpers:longhand products="gecko" name="scroll-snap-points-y" animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
use values::specified::LengthOrPercentage;
|
||||
|
||||
|
|
|
@ -8,9 +8,8 @@
|
|||
|
||||
// FIXME: This prop should be animatable.
|
||||
<%helpers:longhand name="column-width" experimental="True" animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
|
||||
impl HasViewportPercentage for SpecifiedValue {
|
||||
|
@ -91,8 +90,8 @@
|
|||
|
||||
// FIXME: This prop should be animatable.
|
||||
<%helpers:longhand name="column-count" experimental="True" animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::NoViewportPercentage;
|
||||
|
||||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
|
@ -171,9 +170,8 @@
|
|||
|
||||
// FIXME: This prop should be animatable.
|
||||
<%helpers:longhand name="column-gap" experimental="True" products="servo" animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
|
||||
impl HasViewportPercentage for SpecifiedValue {
|
||||
|
|
|
@ -23,8 +23,9 @@
|
|||
pub mod computed_value {
|
||||
use super::super::list_style_type;
|
||||
|
||||
use cssparser::{self, ToCss};
|
||||
use cssparser;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
@ -175,11 +176,12 @@
|
|||
|
||||
<%helpers:longhand name="counter-increment" products="servo" animatable="False">
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use super::content;
|
||||
use values::NoViewportPercentage;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
|
||||
use cssparser::{ToCss, Token, serialize_identifier};
|
||||
use cssparser::{Token, serialize_identifier};
|
||||
use std::borrow::{Cow, ToOwned};
|
||||
|
||||
pub use self::computed_value::T as SpecifiedValue;
|
||||
|
|
|
@ -13,10 +13,10 @@ ${helpers.predefined_type("opacity",
|
|||
animatable=True)}
|
||||
|
||||
<%helpers:vector_longhand name="box-shadow" allow_empty="True" animatable="True">
|
||||
use cssparser::{self, ToCss};
|
||||
use cssparser;
|
||||
use std::fmt;
|
||||
use parser::Parse;
|
||||
use values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
|
@ -189,9 +189,8 @@ ${helpers.predefined_type("opacity",
|
|||
|
||||
// FIXME: This prop should be animatable
|
||||
<%helpers:longhand name="clip" products="servo" animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
|
||||
// NB: `top` and `left` are 0 if `auto` per CSS 2.1 11.1.2.
|
||||
|
@ -405,11 +404,9 @@ ${helpers.predefined_type("opacity",
|
|||
// FIXME: This prop should be animatable
|
||||
<%helpers:longhand name="filter" animatable="False">
|
||||
//pub use self::computed_value::T as SpecifiedValue;
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use values::CSSFloat;
|
||||
use values::HasViewportPercentage;
|
||||
use style_traits::ToCss;
|
||||
use values::{CSSFloat, HasViewportPercentage};
|
||||
use values::specified::{Angle, Length};
|
||||
|
||||
impl HasViewportPercentage for SpecifiedValue {
|
||||
|
@ -675,11 +672,9 @@ ${helpers.predefined_type("opacity",
|
|||
|
||||
<%helpers:longhand name="transform" products="servo" animatable="True">
|
||||
use app_units::Au;
|
||||
use values::CSSFloat;
|
||||
use values::HasViewportPercentage;
|
||||
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::{CSSFloat, HasViewportPercentage};
|
||||
|
||||
pub mod computed_value {
|
||||
use values::CSSFloat;
|
||||
|
@ -1293,13 +1288,11 @@ ${helpers.single_keyword("transform-style",
|
|||
|
||||
<%helpers:longhand name="transform-origin" products="servo" animatable="True">
|
||||
use app_units::Au;
|
||||
use values::LocalToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
use values::specified::{Length, LengthOrPercentage, Percentage};
|
||||
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
|
||||
pub mod computed_value {
|
||||
use properties::animated_properties::Interpolate;
|
||||
use values::computed::{Length, LengthOrPercentage};
|
||||
|
@ -1408,12 +1401,11 @@ ${helpers.predefined_type("perspective",
|
|||
|
||||
// FIXME: This prop should be animatable
|
||||
<%helpers:longhand name="perspective-origin" products="servo" animatable="False">
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
use values::specified::{LengthOrPercentage, Percentage};
|
||||
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
|
||||
pub mod computed_value {
|
||||
use values::computed::LengthOrPercentage;
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
|
||||
pub mod computed_value {
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use Atom;
|
||||
use style_traits::ToCss;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
|
||||
|
@ -137,8 +137,8 @@ ${helpers.single_keyword("font-variant",
|
|||
animatable=False)}
|
||||
|
||||
<%helpers:longhand name="font-weight" need_clone="True" animatable="True">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::NoViewportPercentage;
|
||||
|
||||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
|
@ -271,10 +271,9 @@ ${helpers.single_keyword("font-variant",
|
|||
|
||||
<%helpers:longhand name="font-size" need_clone="True" animatable="True">
|
||||
use app_units::Au;
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::FONT_MEDIUM_PX;
|
||||
use values::HasViewportPercentage;
|
||||
use style_traits::ToCss;
|
||||
use values::{FONT_MEDIUM_PX, HasViewportPercentage};
|
||||
use values::specified::{LengthOrPercentage, Length, Percentage};
|
||||
|
||||
impl ToCss for SpecifiedValue {
|
||||
|
@ -351,11 +350,10 @@ ${helpers.single_keyword("font-variant",
|
|||
</%helpers:longhand>
|
||||
|
||||
<%helpers:longhand products="gecko" name="font-synthesis" animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
use style_traits::ToCss;
|
||||
use values::NoViewportPercentage;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
|
||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
|
@ -438,8 +436,8 @@ ${helpers.single_keyword("font-variant-position",
|
|||
animatable=False)}
|
||||
|
||||
<%helpers:longhand name="font-feature-settings" products="none" animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::NoViewportPercentage;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
pub use self::computed_value::T as SpecifiedValue;
|
||||
|
@ -448,9 +446,9 @@ ${helpers.single_keyword("font-variant-position",
|
|||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
|
||||
pub mod computed_value {
|
||||
use cssparser::ToCss;
|
||||
use cssparser::Parser;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
@ -555,8 +553,8 @@ ${helpers.single_keyword("font-variant-position",
|
|||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
|
||||
pub mod computed_value {
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
||||
impl ToCss for T {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
|
|
|
@ -56,8 +56,8 @@ ${helpers.single_keyword("image-rendering",
|
|||
derived_from="display"
|
||||
products="servo"
|
||||
animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
use values::NoViewportPercentage;
|
||||
|
||||
|
|
|
@ -18,11 +18,9 @@ ${helpers.single_keyword("caption-side", "top bottom",
|
|||
|
||||
<%helpers:longhand name="border-spacing" animatable="False">
|
||||
use app_units::Au;
|
||||
use values::LocalToCss;
|
||||
use values::HasViewportPercentage;
|
||||
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
|
||||
pub mod computed_value {
|
||||
use app_units::Au;
|
||||
|
|
|
@ -7,11 +7,9 @@
|
|||
<% data.new_style_struct("InheritedText", inherited=True, gecko_name="Text") %>
|
||||
|
||||
<%helpers:longhand name="line-height" animatable="True">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use values::CSSFloat;
|
||||
use values::HasViewportPercentage;
|
||||
use style_traits::ToCss;
|
||||
use values::{CSSFloat, HasViewportPercentage};
|
||||
|
||||
impl HasViewportPercentage for SpecifiedValue {
|
||||
fn has_viewport_percentage(&self) -> bool {
|
||||
|
@ -153,6 +151,7 @@
|
|||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
pub mod computed_value {
|
||||
use style_traits::ToCss;
|
||||
macro_rules! define_text_align {
|
||||
( $( $name: ident ( $string: expr ) => $discriminant: expr, )+ ) => {
|
||||
define_css_keyword_enum! { T:
|
||||
|
@ -209,9 +208,8 @@
|
|||
|
||||
// FIXME: This prop should be animatable.
|
||||
<%helpers:longhand name="letter-spacing" animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
|
||||
impl HasViewportPercentage for SpecifiedValue {
|
||||
|
@ -290,9 +288,8 @@
|
|||
</%helpers:longhand>
|
||||
|
||||
<%helpers:longhand name="word-spacing" animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
|
||||
impl HasViewportPercentage for SpecifiedValue {
|
||||
|
@ -405,10 +402,10 @@ ${helpers.single_keyword("text-align-last",
|
|||
derived_from="display text-decoration"
|
||||
need_clone="True" products="servo"
|
||||
animatable="False">
|
||||
use cssparser::{RGBA, ToCss};
|
||||
use cssparser::RGBA;
|
||||
use std::fmt;
|
||||
|
||||
use values:: NoViewportPercentage;
|
||||
use style_traits::ToCss;
|
||||
use values::NoViewportPercentage;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
|
||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||
|
@ -529,9 +526,9 @@ ${helpers.single_keyword("text-align-last",
|
|||
</%helpers:single_keyword_computed>
|
||||
|
||||
<%helpers:longhand name="text-shadow" animatable="True">
|
||||
use cssparser::{self, ToCss};
|
||||
use cssparser;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
|
||||
impl HasViewportPercentage for SpecifiedValue {
|
||||
|
@ -739,10 +736,9 @@ ${helpers.single_keyword("text-align-last",
|
|||
|
||||
<%helpers:longhand name="text-emphasis-style" products="gecko" need_clone="True" animatable="False">
|
||||
use computed_values::writing_mode::T as writing_mode;
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use unicode_segmentation::UnicodeSegmentation;
|
||||
use values::LocalToCss;
|
||||
use values::NoViewportPercentage;
|
||||
|
||||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
|
|
|
@ -31,12 +31,12 @@ ${helpers.predefined_type("list-style-image", "UrlOrNone", "computed_value::T::N
|
|||
animatable="False")}
|
||||
|
||||
<%helpers:longhand name="quotes" animatable="False">
|
||||
use cssparser::Token;
|
||||
use std::borrow::Cow;
|
||||
use std::fmt;
|
||||
use values::NoViewportPercentage;
|
||||
use style_traits::ToCss;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
|
||||
use cssparser::{ToCss, Token};
|
||||
use values::NoViewportPercentage;
|
||||
|
||||
pub use self::computed_value::T as SpecifiedValue;
|
||||
|
||||
|
|
|
@ -29,9 +29,8 @@ ${helpers.predefined_type("outline-color", "CSSColor", "::cssparser::Color::Curr
|
|||
|
||||
<%helpers:longhand name="outline-width" animatable="True">
|
||||
use app_units::Au;
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
|
||||
impl ToCss for SpecifiedValue {
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
|
||||
pub mod computed_value {
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::cursor::Cursor;
|
||||
use style_traits::ToCss;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Copy, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
pub type SpecifiedValue = computed_value::T;
|
||||
pub mod computed_value {
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
||||
#[derive(PartialEq, Clone, Eq, Copy, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
|
|
@ -51,9 +51,8 @@ ${helpers.single_keyword("mask-type", "luminance alpha",
|
|||
products="gecko", animatable=False)}
|
||||
|
||||
<%helpers:longhand name="clip-path" animatable="False" products="gecko">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
use style_traits::ToCss;
|
||||
use values::NoViewportPercentage;
|
||||
use values::specified::basic_shape::{ShapeSource, GeometryBox};
|
||||
|
||||
|
@ -148,18 +147,17 @@ ${helpers.single_keyword("mask-composite",
|
|||
|
||||
<%helpers:vector_longhand name="mask-image" products="gecko" animatable="False"
|
||||
has_uncacheable_values="${product == 'gecko'}">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use url::Url;
|
||||
use values::specified::{Image, UrlExtraData};
|
||||
use values::LocalToCss;
|
||||
use values::NoViewportPercentage;
|
||||
|
||||
pub mod computed_value {
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use url::Url;
|
||||
use values::{computed, LocalToCss};
|
||||
use values::computed;
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum T {
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
${helpers.single_keyword("text-overflow", "clip ellipsis", animatable=False)}
|
||||
% else:
|
||||
<%helpers:longhand name="text-overflow" animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
use style_traits::ToCss;
|
||||
use values::NoViewportPercentage;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
|
||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
|
@ -104,10 +104,10 @@ ${helpers.single_keyword("unicode-bidi",
|
|||
custom_cascade="${product == 'servo'}"
|
||||
animatable="False"
|
||||
disable_when_testing="True">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
use style_traits::ToCss;
|
||||
use values::NoViewportPercentage;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
|
||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
|
|
|
@ -19,7 +19,7 @@ use std::sync::Arc;
|
|||
use Atom;
|
||||
use app_units::Au;
|
||||
#[cfg(feature = "servo")] use cssparser::{Color as CSSParserColor, RGBA};
|
||||
use cssparser::{Parser, ToCss, TokenSerializationType};
|
||||
use cssparser::{Parser, TokenSerializationType};
|
||||
use error_reporting::ParseErrorReporter;
|
||||
use url::Url;
|
||||
#[cfg(feature = "servo")] use euclid::side_offsets::SideOffsets2D;
|
||||
|
@ -28,10 +28,9 @@ use computed_values;
|
|||
#[cfg(feature = "servo")] use logical_geometry::{LogicalMargin, PhysicalSide};
|
||||
use logical_geometry::WritingMode;
|
||||
use parser::{ParserContext, ParserContextExtraData};
|
||||
use style_traits::ToCss;
|
||||
use stylesheets::Origin;
|
||||
#[cfg(feature = "servo")] use values::LocalToCss;
|
||||
use values::HasViewportPercentage;
|
||||
use values::computed;
|
||||
use values::{HasViewportPercentage, computed};
|
||||
use cascade_info::CascadeInfo;
|
||||
use rule_tree::StrongRuleNode;
|
||||
#[cfg(feature = "servo")] use values::specified::BorderStyle;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use cssparser::ToCss;
|
||||
use properties::{AppendableValue, DeclaredValue, PropertyDeclaration, Shorthand};
|
||||
use style_traits::ToCss;
|
||||
use values::specified::{BorderStyle, CSSColor};
|
||||
use std::fmt;
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
//!
|
||||
//! [basic-shape]: https://drafts.csswg.org/css-shapes/#typedef-basic-shape
|
||||
|
||||
use cssparser::ToCss;
|
||||
use properties::shorthands::serialize_four_sides;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use url::Url;
|
||||
use values::computed::{BorderRadiusSize, LengthOrPercentage};
|
||||
use values::computed::UrlExtraData;
|
||||
|
@ -34,7 +34,6 @@ impl<T> Default for ShapeSource<T> {
|
|||
|
||||
impl<T: ToCss> ToCss for ShapeSource<T> {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
use values::LocalToCss;
|
||||
match *self {
|
||||
ShapeSource::Url(ref url, _) => url.to_css(dest),
|
||||
ShapeSource::Shape(ref shape, Some(ref reference)) => {
|
||||
|
|
|
@ -9,12 +9,11 @@
|
|||
|
||||
use cssparser::Color as CSSColor;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use url::Url;
|
||||
use values::LocalToCss;
|
||||
use values::computed::{Context, Length, LengthOrPercentage, ToComputedValue};
|
||||
use values::computed::position::Position;
|
||||
use values::specified;
|
||||
use values::specified::{AngleOrCorner, SizeKeyword, UrlExtraData};
|
||||
use values::specified::{self, AngleOrCorner, SizeKeyword, UrlExtraData};
|
||||
|
||||
|
||||
impl ToComputedValue for specified::Image {
|
||||
|
@ -73,9 +72,8 @@ impl fmt::Debug for Image {
|
|||
}
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for Image {
|
||||
impl ToCss for Image {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
use values::LocalToCss;
|
||||
match *self {
|
||||
Image::Url(ref url, _) => {
|
||||
url.to_css(dest)
|
||||
|
@ -98,7 +96,7 @@ pub struct Gradient {
|
|||
pub gradient_kind: GradientKind,
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for Gradient {
|
||||
impl ToCss for Gradient {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
if self.repeating {
|
||||
try!(dest.write_str("repeating-"));
|
||||
|
@ -224,7 +222,7 @@ pub struct ColorStop {
|
|||
pub position: Option<LengthOrPercentage>,
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for ColorStop {
|
||||
impl ToCss for ColorStop {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
try!(self.color.to_css(dest));
|
||||
if let Some(position) = self.position {
|
||||
|
@ -279,7 +277,7 @@ pub enum EndingShape {
|
|||
Ellipse(LengthOrPercentageOrKeyword),
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for EndingShape {
|
||||
impl ToCss for EndingShape {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
EndingShape::Circle(ref length) => {
|
||||
|
@ -344,7 +342,7 @@ pub enum LengthOrKeyword {
|
|||
Keyword(SizeKeyword),
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for LengthOrKeyword {
|
||||
impl ToCss for LengthOrKeyword {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
LengthOrKeyword::Length(ref length) => length.to_css(dest),
|
||||
|
@ -402,7 +400,7 @@ pub enum LengthOrPercentageOrKeyword {
|
|||
Keyword(SizeKeyword),
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for LengthOrPercentageOrKeyword {
|
||||
impl ToCss for LengthOrPercentageOrKeyword {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
LengthOrPercentageOrKeyword::LengthOrPercentage(ref first_len, second_len) => {
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
use app_units::Au;
|
||||
use ordered_float::NotNaN;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use super::{Number, ToComputedValue, Context};
|
||||
use values::{CSSFloat, LocalToCss, specified};
|
||||
use values::{CSSFloat, specified};
|
||||
|
||||
pub use cssparser::Color as CSSColor;
|
||||
pub use super::image::{EndingShape as GradientShape, Gradient, GradientKind, Image};
|
||||
|
@ -79,7 +80,7 @@ impl From<LengthOrPercentageOrAuto> for Option<CalcLengthOrPercentage> {
|
|||
}
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for CalcLengthOrPercentage {
|
||||
impl ToCss for CalcLengthOrPercentage {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match (self.length, self.percentage) {
|
||||
(None, Some(p)) => write!(dest, "{}%", p * 100.),
|
||||
|
@ -192,7 +193,7 @@ impl ToComputedValue for specified::LengthOrPercentage {
|
|||
}
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for LengthOrPercentage {
|
||||
impl ToCss for LengthOrPercentage {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
LengthOrPercentage::Length(length) => length.to_css(dest),
|
||||
|
@ -279,7 +280,7 @@ impl ToComputedValue for specified::LengthOrPercentageOrAuto {
|
|||
}
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for LengthOrPercentageOrAuto {
|
||||
impl ToCss for LengthOrPercentageOrAuto {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
LengthOrPercentageOrAuto::Length(length) => length.to_css(dest),
|
||||
|
@ -364,7 +365,7 @@ impl ToComputedValue for specified::LengthOrPercentageOrAutoOrContent {
|
|||
}
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for LengthOrPercentageOrAutoOrContent {
|
||||
impl ToCss for LengthOrPercentageOrAutoOrContent {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
LengthOrPercentageOrAutoOrContent::Length(length) => length.to_css(dest),
|
||||
|
@ -439,7 +440,7 @@ impl ToComputedValue for specified::LengthOrPercentageOrNone {
|
|||
}
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for LengthOrPercentageOrNone {
|
||||
impl ToCss for LengthOrPercentageOrNone {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
LengthOrPercentageOrNone::Length(length) => length.to_css(dest),
|
||||
|
@ -498,7 +499,7 @@ impl ToComputedValue for specified::LengthOrNone {
|
|||
}
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for LengthOrNone {
|
||||
impl ToCss for LengthOrNone {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
LengthOrNone::Length(length) => length.to_css(dest),
|
||||
|
@ -546,7 +547,7 @@ impl ToComputedValue for specified::LengthOrNumber {
|
|||
}
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for LengthOrNumber {
|
||||
impl ToCss for LengthOrNumber {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
LengthOrNumber::Length(len) => len.to_css(dest),
|
||||
|
|
|
@ -6,6 +6,7 @@ use app_units::Au;
|
|||
use euclid::size::Size2D;
|
||||
use properties::ComputedValues;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use super::{CSSFloat, specified};
|
||||
|
||||
pub use cssparser::Color as CSSColor;
|
||||
|
@ -111,6 +112,7 @@ impl ToComputedValue for specified::Length {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct BorderRadiusSize(pub Size2D<LengthOrPercentage>);
|
||||
|
@ -139,7 +141,7 @@ impl ToComputedValue for specified::BorderRadiusSize {
|
|||
}
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for BorderRadiusSize {
|
||||
impl ToCss for BorderRadiusSize {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
try!(self.0.width.to_css(dest));
|
||||
try!(dest.write_str("/"));
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
//!
|
||||
//! [position]: https://drafts.csswg.org/css-backgrounds-3/#position
|
||||
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::computed::LengthOrPercentage;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Copy)]
|
||||
|
|
|
@ -8,11 +8,6 @@
|
|||
|
||||
pub use cssparser::RGBA;
|
||||
|
||||
use app_units::Au;
|
||||
use cssparser::CssStringWriter;
|
||||
use std::fmt::{self, Write};
|
||||
use url::Url;
|
||||
|
||||
macro_rules! define_numbered_css_keyword_enum {
|
||||
($name: ident: $( $css: expr => $variant: ident = $value: expr ),+,) => {
|
||||
define_numbered_css_keyword_enum!($name: $( $css => $variant = $value ),+);
|
||||
|
@ -34,7 +29,7 @@ macro_rules! define_numbered_css_keyword_enum {
|
|||
}
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for $name {
|
||||
impl ToCss for $name {
|
||||
fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result
|
||||
where W: ::std::fmt::Write {
|
||||
match *self {
|
||||
|
@ -48,38 +43,6 @@ macro_rules! define_numbered_css_keyword_enum {
|
|||
pub mod computed;
|
||||
pub mod specified;
|
||||
|
||||
/// The real ToCss trait can't be implemented for types in crates that don't
|
||||
/// depend on each other.
|
||||
pub trait LocalToCss {
|
||||
/// Serialize `self` in CSS syntax, writing to `dest`.
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write;
|
||||
|
||||
/// Serialize `self` in CSS syntax and return a string.
|
||||
///
|
||||
/// (This is a convenience wrapper for `to_css` and probably should not be overridden.)
|
||||
#[inline]
|
||||
fn to_css_string(&self) -> String {
|
||||
let mut s = String::new();
|
||||
self.to_css(&mut s).unwrap();
|
||||
s
|
||||
}
|
||||
}
|
||||
|
||||
impl LocalToCss for Au {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
write!(dest, "{}px", self.to_f64_px())
|
||||
}
|
||||
}
|
||||
|
||||
impl LocalToCss for Url {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
try!(dest.write_str("url(\""));
|
||||
try!(write!(CssStringWriter::new(dest), "{}", self));
|
||||
try!(dest.write_str("\")"));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub type CSSFloat = f32;
|
||||
|
||||
pub const FONT_MEDIUM_PX: i32 = 16;
|
||||
|
|
|
@ -7,10 +7,11 @@
|
|||
//!
|
||||
//! [basic-shape]: https://drafts.csswg.org/css-shapes/#typedef-basic-shape
|
||||
|
||||
use cssparser::{Parser, ToCss};
|
||||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use properties::shorthands::{parse_four_sides, serialize_four_sides};
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use url::Url;
|
||||
use values::computed::{ComputedValueAsSpecified, Context, ToComputedValue};
|
||||
use values::computed::basic_shape as computed_basic_shape;
|
||||
|
@ -39,7 +40,6 @@ impl<T> Default for ShapeSource<T> {
|
|||
|
||||
impl<T: ToCss> ToCss for ShapeSource<T> {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
use values::LocalToCss;
|
||||
match *self {
|
||||
ShapeSource::Url(ref url, _) => url.to_css(dest),
|
||||
ShapeSource::Shape(ref shape, Some(ref reference)) => {
|
||||
|
|
|
@ -7,10 +7,11 @@
|
|||
//!
|
||||
//! [image]: https://drafts.csswg.org/css-images/#image-values
|
||||
|
||||
use cssparser::{Parser, ToCss};
|
||||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::f32::consts::PI;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use url::Url;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
use values::specified::{Angle, CSSColor, Length, LengthOrPercentage, UrlExtraData};
|
||||
|
@ -27,7 +28,6 @@ pub enum Image {
|
|||
|
||||
impl ToCss for Image {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
use values::LocalToCss;
|
||||
match *self {
|
||||
Image::Url(ref url, ref _extra_data) => {
|
||||
url.to_css(dest)
|
||||
|
|
|
@ -3,16 +3,17 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use app_units::Au;
|
||||
use cssparser::{Parser, ToCss, Token};
|
||||
use cssparser::{Parser, Token};
|
||||
use euclid::size::Size2D;
|
||||
use parser::Parse;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::cmp;
|
||||
use std::fmt;
|
||||
use std::ops::Mul;
|
||||
use style_traits::ToCss;
|
||||
use style_traits::values::specified::AllowedNumericType;
|
||||
use super::{Angle, Number, SimplifiedValueNode, SimplifiedSumNode, Time};
|
||||
use values::{CSSFloat, FONT_MEDIUM_PX, HasViewportPercentage, LocalToCss, computed};
|
||||
use values::{CSSFloat, FONT_MEDIUM_PX, HasViewportPercentage, computed};
|
||||
|
||||
pub use super::image::{AngleOrCorner, ColorStop, EndingShape as GradientEndingShape, Gradient};
|
||||
pub use super::image::{GradientKind, HorizontalDirection, Image, LengthOrKeyword, LengthOrPercentageOrKeyword};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use app_units::Au;
|
||||
use cssparser::{self, Parser, ToCss, Token};
|
||||
use cssparser::{self, Parser, Token};
|
||||
use euclid::size::Size2D;
|
||||
#[cfg(feature = "gecko")]
|
||||
use gecko_bindings::sugar::refptr::{GeckoArcPrincipal, GeckoArcURI};
|
||||
|
@ -14,6 +14,7 @@ use std::ascii::AsciiExt;
|
|||
use std::f32::consts::PI;
|
||||
use std::fmt;
|
||||
use std::ops::Mul;
|
||||
use style_traits::ToCss;
|
||||
use super::{CSSFloat, HasViewportPercentage, NoViewportPercentage};
|
||||
use super::computed::{ComputedValueAsSpecified, Context, ToComputedValue};
|
||||
use url::Url;
|
||||
|
@ -555,7 +556,6 @@ impl NoViewportPercentage for UrlOrNone {}
|
|||
|
||||
impl ToCss for UrlOrNone {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
use values::LocalToCss;
|
||||
match *self {
|
||||
UrlOrNone::Url(ref url, _) => {
|
||||
url.to_css(dest)
|
||||
|
|
|
@ -7,9 +7,10 @@
|
|||
//!
|
||||
//! [position]: https://drafts.csswg.org/css-backgrounds-3/#position
|
||||
|
||||
use cssparser::{Parser, ToCss, Token};
|
||||
use cssparser::{Parser, Token};
|
||||
use parser::Parse;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
use values::computed::{CalcLengthOrPercentage, Context};
|
||||
use values::computed::{LengthOrPercentage as ComputedLengthOrPercentage, ToComputedValue};
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
use app_units::Au;
|
||||
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser, parse_important};
|
||||
use cssparser::ToCss;
|
||||
use euclid::scale_factor::ScaleFactor;
|
||||
use euclid::size::{Size2D, TypedSize2D};
|
||||
use media_queries::Device;
|
||||
|
@ -20,7 +19,7 @@ use std::borrow::Cow;
|
|||
use std::fmt;
|
||||
use std::iter::Enumerate;
|
||||
use std::str::Chars;
|
||||
use style_traits::ViewportPx;
|
||||
use style_traits::{ToCss, ViewportPx};
|
||||
use style_traits::viewport::{Orientation, UserZoom, ViewportConstraints, Zoom};
|
||||
use stylesheets::{Stylesheet, Origin};
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
|
|
|
@ -22,3 +22,4 @@ heapsize_derive = {version = "0.1", optional = true}
|
|||
rustc-serialize = "0.3"
|
||||
serde = {version = "0.8", optional = true}
|
||||
serde_derive = {version = "0.8", optional = true}
|
||||
url = "1.2"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! A list of common mouse cursors per CSS3-UI § 8.1.1.
|
||||
|
||||
use cssparser::ToCss;
|
||||
use super::ToCss;
|
||||
|
||||
macro_rules! define_cursor {
|
||||
($( $css: expr => $variant: ident = $value: expr, )+) => {
|
||||
|
|
|
@ -23,6 +23,7 @@ extern crate euclid;
|
|||
extern crate rustc_serialize;
|
||||
#[cfg(feature = "servo")] extern crate serde;
|
||||
#[cfg(feature = "servo")] #[macro_use] extern crate serde_derive;
|
||||
extern crate url;
|
||||
|
||||
/// Opaque type stored in type-unsafe work queues for parallel layout.
|
||||
/// Must be transmutable to and from TNode.
|
||||
|
@ -61,3 +62,4 @@ pub mod cursor;
|
|||
pub mod values;
|
||||
pub mod viewport;
|
||||
|
||||
pub use values::ToCss;
|
||||
|
|
|
@ -2,6 +2,60 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use app_units::Au;
|
||||
use cssparser::CssStringWriter;
|
||||
use std::fmt::{self, Write};
|
||||
use url::Url;
|
||||
|
||||
/// The real ToCss trait can't be implemented for types in crates that don't
|
||||
/// depend on each other.
|
||||
pub trait ToCss {
|
||||
/// Serialize `self` in CSS syntax, writing to `dest`.
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write;
|
||||
|
||||
/// Serialize `self` in CSS syntax and return a string.
|
||||
///
|
||||
/// (This is a convenience wrapper for `to_css` and probably should not be overridden.)
|
||||
#[inline]
|
||||
fn to_css_string(&self) -> String {
|
||||
let mut s = String::new();
|
||||
self.to_css(&mut s).unwrap();
|
||||
s
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for Au {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
write!(dest, "{}px", self.to_f64_px())
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for Url {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
try!(dest.write_str("url(\""));
|
||||
try!(write!(CssStringWriter::new(dest), "{}", self));
|
||||
try!(dest.write_str("\")"));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! impl_to_css_for_predefined_type {
|
||||
($name: ty) => {
|
||||
impl<'a> ToCss for $name {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
::cssparser::ToCss::to_css(self, dest)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
impl_to_css_for_predefined_type!(f32);
|
||||
impl_to_css_for_predefined_type!(i32);
|
||||
impl_to_css_for_predefined_type!(u32);
|
||||
impl_to_css_for_predefined_type!(::cssparser::Token<'a>);
|
||||
impl_to_css_for_predefined_type!(::cssparser::RGBA);
|
||||
impl_to_css_for_predefined_type!(::cssparser::Color);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! define_css_keyword_enum {
|
||||
($name: ident: $( $css: expr => $variant: ident ),+,) => {
|
||||
|
@ -50,7 +104,7 @@ macro_rules! __define_css_keyword_enum__actual {
|
|||
}
|
||||
}
|
||||
|
||||
impl ::cssparser::ToCss for $name {
|
||||
impl ToCss for $name {
|
||||
fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result
|
||||
where W: ::std::fmt::Write {
|
||||
match *self {
|
||||
|
@ -61,7 +115,6 @@ macro_rules! __define_css_keyword_enum__actual {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
pub mod specified {
|
||||
use app_units::Au;
|
||||
|
||||
|
|
|
@ -2294,6 +2294,7 @@ dependencies = [
|
|||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -373,6 +373,7 @@ dependencies = [
|
|||
"cssparser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use app_units::Au;
|
||||
use cssparser::{Parser, ToCss};
|
||||
use cssparser::Parser;
|
||||
use env_logger;
|
||||
use euclid::Size2D;
|
||||
use parking_lot::RwLock;
|
||||
|
@ -46,6 +46,7 @@ use style::sequential;
|
|||
use style::string_cache::Atom;
|
||||
use style::stylesheets::{Origin, Stylesheet};
|
||||
use style::timer::Timer;
|
||||
use style_traits::ToCss;
|
||||
use url::Url;
|
||||
|
||||
/*
|
||||
|
|
|
@ -12,6 +12,7 @@ extern crate euclid;
|
|||
extern crate libc;
|
||||
#[macro_use] extern crate log;
|
||||
extern crate parking_lot;
|
||||
extern crate style_traits;
|
||||
extern crate url;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
use parsing::parse;
|
||||
use style::parser::Parse;
|
||||
use style::values::specified::basic_shape::*;
|
||||
use style_traits::ToCss;
|
||||
|
||||
// Ensure that basic-shape sub-functions parse as both basic shapes
|
||||
// and their individual components
|
||||
|
@ -21,14 +22,14 @@ macro_rules! assert_border_radius_values {
|
|||
let input = parse(BorderRadius::parse, $input)
|
||||
.expect(&format!("Failed parsing {} as border radius",
|
||||
$input));
|
||||
assert_eq!(::cssparser::ToCss::to_css_string(&input.top_left.0.width), $tlw);
|
||||
assert_eq!(::cssparser::ToCss::to_css_string(&input.top_right.0.width), $trw);
|
||||
assert_eq!(::cssparser::ToCss::to_css_string(&input.bottom_right.0.width), $brw);
|
||||
assert_eq!(::cssparser::ToCss::to_css_string(&input.bottom_left.0.width), $blw);
|
||||
assert_eq!(::cssparser::ToCss::to_css_string(&input.top_left.0.height), $tlh);
|
||||
assert_eq!(::cssparser::ToCss::to_css_string(&input.top_right.0.height), $trh);
|
||||
assert_eq!(::cssparser::ToCss::to_css_string(&input.bottom_right.0.height), $brh);
|
||||
assert_eq!(::cssparser::ToCss::to_css_string(&input.bottom_left.0.height), $blh);
|
||||
assert_eq!(::style_traits::ToCss::to_css_string(&input.top_left.0.width), $tlw);
|
||||
assert_eq!(::style_traits::ToCss::to_css_string(&input.top_right.0.width), $trw);
|
||||
assert_eq!(::style_traits::ToCss::to_css_string(&input.bottom_right.0.width), $brw);
|
||||
assert_eq!(::style_traits::ToCss::to_css_string(&input.bottom_left.0.width), $blw);
|
||||
assert_eq!(::style_traits::ToCss::to_css_string(&input.top_left.0.height), $tlh);
|
||||
assert_eq!(::style_traits::ToCss::to_css_string(&input.top_right.0.height), $trh);
|
||||
assert_eq!(::style_traits::ToCss::to_css_string(&input.bottom_right.0.height), $brh);
|
||||
assert_eq!(::style_traits::ToCss::to_css_string(&input.bottom_left.0.height), $blh);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ use style::properties::longhands::font_feature_settings;
|
|||
use style::properties::longhands::font_feature_settings::computed_value;
|
||||
use style::properties::longhands::font_feature_settings::computed_value::FeatureTagValue;
|
||||
use style::stylesheets::Origin;
|
||||
use style_traits::ToCss;
|
||||
use url::Url;
|
||||
|
||||
#[test]
|
||||
|
@ -100,7 +101,7 @@ fn font_language_override_should_parse_properly() {
|
|||
#[test]
|
||||
#[should_panic]
|
||||
fn font_language_override_should_fail_on_empty_str() {
|
||||
use style::properties::longhands::font_language_override::{self, SpecifiedValue};
|
||||
use style::properties::longhands::font_language_override;
|
||||
|
||||
parse_longhand!(font_language_override, "");
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ use media_queries::CSSErrorReporterTest;
|
|||
use style::parser::ParserContext;
|
||||
use style::stylesheets::Origin;
|
||||
use style::values::specified::image::*;
|
||||
use style_traits::ToCss;
|
||||
use url::Url;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -21,12 +21,12 @@ macro_rules! assert_roundtrip {
|
|||
($fun:expr, $input:expr, $output:expr) => {
|
||||
let parsed = $crate::parsing::parse($fun, $input)
|
||||
.expect(&format!("Failed to parse {}", $input));
|
||||
let serialized = ::cssparser::ToCss::to_css_string(&parsed);
|
||||
let serialized = ToCss::to_css_string(&parsed);
|
||||
assert_eq!(serialized, $output);
|
||||
|
||||
let re_parsed = $crate::parsing::parse($fun, &serialized)
|
||||
.expect(&format!("Failed to parse serialization {}", $input));
|
||||
let re_serialized = ::cssparser::ToCss::to_css_string(&re_parsed);
|
||||
let re_serialized = ToCss::to_css_string(&re_parsed);
|
||||
assert_eq!(serialized, re_serialized);
|
||||
}
|
||||
}
|
||||
|
@ -41,13 +41,13 @@ macro_rules! assert_roundtrip_with_context {
|
|||
let mut parser = Parser::new($input);
|
||||
let parsed = $fun(&context, &mut parser)
|
||||
.expect(&format!("Failed to parse {}", $input));
|
||||
let serialized = ::cssparser::ToCss::to_css_string(&parsed);
|
||||
let serialized = ToCss::to_css_string(&parsed);
|
||||
assert_eq!(serialized, $output);
|
||||
|
||||
let mut parser = Parser::new(&serialized);
|
||||
let re_parsed = $fun(&context, &mut parser)
|
||||
.expect(&format!("Failed to parse {}", $input));
|
||||
let re_serialized = ::cssparser::ToCss::to_css_string(&re_parsed);
|
||||
let re_serialized = ToCss::to_css_string(&re_parsed);
|
||||
assert_eq!(serialized, re_serialized);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
use parsing::parse;
|
||||
use style::values::specified::position::*;
|
||||
use style_traits::ToCss;
|
||||
|
||||
#[test]
|
||||
fn test_position() {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use cssparser::Parser;
|
||||
use cssparser::{Parser, ToCss};
|
||||
use selectors::parser::{Selector, ParserContext, parse_selector_list};
|
||||
use style::selector_impl::TheSelectorImpl;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
pub use cssparser::ToCss;
|
||||
pub use std::sync::Arc;
|
||||
pub use style::computed_values::display::T::inline_block;
|
||||
pub use style::properties::{DeclaredValue, PropertyDeclaration, PropertyDeclarationBlock, Importance};
|
||||
|
@ -11,6 +10,7 @@ pub use style::values::specified::{LengthOrPercentage, LengthOrPercentageOrAuto,
|
|||
pub use style::properties::longhands::outline_color::computed_value::T as ComputedColor;
|
||||
pub use style::values::RGBA;
|
||||
pub use style::values::specified::UrlExtraData;
|
||||
pub use style_traits::ToCss;
|
||||
pub use url::Url;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -11,6 +11,7 @@ extern crate libc;
|
|||
#[macro_use] extern crate log;
|
||||
extern crate parking_lot;
|
||||
extern crate style;
|
||||
extern crate style_traits;
|
||||
extern crate url;
|
||||
|
||||
mod sanity_checks;
|
||||
|
|
Загрузка…
Ссылка в новой задаче