mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Implement background-position-x/y
This commit is contained in:
parent
a409d41d1d
commit
b302642592
4 changed files with 183 additions and 2 deletions
|
@ -26,7 +26,7 @@ use values::Either;
|
|||
use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
||||
use values::computed::{BorderRadiusSize, LengthOrNone};
|
||||
use values::computed::{CalcLengthOrPercentage, LengthOrPercentage};
|
||||
use values::computed::position::Position;
|
||||
use values::computed::position::{HorizontalPosition, Position, VerticalPosition};
|
||||
use values::computed::ToComputedValue;
|
||||
|
||||
|
||||
|
@ -581,6 +581,45 @@ impl Interpolate for BackgroundPosition {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-simple-list
|
||||
impl Interpolate for HorizontalPosition {
|
||||
#[inline]
|
||||
fn interpolate(&self, other: &Self, progress: f64) -> Result<Self, ()> {
|
||||
Ok(HorizontalPosition(try!(self.0.interpolate(&other.0, progress))))
|
||||
}
|
||||
}
|
||||
|
||||
impl RepeatableListInterpolate for HorizontalPosition {}
|
||||
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-simple-list
|
||||
impl Interpolate for VerticalPosition {
|
||||
#[inline]
|
||||
fn interpolate(&self, other: &Self, progress: f64) -> Result<Self, ()> {
|
||||
Ok(VerticalPosition(try!(self.0.interpolate(&other.0, progress))))
|
||||
}
|
||||
}
|
||||
|
||||
impl RepeatableListInterpolate for VerticalPosition {}
|
||||
|
||||
% if product == "gecko":
|
||||
use properties::longhands::background_position_x::computed_value::T as BackgroundPositionX;
|
||||
use properties::longhands::background_position_y::computed_value::T as BackgroundPositionY;
|
||||
|
||||
impl Interpolate for BackgroundPositionX {
|
||||
#[inline]
|
||||
fn interpolate(&self, other: &Self, progress: f64) -> Result<Self, ()> {
|
||||
Ok(BackgroundPositionX(try!(self.0.interpolate(&other.0, progress))))
|
||||
}
|
||||
}
|
||||
|
||||
impl Interpolate for BackgroundPositionY {
|
||||
#[inline]
|
||||
fn interpolate(&self, other: &Self, progress: f64) -> Result<Self, ()> {
|
||||
Ok(BackgroundPositionY(try!(self.0.interpolate(&other.0, progress))))
|
||||
}
|
||||
}
|
||||
% endif
|
||||
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-shadow-list
|
||||
impl Interpolate for TextShadow {
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue