style: Remove HasViewportPercentage.

It's not needed since #18268
This commit is contained in:
Emilio Cobos Álvarez 2017-08-29 23:45:45 +02:00
parent 473934c989
commit 36ff89bd28
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
61 changed files with 73 additions and 437 deletions

View file

@ -83,8 +83,6 @@
#[allow(unused_imports)]
use smallvec::SmallVec;
use std::fmt;
#[allow(unused_imports)]
use style_traits::HasViewportPercentage;
use style_traits::{Separator, ToCss};
pub mod single_value {
@ -179,7 +177,7 @@
}
/// The specified value of ${name}.
#[derive(Clone, Debug, HasViewportPercentage, PartialEq)]
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue(pub Vec<single_value::SpecifiedValue>);
@ -420,7 +418,6 @@
%>
<%call expr="longhand(name, keyword=Keyword(name, values, **keyword_kwargs), **kwargs)">
use properties::longhands::system_font::SystemFont;
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
use cssparser::Parser;
@ -529,7 +526,6 @@
impl ComputedValueAsSpecified for SpecifiedValue {}
% endif
no_viewport_percentage!(SpecifiedValue);
</%call>
</%def>
@ -948,7 +944,7 @@
}
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
#[derive(Clone, Debug, PartialEq, ToCss)]
pub struct SpecifiedValue(pub ${length_type});
% if length_type == "MozLength":

View file

@ -214,7 +214,6 @@ pub enum TransitionProperty {
Unsupported(CustomIdent)
}
no_viewport_percentage!(TransitionProperty);
impl ComputedValueAsSpecified for TransitionProperty {}

View file

@ -69,7 +69,6 @@ ${helpers.predefined_type("background-image", "ImageLayer",
pub struct T(pub RepeatKeyword, pub RepeatKeyword);
}
no_viewport_percentage!(SpecifiedValue);
impl ToCss for computed_value::T {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {

View file

@ -78,7 +78,6 @@ ${helpers.gecko_keyword_conversion(Keyword('border-style',
use std::fmt;
use style_traits::ToCss;
use values::specified::RGBAColor;
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
use cssparser::RGBA;
@ -230,7 +229,6 @@ ${helpers.predefined_type("border-image-outset", "LengthOrNumberRect",
spec="https://drafts.csswg.org/css-backgrounds/#border-image-repeat">
use style_traits::ToCss;
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
pub use super::RepeatKeyword;

View file

@ -36,7 +36,6 @@
%>
use values::computed::ComputedValueAsSpecified;
use style_traits::ToCss;
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
pub use super::SpecifiedValue as T;
@ -222,7 +221,6 @@ ${helpers.single_keyword("position", "static absolute relative fixed",
gecko_pref_ident="float_"
flags="APPLIES_TO_FIRST_LETTER"
spec="https://drafts.csswg.org/css-box/#propdef-float">
no_viewport_percentage!(SpecifiedValue);
impl ToComputedValue for SpecifiedValue {
type ComputedValue = computed_value::T;
@ -261,7 +259,6 @@ ${helpers.single_keyword("position", "static absolute relative fixed",
gecko_enum_prefix="StyleClear"
gecko_ffi_name="mBreakType"
spec="https://www.w3.org/TR/CSS2/visuren.html#flow-control">
no_viewport_percentage!(SpecifiedValue);
impl ToComputedValue for SpecifiedValue {
type ComputedValue = computed_value::T;
@ -327,7 +324,7 @@ ${helpers.single_keyword("position", "static absolute relative fixed",
/// The `vertical-align` value.
#[allow(non_camel_case_types)]
#[derive(Clone, Debug, HasViewportPercentage, PartialEq)]
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum SpecifiedValue {
% 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>)
-> Result<SpecifiedValue,ParseError<'i>> {
@ -641,7 +637,6 @@ ${helpers.predefined_type("animation-timing-function",
}
}
no_viewport_percentage!(SpecifiedValue);
#[inline]
pub fn get_initial_value() -> computed_value::T {
@ -842,7 +837,7 @@ ${helpers.predefined_type(
/// Multiple transform functions compose a transformation.
///
/// 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))]
pub enum SpecifiedOperation {
/// 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))]
pub struct SpecifiedValue(Vec<SpecifiedOperation>);
@ -1705,7 +1700,6 @@ ${helpers.predefined_type("transform-origin",
use values::computed::ComputedValueAsSpecified;
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
pub type T = super::SpecifiedValue;
@ -1850,7 +1844,6 @@ ${helpers.single_keyword("-moz-orient",
use values::computed::ComputedValueAsSpecified;
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
pub use super::SpecifiedValue as T;
@ -1924,7 +1917,6 @@ ${helpers.predefined_type(
use values::computed::ComputedValueAsSpecified;
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
pub use super::SpecifiedValue as T;

View file

@ -34,7 +34,6 @@
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
pub struct SpecifiedValue(pub Color);
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
use cssparser;

View file

@ -23,7 +23,6 @@
pub use self::computed_value::ContentItem;
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
use cssparser;
@ -296,7 +295,6 @@
computed_value::T(Vec::new())
}
no_viewport_percentage!(SpecifiedValue);
impl ToCss for SpecifiedValue {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result

View file

@ -76,7 +76,6 @@ macro_rules! impl_gecko_keyword_conversions {
use std::fmt;
use style_traits::ToCss;
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
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">
use properties::longhands::system_font::SystemFont;
no_viewport_percentage!(SpecifiedValue);
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)]
@ -597,7 +595,7 @@ ${helpers.single_keyword_system("font-variant-caps",
use app_units::Au;
use properties::longhands::system_font::SystemFont;
use std::fmt;
use style_traits::{HasViewportPercentage, ToCss};
use style_traits::ToCss;
use values::FONT_MEDIUM_PX;
use values::computed::NonNegativeAu;
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)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
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">
use properties::longhands::system_font::SystemFont;
no_viewport_percentage!(SpecifiedValue);
#[derive(Clone, Copy, Debug, PartialEq, ToCss)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
@ -1190,7 +1178,6 @@ ${helpers.single_keyword_system("font-variant-caps",
use values::computed::ComputedValueAsSpecified;
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
pub use super::SpecifiedValue as T;
@ -1302,7 +1289,6 @@ ${helpers.single_keyword_system("font-kerning",
use style_traits::ToCss;
use values::CustomIdent;
no_viewport_percentage!(SpecifiedValue);
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
@ -1512,7 +1498,6 @@ macro_rules! exclusive_value {
use std::fmt;
use style_traits::ToCss;
no_viewport_percentage!(SpecifiedValue);
bitflags! {
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
@ -1658,7 +1643,6 @@ macro_rules! exclusive_value {
use std::fmt;
use style_traits::ToCss;
no_viewport_percentage!(SpecifiedValue);
bitflags! {
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
@ -1818,7 +1802,6 @@ macro_rules! exclusive_value {
use std::fmt;
use style_traits::ToCss;
no_viewport_percentage!(SpecifiedValue);
bitflags! {
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
@ -1981,7 +1964,6 @@ ${helpers.single_keyword_system("font-variant-position",
Value(computed_value::T),
System(SystemFont)
}
no_viewport_percentage!(SpecifiedValue);
<%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;
no_viewport_percentage!(SpecifiedValue);
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 style_traits::ToCss;
use byteorder::{BigEndian, ByteOrder};
no_viewport_percentage!(SpecifiedValue);
#[derive(Clone, Debug, Eq, PartialEq)]
#[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;
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
use Atom;
@ -2269,7 +2248,6 @@ https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control-
use std::fmt;
use style_traits::ToCss;
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
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 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 mod computed_value {
@ -2418,7 +2396,6 @@ ${helpers.single_keyword("-moz-math-variant",
pub use self::computed_value::T as SpecifiedValue;
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
use std::fmt;

View file

@ -66,7 +66,6 @@ ${helpers.single_keyword("image-rendering",
use style_traits::ToCss;
use values::specified::Angle;
no_viewport_percentage!(SpecifiedValue);
use std::f64::consts::PI;
const TWO_PI: f64 = 2.0 * PI;
@ -259,7 +258,6 @@ ${helpers.single_keyword("image-rendering",
use style_traits::ToCss;
use values::computed::ComputedValueAsSpecified;
no_viewport_percentage!(SpecifiedValue);
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]

View file

@ -259,7 +259,6 @@ ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
}
}
no_viewport_percentage!(SpecifiedValue);
impl ComputedValueAsSpecified for SpecifiedValue { }
</%helpers:longhand>
@ -271,7 +270,6 @@ ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
use values::CustomIdent;
use values::computed::ComputedValueAsSpecified;
no_viewport_percentage!(SpecifiedValue);
impl ComputedValueAsSpecified for SpecifiedValue { }

View file

@ -60,7 +60,7 @@ ${helpers.single_keyword("caption-side", "top bottom",
}
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
#[derive(Clone, Debug, PartialEq, ToCss)]
pub struct SpecifiedValue {
pub horizontal: NonNegativeLength,
pub vertical: Option<NonNegativeLength>,

View file

@ -70,7 +70,6 @@ ${helpers.single_keyword("word-break",
animation_value_type="discrete"
flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-text/#propdef-text-justify">
no_viewport_percentage!(SpecifiedValue);
impl ToComputedValue for SpecifiedValue {
type ComputedValue = computed_value::T;
@ -114,7 +113,6 @@ ${helpers.single_keyword("text-align-last",
<%helpers:longhand name="text-align" animation_value_type="discrete"
flags="APPLIES_TO_PLACEHOLDER"
spec="https://drafts.csswg.org/css-text/#propdef-text-align">
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
use style_traits::ToCss;
macro_rules! define_text_align {
@ -292,7 +290,6 @@ ${helpers.predefined_type("word-spacing",
use values::computed::ComputedValueAsSpecified;
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
#[derive(Clone, Copy, Debug, PartialEq)]
#[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">
use values::computed::ComputedValueAsSpecified;
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
% if product != "gecko":
impl SpecifiedValue {
@ -435,7 +431,6 @@ ${helpers.predefined_type(
use style_traits::ToCss;
use unicode_segmentation::UnicodeSegmentation;
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
@ -638,7 +633,6 @@ ${helpers.predefined_type(
}
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
pub fn get_initial_value() -> computed_value::T {
SpecifiedValue(HorizontalWritingModeValue::Over, VerticalWritingModeValue::Right)

View file

@ -50,7 +50,6 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu
}
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
#[cfg(feature = "gecko")]
impl SpecifiedValue {
@ -116,7 +115,6 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
#[inline]
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 {}
no_viewport_percentage!(SpecifiedValue);
impl ToCss for SpecifiedValue {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {

View file

@ -14,7 +14,6 @@
use values::specified::url::SpecifiedUrl;
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
#[cfg(feature = "gecko")]

View file

@ -311,7 +311,6 @@ ${helpers.predefined_type("object-position",
}
}
no_viewport_percentage!(SpecifiedValue);
impl ComputedValueAsSpecified for SpecifiedValue {}
impl ToCss for computed_value::T {
@ -454,7 +453,6 @@ ${helpers.predefined_type("object-position",
pub columns: Range<u32>,
}
no_viewport_percentage!(TemplateAreas);
impl ComputedValueAsSpecified for TemplateAreas {}
impl Parse for TemplateAreas {

View file

@ -17,7 +17,6 @@ ${helpers.single_keyword("table-layout", "auto fixed",
use values::computed::ComputedValueAsSpecified;
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
pub type SpecifiedValue = computed_value::T;
pub mod computed_value {
use std::fmt;

View file

@ -18,7 +18,6 @@
use std::fmt;
use style_traits::ToCss;
no_viewport_percentage!(SpecifiedValue);
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, Eq, PartialEq, ToCss)]
@ -150,7 +149,6 @@ ${helpers.single_keyword("unicode-bidi",
use values::computed::ComputedValueAsSpecified;
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
bitflags! {
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]

View file

@ -51,7 +51,6 @@ ${helpers.single_keyword("-moz-window-shadow", "none default menu tooltip sheet"
use style_traits::ToCss;
use values::computed::ComputedValueAsSpecified;
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
#[derive(Clone, Copy, Debug, PartialEq)]

View file

@ -36,7 +36,7 @@ use selector_parser::PseudoElement;
use selectors::parser::SelectorParseError;
#[cfg(feature = "servo")] use servo_config::prefs::PREFS;
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 stylesheets::{CssRuleType, MallocSizeOf, MallocSizeOfFn, Origin, UrlExtraData};
#[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> {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
where W: fmt::Write,
@ -1299,26 +1286,6 @@ pub enum PropertyDeclaration {
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 {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.id().to_css(f)?;