mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
parent
473934c989
commit
36ff89bd28
61 changed files with 73 additions and 437 deletions
|
@ -14,7 +14,7 @@ use parser::{Parse, ParserContext};
|
|||
use std::{cmp, fmt, mem};
|
||||
use std::ascii::AsciiExt;
|
||||
use std::ops::Mul;
|
||||
use style_traits::{HasViewportPercentage, ToCss, ParseError, StyleParseError};
|
||||
use style_traits::{ToCss, ParseError, StyleParseError};
|
||||
use style_traits::values::specified::AllowedLengthType;
|
||||
use stylesheets::CssRuleType;
|
||||
use super::{AllowQuirks, Number, ToComputedValue, Percentage};
|
||||
|
@ -183,12 +183,6 @@ pub enum ViewportPercentageLength {
|
|||
Vmax(CSSFloat)
|
||||
}
|
||||
|
||||
impl HasViewportPercentage for ViewportPercentageLength {
|
||||
fn has_viewport_percentage(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for ViewportPercentageLength {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
|
@ -422,15 +416,6 @@ pub enum NoCalcLength {
|
|||
Physical(PhysicalLength),
|
||||
}
|
||||
|
||||
impl HasViewportPercentage for NoCalcLength {
|
||||
fn has_viewport_percentage(&self) -> bool {
|
||||
match *self {
|
||||
NoCalcLength::ViewportPercentage(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for NoCalcLength {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
|
@ -545,7 +530,7 @@ impl NoCalcLength {
|
|||
///
|
||||
/// https://drafts.csswg.org/css-values/#lengths
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
pub enum Length {
|
||||
/// The internal length type that cannot parse `calc`
|
||||
NoCalc(NoCalcLength),
|
||||
|
@ -759,7 +744,7 @@ pub type NonNegativeLengthOrNumber = Either<NonNegativeLength, NonNegativeNumber
|
|||
/// A length or a percentage value.
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
pub enum LengthOrPercentage {
|
||||
Length(NoCalcLength),
|
||||
Percentage(computed::Percentage),
|
||||
|
@ -929,7 +914,7 @@ impl LengthOrPercentage {
|
|||
/// Either a `<length>`, a `<percentage>`, or the `auto` keyword.
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
pub enum LengthOrPercentageOrAuto {
|
||||
Length(NoCalcLength),
|
||||
Percentage(computed::Percentage),
|
||||
|
@ -1045,7 +1030,7 @@ impl LengthOrPercentageOrAuto {
|
|||
|
||||
/// Either a `<length>`, a `<percentage>`, or the `none` keyword.
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum LengthOrPercentageOrNone {
|
||||
Length(NoCalcLength),
|
||||
|
@ -1193,7 +1178,7 @@ impl LengthOrNumber {
|
|||
/// `auto`, and cannot be `none`.
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
pub enum MozLength {
|
||||
LengthOrPercentageOrAuto(LengthOrPercentageOrAuto),
|
||||
ExtremumLength(ExtremumLength),
|
||||
|
@ -1219,7 +1204,7 @@ impl MozLength {
|
|||
/// A value suitable for a `max-width` or `max-height` property.
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
pub enum MaxLength {
|
||||
LengthOrPercentageOrNone(LengthOrPercentageOrNone),
|
||||
ExtremumLength(ExtremumLength),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue