Bug 1305325 - Part 2: Add AnimationProperty::HasNonReplaceComposite. r?birtles
We will resolve base values only if HasNonReplaceComposite() returns true.
MozReview-Commit-ID: LUui9BpuphW
--- a/dom/animation/KeyframeEffectReadOnly.h
+++ b/dom/animation/KeyframeEffectReadOnly.h
@@ -115,16 +115,18 @@ struct Keyframe
nsTArray<PropertyValuePair> mPropertyValues;
};
struct AnimationPropertySegment
{
float mFromKey, mToKey;
StyleAnimationValue mFromValue, mToValue;
Maybe<ComputedTimingFunction> mTimingFunction;
+ dom::CompositeOperation mFromComposite = dom::CompositeOperation::Replace;
+ dom::CompositeOperation mToComposite = dom::CompositeOperation::Replace;
bool operator==(const AnimationPropertySegment& aOther) const
{
return mFromKey == aOther.mFromKey &&
mToKey == aOther.mToKey &&
mFromValue == aOther.mFromValue &&
mToValue == aOther.mToValue &&
mTimingFunction == aOther.mTimingFunction;
@@ -176,16 +178,29 @@ struct AnimationProperty
{
return mProperty == aOther.mProperty &&
mSegments == aOther.mSegments;
}
bool operator!=(const AnimationProperty& aOther) const
{
return !(*this == aOther);
}
+
+ // Returns true if there is at least one segment with a composite value that
+ // is not 'replace'.
+ bool HasNonReplaceComposite() const
+ {
+ for (const AnimationPropertySegment& segment : mSegments) {
+ if (segment.mFromComposite != dom::CompositeOperation::Replace ||
+ segment.mToComposite != dom::CompositeOperation::Replace) {
+ return true;
+ }
+ }
+ return false;
+ }
};
struct ElementPropertyTransition;
namespace dom {
class Animation;