mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
style: Move line-clamp out of mako and do some adjacent clean-up
No behavior change, but simplifies the following patch. Differential Revision: https://phabricator.services.mozilla.com/D155180
This commit is contained in:
parent
3fa76ff2e8
commit
a44db17432
12 changed files with 101 additions and 99 deletions
|
@ -4,12 +4,11 @@
|
|||
|
||||
//! Computed types for box properties.
|
||||
|
||||
use crate::values::animated::{Animate, Procedure};
|
||||
use crate::values::computed::length::{LengthPercentage, NonNegativeLength};
|
||||
use crate::values::computed::{Context, Number, ToComputedValue};
|
||||
use crate::values::computed::{Context, Integer, Number, ToComputedValue};
|
||||
use crate::values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount;
|
||||
use crate::values::generics::box_::Perspective as GenericPerspective;
|
||||
use crate::values::generics::box_::VerticalAlign as GenericVerticalAlign;
|
||||
use crate::values::generics::box_::ContainIntrinsicSize as GenericContainIntrinsicSize;
|
||||
use crate::values::generics::box_::{GenericLineClamp, GenericPerspective, GenericVerticalAlign, GenericContainIntrinsicSize};
|
||||
use crate::values::specified::box_ as specified;
|
||||
|
||||
pub use crate::values::specified::box_::{
|
||||
|
@ -30,6 +29,22 @@ pub type AnimationIterationCount = GenericAnimationIterationCount<Number>;
|
|||
/// A computed value for the `contain-intrinsic-size` property.
|
||||
pub type ContainIntrinsicSize = GenericContainIntrinsicSize<NonNegativeLength>;
|
||||
|
||||
/// A computed value for the `line-clamp` property.
|
||||
pub type LineClamp = GenericLineClamp<Integer>;
|
||||
|
||||
impl Animate for LineClamp {
|
||||
#[inline]
|
||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
if self.is_none() != other.is_none() {
|
||||
return Err(());
|
||||
}
|
||||
if self.is_none() {
|
||||
return Ok(Self::none())
|
||||
}
|
||||
Ok(Self(self.0.animate(&other.0, procedure)?.max(1)))
|
||||
}
|
||||
}
|
||||
|
||||
impl AnimationIterationCount {
|
||||
/// Returns the value `1.0`.
|
||||
#[inline]
|
||||
|
|
|
@ -47,7 +47,7 @@ pub use self::border::{BorderImageRepeat, BorderImageSideWidth};
|
|||
pub use self::border::{BorderImageSlice, BorderImageWidth};
|
||||
pub use self::box_::{AnimationIterationCount, AnimationName, AnimationTimeline, Contain, ContainerName, ContainerType};
|
||||
pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, ContentVisibility, ContainIntrinsicSize, Float};
|
||||
pub use self::box_::{Display, Overflow, OverflowAnchor, TransitionProperty};
|
||||
pub use self::box_::{Display, LineClamp, Overflow, OverflowAnchor, TransitionProperty};
|
||||
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize, ScrollbarGutter};
|
||||
pub use self::box_::{ScrollAxis, ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStop};
|
||||
pub use self::box_::{ScrollSnapStrictness, ScrollSnapType, ScrollTimelineName};
|
||||
|
@ -101,7 +101,6 @@ pub use self::ui::{Cursor, MozForceBrokenImageIcon, UserSelect};
|
|||
pub use super::specified::TextTransform;
|
||||
pub use super::specified::ViewportVariant;
|
||||
pub use super::specified::{BorderStyle, TextDecorationLine};
|
||||
pub use super::{Auto, Either, None_};
|
||||
pub use app_units::Au;
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
|
@ -876,9 +875,6 @@ impl From<CSSInteger> for PositiveInteger {
|
|||
}
|
||||
}
|
||||
|
||||
/// A computed positive `<integer>` value or `none`.
|
||||
pub type PositiveIntegerOrNone = Either<PositiveInteger, None_>;
|
||||
|
||||
/// rect(...) | auto
|
||||
pub type ClipRect = generics::GenericClipRect<LengthOrAuto>;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue