Bug 1334036 - Part 10: Return AnimationValue for BaseStyle. r=hiro

We need to retrieve the correct base style for Servo backend, so change
the return value to AnimationValue and update
KeyframeEffectReadOnly::BaseStyle().

MozReview-Commit-ID: 9FL3h1DLoJt

--HG--
extra : rebase_source : 42284c5fe8b8135910cde44b0815eb475ca2f1cc
This commit is contained in:
Boris Chiou 2017-05-10 11:06:19 +08:00
Родитель 3ae8dacbdf
Коммит 731ab38439
4 изменённых файлов: 19 добавлений и 15 удалений

Просмотреть файл

@ -427,7 +427,7 @@ KeyframeEffectReadOnly::GetUnderlyingStyle(
// If we are composing with composite operation that is not 'replace'
// and we have not composed style for the property yet, we have to get
// the base style for the property.
result = BaseStyle(aProperty);
result = BaseStyle(aProperty).mGecko;
}
return result;
@ -1297,7 +1297,8 @@ KeyframeEffectReadOnly::GetKeyframes(JSContext*& aCx,
// handle null nsCSSValues for longhand properties.
DebugOnly<bool> uncomputeResult =
StyleAnimationValue::UncomputeValue(
propertyValue.mProperty, Move(BaseStyle(propertyValue.mProperty)),
propertyValue.mProperty,
Move(BaseStyle(propertyValue.mProperty).mGecko),
cssValue);
MOZ_ASSERT(uncomputeResult,
@ -1848,7 +1849,7 @@ KeyframeEffectReadOnly::ContainsAnimatedScale(const nsIFrame* aFrame) const
continue;
}
StyleAnimationValue baseStyle = BaseStyle(prop.mProperty);
AnimationValue baseStyle = BaseStyle(prop.mProperty);
if (baseStyle.IsNull()) {
// If we failed to get the base style, we consider it has scale value
// here just to be safe.

Просмотреть файл

@ -279,10 +279,18 @@ public:
// |aFrame| is used for calculation of scale values.
bool ContainsAnimatedScale(const nsIFrame* aFrame) const;
StyleAnimationValue BaseStyle(nsCSSPropertyID aProperty) const
AnimationValue BaseStyle(nsCSSPropertyID aProperty) const
{
StyleAnimationValue result;
DebugOnly<bool> hasProperty = mBaseStyleValues.Get(aProperty, &result);
AnimationValue result;
bool hasProperty = false;
if (mDocument->IsStyledByServo()) {
// We cannot use getters_AddRefs on RawServoAnimationValue because it is
// an incomplete type, so Get() doesn't work. Instead, use GetWeak, and
// then assign the raw pointer to a RefPtr.
result.mServo = mBaseStyleValuesForServo.GetWeak(aProperty, &hasProperty);
} else {
hasProperty = mBaseStyleValues.Get(aProperty, &result.mGecko);
}
MOZ_ASSERT(hasProperty || result.IsNull());
return result;
}

Просмотреть файл

@ -633,12 +633,9 @@ GetMinAndMaxScaleForAnimationProperty(const nsIFrame* aFrame,
// 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);
AnimationValue baseStyle = effect->BaseStyle(prop.mProperty);
if (!baseStyle.IsNull()) {
// FIXME: Bug 1334036: We need to get the baseStyle for
// RawServoAnimationValue.
UpdateMinMaxScale(aFrame, AnimationValue(baseStyle),
aMinScale, aMaxScale);
UpdateMinMaxScale(aFrame, baseStyle, aMinScale, aMaxScale);
}
for (const AnimationPropertySegment& segment : prop.mSegments) {

Просмотреть файл

@ -566,13 +566,11 @@ AddAnimationForProperty(nsIFrame* aFrame, const AnimationProperty& aProperty,
// If the animation is additive or accumulates, we need to pass its base value
// to the compositor.
StyleAnimationValue baseStyle =
AnimationValue baseStyle =
aAnimation->GetEffect()->AsKeyframeEffect()->BaseStyle(aProperty.mProperty);
if (!baseStyle.IsNull()) {
// FIXME: Bug 1334036: We need to get the baseValue for
// RawServoAnimationValue.
SetAnimatable(aProperty.mProperty,
AnimationValue(baseStyle),
baseStyle,
aFrame, refBox,
animation->baseStyle());
} else {