Repository navigation
Prepare some code for future derivation 🌊 - #17774
Conversation
|
Heads up! This PR modifies the following files:
|
|
|
||
| impl TimingKeyword { | ||
| /// Returns this timing keyword as a pair of `cubic-bezier()` points. | ||
| /// Returns the keyword as a quadruplet of Bezier point coordinates. |
There was a problem hiding this comment.
Maybe worth pointing out that they're returned as x1, y1, x2, y2?
|
|
||
| impl ToAnimatedZero for Percentage { | ||
| #[inline] | ||
| fn to_animated_zero(&self) -> Result<Self, ()> { |
There was a problem hiding this comment.
nit: I think we have a Percentage::zero() function, not a big deal though.
| match *self { | ||
| LengthOrPercentageOrAuto::Length(_) | | ||
| LengthOrPercentageOrAuto::Percentage(_) | | ||
| LengthOrPercentageOrAuto::Calc(_) => { |
There was a problem hiding this comment.
I guess this one seems somewhat weird, in the sense of it converts foo% into 0px, but since it's preserving it it's probably not a big deal.
| } | ||
|
|
||
| impl ToAnimatedZero for MaxLength { | ||
| #[inline] |
There was a problem hiding this comment.
These ones seem... dubious. Mind checking with @hiikezoe or @BorisChiou to see if it's worth to open issues about this? (or do so directly)
There was a problem hiding this comment.
Yeah, it seems to me that we should return Length(Au(0)) here. But, in the first place, MaxLength does not have get_zero_value(), so I think it's a different issue. (I also suspect we should return Length(Au(0)) for MozLength)
There was a problem hiding this comment.
| impl ToAnimatedZero for TransformList { | ||
| #[inline] | ||
| fn get_zero_value(&self) -> Result<Self, ()> { Ok(TransformList(None)) } | ||
| fn to_animated_zero(&self) -> Result<Self, ()> { |
There was a problem hiding this comment.
Hmm... So we return ok for a TransformList, but not for any other kind of lists? huh.
| impl ToAnimatedZero for T { | ||
| #[inline] | ||
| fn to_animated_zero(&self) -> Result<Self, ()> { | ||
| Err(()) |
|
|
||
| impl ToAnimatedZero for T { | ||
| #[inline] | ||
| fn to_animated_zero(&self) -> Result<Self, ()> { Err(()) } |
| impl ToAnimatedZero for BackgroundSize { | ||
| #[inline] | ||
| fn to_animated_zero(&self) -> Result<Self, ()> { | ||
| Err(()) |
|
|
||
| impl ToAnimatedZero for LineHeight { | ||
| #[inline] | ||
| fn to_animated_zero(&self) -> Result<Self, ()> { Err(()) } |
| { | ||
| let value_to_match = AnimationValue::as_arc(&value_to_match); | ||
| if let Ok(zero_value) = value_to_match.get_zero_value() { | ||
| if let Ok(zero_value) = value_to_match.to_animated_zero() { |
There was a problem hiding this comment.
This should probably use match, but it's pre-existing.
8c088a2 to
98bf832
Compare
|
@bors-servo r=emilio |
|
📌 Commit 98bf832 has been approved by |
Prepare some code for future derivation 🌊 <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17774) <!-- Reviewable:end -->
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
This change is