Bug 1412716 - De-templatize EffectCompositor::UpdateEffectProperties and relevant stuff. r?emilio
MozReview-Commit-ID: K8yb8Kw16Mr
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -374,34 +374,33 @@ EffectCompositor::ClearRestyleRequestsFo
pseudoType == CSSPseudoElementType::after) {
Element* parentElement = aElement->GetParentElement();
MOZ_ASSERT(parentElement);
PseudoElementHashEntry::KeyType key = { parentElement, pseudoType };
elementsToRestyle.Remove(key);
}
}
-template<typename StyleType>
void
-EffectCompositor::UpdateEffectProperties(StyleType* aStyleType,
+EffectCompositor::UpdateEffectProperties(const ComputedStyle* aStyle,
Element* aElement,
CSSPseudoElementType aPseudoType)
{
EffectSet* effectSet = EffectSet::GetEffectSet(aElement, aPseudoType);
if (!effectSet) {
return;
}
// Style context (Gecko) or computed values (Stylo) change might cause CSS
// cascade level, e.g removing !important, so we should update the cascading
// result.
effectSet->MarkCascadeNeedsUpdate();
for (KeyframeEffectReadOnly* effect : *effectSet) {
- effect->UpdateProperties(aStyleType);
+ effect->UpdateProperties(aStyle);
}
}
namespace {
class EffectCompositeOrderComparator {
public:
bool Equals(const KeyframeEffectReadOnly* a,
@@ -984,16 +983,9 @@ EffectCompositor::PreTraverse(dom::Eleme
elementSet.Remove(key);
found = true;
}
return found;
}
-template
-void
-EffectCompositor::UpdateEffectProperties(
- const ComputedStyle* aComputedStyle,
- Element* aElement,
- CSSPseudoElementType aPseudoType);
-
} // namespace mozilla
--- a/dom/animation/EffectCompositor.h
+++ b/dom/animation/EffectCompositor.h
@@ -113,18 +113,17 @@ public:
// Clear all pending restyle requests for the given (pseudo-) element (and its
// ::before and ::after elements if the given element is not pseudo).
void ClearRestyleRequestsFor(dom::Element* aElement);
// Called when computed style on the specified (pseudo-) element might
// have changed so that any context-sensitive values stored within
// animation effects (e.g. em-based endpoints used in keyframe effects)
// can be re-resolved to computed values.
- template<typename StyleType>
- void UpdateEffectProperties(StyleType* aStyleType,
+ void UpdateEffectProperties(const ComputedStyle* aStyle,
dom::Element* aElement,
CSSPseudoElementType aPseudoType);
// Get animation rule for stylo. This is an equivalent of GetAnimationRule
// and will be called from servo side.
// The animation rule is stored in |RawServoAnimationValueMapBorrowed|.
// We need to be careful while doing any modification because it may cause
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -660,19 +660,18 @@ KeyframeEffectReadOnly::ConstructKeyfram
// Copy aSource's keyframes and animation properties.
// Note: We don't call SetKeyframes directly, which might revise the
// computed offsets and rebuild the animation properties.
effect->mKeyframes = aSource.mKeyframes;
effect->mProperties = aSource.mProperties;
return effect.forget();
}
-template<typename StyleType>
nsTArray<AnimationProperty>
-KeyframeEffectReadOnly::BuildProperties(StyleType* aStyle)
+KeyframeEffectReadOnly::BuildProperties(const ComputedStyle* aStyle)
{
MOZ_ASSERT(aStyle);
nsTArray<AnimationProperty> result;
// If mTarget is null, return an empty property array.
if (!mTarget) {
return result;
--- a/dom/animation/KeyframeEffectReadOnly.h
+++ b/dom/animation/KeyframeEffectReadOnly.h
@@ -290,18 +290,17 @@ protected:
static already_AddRefed<KeyframeEffectType>
ConstructKeyframeEffect(const GlobalObject& aGlobal,
KeyframeEffectReadOnly& aSource,
ErrorResult& aRv);
// Build properties by recalculating from |mKeyframes| using |aComputedStyle|
// to resolve specified values. This function also applies paced spacing if
// needed.
- template<typename StyleType>
- nsTArray<AnimationProperty> BuildProperties(StyleType* aStyle);
+ nsTArray<AnimationProperty> BuildProperties(const ComputedStyle* aStyle);
// This effect is registered with its target element so long as:
//
// (a) It has a target element, and
// (b) It is "relevant" (i.e. yet to finish but not idle, or finished but
// filling forwards)
//
// As a result, we need to make sure this gets called whenever anything
--- a/dom/animation/KeyframeUtils.cpp
+++ b/dom/animation/KeyframeUtils.cpp
@@ -476,22 +476,21 @@ KeyframeUtils::DistributeKeyframes(nsTAr
keyframeB->mComputedOffset = keyframeB->mOffset.valueOr(1.0);
// Fill computed offsets in (keyframe A, keyframe B).
DistributeRange(Range<Keyframe>(keyframeA, keyframeB + 1));
keyframeA = keyframeB;
}
}
-template<typename StyleType>
/* static */ nsTArray<AnimationProperty>
KeyframeUtils::GetAnimationPropertiesFromKeyframes(
const nsTArray<Keyframe>& aKeyframes,
dom::Element* aElement,
- StyleType* aStyle,
+ const ComputedStyle* aStyle,
dom::CompositeOperation aEffectComposite)
{
nsTArray<AnimationProperty> result;
const nsTArray<ComputedKeyframeValues> computedValues =
GetComputedKeyframeValues(aKeyframes, aElement, aStyle);
if (computedValues.IsEmpty()) {
// In rare cases GetComputedKeyframeValues might fail and return an empty
@@ -1487,17 +1486,9 @@ DistributeRange(const Range<Keyframe>& a
const double diffOffset = aRange[n].mComputedOffset - startOffset;
for (auto iter = rangeToAdjust.begin(); iter != rangeToAdjust.end(); ++iter) {
size_t index = iter - aRange.begin();
iter->mComputedOffset = startOffset + double(index) / n * diffOffset;
}
}
-template
-nsTArray<AnimationProperty>
-KeyframeUtils::GetAnimationPropertiesFromKeyframes(
- const nsTArray<Keyframe>& aKeyframes,
- dom::Element* aElement,
- const ComputedStyle* aStyle,
- dom::CompositeOperation aEffectComposite);
-
} // namespace mozilla
--- a/dom/animation/KeyframeUtils.h
+++ b/dom/animation/KeyframeUtils.h
@@ -76,29 +76,27 @@ public:
/**
* Converts an array of Keyframe objects into an array of AnimationProperty
* objects. This involves creating an array of computed values for each
* longhand property and determining the offset and timing function to use
* for each value.
*
* @param aKeyframes The input keyframes.
* @param aElement The context element.
- * @param aStyleType The |ComputedStyle| or |GeckoComputedStyle| to use
- * when computing values.
+ * @param aStyle The computed style values.
* @param aEffectComposite The composite operation specified on the effect.
* For any keyframes in |aKeyframes| that do not specify a composite
* operation, this value will be used.
* @return The set of animation properties. If an error occurs, the returned
* array will be empty.
*/
- template<typename StyleType>
static nsTArray<AnimationProperty> GetAnimationPropertiesFromKeyframes(
const nsTArray<Keyframe>& aKeyframes,
dom::Element* aElement,
- StyleType* aStyleType,
+ const ComputedStyle* aStyle,
dom::CompositeOperation aEffectComposite);
/**
* Check if the property or, for shorthands, one or more of
* its subproperties, is animatable.
*
* @param aProperty The property to check.
* @param aBackend The style backend, Servo or Gecko, that should determine