зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #18300 - style: Remove HasViewportPercentage (from emilio:die-hvp-die); r=nox
It's not needed since #18268, let's kill it. Source-Repo: https://github.com/servo/servo Source-Revision: 5dee83d54d3f05cc631ee89de612c14e21dd92ec --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : e6f1d82f2005c8203891fedd5bd564411817e858
This commit is contained in:
Родитель
c159686ac3
Коммит
22b2d26b42
|
@ -17,7 +17,7 @@ use std::borrow::{Borrow, Cow};
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use style_traits::{HasViewportPercentage, ToCss, StyleParseError, ParseError};
|
use style_traits::{ToCss, StyleParseError, ParseError};
|
||||||
|
|
||||||
/// A custom property name is just an `Atom`.
|
/// A custom property name is just an `Atom`.
|
||||||
///
|
///
|
||||||
|
@ -51,12 +51,6 @@ pub struct SpecifiedValue {
|
||||||
references: HashSet<Name>,
|
references: HashSet<Name>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HasViewportPercentage for SpecifiedValue {
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
panic!("has_viewport_percentage called before resolving!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// This struct is a cheap borrowed version of a `SpecifiedValue`.
|
/// This struct is a cheap borrowed version of a `SpecifiedValue`.
|
||||||
pub struct BorrowedSpecifiedValue<'a> {
|
pub struct BorrowedSpecifiedValue<'a> {
|
||||||
css: &'a str,
|
css: &'a str,
|
||||||
|
|
|
@ -57,9 +57,8 @@ macro_rules! define_numbered_css_keyword_enum {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A macro for implementing `ComputedValueAsSpecified`, `Parse`
|
/// A macro for implementing `ComputedValueAsSpecified`, and `Parse` traits for
|
||||||
/// and `HasViewportPercentage` traits for the enums defined
|
/// the enums defined using `define_css_keyword_enum` macro.
|
||||||
/// using `define_css_keyword_enum` macro.
|
|
||||||
///
|
///
|
||||||
/// NOTE: We should either move `Parse` trait to `style_traits`
|
/// NOTE: We should either move `Parse` trait to `style_traits`
|
||||||
/// or `define_css_keyword_enum` macro to this crate, but that
|
/// or `define_css_keyword_enum` macro to this crate, but that
|
||||||
|
@ -76,7 +75,6 @@ macro_rules! add_impls_for_keyword_enum {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl $crate::values::computed::ComputedValueAsSpecified for $name {}
|
impl $crate::values::computed::ComputedValueAsSpecified for $name {}
|
||||||
no_viewport_percentage!($name);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +102,5 @@ macro_rules! define_keyword_type {
|
||||||
|
|
||||||
impl $crate::values::computed::ComputedValueAsSpecified for $name {}
|
impl $crate::values::computed::ComputedValueAsSpecified for $name {}
|
||||||
impl $crate::values::animated::AnimatedValueAsComputed for $name {}
|
impl $crate::values::animated::AnimatedValueAsComputed for $name {}
|
||||||
no_viewport_percentage!($name);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,8 +83,6 @@
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
#[allow(unused_imports)]
|
|
||||||
use style_traits::HasViewportPercentage;
|
|
||||||
use style_traits::{Separator, ToCss};
|
use style_traits::{Separator, ToCss};
|
||||||
|
|
||||||
pub mod single_value {
|
pub mod single_value {
|
||||||
|
@ -179,7 +177,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The specified value of ${name}.
|
/// The specified value of ${name}.
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub struct SpecifiedValue(pub Vec<single_value::SpecifiedValue>);
|
pub struct SpecifiedValue(pub Vec<single_value::SpecifiedValue>);
|
||||||
|
|
||||||
|
@ -420,7 +418,6 @@
|
||||||
%>
|
%>
|
||||||
<%call expr="longhand(name, keyword=Keyword(name, values, **keyword_kwargs), **kwargs)">
|
<%call expr="longhand(name, keyword=Keyword(name, values, **keyword_kwargs), **kwargs)">
|
||||||
use properties::longhands::system_font::SystemFont;
|
use properties::longhands::system_font::SystemFont;
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
use cssparser::Parser;
|
use cssparser::Parser;
|
||||||
|
@ -529,7 +526,6 @@
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
% endif
|
% endif
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
</%call>
|
</%call>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
@ -948,7 +944,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||||
pub struct SpecifiedValue(pub ${length_type});
|
pub struct SpecifiedValue(pub ${length_type});
|
||||||
|
|
||||||
% if length_type == "MozLength":
|
% if length_type == "MozLength":
|
||||||
|
|
|
@ -214,7 +214,6 @@ pub enum TransitionProperty {
|
||||||
Unsupported(CustomIdent)
|
Unsupported(CustomIdent)
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(TransitionProperty);
|
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for TransitionProperty {}
|
impl ComputedValueAsSpecified for TransitionProperty {}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,6 @@ ${helpers.predefined_type("background-image", "ImageLayer",
|
||||||
pub struct T(pub RepeatKeyword, pub RepeatKeyword);
|
pub struct T(pub RepeatKeyword, pub RepeatKeyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
impl ToCss for computed_value::T {
|
impl ToCss for computed_value::T {
|
||||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||||
|
|
|
@ -78,7 +78,6 @@ ${helpers.gecko_keyword_conversion(Keyword('border-style',
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use values::specified::RGBAColor;
|
use values::specified::RGBAColor;
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
use cssparser::RGBA;
|
use cssparser::RGBA;
|
||||||
|
@ -230,7 +229,6 @@ ${helpers.predefined_type("border-image-outset", "LengthOrNumberRect",
|
||||||
spec="https://drafts.csswg.org/css-backgrounds/#border-image-repeat">
|
spec="https://drafts.csswg.org/css-backgrounds/#border-image-repeat">
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
pub use super::RepeatKeyword;
|
pub use super::RepeatKeyword;
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
%>
|
%>
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
pub use super::SpecifiedValue as T;
|
pub use super::SpecifiedValue as T;
|
||||||
|
@ -222,7 +221,6 @@ ${helpers.single_keyword("position", "static absolute relative fixed",
|
||||||
gecko_pref_ident="float_"
|
gecko_pref_ident="float_"
|
||||||
flags="APPLIES_TO_FIRST_LETTER"
|
flags="APPLIES_TO_FIRST_LETTER"
|
||||||
spec="https://drafts.csswg.org/css-box/#propdef-float">
|
spec="https://drafts.csswg.org/css-box/#propdef-float">
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
impl ToComputedValue for SpecifiedValue {
|
impl ToComputedValue for SpecifiedValue {
|
||||||
type ComputedValue = computed_value::T;
|
type ComputedValue = computed_value::T;
|
||||||
|
|
||||||
|
@ -261,7 +259,6 @@ ${helpers.single_keyword("position", "static absolute relative fixed",
|
||||||
gecko_enum_prefix="StyleClear"
|
gecko_enum_prefix="StyleClear"
|
||||||
gecko_ffi_name="mBreakType"
|
gecko_ffi_name="mBreakType"
|
||||||
spec="https://www.w3.org/TR/CSS2/visuren.html#flow-control">
|
spec="https://www.w3.org/TR/CSS2/visuren.html#flow-control">
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
impl ToComputedValue for SpecifiedValue {
|
impl ToComputedValue for SpecifiedValue {
|
||||||
type ComputedValue = computed_value::T;
|
type ComputedValue = computed_value::T;
|
||||||
|
|
||||||
|
@ -327,7 +324,7 @@ ${helpers.single_keyword("position", "static absolute relative fixed",
|
||||||
|
|
||||||
/// The `vertical-align` value.
|
/// The `vertical-align` value.
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub enum SpecifiedValue {
|
pub enum SpecifiedValue {
|
||||||
% for keyword in vertical_align_keywords:
|
% for keyword in vertical_align_keywords:
|
||||||
|
@ -571,7 +568,6 @@ ${helpers.predefined_type("transition-delay",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
|
pub fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
|
||||||
-> Result<SpecifiedValue,ParseError<'i>> {
|
-> Result<SpecifiedValue,ParseError<'i>> {
|
||||||
|
@ -641,7 +637,6 @@ ${helpers.predefined_type("animation-timing-function",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_initial_value() -> computed_value::T {
|
pub fn get_initial_value() -> computed_value::T {
|
||||||
|
@ -842,7 +837,7 @@ ${helpers.predefined_type(
|
||||||
/// Multiple transform functions compose a transformation.
|
/// Multiple transform functions compose a transformation.
|
||||||
///
|
///
|
||||||
/// Some transformations can be expressed by other more general functions.
|
/// Some transformations can be expressed by other more general functions.
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub enum SpecifiedOperation {
|
pub enum SpecifiedOperation {
|
||||||
/// Represents a 2D 2x3 matrix.
|
/// Represents a 2D 2x3 matrix.
|
||||||
|
@ -991,7 +986,7 @@ ${helpers.predefined_type(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub struct SpecifiedValue(Vec<SpecifiedOperation>);
|
pub struct SpecifiedValue(Vec<SpecifiedOperation>);
|
||||||
|
|
||||||
|
@ -1705,7 +1700,6 @@ ${helpers.predefined_type("transform-origin",
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
pub type T = super::SpecifiedValue;
|
pub type T = super::SpecifiedValue;
|
||||||
|
@ -1850,7 +1844,6 @@ ${helpers.single_keyword("-moz-orient",
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
pub use super::SpecifiedValue as T;
|
pub use super::SpecifiedValue as T;
|
||||||
|
@ -1924,7 +1917,6 @@ ${helpers.predefined_type(
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
pub use super::SpecifiedValue as T;
|
pub use super::SpecifiedValue as T;
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||||
pub struct SpecifiedValue(pub Color);
|
pub struct SpecifiedValue(pub Color);
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
use cssparser;
|
use cssparser;
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
pub use self::computed_value::ContentItem;
|
pub use self::computed_value::ContentItem;
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
use cssparser;
|
use cssparser;
|
||||||
|
@ -296,7 +295,6 @@
|
||||||
computed_value::T(Vec::new())
|
computed_value::T(Vec::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
impl ToCss for SpecifiedValue {
|
impl ToCss for SpecifiedValue {
|
||||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
|
||||||
|
|
|
@ -76,7 +76,6 @@ macro_rules! impl_gecko_keyword_conversions {
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
use cssparser::{CssStringWriter, Parser, serialize_identifier};
|
use cssparser::{CssStringWriter, Parser, serialize_identifier};
|
||||||
|
@ -430,7 +429,6 @@ ${helpers.single_keyword_system("font-variant-caps",
|
||||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-weight">
|
spec="https://drafts.csswg.org/css-fonts/#propdef-font-weight">
|
||||||
use properties::longhands::system_font::SystemFont;
|
use properties::longhands::system_font::SystemFont;
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)]
|
||||||
|
@ -597,7 +595,7 @@ ${helpers.single_keyword_system("font-variant-caps",
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use properties::longhands::system_font::SystemFont;
|
use properties::longhands::system_font::SystemFont;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::{HasViewportPercentage, ToCss};
|
use style_traits::ToCss;
|
||||||
use values::FONT_MEDIUM_PX;
|
use values::FONT_MEDIUM_PX;
|
||||||
use values::computed::NonNegativeAu;
|
use values::computed::NonNegativeAu;
|
||||||
use values::specified::{AllowQuirks, FontRelativeLength, LengthOrPercentage, NoCalcLength};
|
use values::specified::{AllowQuirks, FontRelativeLength, LengthOrPercentage, NoCalcLength};
|
||||||
|
@ -615,15 +613,6 @@ ${helpers.single_keyword_system("font-variant-caps",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HasViewportPercentage for SpecifiedValue {
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
match *self {
|
|
||||||
SpecifiedValue::Length(ref lop) => lop.has_viewport_percentage(),
|
|
||||||
_ => false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub enum SpecifiedValue {
|
pub enum SpecifiedValue {
|
||||||
|
@ -1068,7 +1057,6 @@ ${helpers.single_keyword_system("font-variant-caps",
|
||||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-size-adjust">
|
spec="https://drafts.csswg.org/css-fonts/#propdef-font-size-adjust">
|
||||||
use properties::longhands::system_font::SystemFont;
|
use properties::longhands::system_font::SystemFont;
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, ToCss)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToCss)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
|
@ -1190,7 +1178,6 @@ ${helpers.single_keyword_system("font-variant-caps",
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
pub use super::SpecifiedValue as T;
|
pub use super::SpecifiedValue as T;
|
||||||
|
@ -1302,7 +1289,6 @@ ${helpers.single_keyword_system("font-kerning",
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use values::CustomIdent;
|
use values::CustomIdent;
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
|
@ -1512,7 +1498,6 @@ macro_rules! exclusive_value {
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
|
@ -1658,7 +1643,6 @@ macro_rules! exclusive_value {
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
|
@ -1818,7 +1802,6 @@ macro_rules! exclusive_value {
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
|
@ -1981,7 +1964,6 @@ ${helpers.single_keyword_system("font-variant-position",
|
||||||
Value(computed_value::T),
|
Value(computed_value::T),
|
||||||
System(SystemFont)
|
System(SystemFont)
|
||||||
}
|
}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
<%self:simple_system_boilerplate name="font_feature_settings"></%self:simple_system_boilerplate>
|
<%self:simple_system_boilerplate name="font_feature_settings"></%self:simple_system_boilerplate>
|
||||||
|
|
||||||
|
@ -2023,7 +2005,6 @@ https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control-
|
||||||
|
|
||||||
pub type SpecifiedValue = computed_value::T;
|
pub type SpecifiedValue = computed_value::T;
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
|
@ -2051,7 +2032,6 @@ https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control-
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use byteorder::{BigEndian, ByteOrder};
|
use byteorder::{BigEndian, ByteOrder};
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
|
@ -2209,7 +2189,6 @@ https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control-
|
||||||
pub use self::computed_value::T as SpecifiedValue;
|
pub use self::computed_value::T as SpecifiedValue;
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
use Atom;
|
use Atom;
|
||||||
|
@ -2269,7 +2248,6 @@ https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control-
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
pub type T = i8;
|
pub type T = i8;
|
||||||
|
@ -2369,7 +2347,7 @@ ${helpers.single_keyword("-moz-math-variant",
|
||||||
use gecko_bindings::structs::NS_MATHML_DEFAULT_SCRIPT_MIN_SIZE_PT;
|
use gecko_bindings::structs::NS_MATHML_DEFAULT_SCRIPT_MIN_SIZE_PT;
|
||||||
use values::specified::length::{AU_PER_PT, FontBaseSize, NoCalcLength};
|
use values::specified::length::{AU_PER_PT, FontBaseSize, NoCalcLength};
|
||||||
|
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||||
pub struct SpecifiedValue(pub NoCalcLength);
|
pub struct SpecifiedValue(pub NoCalcLength);
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
|
@ -2418,7 +2396,6 @@ ${helpers.single_keyword("-moz-math-variant",
|
||||||
pub use self::computed_value::T as SpecifiedValue;
|
pub use self::computed_value::T as SpecifiedValue;
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
|
@ -66,7 +66,6 @@ ${helpers.single_keyword("image-rendering",
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use values::specified::Angle;
|
use values::specified::Angle;
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
use std::f64::consts::PI;
|
use std::f64::consts::PI;
|
||||||
const TWO_PI: f64 = 2.0 * PI;
|
const TWO_PI: f64 = 2.0 * PI;
|
||||||
|
@ -259,7 +258,6 @@ ${helpers.single_keyword("image-rendering",
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
|
||||||
|
|
|
@ -259,7 +259,6 @@ ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue { }
|
impl ComputedValueAsSpecified for SpecifiedValue { }
|
||||||
</%helpers:longhand>
|
</%helpers:longhand>
|
||||||
|
@ -271,7 +270,6 @@ ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
|
||||||
use values::CustomIdent;
|
use values::CustomIdent;
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue { }
|
impl ComputedValueAsSpecified for SpecifiedValue { }
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ ${helpers.single_keyword("caption-side", "top bottom",
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||||
pub struct SpecifiedValue {
|
pub struct SpecifiedValue {
|
||||||
pub horizontal: NonNegativeLength,
|
pub horizontal: NonNegativeLength,
|
||||||
pub vertical: Option<NonNegativeLength>,
|
pub vertical: Option<NonNegativeLength>,
|
||||||
|
|
|
@ -70,7 +70,6 @@ ${helpers.single_keyword("word-break",
|
||||||
animation_value_type="discrete"
|
animation_value_type="discrete"
|
||||||
flags="APPLIES_TO_PLACEHOLDER",
|
flags="APPLIES_TO_PLACEHOLDER",
|
||||||
spec="https://drafts.csswg.org/css-text/#propdef-text-justify">
|
spec="https://drafts.csswg.org/css-text/#propdef-text-justify">
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
impl ToComputedValue for SpecifiedValue {
|
impl ToComputedValue for SpecifiedValue {
|
||||||
type ComputedValue = computed_value::T;
|
type ComputedValue = computed_value::T;
|
||||||
|
@ -114,7 +113,6 @@ ${helpers.single_keyword("text-align-last",
|
||||||
<%helpers:longhand name="text-align" animation_value_type="discrete"
|
<%helpers:longhand name="text-align" animation_value_type="discrete"
|
||||||
flags="APPLIES_TO_PLACEHOLDER"
|
flags="APPLIES_TO_PLACEHOLDER"
|
||||||
spec="https://drafts.csswg.org/css-text/#propdef-text-align">
|
spec="https://drafts.csswg.org/css-text/#propdef-text-align">
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
macro_rules! define_text_align {
|
macro_rules! define_text_align {
|
||||||
|
@ -292,7 +290,6 @@ ${helpers.predefined_type("word-spacing",
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
|
@ -379,7 +376,6 @@ ${helpers.predefined_type("word-spacing",
|
||||||
spec="https://drafts.csswg.org/css-text/#propdef-white-space">
|
spec="https://drafts.csswg.org/css-text/#propdef-white-space">
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
% if product != "gecko":
|
% if product != "gecko":
|
||||||
impl SpecifiedValue {
|
impl SpecifiedValue {
|
||||||
|
@ -435,7 +431,6 @@ ${helpers.predefined_type(
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use unicode_segmentation::UnicodeSegmentation;
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
|
@ -638,7 +633,6 @@ ${helpers.predefined_type(
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub fn get_initial_value() -> computed_value::T {
|
pub fn get_initial_value() -> computed_value::T {
|
||||||
SpecifiedValue(HorizontalWritingModeValue::Over, VerticalWritingModeValue::Right)
|
SpecifiedValue(HorizontalWritingModeValue::Over, VerticalWritingModeValue::Right)
|
||||||
|
|
|
@ -50,7 +50,6 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
impl SpecifiedValue {
|
impl SpecifiedValue {
|
||||||
|
@ -116,7 +115,6 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu
|
||||||
|
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_initial_value() -> computed_value::T {
|
pub fn get_initial_value() -> computed_value::T {
|
||||||
|
@ -157,7 +155,6 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
impl ToCss for SpecifiedValue {
|
impl ToCss for SpecifiedValue {
|
||||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
use values::specified::url::SpecifiedUrl;
|
use values::specified::url::SpecifiedUrl;
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
|
|
|
@ -311,7 +311,6 @@ ${helpers.predefined_type("object-position",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
|
|
||||||
impl ToCss for computed_value::T {
|
impl ToCss for computed_value::T {
|
||||||
|
@ -454,7 +453,6 @@ ${helpers.predefined_type("object-position",
|
||||||
pub columns: Range<u32>,
|
pub columns: Range<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(TemplateAreas);
|
|
||||||
impl ComputedValueAsSpecified for TemplateAreas {}
|
impl ComputedValueAsSpecified for TemplateAreas {}
|
||||||
|
|
||||||
impl Parse for TemplateAreas {
|
impl Parse for TemplateAreas {
|
||||||
|
|
|
@ -17,7 +17,6 @@ ${helpers.single_keyword("table-layout", "auto fixed",
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
pub type SpecifiedValue = computed_value::T;
|
pub type SpecifiedValue = computed_value::T;
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, ToCss)]
|
#[derive(Clone, Debug, Eq, PartialEq, ToCss)]
|
||||||
|
@ -150,7 +149,6 @@ ${helpers.single_keyword("unicode-bidi",
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
|
|
|
@ -51,7 +51,6 @@ ${helpers.single_keyword("-moz-window-shadow", "none default menu tooltip sheet"
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedValue);
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
|
|
|
@ -36,7 +36,7 @@ use selector_parser::PseudoElement;
|
||||||
use selectors::parser::SelectorParseError;
|
use selectors::parser::SelectorParseError;
|
||||||
#[cfg(feature = "servo")] use servo_config::prefs::PREFS;
|
#[cfg(feature = "servo")] use servo_config::prefs::PREFS;
|
||||||
use shared_lock::StylesheetGuards;
|
use shared_lock::StylesheetGuards;
|
||||||
use style_traits::{PARSING_MODE_DEFAULT, HasViewportPercentage, ToCss, ParseError};
|
use style_traits::{PARSING_MODE_DEFAULT, ToCss, ParseError};
|
||||||
use style_traits::{PropertyDeclarationParseError, StyleParseError, ValueParseError};
|
use style_traits::{PropertyDeclarationParseError, StyleParseError, ValueParseError};
|
||||||
use stylesheets::{CssRuleType, MallocSizeOf, MallocSizeOfFn, Origin, UrlExtraData};
|
use stylesheets::{CssRuleType, MallocSizeOf, MallocSizeOfFn, Origin, UrlExtraData};
|
||||||
#[cfg(feature = "servo")] use values::Either;
|
#[cfg(feature = "servo")] use values::Either;
|
||||||
|
@ -873,19 +873,6 @@ impl UnparsedValue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: HasViewportPercentage> HasViewportPercentage for DeclaredValue<'a, T> {
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
match *self {
|
|
||||||
DeclaredValue::Value(ref v) => v.has_viewport_percentage(),
|
|
||||||
DeclaredValue::WithVariables(_) => {
|
|
||||||
panic!("DeclaredValue::has_viewport_percentage without \
|
|
||||||
resolving variables!")
|
|
||||||
},
|
|
||||||
DeclaredValue::CSSWideKeyword(_) => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, T: ToCss> ToCss for DeclaredValue<'a, T> {
|
impl<'a, T: ToCss> ToCss for DeclaredValue<'a, T> {
|
||||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
|
||||||
where W: fmt::Write,
|
where W: fmt::Write,
|
||||||
|
@ -1299,26 +1286,6 @@ pub enum PropertyDeclaration {
|
||||||
Custom(::custom_properties::Name, DeclaredValueOwned<Box<::custom_properties::SpecifiedValue>>),
|
Custom(::custom_properties::Name, DeclaredValueOwned<Box<::custom_properties::SpecifiedValue>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HasViewportPercentage for PropertyDeclaration {
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
match *self {
|
|
||||||
% for property in data.longhands:
|
|
||||||
PropertyDeclaration::${property.camel_case}(ref val) => {
|
|
||||||
val.has_viewport_percentage()
|
|
||||||
},
|
|
||||||
% endfor
|
|
||||||
PropertyDeclaration::WithVariables(..) => {
|
|
||||||
panic!("DeclaredValue::has_viewport_percentage without \
|
|
||||||
resolving variables!")
|
|
||||||
},
|
|
||||||
PropertyDeclaration::CSSWideKeyword(..) => false,
|
|
||||||
PropertyDeclaration::Custom(_, ref val) => {
|
|
||||||
val.borrow().has_viewport_percentage()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Debug for PropertyDeclaration {
|
impl fmt::Debug for PropertyDeclaration {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
self.id().to_css(f)?;
|
self.id().to_css(f)?;
|
||||||
|
|
|
@ -14,7 +14,7 @@ use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||||
/// A computed angle.
|
/// A computed angle.
|
||||||
#[animate(fallback = "Self::animate_fallback")]
|
#[animate(fallback = "Self::animate_fallback")]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
|
||||||
#[derive(Animate, Clone, Copy, Debug, HasViewportPercentage, PartialEq)]
|
#[derive(Animate, Clone, Copy, Debug, PartialEq)]
|
||||||
#[derive(PartialOrd, ToAnimatedZero)]
|
#[derive(PartialOrd, ToAnimatedZero)]
|
||||||
pub enum Angle {
|
pub enum Angle {
|
||||||
/// An angle with degree unit.
|
/// An angle with degree unit.
|
||||||
|
|
|
@ -11,7 +11,7 @@ use values::{CSSFloat, serialize_percentage};
|
||||||
/// A computed percentage.
|
/// A computed percentage.
|
||||||
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
||||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, Default)]
|
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, Default)]
|
||||||
#[derive(HasViewportPercentage, PartialEq, PartialOrd, ToAnimatedZero)]
|
#[derive(PartialEq, PartialOrd, ToAnimatedZero)]
|
||||||
pub struct Percentage(pub CSSFloat);
|
pub struct Percentage(pub CSSFloat);
|
||||||
|
|
||||||
impl Percentage {
|
impl Percentage {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
/// A generic value for the `background-size` property.
|
/// A generic value for the `background-size` property.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||||
#[derive(HasViewportPercentage, PartialEq, ToComputedValue, ToCss)]
|
#[derive(PartialEq, ToComputedValue, ToCss)]
|
||||||
pub enum BackgroundSize<LengthOrPercentageOrAuto> {
|
pub enum BackgroundSize<LengthOrPercentageOrAuto> {
|
||||||
/// `<width> <height>`
|
/// `<width> <height>`
|
||||||
Explicit {
|
Explicit {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
//! types that are generic over their `ToCss` implementations.
|
//! types that are generic over their `ToCss` implementations.
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::{HasViewportPercentage, ToCss};
|
use style_traits::ToCss;
|
||||||
use values::animated::{Animate, Procedure, ToAnimatedZero};
|
use values::animated::{Animate, Procedure, ToAnimatedZero};
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||||
|
@ -159,11 +159,6 @@ impl<B, T, U> ToAnimatedZero for ShapeSource<B, T, U> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<B, T, U> HasViewportPercentage for ShapeSource<B, T, U> {
|
|
||||||
#[inline]
|
|
||||||
fn has_viewport_percentage(&self) -> bool { false }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<L> ToCss for InsetRect<L>
|
impl<L> ToCss for InsetRect<L>
|
||||||
where L: ToCss + PartialEq
|
where L: ToCss + PartialEq
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@ use values::generics::rect::Rect;
|
||||||
|
|
||||||
/// A generic value for a single side of a `border-image-width` property.
|
/// A generic value for a single side of a `border-image-width` property.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue, ToCss)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||||
pub enum BorderImageSideWidth<LengthOrPercentage, Number> {
|
pub enum BorderImageSideWidth<LengthOrPercentage, Number> {
|
||||||
/// `<length-or-percentage>`
|
/// `<length-or-percentage>`
|
||||||
Length(LengthOrPercentage),
|
Length(LengthOrPercentage),
|
||||||
|
@ -22,7 +22,7 @@ pub enum BorderImageSideWidth<LengthOrPercentage, Number> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A generic value for the `border-image-slice` property.
|
/// A generic value for the `border-image-slice` property.
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub struct BorderImageSlice<NumberOrPercentage> {
|
pub struct BorderImageSlice<NumberOrPercentage> {
|
||||||
/// The offsets.
|
/// The offsets.
|
||||||
|
@ -35,7 +35,7 @@ pub struct BorderImageSlice<NumberOrPercentage> {
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/css-backgrounds-3/#border-radius
|
/// https://drafts.csswg.org/css-backgrounds-3/#border-radius
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, HasViewportPercentage)]
|
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||||
#[derive(PartialEq, ToComputedValue)]
|
#[derive(PartialEq, ToComputedValue)]
|
||||||
pub struct BorderRadius<LengthOrPercentage> {
|
pub struct BorderRadius<LengthOrPercentage> {
|
||||||
/// The top left radius.
|
/// The top left radius.
|
||||||
|
@ -50,7 +50,7 @@ pub struct BorderRadius<LengthOrPercentage> {
|
||||||
|
|
||||||
/// A generic value for `border-*-radius` longhand properties.
|
/// A generic value for `border-*-radius` longhand properties.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, HasViewportPercentage)]
|
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||||
#[derive(PartialEq, ToComputedValue)]
|
#[derive(PartialEq, ToComputedValue)]
|
||||||
pub struct BorderCornerRadius<L>(pub Size2D<L>);
|
pub struct BorderCornerRadius<L>(pub Size2D<L>);
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
//! Generic types for counters-related CSS values.
|
//! Generic types for counters-related CSS values.
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::{HasViewportPercentage, ToCss};
|
use style_traits::ToCss;
|
||||||
use values::CustomIdent;
|
use values::CustomIdent;
|
||||||
|
|
||||||
/// A generic value for the `counter-increment` property.
|
/// A generic value for the `counter-increment` property.
|
||||||
|
@ -22,10 +22,6 @@ impl<I> CounterIncrement<I> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<I> HasViewportPercentage for CounterIncrement<I> {
|
|
||||||
#[inline] fn has_viewport_percentage(&self) -> bool { false }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<I> ToCss for CounterIncrement<I>
|
impl<I> ToCss for CounterIncrement<I>
|
||||||
where
|
where
|
||||||
I: ToCss,
|
I: ToCss,
|
||||||
|
|
|
@ -11,7 +11,7 @@ use values::specified::url::SpecifiedUrl;
|
||||||
|
|
||||||
/// A generic value for a single `box-shadow`.
|
/// A generic value for a single `box-shadow`.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Animate, Clone, Debug, HasViewportPercentage, PartialEq)]
|
#[derive(Animate, Clone, Debug, PartialEq)]
|
||||||
#[derive(ToAnimatedValue, ToAnimatedZero)]
|
#[derive(ToAnimatedValue, ToAnimatedZero)]
|
||||||
pub struct BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength> {
|
pub struct BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength> {
|
||||||
/// The base shadow.
|
/// The base shadow.
|
||||||
|
@ -25,7 +25,7 @@ pub struct BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength> {
|
||||||
|
|
||||||
/// A generic value for a single `filter`.
|
/// A generic value for a single `filter`.
|
||||||
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToAnimatedValue, ToComputedValue, ToCss)]
|
#[derive(Clone, Debug, PartialEq, ToAnimatedValue, ToComputedValue, ToCss)]
|
||||||
pub enum Filter<Angle, Factor, Length, DropShadow> {
|
pub enum Filter<Angle, Factor, Length, DropShadow> {
|
||||||
/// `blur(<length>)`
|
/// `blur(<length>)`
|
||||||
#[css(function)]
|
#[css(function)]
|
||||||
|
@ -67,7 +67,7 @@ pub enum Filter<Angle, Factor, Length, DropShadow> {
|
||||||
/// Contrary to the canonical order from the spec, the color is serialised
|
/// Contrary to the canonical order from the spec, the color is serialised
|
||||||
/// first, like in Gecko and Webkit.
|
/// first, like in Gecko and Webkit.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, HasViewportPercentage)]
|
#[derive(Animate, Clone, ComputeSquaredDistance, Debug)]
|
||||||
#[derive(PartialEq, ToAnimatedValue, ToAnimatedZero, ToCss)]
|
#[derive(PartialEq, ToAnimatedValue, ToAnimatedZero, ToCss)]
|
||||||
pub struct SimpleShadow<Color, SizeLength, ShapeLength> {
|
pub struct SimpleShadow<Color, SizeLength, ShapeLength> {
|
||||||
/// Color.
|
/// Color.
|
||||||
|
|
|
@ -8,7 +8,7 @@ use values::computed::Percentage;
|
||||||
|
|
||||||
/// A generic value for the `flex-basis` property.
|
/// A generic value for the `flex-basis` property.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue, ToCss)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||||
pub enum FlexBasis<LengthOrPercentage> {
|
pub enum FlexBasis<LengthOrPercentage> {
|
||||||
/// `auto`
|
/// `auto`
|
||||||
Auto,
|
Auto,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
//! unshipped at some point in the future.
|
//! unshipped at some point in the future.
|
||||||
|
|
||||||
/// A generic value for scroll snap points.
|
/// A generic value for scroll snap points.
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue, ToCss)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||||
pub enum ScrollSnapPoint<LengthOrPercentage> {
|
pub enum ScrollSnapPoint<LengthOrPercentage> {
|
||||||
/// `none`
|
/// `none`
|
||||||
None,
|
None,
|
||||||
|
|
|
@ -130,7 +130,6 @@ impl Parse for GridLine {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for GridLine {}
|
impl ComputedValueAsSpecified for GridLine {}
|
||||||
no_viewport_percentage!(GridLine);
|
|
||||||
|
|
||||||
define_css_keyword_enum!{ TrackKeyword:
|
define_css_keyword_enum!{ TrackKeyword:
|
||||||
"auto" => Auto,
|
"auto" => Auto,
|
||||||
|
@ -182,7 +181,7 @@ impl<L: ToCss> ToCss for TrackBreadth<L> {
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/css-grid/#typedef-track-size
|
/// https://drafts.csswg.org/css-grid/#typedef-track-size
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub enum TrackSize<L> {
|
pub enum TrackSize<L> {
|
||||||
/// A flexible `<track-breadth>`
|
/// A flexible `<track-breadth>`
|
||||||
Breadth(TrackBreadth<L>),
|
Breadth(TrackBreadth<L>),
|
||||||
|
@ -372,7 +371,6 @@ impl Parse for RepeatCount {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for RepeatCount {}
|
impl ComputedValueAsSpecified for RepeatCount {}
|
||||||
no_viewport_percentage!(RepeatCount);
|
|
||||||
|
|
||||||
/// The structure containing `<line-names>` and `<track-size>` values.
|
/// The structure containing `<line-names>` and `<track-size>` values.
|
||||||
///
|
///
|
||||||
|
@ -666,7 +664,6 @@ impl ToCss for LineNameList {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for LineNameList {}
|
impl ComputedValueAsSpecified for LineNameList {}
|
||||||
no_viewport_percentage!(LineNameList);
|
|
||||||
|
|
||||||
/// Variants for `<grid-template-rows> | <grid-template-columns>`
|
/// Variants for `<grid-template-rows> | <grid-template-columns>`
|
||||||
/// Subgrid deferred to Level 2 spec due to lack of implementation.
|
/// Subgrid deferred to Level 2 spec due to lack of implementation.
|
||||||
|
|
|
@ -10,7 +10,7 @@ use Atom;
|
||||||
use cssparser::serialize_identifier;
|
use cssparser::serialize_identifier;
|
||||||
use custom_properties::SpecifiedValue;
|
use custom_properties::SpecifiedValue;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::{HasViewportPercentage, ToCss};
|
use style_traits::ToCss;
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
|
|
||||||
/// An [image].
|
/// An [image].
|
||||||
|
@ -36,7 +36,7 @@ pub enum Image<Gradient, MozImageRect, ImageUrl> {
|
||||||
/// A CSS gradient.
|
/// A CSS gradient.
|
||||||
/// https://drafts.csswg.org/css-images/#gradients
|
/// https://drafts.csswg.org/css-images/#gradients
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToComputedValue)]
|
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
|
||||||
pub struct Gradient<LineDirection, Length, LengthOrPercentage, Position, Color, Angle> {
|
pub struct Gradient<LineDirection, Length, LengthOrPercentage, Position, Color, Angle> {
|
||||||
/// Gradients can be linear or radial.
|
/// Gradients can be linear or radial.
|
||||||
pub kind: GradientKind<LineDirection, Length, LengthOrPercentage, Position, Angle>,
|
pub kind: GradientKind<LineDirection, Length, LengthOrPercentage, Position, Angle>,
|
||||||
|
@ -50,7 +50,7 @@ pub struct Gradient<LineDirection, Length, LengthOrPercentage, Position, Color,
|
||||||
pub compat_mode: CompatMode,
|
pub compat_mode: CompatMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
/// Whether we used the modern notation or the compatibility `-webkit`, `-moz` prefixes.
|
/// Whether we used the modern notation or the compatibility `-webkit`, `-moz` prefixes.
|
||||||
pub enum CompatMode {
|
pub enum CompatMode {
|
||||||
|
@ -64,7 +64,7 @@ pub enum CompatMode {
|
||||||
|
|
||||||
/// A gradient kind.
|
/// A gradient kind.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
|
||||||
pub enum GradientKind<LineDirection, Length, LengthOrPercentage, Position, Angle> {
|
pub enum GradientKind<LineDirection, Length, LengthOrPercentage, Position, Angle> {
|
||||||
/// A linear gradient.
|
/// A linear gradient.
|
||||||
Linear(LineDirection),
|
Linear(LineDirection),
|
||||||
|
@ -73,7 +73,7 @@ pub enum GradientKind<LineDirection, Length, LengthOrPercentage, Position, Angle
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A radial gradient's ending shape.
|
/// A radial gradient's ending shape.
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue, ToCss)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub enum EndingShape<Length, LengthOrPercentage> {
|
pub enum EndingShape<Length, LengthOrPercentage> {
|
||||||
/// A circular gradient.
|
/// A circular gradient.
|
||||||
|
@ -83,7 +83,7 @@ pub enum EndingShape<Length, LengthOrPercentage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A circle shape.
|
/// A circle shape.
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub enum Circle<Length> {
|
pub enum Circle<Length> {
|
||||||
/// A circle radius.
|
/// A circle radius.
|
||||||
|
@ -93,7 +93,7 @@ pub enum Circle<Length> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An ellipse shape.
|
/// An ellipse shape.
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue, ToCss)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub enum Ellipse<LengthOrPercentage> {
|
pub enum Ellipse<LengthOrPercentage> {
|
||||||
/// An ellipse pair of radii.
|
/// An ellipse pair of radii.
|
||||||
|
@ -111,13 +111,12 @@ define_css_keyword_enum!(ShapeExtent:
|
||||||
"contain" => Contain,
|
"contain" => Contain,
|
||||||
"cover" => Cover
|
"cover" => Cover
|
||||||
);
|
);
|
||||||
no_viewport_percentage!(ShapeExtent);
|
|
||||||
impl ComputedValueAsSpecified for ShapeExtent {}
|
impl ComputedValueAsSpecified for ShapeExtent {}
|
||||||
|
|
||||||
/// A gradient item.
|
/// A gradient item.
|
||||||
/// https://drafts.csswg.org/css-images-4/#color-stop-syntax
|
/// https://drafts.csswg.org/css-images-4/#color-stop-syntax
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue, ToCss)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||||
pub enum GradientItem<Color, LengthOrPercentage> {
|
pub enum GradientItem<Color, LengthOrPercentage> {
|
||||||
/// A color stop.
|
/// A color stop.
|
||||||
ColorStop(ColorStop<Color, LengthOrPercentage>),
|
ColorStop(ColorStop<Color, LengthOrPercentage>),
|
||||||
|
@ -127,7 +126,7 @@ pub enum GradientItem<Color, LengthOrPercentage> {
|
||||||
|
|
||||||
/// A color stop.
|
/// A color stop.
|
||||||
/// https://drafts.csswg.org/css-images/#typedef-color-stop-list
|
/// https://drafts.csswg.org/css-images/#typedef-color-stop-list
|
||||||
#[derive(Clone, Copy, HasViewportPercentage, PartialEq, ToComputedValue, ToCss)]
|
#[derive(Clone, Copy, PartialEq, ToComputedValue, ToCss)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub struct ColorStop<Color, LengthOrPercentage> {
|
pub struct ColorStop<Color, LengthOrPercentage> {
|
||||||
/// The color of this stop.
|
/// The color of this stop.
|
||||||
|
@ -215,17 +214,6 @@ impl<G, R, U> ToCss for Image<G, R, U>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<G, R, U> HasViewportPercentage for Image<G, R, U>
|
|
||||||
where G: HasViewportPercentage
|
|
||||||
{
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
match *self {
|
|
||||||
Image::Gradient(ref gradient) => gradient.has_viewport_percentage(),
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<D, L, LoP, P, C, A> ToCss for Gradient<D, L, LoP, P, C, A>
|
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
|
where D: LineDirection, L: ToCss, LoP: ToCss, P: ToCss, C: ToCss, A: ToCss
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,7 +92,6 @@ impl CounterStyleOrNone {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(CounterStyleOrNone);
|
|
||||||
|
|
||||||
impl Parse for CounterStyleOrNone {
|
impl Parse for CounterStyleOrNone {
|
||||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||||
|
@ -268,12 +267,12 @@ impl ToCss for FontSettingTagFloat {
|
||||||
|
|
||||||
/// A wrapper of Non-negative values.
|
/// A wrapper of Non-negative values.
|
||||||
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
||||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, HasViewportPercentage)]
|
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||||
#[derive(PartialEq, PartialOrd, ToAnimatedZero, ToComputedValue, ToCss)]
|
#[derive(PartialEq, PartialOrd, ToAnimatedZero, ToComputedValue, ToCss)]
|
||||||
pub struct NonNegative<T>(pub T);
|
pub struct NonNegative<T>(pub T);
|
||||||
|
|
||||||
/// A wrapper of greater-than-or-equal-to-one values.
|
/// A wrapper of greater-than-or-equal-to-one values.
|
||||||
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
||||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, HasViewportPercentage)]
|
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||||
#[derive(PartialEq, PartialOrd, ToAnimatedZero, ToComputedValue, ToCss)]
|
#[derive(PartialEq, PartialOrd, ToAnimatedZero, ToComputedValue, ToCss)]
|
||||||
pub struct GreaterThanOrEqualToOne<T>(pub T);
|
pub struct GreaterThanOrEqualToOne<T>(pub T);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
/// A generic type for representing a CSS [position](https://drafts.csswg.org/css-values/#position).
|
/// A generic type for representing a CSS [position](https://drafts.csswg.org/css-values/#position).
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||||
#[derive(HasViewportPercentage, PartialEq, ToAnimatedZero, ToComputedValue)]
|
#[derive(PartialEq, ToAnimatedZero, ToComputedValue)]
|
||||||
pub struct Position<H, V> {
|
pub struct Position<H, V> {
|
||||||
/// The horizontal component of position.
|
/// The horizontal component of position.
|
||||||
pub horizontal: H,
|
pub horizontal: H,
|
||||||
|
|
|
@ -13,7 +13,7 @@ use style_traits::{ToCss, ParseError};
|
||||||
/// serialize as few components as possible, like for example in `border-width`.
|
/// serialize as few components as possible, like for example in `border-width`.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||||
#[derive(HasViewportPercentage, PartialEq, ToComputedValue)]
|
#[derive(PartialEq, ToComputedValue)]
|
||||||
pub struct Rect<T>(pub T, pub T, pub T, pub T);
|
pub struct Rect<T>(pub T, pub T, pub T, pub T);
|
||||||
|
|
||||||
impl<T> Rect<T> {
|
impl<T> Rect<T> {
|
||||||
|
|
|
@ -104,7 +104,7 @@ impl<ColorType: Parse, UrlPaintServer: Parse> Parse for SVGPaint<ColorType, UrlP
|
||||||
/// A value of <length> | <percentage> | <number> for svg which allow unitless length.
|
/// A value of <length> | <percentage> | <number> for svg which allow unitless length.
|
||||||
/// https://www.w3.org/TR/SVG11/painting.html#StrokeProperties
|
/// https://www.w3.org/TR/SVG11/painting.html#StrokeProperties
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToAnimatedValue)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToAnimatedValue)]
|
||||||
#[derive(ToAnimatedZero, ToComputedValue, ToCss)]
|
#[derive(ToAnimatedZero, ToComputedValue, ToCss)]
|
||||||
pub enum SvgLengthOrPercentageOrNumber<LengthOrPercentage, Number> {
|
pub enum SvgLengthOrPercentageOrNumber<LengthOrPercentage, Number> {
|
||||||
/// <length> | <percentage>
|
/// <length> | <percentage>
|
||||||
|
@ -187,7 +187,7 @@ impl <LengthOrPercentageType: Parse, NumberType: Parse> Parse for
|
||||||
/// An SVG length value supports `context-value` in addition to length.
|
/// An SVG length value supports `context-value` in addition to length.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, PartialEq)]
|
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, PartialEq)]
|
||||||
#[derive(HasViewportPercentage, ToAnimatedValue, ToAnimatedZero)]
|
#[derive(ToAnimatedValue, ToAnimatedZero)]
|
||||||
#[derive(ToComputedValue, ToCss)]
|
#[derive(ToComputedValue, ToCss)]
|
||||||
pub enum SVGLength<LengthType> {
|
pub enum SVGLength<LengthType> {
|
||||||
/// `<length> | <percentage> | <number>`
|
/// `<length> | <percentage> | <number>`
|
||||||
|
@ -198,7 +198,7 @@ pub enum SVGLength<LengthType> {
|
||||||
|
|
||||||
/// Generic value for stroke-dasharray.
|
/// Generic value for stroke-dasharray.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, ComputeSquaredDistance, Debug, HasViewportPercentage, PartialEq, ToAnimatedValue, ToComputedValue)]
|
#[derive(Clone, ComputeSquaredDistance, Debug, PartialEq, ToAnimatedValue, ToComputedValue)]
|
||||||
pub enum SVGStrokeDashArray<LengthType> {
|
pub enum SVGStrokeDashArray<LengthType> {
|
||||||
/// `[ <length> | <percentage> | <number> ]#`
|
/// `[ <length> | <percentage> | <number> ]#`
|
||||||
Values(Vec<LengthType>),
|
Values(Vec<LengthType>),
|
||||||
|
@ -232,7 +232,7 @@ impl<LengthType> ToCss for SVGStrokeDashArray<LengthType> where LengthType: ToCs
|
||||||
/// An SVG opacity value accepts `context-{fill,stroke}-opacity` in
|
/// An SVG opacity value accepts `context-{fill,stroke}-opacity` in
|
||||||
/// addition to opacity value.
|
/// addition to opacity value.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, HasViewportPercentage)]
|
#[derive(Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||||
#[derive(PartialEq, ToAnimatedZero, ToComputedValue, ToCss)]
|
#[derive(PartialEq, ToAnimatedZero, ToComputedValue, ToCss)]
|
||||||
pub enum SVGOpacity<OpacityType> {
|
pub enum SVGOpacity<OpacityType> {
|
||||||
/// `<opacity-value>`
|
/// `<opacity-value>`
|
||||||
|
|
|
@ -13,7 +13,7 @@ use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||||
|
|
||||||
/// A generic value for the `initial-letter` property.
|
/// A generic value for the `initial-letter` property.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue, ToCss)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||||
pub enum InitialLetter<Number, Integer> {
|
pub enum InitialLetter<Number, Integer> {
|
||||||
/// `normal`
|
/// `normal`
|
||||||
Normal,
|
Normal,
|
||||||
|
@ -31,7 +31,7 @@ impl<N, I> InitialLetter<N, I> {
|
||||||
|
|
||||||
/// A generic spacing value for the `letter-spacing` and `word-spacing` properties.
|
/// A generic spacing value for the `letter-spacing` and `word-spacing` properties.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue, ToCss)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||||
pub enum Spacing<Value> {
|
pub enum Spacing<Value> {
|
||||||
/// `normal`
|
/// `normal`
|
||||||
Normal,
|
Normal,
|
||||||
|
@ -111,7 +111,7 @@ where
|
||||||
/// A generic value for the `line-height` property.
|
/// A generic value for the `line-height` property.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||||
#[derive(HasViewportPercentage, PartialEq, ToAnimatedValue, ToCss)]
|
#[derive(PartialEq, ToAnimatedValue, ToCss)]
|
||||||
pub enum LineHeight<Number, LengthOrPercentage> {
|
pub enum LineHeight<Number, LengthOrPercentage> {
|
||||||
/// `normal`
|
/// `normal`
|
||||||
Normal,
|
Normal,
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
//! Generic types for CSS values that are related to transformations.
|
//! Generic types for CSS values that are related to transformations.
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::{HasViewportPercentage, ToCss};
|
use style_traits::ToCss;
|
||||||
use values::CSSFloat;
|
use values::CSSFloat;
|
||||||
|
|
||||||
/// A generic 2D transformation matrix.
|
/// A generic 2D transformation matrix.
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue, ToCss)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||||
#[css(comma, function)]
|
#[css(comma, function)]
|
||||||
pub struct Matrix<T, U = T> {
|
pub struct Matrix<T, U = T> {
|
||||||
pub a: T,
|
pub a: T,
|
||||||
|
@ -24,7 +24,7 @@ pub struct Matrix<T, U = T> {
|
||||||
|
|
||||||
/// A generic transform origin.
|
/// A generic transform origin.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, HasViewportPercentage)]
|
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||||
#[derive(PartialEq, ToAnimatedZero, ToComputedValue, ToCss)]
|
#[derive(PartialEq, ToAnimatedZero, ToComputedValue, ToCss)]
|
||||||
pub struct TransformOrigin<H, V, Depth> {
|
pub struct TransformOrigin<H, V, Depth> {
|
||||||
/// The horizontal origin.
|
/// The horizontal origin.
|
||||||
|
@ -78,10 +78,6 @@ impl<H, V, D> TransformOrigin<H, V, D> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<I, N> HasViewportPercentage for TimingFunction<I, N> {
|
|
||||||
fn has_viewport_percentage(&self) -> bool { false }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<Integer, Number> TimingFunction<Integer, Number> {
|
impl<Integer, Number> TimingFunction<Integer, Number> {
|
||||||
/// `ease`
|
/// `ease`
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -54,7 +54,7 @@ pub fn serialize_dimension<W>(value: CSSFloat, unit: &str, dest: &mut W)
|
||||||
|
|
||||||
/// Convenience void type to disable some properties and values through types.
|
/// Convenience void type to disable some properties and values through types.
|
||||||
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue, ToCss)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||||
pub enum Impossible {}
|
pub enum Impossible {}
|
||||||
|
|
||||||
impl Parse for Impossible {
|
impl Parse for Impossible {
|
||||||
|
@ -68,7 +68,7 @@ impl Parse for Impossible {
|
||||||
|
|
||||||
/// A struct representing one of two kinds of values.
|
/// A struct representing one of two kinds of values.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, HasViewportPercentage)]
|
#[derive(Animate, Clone, ComputeSquaredDistance, Copy)]
|
||||||
#[derive(PartialEq, ToAnimatedValue, ToAnimatedZero, ToComputedValue, ToCss)]
|
#[derive(PartialEq, ToAnimatedValue, ToAnimatedZero, ToComputedValue, ToCss)]
|
||||||
pub enum Either<A, B> {
|
pub enum Either<A, B> {
|
||||||
/// The first value.
|
/// The first value.
|
||||||
|
@ -196,4 +196,3 @@ define_css_keyword_enum!(ExtremumLength:
|
||||||
"-moz-min-content" => MinContent,
|
"-moz-min-content" => MinContent,
|
||||||
"-moz-fit-content" => FitContent,
|
"-moz-fit-content" => FitContent,
|
||||||
"-moz-available" => FillAvailable);
|
"-moz-available" => FillAvailable);
|
||||||
no_viewport_percentage!(ExtremumLength);
|
|
||||||
|
|
|
@ -173,7 +173,6 @@ impl ToCss for AlignJustifyContent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(AlignJustifyContent);
|
|
||||||
|
|
||||||
impl Parse for AlignJustifyContent {
|
impl Parse for AlignJustifyContent {
|
||||||
// normal | <baseline-position> |
|
// normal | <baseline-position> |
|
||||||
|
@ -223,7 +222,6 @@ impl AlignJustifySelf {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(AlignJustifySelf);
|
|
||||||
|
|
||||||
impl Parse for AlignJustifySelf {
|
impl Parse for AlignJustifySelf {
|
||||||
// auto | normal | stretch | <baseline-position> |
|
// auto | normal | stretch | <baseline-position> |
|
||||||
|
@ -261,7 +259,6 @@ impl AlignItems {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(AlignItems);
|
|
||||||
|
|
||||||
impl Parse for AlignItems {
|
impl Parse for AlignItems {
|
||||||
// normal | stretch | <baseline-position> |
|
// normal | stretch | <baseline-position> |
|
||||||
|
@ -305,7 +302,6 @@ impl JustifyItems {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(JustifyItems);
|
|
||||||
|
|
||||||
impl Parse for JustifyItems {
|
impl Parse for JustifyItems {
|
||||||
// auto | normal | stretch | <baseline-position> |
|
// auto | normal | stretch | <baseline-position> |
|
||||||
|
|
|
@ -20,7 +20,7 @@ use values::specified::calc::CalcNode;
|
||||||
/// value serialization. Therefore we are storing a computed angle inside
|
/// value serialization. Therefore we are storing a computed angle inside
|
||||||
/// to hold the actual value and its unit.
|
/// to hold the actual value and its unit.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
pub struct Angle {
|
pub struct Angle {
|
||||||
value: ComputedAngle,
|
value: ComputedAngle,
|
||||||
was_calc: bool,
|
was_calc: bool,
|
||||||
|
|
|
@ -18,7 +18,7 @@ use values::specified::length::{Length, LengthOrPercentage};
|
||||||
|
|
||||||
/// A specified value for a single side of the `border-width` property.
|
/// A specified value for a single side of the `border-width` property.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||||
pub enum BorderSideWidth {
|
pub enum BorderSideWidth {
|
||||||
/// `thin`
|
/// `thin`
|
||||||
Thin,
|
Thin,
|
||||||
|
|
|
@ -11,7 +11,7 @@ use cssparser::{Parser, Token, BasicParseError};
|
||||||
use parser::ParserContext;
|
use parser::ParserContext;
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::{HasViewportPercentage, ToCss, ParseError, StyleParseError};
|
use style_traits::{ToCss, ParseError, StyleParseError};
|
||||||
use style_traits::values::specified::AllowedLengthType;
|
use style_traits::values::specified::AllowedLengthType;
|
||||||
use values::{CSSInteger, CSSFloat};
|
use values::{CSSInteger, CSSFloat};
|
||||||
use values::computed;
|
use values::computed;
|
||||||
|
@ -82,13 +82,6 @@ pub struct CalcLengthOrPercentage {
|
||||||
pub mozmm: Option<CSSFloat>,
|
pub mozmm: Option<CSSFloat>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HasViewportPercentage for CalcLengthOrPercentage {
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
self.vw.is_some() || self.vh.is_some() ||
|
|
||||||
self.vmin.is_some() || self.vmax.is_some()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToCss for CalcLengthOrPercentage {
|
impl ToCss for CalcLengthOrPercentage {
|
||||||
/// https://drafts.csswg.org/css-values/#calc-serialize
|
/// https://drafts.csswg.org/css-values/#calc-serialize
|
||||||
///
|
///
|
||||||
|
|
|
@ -44,7 +44,6 @@ pub enum Color {
|
||||||
InheritFromBodyQuirk,
|
InheritFromBodyQuirk,
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(Color);
|
|
||||||
|
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
mod gecko {
|
mod gecko {
|
||||||
|
@ -305,7 +304,6 @@ impl ToComputedValue for Color {
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub struct RGBAColor(pub Color);
|
pub struct RGBAColor(pub Color);
|
||||||
|
|
||||||
no_viewport_percentage!(RGBAColor);
|
|
||||||
|
|
||||||
impl Parse for RGBAColor {
|
impl Parse for RGBAColor {
|
||||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||||
|
|
|
@ -35,7 +35,7 @@ pub type Filter = GenericFilter<Angle, Factor, NonNegativeLength, SimpleShadow>;
|
||||||
pub type Filter = GenericFilter<Angle, Factor, NonNegativeLength, Impossible>;
|
pub type Filter = GenericFilter<Angle, Factor, NonNegativeLength, Impossible>;
|
||||||
|
|
||||||
/// A value for the `<factor>` parts in `Filter`.
|
/// A value for the `<factor>` parts in `Filter`.
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub struct Factor(NumberOrPercentage);
|
pub struct Factor(NumberOrPercentage);
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ use cssparser::{Parser, Token, BasicParseError};
|
||||||
use parser::{Parse, ParserContext};
|
use parser::{Parse, ParserContext};
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use style_traits::{HasViewportPercentage, ParseError, StyleParseError};
|
use style_traits::{ParseError, StyleParseError};
|
||||||
use values::{CSSFloat, CustomIdent};
|
use values::{CSSFloat, CustomIdent};
|
||||||
use values::generics::grid::{GridTemplateComponent, RepeatCount, TrackBreadth, TrackKeyword, TrackRepeat};
|
use values::generics::grid::{GridTemplateComponent, RepeatCount, TrackBreadth, TrackKeyword, TrackRepeat};
|
||||||
use values::generics::grid::{LineNameList, TrackSize, TrackList, TrackListType};
|
use values::generics::grid::{LineNameList, TrackSize, TrackList, TrackListType};
|
||||||
|
@ -38,17 +38,6 @@ impl Parse for TrackBreadth<LengthOrPercentage> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HasViewportPercentage for TrackBreadth<LengthOrPercentage> {
|
|
||||||
#[inline]
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
if let TrackBreadth::Breadth(ref lop) = *self {
|
|
||||||
lop.has_viewport_percentage()
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Parse for TrackSize<LengthOrPercentage> {
|
impl Parse for TrackSize<LengthOrPercentage> {
|
||||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||||
if let Ok(b) = input.try(|i| TrackBreadth::parse(context, i)) {
|
if let Ok(b) = input.try(|i| TrackBreadth::parse(context, i)) {
|
||||||
|
@ -175,13 +164,6 @@ impl TrackRepeat<LengthOrPercentage> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HasViewportPercentage for TrackRepeat<LengthOrPercentage> {
|
|
||||||
#[inline]
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
self.track_sizes.iter().any(|ref v| v.has_viewport_percentage())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Parse for TrackList<LengthOrPercentage> {
|
impl Parse for TrackList<LengthOrPercentage> {
|
||||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||||
// Merge the line names while parsing values. The resulting values will
|
// Merge the line names while parsing values. The resulting values will
|
||||||
|
@ -278,13 +260,6 @@ impl Parse for TrackList<LengthOrPercentage> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HasViewportPercentage for TrackList<LengthOrPercentage> {
|
|
||||||
#[inline]
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
self.values.iter().any(|ref v| v.has_viewport_percentage())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Parse for GridTemplateComponent<LengthOrPercentage> {
|
impl Parse for GridTemplateComponent<LengthOrPercentage> {
|
||||||
// FIXME: Derive Parse (probably with None_)
|
// FIXME: Derive Parse (probably with None_)
|
||||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||||
|
@ -307,13 +282,3 @@ impl GridTemplateComponent<LengthOrPercentage> {
|
||||||
LineNameList::parse(context, input).map(GridTemplateComponent::Subgrid)
|
LineNameList::parse(context, input).map(GridTemplateComponent::Subgrid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HasViewportPercentage for GridTemplateComponent<LengthOrPercentage> {
|
|
||||||
#[inline]
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
match *self {
|
|
||||||
GridTemplateComponent::TrackList(ref l) => l.has_viewport_percentage(),
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ pub type GradientKind = GenericGradientKind<
|
||||||
>;
|
>;
|
||||||
|
|
||||||
/// A specified gradient line direction.
|
/// A specified gradient line direction.
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub enum LineDirection {
|
pub enum LineDirection {
|
||||||
/// An angular direction.
|
/// An angular direction.
|
||||||
|
@ -105,7 +105,7 @@ pub enum LineDirection {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A binary enum to hold either Position or LegacyPosition.
|
/// A binary enum to hold either Position or LegacyPosition.
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
pub enum GradientPosition {
|
pub enum GradientPosition {
|
||||||
/// 1, 2, 3, 4-valued <position>.
|
/// 1, 2, 3, 4-valued <position>.
|
||||||
|
|
|
@ -14,7 +14,7 @@ use parser::{Parse, ParserContext};
|
||||||
use std::{cmp, fmt, mem};
|
use std::{cmp, fmt, mem};
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
use std::ops::Mul;
|
use std::ops::Mul;
|
||||||
use style_traits::{HasViewportPercentage, ToCss, ParseError, StyleParseError};
|
use style_traits::{ToCss, ParseError, StyleParseError};
|
||||||
use style_traits::values::specified::AllowedLengthType;
|
use style_traits::values::specified::AllowedLengthType;
|
||||||
use stylesheets::CssRuleType;
|
use stylesheets::CssRuleType;
|
||||||
use super::{AllowQuirks, Number, ToComputedValue, Percentage};
|
use super::{AllowQuirks, Number, ToComputedValue, Percentage};
|
||||||
|
@ -183,12 +183,6 @@ pub enum ViewportPercentageLength {
|
||||||
Vmax(CSSFloat)
|
Vmax(CSSFloat)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HasViewportPercentage for ViewportPercentageLength {
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToCss for ViewportPercentageLength {
|
impl ToCss for ViewportPercentageLength {
|
||||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||||
match *self {
|
match *self {
|
||||||
|
@ -422,15 +416,6 @@ pub enum NoCalcLength {
|
||||||
Physical(PhysicalLength),
|
Physical(PhysicalLength),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HasViewportPercentage for NoCalcLength {
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
match *self {
|
|
||||||
NoCalcLength::ViewportPercentage(_) => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToCss for NoCalcLength {
|
impl ToCss for NoCalcLength {
|
||||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||||
match *self {
|
match *self {
|
||||||
|
@ -545,7 +530,7 @@ impl NoCalcLength {
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/css-values/#lengths
|
/// https://drafts.csswg.org/css-values/#lengths
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||||
pub enum Length {
|
pub enum Length {
|
||||||
/// The internal length type that cannot parse `calc`
|
/// The internal length type that cannot parse `calc`
|
||||||
NoCalc(NoCalcLength),
|
NoCalc(NoCalcLength),
|
||||||
|
@ -759,7 +744,7 @@ pub type NonNegativeLengthOrNumber = Either<NonNegativeLength, NonNegativeNumber
|
||||||
/// A length or a percentage value.
|
/// A length or a percentage value.
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||||
pub enum LengthOrPercentage {
|
pub enum LengthOrPercentage {
|
||||||
Length(NoCalcLength),
|
Length(NoCalcLength),
|
||||||
Percentage(computed::Percentage),
|
Percentage(computed::Percentage),
|
||||||
|
@ -929,7 +914,7 @@ impl LengthOrPercentage {
|
||||||
/// Either a `<length>`, a `<percentage>`, or the `auto` keyword.
|
/// Either a `<length>`, a `<percentage>`, or the `auto` keyword.
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||||
pub enum LengthOrPercentageOrAuto {
|
pub enum LengthOrPercentageOrAuto {
|
||||||
Length(NoCalcLength),
|
Length(NoCalcLength),
|
||||||
Percentage(computed::Percentage),
|
Percentage(computed::Percentage),
|
||||||
|
@ -1045,7 +1030,7 @@ impl LengthOrPercentageOrAuto {
|
||||||
|
|
||||||
/// Either a `<length>`, a `<percentage>`, or the `none` keyword.
|
/// Either a `<length>`, a `<percentage>`, or the `none` keyword.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub enum LengthOrPercentageOrNone {
|
pub enum LengthOrPercentageOrNone {
|
||||||
Length(NoCalcLength),
|
Length(NoCalcLength),
|
||||||
|
@ -1193,7 +1178,7 @@ impl LengthOrNumber {
|
||||||
/// `auto`, and cannot be `none`.
|
/// `auto`, and cannot be `none`.
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||||
pub enum MozLength {
|
pub enum MozLength {
|
||||||
LengthOrPercentageOrAuto(LengthOrPercentageOrAuto),
|
LengthOrPercentageOrAuto(LengthOrPercentageOrAuto),
|
||||||
ExtremumLength(ExtremumLength),
|
ExtremumLength(ExtremumLength),
|
||||||
|
@ -1219,7 +1204,7 @@ impl MozLength {
|
||||||
/// A value suitable for a `max-width` or `max-height` property.
|
/// A value suitable for a `max-width` or `max-height` property.
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||||
pub enum MaxLength {
|
pub enum MaxLength {
|
||||||
LengthOrPercentageOrNone(LengthOrPercentageOrNone),
|
LengthOrPercentageOrNone(LengthOrPercentageOrNone),
|
||||||
ExtremumLength(ExtremumLength),
|
ExtremumLength(ExtremumLength),
|
||||||
|
|
|
@ -102,7 +102,6 @@ impl Eq for SpecifiedUrl {}
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
impl ComputedValueAsSpecified for SpecifiedUrl {}
|
impl ComputedValueAsSpecified for SpecifiedUrl {}
|
||||||
|
|
||||||
no_viewport_percentage!(SpecifiedUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse an `<integer>` value, handling `calc()` correctly.
|
/// Parse an `<integer>` value, handling `calc()` correctly.
|
||||||
|
@ -171,7 +170,6 @@ define_numbered_css_keyword_enum! { BorderStyle:
|
||||||
"outset" => outset = 2,
|
"outset" => outset = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(BorderStyle);
|
|
||||||
|
|
||||||
impl BorderStyle {
|
impl BorderStyle {
|
||||||
/// Whether this border style is either none or hidden.
|
/// Whether this border style is either none or hidden.
|
||||||
|
@ -191,7 +189,6 @@ pub struct Number {
|
||||||
calc_clamping_mode: Option<AllowedNumericType>,
|
calc_clamping_mode: Option<AllowedNumericType>,
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(Number);
|
|
||||||
|
|
||||||
impl Parse for Number {
|
impl Parse for Number {
|
||||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||||
|
@ -296,7 +293,6 @@ pub enum NumberOrPercentage {
|
||||||
Number(Number),
|
Number(Number),
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(NumberOrPercentage);
|
|
||||||
|
|
||||||
impl NumberOrPercentage {
|
impl NumberOrPercentage {
|
||||||
fn parse_with_clamping_mode<'i, 't>(
|
fn parse_with_clamping_mode<'i, 't>(
|
||||||
|
@ -329,7 +325,6 @@ impl Parse for NumberOrPercentage {
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, ToCss)]
|
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, ToCss)]
|
||||||
pub struct Opacity(Number);
|
pub struct Opacity(Number);
|
||||||
|
|
||||||
no_viewport_percentage!(Opacity);
|
|
||||||
|
|
||||||
impl Parse for Opacity {
|
impl Parse for Opacity {
|
||||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||||
|
@ -389,7 +384,6 @@ impl Integer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(Integer);
|
|
||||||
|
|
||||||
impl Parse for Integer {
|
impl Parse for Integer {
|
||||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||||
|
@ -498,7 +492,7 @@ pub type LengthOrPercentageOrNumber = Either<Number, LengthOrPercentage>;
|
||||||
/// NonNegativeLengthOrPercentage | NonNegativeNumber
|
/// NonNegativeLengthOrPercentage | NonNegativeNumber
|
||||||
pub type NonNegativeLengthOrPercentageOrNumber = Either<NonNegativeNumber, NonNegativeLengthOrPercentage>;
|
pub type NonNegativeLengthOrPercentageOrNumber = Either<NonNegativeNumber, NonNegativeLengthOrPercentage>;
|
||||||
|
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
/// rect(<top>, <left>, <bottom>, <right>) used by clip and image-region
|
/// rect(<top>, <left>, <bottom>, <right>) used by clip and image-region
|
||||||
pub struct ClipRect {
|
pub struct ClipRect {
|
||||||
|
|
|
@ -28,7 +28,6 @@ pub struct Percentage {
|
||||||
calc_clamping_mode: Option<AllowedNumericType>,
|
calc_clamping_mode: Option<AllowedNumericType>,
|
||||||
}
|
}
|
||||||
|
|
||||||
no_viewport_percentage!(Percentage);
|
|
||||||
|
|
||||||
impl ToCss for Percentage {
|
impl ToCss for Percentage {
|
||||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
use cssparser::Parser;
|
use cssparser::Parser;
|
||||||
use parser::{Parse, ParserContext};
|
use parser::{Parse, ParserContext};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::{HasViewportPercentage, ToCss, ParseError};
|
use style_traits::{ToCss, ParseError};
|
||||||
use values::computed::{CalcLengthOrPercentage, LengthOrPercentage as ComputedLengthOrPercentage};
|
use values::computed::{CalcLengthOrPercentage, LengthOrPercentage as ComputedLengthOrPercentage};
|
||||||
use values::computed::{Context, Percentage, ToComputedValue};
|
use values::computed::{Context, Percentage, ToComputedValue};
|
||||||
use values::generics::position::Position as GenericPosition;
|
use values::generics::position::Position as GenericPosition;
|
||||||
|
@ -156,18 +156,6 @@ impl ToCss for Position {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S> HasViewportPercentage for PositionComponent<S> {
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
match *self {
|
|
||||||
PositionComponent::Length(ref lop) |
|
|
||||||
PositionComponent::Side(_, Some(ref lop)) => {
|
|
||||||
lop.has_viewport_percentage()
|
|
||||||
},
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<S: Parse> Parse for PositionComponent<S> {
|
impl<S: Parse> Parse for PositionComponent<S> {
|
||||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||||
Self::parse_quirky(context, input, AllowQuirks::No)
|
Self::parse_quirky(context, input, AllowQuirks::No)
|
||||||
|
|
|
@ -15,7 +15,6 @@ use values::specified::color::RGBAColor;
|
||||||
/// Specified SVG Paint value
|
/// Specified SVG Paint value
|
||||||
pub type SVGPaint = generic::SVGPaint<RGBAColor, SpecifiedUrl>;
|
pub type SVGPaint = generic::SVGPaint<RGBAColor, SpecifiedUrl>;
|
||||||
|
|
||||||
no_viewport_percentage!(SVGPaint);
|
|
||||||
|
|
||||||
/// Specified SVG Paint Kind value
|
/// Specified SVG Paint Kind value
|
||||||
pub type SVGPaintKind = generic::SVGPaintKind<RGBAColor, SpecifiedUrl>;
|
pub type SVGPaintKind = generic::SVGPaintKind<RGBAColor, SpecifiedUrl>;
|
||||||
|
|
|
@ -16,7 +16,7 @@ use values::computed::time::Time as ComputedTime;
|
||||||
use values::specified::calc::CalcNode;
|
use values::specified::calc::CalcNode;
|
||||||
|
|
||||||
/// A time value according to CSS-VALUES § 6.2.
|
/// A time value according to CSS-VALUES § 6.2.
|
||||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub struct Time {
|
pub struct Time {
|
||||||
seconds: CSSFloat,
|
seconds: CSSFloat,
|
||||||
|
@ -25,7 +25,7 @@ pub struct Time {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A time unit.
|
/// A time unit.
|
||||||
#[derive(Clone, Copy, Debug, Eq, HasViewportPercentage, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub enum TimeUnit {
|
pub enum TimeUnit {
|
||||||
/// `s`
|
/// `s`
|
||||||
|
|
|
@ -22,7 +22,7 @@ pub type TransformOrigin = GenericTransformOrigin<OriginComponent<X>, OriginComp
|
||||||
|
|
||||||
/// The specified value of a component of a CSS `<transform-origin>`.
|
/// The specified value of a component of a CSS `<transform-origin>`.
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||||
pub enum OriginComponent<S> {
|
pub enum OriginComponent<S> {
|
||||||
/// `center`
|
/// `center`
|
||||||
Center,
|
Center,
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* 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 cg;
|
|
||||||
use quote;
|
|
||||||
use syn;
|
|
||||||
use synstructure;
|
|
||||||
|
|
||||||
pub fn derive(input: syn::DeriveInput) -> quote::Tokens {
|
|
||||||
let name = &input.ident;
|
|
||||||
let trait_path = &["style_traits", "HasViewportPercentage"];
|
|
||||||
let (impl_generics, ty_generics, mut where_clause) =
|
|
||||||
cg::trait_parts(&input, trait_path);
|
|
||||||
|
|
||||||
let style = synstructure::BindStyle::Ref.into();
|
|
||||||
let match_body = synstructure::each_variant(&input, &style, |bindings, _| {
|
|
||||||
let (first, rest) = match bindings.split_first() {
|
|
||||||
None => return Some(quote!(false)),
|
|
||||||
Some(pair) => pair,
|
|
||||||
};
|
|
||||||
where_clause.add_trait_bound(&first.field.ty);
|
|
||||||
let mut expr = quote!(::style_traits::HasViewportPercentage::has_viewport_percentage(#first));
|
|
||||||
for binding in rest {
|
|
||||||
where_clause.add_trait_bound(&binding.field.ty);
|
|
||||||
expr = quote!(#expr || ::style_traits::HasViewportPercentage::has_viewport_percentage(#binding));
|
|
||||||
}
|
|
||||||
Some(expr)
|
|
||||||
});
|
|
||||||
|
|
||||||
quote! {
|
|
||||||
impl #impl_generics ::style_traits::HasViewportPercentage for #name #ty_generics #where_clause {
|
|
||||||
#[allow(unused_variables, unused_imports)]
|
|
||||||
#[inline]
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
match *self {
|
|
||||||
#match_body
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -13,7 +13,6 @@ use proc_macro::TokenStream;
|
||||||
mod animate;
|
mod animate;
|
||||||
mod cg;
|
mod cg;
|
||||||
mod compute_squared_distance;
|
mod compute_squared_distance;
|
||||||
mod has_viewport_percentage;
|
|
||||||
mod to_animated_value;
|
mod to_animated_value;
|
||||||
mod to_animated_zero;
|
mod to_animated_zero;
|
||||||
mod to_computed_value;
|
mod to_computed_value;
|
||||||
|
@ -31,12 +30,6 @@ pub fn derive_compute_squared_distance(stream: TokenStream) -> TokenStream {
|
||||||
compute_squared_distance::derive(input).to_string().parse().unwrap()
|
compute_squared_distance::derive(input).to_string().parse().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[proc_macro_derive(HasViewportPercentage)]
|
|
||||||
pub fn derive_has_viewport_percentage(stream: TokenStream) -> TokenStream {
|
|
||||||
let input = syn::parse_derive_input(&stream.to_string()).unwrap();
|
|
||||||
has_viewport_percentage::derive(input).to_string().parse().unwrap()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[proc_macro_derive(ToAnimatedValue)]
|
#[proc_macro_derive(ToAnimatedValue)]
|
||||||
pub fn derive_to_animated_value(stream: TokenStream) -> TokenStream {
|
pub fn derive_to_animated_value(stream: TokenStream) -> TokenStream {
|
||||||
let input = syn::parse_derive_input(&stream.to_string()).unwrap();
|
let input = syn::parse_derive_input(&stream.to_string()).unwrap();
|
||||||
|
|
|
@ -84,7 +84,6 @@ pub mod values;
|
||||||
pub mod viewport;
|
pub mod viewport;
|
||||||
|
|
||||||
pub use values::{Comma, CommaWithSpace, OneOrMoreSeparated, Separator, Space, ToCss};
|
pub use values::{Comma, CommaWithSpace, OneOrMoreSeparated, Separator, Space, ToCss};
|
||||||
pub use viewport::HasViewportPercentage;
|
|
||||||
|
|
||||||
/// The error type for all CSS parsing routines.
|
/// The error type for all CSS parsing routines.
|
||||||
pub type ParseError<'i> = cssparser::ParseError<'i, SelectorParseError<'i, StyleParseError<'i>>>;
|
pub type ParseError<'i> = cssparser::ParseError<'i, SelectorParseError<'i, StyleParseError<'i>>>;
|
||||||
|
|
|
@ -19,66 +19,6 @@ define_css_keyword_enum!(Orientation:
|
||||||
"portrait" => Portrait,
|
"portrait" => Portrait,
|
||||||
"landscape" => Landscape);
|
"landscape" => Landscape);
|
||||||
|
|
||||||
/// A trait used to query whether this value has viewport units.
|
|
||||||
pub trait HasViewportPercentage {
|
|
||||||
/// Returns true if this value has viewport units.
|
|
||||||
fn has_viewport_percentage(&self) -> bool;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A macro used to implement HasViewportPercentage trait
|
|
||||||
/// for a given type that may never contain viewport units.
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! no_viewport_percentage {
|
|
||||||
($($name: ident),+) => {
|
|
||||||
$(impl $crate::HasViewportPercentage for $name {
|
|
||||||
#[inline]
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
})+
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
no_viewport_percentage!(bool, f32);
|
|
||||||
|
|
||||||
impl<T> HasViewportPercentage for Box<T>
|
|
||||||
where
|
|
||||||
T: ?Sized + HasViewportPercentage
|
|
||||||
{
|
|
||||||
#[inline]
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
(**self).has_viewport_percentage()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: HasViewportPercentage> HasViewportPercentage for Option<T> {
|
|
||||||
#[inline]
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
self.as_ref().map_or(false, T::has_viewport_percentage)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: HasViewportPercentage, U> HasViewportPercentage for TypedSize2D<T, U> {
|
|
||||||
#[inline]
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
self.width.has_viewport_percentage() || self.height.has_viewport_percentage()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: HasViewportPercentage> HasViewportPercentage for Vec<T> {
|
|
||||||
#[inline]
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
self.iter().any(T::has_viewport_percentage)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: HasViewportPercentage> HasViewportPercentage for [T] {
|
|
||||||
#[inline]
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
self.iter().any(T::has_viewport_percentage)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A set of viewport descriptors:
|
/// A set of viewport descriptors:
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/css-device-adapt/#viewport-desc
|
/// https://drafts.csswg.org/css-device-adapt/#viewport-desc
|
||||||
|
|
|
@ -2,21 +2,12 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use cssparser::{Parser, ParserInput};
|
use cssparser::{Parser, ParserInput};
|
||||||
use style::context::QuirksMode;
|
use style::context::QuirksMode;
|
||||||
use style::parser::ParserContext;
|
use style::parser::ParserContext;
|
||||||
use style::stylesheets::{CssRuleType, Origin};
|
use style::stylesheets::{CssRuleType, Origin};
|
||||||
use style::values::specified::{AbsoluteLength, NoCalcLength, Number, ViewportPercentageLength};
|
use style::values::specified::Number;
|
||||||
use style_traits::{PARSING_MODE_ALLOW_ALL_NUMERIC_VALUES, HasViewportPercentage};
|
use style_traits::PARSING_MODE_ALLOW_ALL_NUMERIC_VALUES;
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn length_has_viewport_percentage() {
|
|
||||||
let l = NoCalcLength::ViewportPercentage(ViewportPercentageLength::Vw(100.));
|
|
||||||
assert!(l.has_viewport_percentage());
|
|
||||||
let l = NoCalcLength::Absolute(AbsoluteLength::Px(Au(100).to_f32_px()));
|
|
||||||
assert!(!l.has_viewport_percentage());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parsing_allo_all_numeric_values() {
|
fn test_parsing_allo_all_numeric_values() {
|
||||||
|
|
|
@ -61,4 +61,3 @@ macro_rules! assert_roundtrip_with_context {
|
||||||
mod background;
|
mod background;
|
||||||
mod scaffolding;
|
mod scaffolding;
|
||||||
mod serialization;
|
mod serialization;
|
||||||
mod viewport;
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* 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 style::properties::PropertyDeclaration;
|
|
||||||
use style::values::specified::{AbsoluteLength, Length, NoCalcLength, ViewportPercentageLength};
|
|
||||||
use style::values::specified::border::BorderSideWidth;
|
|
||||||
use style_traits::HasViewportPercentage;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn has_viewport_percentage_for_specified_value() {
|
|
||||||
//TODO: test all specified value with a HasViewportPercentage impl
|
|
||||||
let pvw = PropertyDeclaration::BorderTopWidth(
|
|
||||||
BorderSideWidth::Length(
|
|
||||||
Length::NoCalc(NoCalcLength::ViewportPercentage(ViewportPercentageLength::Vw(100.)))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert!(pvw.has_viewport_percentage());
|
|
||||||
|
|
||||||
let pabs = PropertyDeclaration::BorderTopWidth(
|
|
||||||
BorderSideWidth::Length(
|
|
||||||
Length::NoCalc(NoCalcLength::Absolute(AbsoluteLength::Px(Au(100).to_f32_px())))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert!(!pabs.has_viewport_percentage());
|
|
||||||
}
|
|
Загрузка…
Ссылка в новой задаче