зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1343753 - Part 5: Support ServoComputedValues in ExtractNonDiscreteComputedValue. r=birtles,hiro,manishearth
We use ServoComputedStyleValues as the argument here, instead of ServoComputedValues, because I will use template for nsStyleContext and ServoComputedValuesWithParent in UpdateTransitions() and ConsiderInitiatingTransition(). Besides, add an FFI to check if a proeprty is discrete animation type. MozReview-Commit-ID: 7VtcMDtgl55 --HG-- extra : rebase_source : eeef2e634887b66bb6650d66fb2e3929a5ea1855
This commit is contained in:
Родитель
fb53a02a99
Коммит
a699413b9a
|
@ -143,6 +143,8 @@ SERVO_BINDING_FUNC(Servo_ComputedValues_ExtractAnimationValue,
|
|||
RawServoAnimationValueStrong,
|
||||
ServoComputedValuesBorrowed computed_values,
|
||||
nsCSSPropertyID property)
|
||||
SERVO_BINDING_FUNC(Servo_Property_IsDiscreteAnimatable, bool,
|
||||
nsCSSPropertyID property)
|
||||
|
||||
// AnimationValues handling
|
||||
SERVO_BINDING_FUNC(Servo_AnimationValues_Interpolate,
|
||||
|
|
|
@ -434,12 +434,29 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsTransitionManager, Release)
|
|||
static inline bool
|
||||
ExtractNonDiscreteComputedValue(nsCSSPropertyID aProperty,
|
||||
nsStyleContext* aStyleContext,
|
||||
StyleAnimationValue& aComputedValue)
|
||||
AnimationValue& aAnimationValue)
|
||||
{
|
||||
return (nsCSSProps::kAnimTypeTable[aProperty] != eStyleAnimType_Discrete ||
|
||||
aProperty == eCSSProperty_visibility) &&
|
||||
StyleAnimationValue::ExtractComputedValue(aProperty, aStyleContext,
|
||||
aComputedValue);
|
||||
aAnimationValue.mGecko);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
ExtractNonDiscreteComputedValue(nsCSSPropertyID aProperty,
|
||||
const ServoComputedValuesWithParent&
|
||||
aComputedStyle,
|
||||
AnimationValue& aAnimationValue)
|
||||
{
|
||||
if (Servo_Property_IsDiscreteAnimatable(aProperty) &&
|
||||
aProperty != eCSSProperty_visibility) {
|
||||
return false;
|
||||
}
|
||||
|
||||
aAnimationValue.mServo =
|
||||
Servo_ComputedValues_ExtractAnimationValue(aComputedStyle.mCurrentStyle,
|
||||
aProperty).Consume();
|
||||
return !!aAnimationValue.mServo;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -700,7 +717,7 @@ nsTransitionManager::UpdateTransitions(
|
|||
OwningCSSTransitionPtrArray& animations = aElementTransitions->mAnimations;
|
||||
size_t i = animations.Length();
|
||||
MOZ_ASSERT(i != 0, "empty transitions list?");
|
||||
StyleAnimationValue currentValue;
|
||||
AnimationValue currentValue;
|
||||
do {
|
||||
--i;
|
||||
CSSTransition* anim = animations[i];
|
||||
|
@ -714,7 +731,7 @@ nsTransitionManager::UpdateTransitions(
|
|||
// matching currentValue
|
||||
!ExtractNonDiscreteComputedValue(anim->TransitionProperty(),
|
||||
aNewStyleContext, currentValue) ||
|
||||
currentValue != anim->ToValue().mGecko) {
|
||||
currentValue != anim->ToValue()) {
|
||||
// stop the transition
|
||||
if (anim->HasCurrentEffect()) {
|
||||
EffectSet* effectSet =
|
||||
|
@ -822,10 +839,8 @@ nsTransitionManager::ConsiderInitiatingTransition(
|
|||
|
||||
AnimationValue startValue, endValue;
|
||||
bool haveValues =
|
||||
ExtractNonDiscreteComputedValue(aProperty, aOldStyleContext,
|
||||
startValue.mGecko) &&
|
||||
ExtractNonDiscreteComputedValue(aProperty, aNewStyleContext,
|
||||
endValue.mGecko);
|
||||
ExtractNonDiscreteComputedValue(aProperty, aOldStyleContext, startValue) &&
|
||||
ExtractNonDiscreteComputedValue(aProperty, aNewStyleContext, endValue);
|
||||
|
||||
bool haveChange = startValue != endValue;
|
||||
|
||||
|
@ -1088,8 +1103,7 @@ nsTransitionManager::PruneCompletedTransitions(mozilla::dom::Element* aElement,
|
|||
// influence style.
|
||||
AnimationValue currentValue;
|
||||
if (!ExtractNonDiscreteComputedValue(anim->TransitionProperty(),
|
||||
aNewStyleContext,
|
||||
currentValue.mGecko) ||
|
||||
aNewStyleContext, currentValue) ||
|
||||
currentValue != anim->ToValue()) {
|
||||
anim->CancelFromStyle();
|
||||
animations.RemoveElementAt(i);
|
||||
|
|
Загрузка…
Ссылка в новой задаче