зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1335942 - Part 2: Use mozilla::AnimationValue in AnimationPropertySegment. r=hiro,manishearth
MozReview-Commit-ID: L6U1A223jsa --HG-- extra : rebase_source : 26d8ec4386443d6526fed2f4926c6e4519e6bbd0
This commit is contained in:
Родитель
13d39b9757
Коммит
155c2acd50
|
@ -542,8 +542,8 @@ KeyframeEffectReadOnly::ComposeStyle(
|
|||
|
||||
// Bug 1329878 - Stylo: Implement accumulate and addition on Servo
|
||||
// AnimationValue.
|
||||
RawServoAnimationValue* servoFromValue = segment->mServoFromValue;
|
||||
RawServoAnimationValue* servoToValue = segment->mServoToValue;
|
||||
RawServoAnimationValue* servoFromValue = segment->mFromValue.mServo;
|
||||
RawServoAnimationValue* servoToValue = segment->mToValue.mServo;
|
||||
|
||||
// For unsupported or non-animatable animation types, we get nullptrs.
|
||||
if (!servoFromValue || !servoToValue) {
|
||||
|
@ -599,11 +599,11 @@ KeyframeEffectReadOnly::ComposeStyle(
|
|||
|
||||
StyleAnimationValue fromValue =
|
||||
CompositeValue(prop.mProperty, aStyleRule.mGecko,
|
||||
segment->mFromValue,
|
||||
segment->mFromValue.mGecko,
|
||||
segment->mFromComposite);
|
||||
StyleAnimationValue toValue =
|
||||
CompositeValue(prop.mProperty, aStyleRule.mGecko,
|
||||
segment->mToValue,
|
||||
segment->mToValue.mGecko,
|
||||
segment->mToComposite);
|
||||
|
||||
// Iteration composition for accumulate
|
||||
|
@ -614,9 +614,9 @@ KeyframeEffectReadOnly::ComposeStyle(
|
|||
prop.mSegments.LastElement();
|
||||
// FIXME: Bug 1293492: Add a utility function to calculate both of
|
||||
// below StyleAnimationValues.
|
||||
StyleAnimationValue lastValue = lastSegment.mToValue.IsNull()
|
||||
StyleAnimationValue lastValue = lastSegment.mToValue.mGecko.IsNull()
|
||||
? GetUnderlyingStyle(prop.mProperty, aStyleRule.mGecko)
|
||||
: lastSegment.mToValue;
|
||||
: lastSegment.mToValue.mGecko;
|
||||
fromValue =
|
||||
StyleAnimationValue::Accumulate(prop.mProperty,
|
||||
lastValue,
|
||||
|
@ -1015,10 +1015,10 @@ DumpAnimationProperties(nsTArray<AnimationProperty>& aAnimationProperties)
|
|||
for (auto& s : p.mSegments) {
|
||||
nsString fromValue, toValue;
|
||||
Unused << StyleAnimationValue::UncomputeValue(p.mProperty,
|
||||
s.mFromValue,
|
||||
s.mFromValue.mGecko,
|
||||
fromValue);
|
||||
Unused << StyleAnimationValue::UncomputeValue(p.mProperty,
|
||||
s.mToValue,
|
||||
s.mToValue.mGecko,
|
||||
toValue);
|
||||
printf(" %f..%f: %s..%s\n", s.mFromKey, s.mToKey,
|
||||
NS_ConvertUTF16toUTF8(fromValue).get(),
|
||||
|
@ -1135,7 +1135,7 @@ KeyframeEffectReadOnly::GetProperties(
|
|||
|
||||
binding_detail::FastAnimationPropertyValueDetails fromValue;
|
||||
CreatePropertyValue(property.mProperty, segment.mFromKey,
|
||||
segment.mTimingFunction, segment.mFromValue,
|
||||
segment.mTimingFunction, segment.mFromValue.mGecko,
|
||||
segment.mFromComposite, fromValue);
|
||||
// We don't apply timing functions for zero-length segments, so
|
||||
// don't return one here.
|
||||
|
@ -1152,10 +1152,11 @@ KeyframeEffectReadOnly::GetProperties(
|
|||
// a) this is the last segment, or
|
||||
// b) the next segment's from-value differs.
|
||||
if (segmentIdx == segmentLen - 1 ||
|
||||
property.mSegments[segmentIdx + 1].mFromValue != segment.mToValue) {
|
||||
property.mSegments[segmentIdx + 1].mFromValue.mGecko !=
|
||||
segment.mToValue.mGecko) {
|
||||
binding_detail::FastAnimationPropertyValueDetails toValue;
|
||||
CreatePropertyValue(property.mProperty, segment.mToKey,
|
||||
Nothing(), segment.mToValue,
|
||||
Nothing(), segment.mToValue.mGecko,
|
||||
segment.mToComposite, toValue);
|
||||
// It doesn't really make sense to have a timing function on the
|
||||
// last property value or before a sudden jump so we just drop the
|
||||
|
@ -1621,11 +1622,13 @@ KeyframeEffectReadOnly::CalculateCumulativeChangeHint(
|
|||
}
|
||||
RefPtr<nsStyleContext> fromContext =
|
||||
CreateStyleContextForAnimationValue(property.mProperty,
|
||||
segment.mFromValue, aStyleContext);
|
||||
segment.mFromValue.mGecko,
|
||||
aStyleContext);
|
||||
|
||||
RefPtr<nsStyleContext> toContext =
|
||||
CreateStyleContextForAnimationValue(property.mProperty,
|
||||
segment.mToValue, aStyleContext);
|
||||
segment.mToValue.mGecko,
|
||||
aStyleContext);
|
||||
|
||||
uint32_t equalStructs = 0;
|
||||
uint32_t samePointerStructs = 0;
|
||||
|
|
|
@ -60,9 +60,7 @@ struct AnimationPropertySegment
|
|||
float mFromKey, mToKey;
|
||||
// NOTE: In the case that no keyframe for 0 or 1 offset is specified
|
||||
// the unit of mFromValue or mToValue is eUnit_Null.
|
||||
StyleAnimationValue mFromValue, mToValue;
|
||||
// FIXME add a deep == impl for RawServoAnimationValue
|
||||
RefPtr<RawServoAnimationValue> mServoFromValue, mServoToValue;
|
||||
AnimationValue mFromValue, mToValue;
|
||||
|
||||
Maybe<ComputedTimingFunction> mTimingFunction;
|
||||
dom::CompositeOperation mFromComposite = dom::CompositeOperation::Replace;
|
||||
|
|
|
@ -1166,7 +1166,7 @@ AppendInitialSegment(AnimationProperty* aAnimationProperty,
|
|||
segment->mFromKey = 0.0f;
|
||||
segment->mFromComposite = dom::CompositeOperation::Add;
|
||||
segment->mToKey = aFirstEntry.mOffset;
|
||||
segment->mToValue = aFirstEntry.mValue.mGecko;
|
||||
segment->mToValue = aFirstEntry.mValue;
|
||||
segment->mToComposite = aFirstEntry.mComposite;
|
||||
}
|
||||
|
||||
|
@ -1177,7 +1177,7 @@ AppendFinalSegment(AnimationProperty* aAnimationProperty,
|
|||
AnimationPropertySegment* segment =
|
||||
aAnimationProperty->mSegments.AppendElement();
|
||||
segment->mFromKey = aLastEntry.mOffset;
|
||||
segment->mFromValue = aLastEntry.mValue.mGecko;
|
||||
segment->mFromValue = aLastEntry.mValue;
|
||||
segment->mFromComposite = aLastEntry.mComposite;
|
||||
segment->mToKey = 1.0f;
|
||||
segment->mToComposite = dom::CompositeOperation::Add;
|
||||
|
@ -1400,10 +1400,8 @@ BuildSegmentsFromValueEntries(nsTArray<KeyframeValueEntry>& aEntries,
|
|||
animationProperty->mSegments.AppendElement();
|
||||
segment->mFromKey = aEntries[i].mOffset;
|
||||
segment->mToKey = aEntries[j].mOffset;
|
||||
segment->mFromValue = aEntries[i].mValue.mGecko;
|
||||
segment->mToValue = aEntries[j].mValue.mGecko;
|
||||
segment->mServoFromValue = aEntries[i].mValue.mServo;
|
||||
segment->mServoToValue = aEntries[j].mValue.mServo;
|
||||
segment->mFromValue = aEntries[i].mValue;
|
||||
segment->mToValue = aEntries[j].mValue;
|
||||
segment->mTimingFunction = aEntries[i].mTimingFunction;
|
||||
segment->mFromComposite = aEntries[i].mComposite;
|
||||
segment->mToComposite = aEntries[j].mComposite;
|
||||
|
|
|
@ -598,10 +598,12 @@ GetMinAndMaxScaleForAnimationProperty(const nsIFrame* aFrame,
|
|||
// In case of add or accumulate composite, StyleAnimationValue does
|
||||
// not have a valid value.
|
||||
if (segment.mFromComposite == dom::CompositeOperation::Replace) {
|
||||
UpdateMinMaxScale(aFrame, segment.mFromValue, aMinScale, aMaxScale);
|
||||
UpdateMinMaxScale(aFrame, segment.mFromValue.mGecko, aMinScale,
|
||||
aMaxScale);
|
||||
}
|
||||
if (segment.mToComposite == dom::CompositeOperation::Replace) {
|
||||
UpdateMinMaxScale(aFrame, segment.mToValue, aMinScale, aMaxScale);
|
||||
UpdateMinMaxScale(aFrame, segment.mToValue.mGecko, aMinScale,
|
||||
aMaxScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -488,11 +488,11 @@ ContainsAnimatedScale(EffectSet& aEffects, nsIFrame* aFrame)
|
|||
continue;
|
||||
}
|
||||
for (AnimationPropertySegment segment : prop.mSegments) {
|
||||
gfxSize from = segment.mFromValue.GetScaleValue(aFrame);
|
||||
gfxSize from = segment.mFromValue.mGecko.GetScaleValue(aFrame);
|
||||
if (from != gfxSize(1.0f, 1.0f)) {
|
||||
return true;
|
||||
}
|
||||
gfxSize to = segment.mToValue.GetScaleValue(aFrame);
|
||||
gfxSize to = segment.mToValue.mGecko.GetScaleValue(aFrame);
|
||||
if (to != gfxSize(1.0f, 1.0f)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -557,11 +557,11 @@ AddAnimationForProperty(nsIFrame* aFrame, const AnimationProperty& aProperty,
|
|||
|
||||
AnimationSegment* animSegment = animation->segments().AppendElement();
|
||||
SetAnimatable(aProperty.mProperty,
|
||||
segment.mFromValue,
|
||||
segment.mFromValue.mGecko,
|
||||
aFrame, refBox,
|
||||
animSegment->startState());
|
||||
SetAnimatable(aProperty.mProperty,
|
||||
segment.mToValue,
|
||||
segment.mToValue.mGecko,
|
||||
aFrame, refBox,
|
||||
animSegment->endState());
|
||||
|
||||
|
|
|
@ -586,6 +586,11 @@ struct AnimationValue
|
|||
{
|
||||
StyleAnimationValue mGecko;
|
||||
RefPtr<RawServoAnimationValue> mServo;
|
||||
|
||||
bool operator==(const AnimationValue& aOther) const {
|
||||
// FIXME: Bug 1337229: add a deep == impl for RawServoAnimationValue.
|
||||
return mGecko == aOther.mGecko && mServo == aOther.mServo;
|
||||
}
|
||||
};
|
||||
|
||||
struct PropertyStyleAnimationValuePair
|
||||
|
|
|
@ -120,7 +120,7 @@ ElementPropertyTransition::UpdateStartValueFromReplacedTransition()
|
|||
StyleAnimationValue::UncomputeValue(mProperties[0].mProperty,
|
||||
startValue,
|
||||
cssValue);
|
||||
mProperties[0].mSegments[0].mFromValue = Move(startValue);
|
||||
mProperties[0].mSegments[0].mFromValue.mGecko = Move(startValue);
|
||||
MOZ_ASSERT(uncomputeResult, "UncomputeValue should not fail");
|
||||
MOZ_ASSERT(mKeyframes.Length() == 2,
|
||||
"Transitions should have exactly two animation keyframes");
|
||||
|
@ -989,8 +989,8 @@ nsTransitionManager::ConsiderInitiatingTransition(
|
|||
oldPT->GetAnimation()->PlaybackRate(),
|
||||
oldPT->SpecifiedTiming(),
|
||||
segment.mTimingFunction,
|
||||
segment.mFromValue,
|
||||
segment.mToValue
|
||||
segment.mFromValue.mGecko,
|
||||
segment.mToValue.mGecko
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ struct ElementPropertyTransition : public dom::KeyframeEffectReadOnly
|
|||
NS_WARNING("Failed to generate transition property values");
|
||||
return StyleAnimationValue();
|
||||
}
|
||||
return mProperties[0].mSegments[0].mToValue;
|
||||
return mProperties[0].mSegments[0].mToValue.mGecko;
|
||||
}
|
||||
|
||||
// This is the start value to be used for a check for whether a
|
||||
|
|
Загрузка…
Ссылка в новой задаче