mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Auto merge of #16527 - BorisChiou:stylo/transition/shorthands, r=emilio
stylo: Bug 1353628 - Support shorthand properties for CSS Transition. These patches add shorthand properties into TransitionProperty, so we can parse the shorthand properties properly and create transitions for them. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix Bug 1353628 - [X] There are tests for these changes <!-- 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/16527) <!-- Reviewable:end -->
This commit is contained in:
commit
355d5f89da
8 changed files with 150 additions and 25 deletions
|
@ -775,7 +775,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
after_change_style: &Arc<ComputedValues>,
|
||||
pseudo: Option<&PseudoElement>) -> bool {
|
||||
use gecko_bindings::structs::nsCSSPropertyID;
|
||||
use properties::animated_properties;
|
||||
use properties::{PropertyId, animated_properties};
|
||||
use std::collections::HashSet;
|
||||
|
||||
debug_assert!(self.might_need_transitions_update(&Some(before_change_style),
|
||||
|
@ -825,16 +825,24 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
}
|
||||
false
|
||||
};
|
||||
// FIXME: Bug 1353628: Shorthand properties are parsed failed now, so after fixing
|
||||
// that, we have to handle shorthand.
|
||||
if property == nsCSSPropertyID::eCSSPropertyExtra_all_properties {
|
||||
if TransitionProperty::any(property_check_helper) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if animated_properties::nscsspropertyid_is_animatable(property) &&
|
||||
property_check_helper(property.into()) {
|
||||
return true;
|
||||
let is_shorthand = PropertyId::from_nscsspropertyid(property).ok().map_or(false, |p| {
|
||||
p.as_shorthand().is_ok()
|
||||
});
|
||||
if is_shorthand {
|
||||
let shorthand: TransitionProperty = property.into();
|
||||
if shorthand.longhands().iter().any(|&p| property_check_helper(p)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if animated_properties::nscsspropertyid_is_animatable(property) &&
|
||||
property_check_helper(property.into()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue