mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Implement support for the drop-shadow
filter (#30439)
* Implement support for `drop-shadow` * Clean up remnant from early attempts * Fix misleading comments on GenericSimpleShadow If Servo-specific `style` changes will need to be upstreamed anyway, I might as well fix a thing that had thrown me off! * Revert "Fix misleading comments on GenericSimpleShadow" This reverts commit cdc810b826ac082041adc212c24649ee3b86ca0a. * Clean up an import * Update test expectations * Fix missing expectation on Layout 2013
This commit is contained in:
parent
8436002383
commit
f7c340f881
23 changed files with 51 additions and 355 deletions
|
@ -749,7 +749,7 @@ impl Animate for AnimatedFilter {
|
|||
) -> Result<Self, ()> {
|
||||
use crate::values::animated::animate_multiplicative_factor;
|
||||
match (self, other) {
|
||||
% for func in ['Blur', 'Grayscale', 'HueRotate', 'Invert', 'Sepia']:
|
||||
% for func in ['Blur', 'DropShadow', 'Grayscale', 'HueRotate', 'Invert', 'Sepia']:
|
||||
(&Filter::${func}(ref this), &Filter::${func}(ref other)) => {
|
||||
Ok(Filter::${func}(this.animate(other, procedure)?))
|
||||
},
|
||||
|
@ -759,11 +759,6 @@ impl Animate for AnimatedFilter {
|
|||
Ok(Filter::${func}(animate_multiplicative_factor(this, other, procedure)?))
|
||||
},
|
||||
% endfor
|
||||
% if engine == "gecko":
|
||||
(&Filter::DropShadow(ref this), &Filter::DropShadow(ref other)) => {
|
||||
Ok(Filter::DropShadow(this.animate(other, procedure)?))
|
||||
},
|
||||
% endif
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
|
@ -773,15 +768,12 @@ impl Animate for AnimatedFilter {
|
|||
impl ToAnimatedZero for AnimatedFilter {
|
||||
fn to_animated_zero(&self) -> Result<Self, ()> {
|
||||
match *self {
|
||||
% for func in ['Blur', 'Grayscale', 'HueRotate', 'Invert', 'Sepia']:
|
||||
% for func in ['Blur', 'DropShadow', 'Grayscale', 'HueRotate', 'Invert', 'Sepia']:
|
||||
Filter::${func}(ref this) => Ok(Filter::${func}(this.to_animated_zero()?)),
|
||||
% endfor
|
||||
% for func in ['Brightness', 'Contrast', 'Opacity', 'Saturate']:
|
||||
Filter::${func}(_) => Ok(Filter::${func}(1.)),
|
||||
% endfor
|
||||
% if engine == "gecko":
|
||||
Filter::DropShadow(ref this) => Ok(Filter::DropShadow(this.to_animated_zero()?)),
|
||||
% endif
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,4 +24,4 @@ pub type AnimatedFilter =
|
|||
|
||||
/// An animated value for a single `filter`.
|
||||
#[cfg(not(feature = "gecko"))]
|
||||
pub type AnimatedFilter = GenericFilter<Angle, Number, Number, Length, Impossible, Impossible>;
|
||||
pub type AnimatedFilter = GenericFilter<Angle, Number, Number, Length, AnimatedSimpleShadow, Impossible>;
|
||||
|
|
|
@ -36,7 +36,7 @@ pub type Filter = GenericFilter<
|
|||
NonNegativeNumber,
|
||||
ZeroToOneNumber,
|
||||
NonNegativeLength,
|
||||
Impossible,
|
||||
SimpleShadow,
|
||||
Impossible,
|
||||
>;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ pub type SpecifiedFilter = GenericFilter<
|
|||
NonNegativeFactor,
|
||||
ZeroToOneFactor,
|
||||
NonNegativeLength,
|
||||
Impossible,
|
||||
SimpleShadow,
|
||||
Impossible,
|
||||
>;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue