mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Skip adding/accumulating the values which corresponding rect offset is auto.
This patch will skip add_weighted() when self_portion + other_portion not equal to zero. (i.e. adding or accumulating). Gecko does same behavior since we can't add two auto value.
This commit is contained in:
parent
76e77be041
commit
8fc7d28758
2 changed files with 22 additions and 1 deletions
|
@ -1072,6 +1072,27 @@ impl Into<FontStretch> for f64 {
|
||||||
impl<H, V> RepeatableListAnimatable for generic_position::Position<H, V>
|
impl<H, V> RepeatableListAnimatable for generic_position::Position<H, V>
|
||||||
where H: RepeatableListAnimatable, V: RepeatableListAnimatable {}
|
where H: RepeatableListAnimatable, V: RepeatableListAnimatable {}
|
||||||
|
|
||||||
|
/// https://drafts.csswg.org/css-transitions/#animtype-rect
|
||||||
|
impl Animate for ClipRect {
|
||||||
|
#[inline]
|
||||||
|
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||||
|
let animate_component = |this: &Option<Au>, other: &Option<Au>| {
|
||||||
|
match (this.animate(other, procedure)?, procedure) {
|
||||||
|
(None, Procedure::Interpolate { .. }) => Ok(None),
|
||||||
|
(None, _) => Err(()),
|
||||||
|
(result, _) => Ok(result),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(ClipRect {
|
||||||
|
top: animate_component(&self.top, &other.top)?,
|
||||||
|
right: animate_component(&self.right, &other.right)?,
|
||||||
|
bottom: animate_component(&self.bottom, &other.bottom)?,
|
||||||
|
left: animate_component(&self.left, &other.left)?,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ToAnimatedZero for ClipRect {
|
impl ToAnimatedZero for ClipRect {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_animated_zero(&self) -> Result<Self, ()> { Err(()) }
|
fn to_animated_zero(&self) -> Result<Self, ()> { Err(()) }
|
||||||
|
|
|
@ -439,7 +439,7 @@ pub type NonNegativeLengthOrPercentageOrNumber = Either<NonNegativeNumber, NonNe
|
||||||
|
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, Eq, PartialEq)]
|
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, Eq, PartialEq)]
|
||||||
/// A computed cliprect for clip and image-region
|
/// A computed cliprect for clip and image-region
|
||||||
pub struct ClipRect {
|
pub struct ClipRect {
|
||||||
pub top: Option<Au>,
|
pub top: Option<Au>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue