Bug 1355348 - Add constructor to AnimationValue; r?hiro
We will use this later in this patch series to simplify the creation of SMIL's
ValueWrapper objects.
MozReview-Commit-ID: 7EF9CN2SdwQ
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -591,17 +591,18 @@ GetMinAndMaxScaleForAnimationProperty(co
}
// We need to factor in the scale of the base style if the base style
// will be used on the compositor.
StyleAnimationValue baseStyle = effect->BaseStyle(prop.mProperty);
if (!baseStyle.IsNull()) {
// FIXME: Bug 1334036: We need to get the baseStyle for
// RawServoAnimationValue.
- UpdateMinMaxScale(aFrame, { baseStyle, nullptr }, aMinScale, aMaxScale);
+ UpdateMinMaxScale(aFrame, AnimationValue(baseStyle),
+ aMinScale, aMaxScale);
}
for (const AnimationPropertySegment& segment : prop.mSegments) {
// In case of add or accumulate composite, StyleAnimationValue does
// not have a valid value.
if (segment.HasReplaceableFromValue()) {
UpdateMinMaxScale(aFrame, segment.mFromValue, aMinScale, aMaxScale);
}
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -557,17 +557,17 @@ AddAnimationForProperty(nsIFrame* aFrame
// to the compositor.
StyleAnimationValue baseStyle =
aAnimation->GetEffect()->AsKeyframeEffect()->BaseStyle(aProperty.mProperty);
if (!baseStyle.IsNull()) {
// FIXME: Bug 1334036: We need to get the baseValue for
// RawServoAnimationValue.
SetAnimatable(aProperty.mProperty,
- { baseStyle, nullptr },
+ AnimationValue(baseStyle),
aFrame, refBox,
animation->baseStyle());
} else {
animation->baseStyle() = null_t();
}
for (uint32_t segIdx = 0; segIdx < aProperty.mSegments.Length(); segIdx++) {
const AnimationPropertySegment& segment = aProperty.mSegments[segIdx];
--- a/layout/style/StyleAnimationValue.h
+++ b/layout/style/StyleAnimationValue.h
@@ -565,16 +565,22 @@ private:
}
static bool IsStringUnit(Unit aUnit) {
return aUnit == eUnit_UnparsedString;
}
};
struct AnimationValue
{
+ explicit AnimationValue(const StyleAnimationValue& aValue)
+ : mGecko(aValue) { }
+ explicit AnimationValue(const RefPtr<RawServoAnimationValue>& aValue)
+ : mServo(aValue) { }
+ AnimationValue() = default;
+
// mGecko and mServo are mutually exclusive: only one or the other should
// ever be set.
// FIXME: After obsoleting StyleAnimationValue, we should remove mGecko, and
// make AnimationValue a wrapper of RawServoAnimationValue to hide these
// FFIs.
StyleAnimationValue mGecko;
RefPtr<RawServoAnimationValue> mServo;