--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -350,32 +350,32 @@ EffectCompositor::PostRestyleForThrottle
cascadeLevel);
postedRestyle = true;
}
}
}
template<typename StyleType>
void
-EffectCompositor::UpdateEffectProperties(StyleType&& aStyleType,
+EffectCompositor::UpdateEffectProperties(StyleType* aStyleType,
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(Forward<StyleType>(aStyleType));
+ effect->UpdateProperties(aStyleType);
}
}
void
EffectCompositor::MaybeUpdateAnimationRule(dom::Element* aElement,
CSSPseudoElementType aPseudoType,
CascadeLevel aCascadeLevel,
nsStyleContext* aStyleContext)
@@ -1234,21 +1234,21 @@ size_t
EffectCompositor::AnimationStyleRuleProcessor::SizeOfIncludingThis(
MallocSizeOf aMallocSizeOf) const
{
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
template
void
-EffectCompositor::UpdateEffectProperties<RefPtr<nsStyleContext>&>(
- RefPtr<nsStyleContext>& aStyleContext,
+EffectCompositor::UpdateEffectProperties(
+ nsStyleContext* aStyleContext,
Element* aElement,
CSSPseudoElementType aPseudoType);
template
void
-EffectCompositor::UpdateEffectProperties<const ServoComputedValuesWithParent&>(
- const ServoComputedValuesWithParent& aServoValues,
+EffectCompositor::UpdateEffectProperties(
+ const ServoComputedValues* aServoValues,
Element* aElement,
CSSPseudoElementType aPseudoType);
} // namespace mozilla
--- a/dom/animation/EffectCompositor.h
+++ b/dom/animation/EffectCompositor.h
@@ -116,17 +116,17 @@ public:
// posted because updates on the main thread are throttled.
void PostRestyleForThrottledAnimations();
// 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(StyleType* aStyleType,
dom::Element* aElement,
CSSPseudoElementType aPseudoType);
// Updates the animation rule stored on the EffectSet for the
// specified (pseudo-)element for cascade level |aLevel|.
// If the animation rule is not marked as needing an update,
// no work is done.
// |aStyleContext| is used for UpdateCascadingResults.
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -14,17 +14,16 @@
#include "mozilla/AnimValuesStyleRule.h"
#include "mozilla/AnimationUtils.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/EffectSet.h"
#include "mozilla/FloatingPoint.h" // For IsFinite
#include "mozilla/LookAndFeel.h" // For LookAndFeel::GetInt
#include "mozilla/KeyframeUtils.h"
#include "mozilla/ServoBindings.h"
-#include "mozilla/ServoComputedValuesWithParent.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TypeTraits.h"
#include "Layers.h" // For Layer
#include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetStyleContext
#include "nsContentUtils.h" // nsContentUtils::ReportToConsole
#include "nsCSSPropertyIDSet.h"
#include "nsCSSProps.h" // For nsCSSProps::PropHasFlags
#include "nsCSSPseudoElements.h" // For CSSPseudoElementType
@@ -194,50 +193,48 @@ KeyframeEffectReadOnly::SetKeyframes(nsT
nsStyleContext* aStyleContext)
{
DoSetKeyframes(Move(aKeyframes), Move(aStyleContext));
}
void
KeyframeEffectReadOnly::SetKeyframes(
nsTArray<Keyframe>&& aKeyframes,
- const ServoComputedValuesWithParent& aServoValues)
+ const ServoComputedValues* aComputedValues)
{
- DoSetKeyframes(Move(aKeyframes), aServoValues);
+ DoSetKeyframes(Move(aKeyframes), aComputedValues);
}
template<typename StyleType>
void
KeyframeEffectReadOnly::DoSetKeyframes(nsTArray<Keyframe>&& aKeyframes,
- StyleType&& aStyle)
+ StyleType* aStyle)
{
- static_assert(IsSame<StyleType, nsStyleContext*>::value ||
- IsSame<StyleType, const ServoComputedValuesWithParent&>::value,
+ static_assert(IsSame<StyleType, nsStyleContext>::value ||
+ IsSame<StyleType, const ServoComputedValues>::value,
"StyleType should be nsStyleContext* or "
- "const ServoComputedValuesWithParent&");
+ "const ServoComputedValues*");
if (KeyframesEqualIgnoringComputedOffsets(aKeyframes, mKeyframes)) {
return;
}
mKeyframes = Move(aKeyframes);
// Apply distribute spacing irrespective of the spacing mode. We will apply
// the specified spacing mode when we generate computed animation property
// values from the keyframes since both operations require a style context
// and need to be performed whenever the style context changes.
KeyframeUtils::ApplyDistributeSpacing(mKeyframes);
if (mAnimation && mAnimation->IsRelevant()) {
nsNodeUtils::AnimationChanged(mAnimation);
}
- // We need to call UpdateProperties() if the StyleType is
- // 'const ServoComputedValuesWithParent&' (i.e. not a pointer) or
- // nsStyleContext* is not nullptr.
- if (!IsPointer<StyleType>::value || aStyle) {
+ // We need to call UpdateProperties() if the StyleType is not nullptr.
+ if (aStyle) {
UpdateProperties(aStyle);
MaybeUpdateFrameForCompositor();
}
}
const AnimationProperty*
KeyframeEffectReadOnly::GetEffectiveAnimationOfProperty(
nsCSSPropertyID aProperty) const
@@ -304,50 +301,43 @@ KeyframeEffectReadOnly::UpdateProperties
if (!mDocument->IsStyledByServo()) {
DoUpdateProperties(Move(aStyleContext));
return;
}
const ServoComputedValues* currentStyle =
aStyleContext->StyleSource().AsServoComputedValues();
- // FIXME: Remove GetParentAllowServo() in Bug 1349004.
- const ServoComputedValues* parentStyle =
- aStyleContext->GetParentAllowServo()
- ? aStyleContext->GetParentAllowServo()->StyleSource().AsServoComputedValues()
- : nullptr;
- const ServoComputedValuesWithParent servoValues = { currentStyle, parentStyle };
- DoUpdateProperties(servoValues);
+ DoUpdateProperties(currentStyle);
}
void
KeyframeEffectReadOnly::UpdateProperties(
- const ServoComputedValuesWithParent& aServoValues)
+ const ServoComputedValues* aComputedValues)
{
- DoUpdateProperties(aServoValues);
+ DoUpdateProperties(aComputedValues);
}
template<typename StyleType>
void
-KeyframeEffectReadOnly::DoUpdateProperties(StyleType&& aStyle)
+KeyframeEffectReadOnly::DoUpdateProperties(StyleType* aStyle)
{
- MOZ_ASSERT_IF(IsPointer<StyleType>::value, aStyle);
+ MOZ_ASSERT(aStyle);
// Skip updating properties when we are composing style.
// FIXME: Bug 1324966. Drop this check once we have a function to get
// nsStyleContext without resolving animating style.
MOZ_DIAGNOSTIC_ASSERT(!mIsComposingStyle,
"Should not be called while processing ComposeStyle()");
if (mIsComposingStyle) {
return;
}
- nsTArray<AnimationProperty> properties =
- BuildProperties(Forward<StyleType>(aStyle));
+ nsTArray<AnimationProperty> properties = BuildProperties(aStyle);
// We need to update base styles even if any properties are not changed at all
// since base styles might have been changed due to parent style changes, etc.
EnsureBaseStyles(aStyle, properties);
if (mProperties == properties) {
return;
}
@@ -506,17 +496,17 @@ KeyframeEffectReadOnly::EnsureBaseStyle(
MOZ_ASSERT(success, "Should be able to extract computed animation value");
MOZ_ASSERT(!result.IsNull(), "Should have a valid StyleAnimationValue");
mBaseStyleValues.Put(aProperty, result);
}
void
KeyframeEffectReadOnly::EnsureBaseStyles(
- const ServoComputedValuesWithParent& aServoValues,
+ const ServoComputedValues* aComputedValues,
const nsTArray<AnimationProperty>& aProperties)
{
if (!mTarget) {
return;
}
mBaseStyleValuesForServo.Clear();
@@ -931,22 +921,22 @@ KeyframeEffectReadOnly::ConstructKeyfram
// properly.
effect->mKeyframes = aSource.mKeyframes;
effect->mProperties = aSource.mProperties;
return effect.forget();
}
template<typename StyleType>
nsTArray<AnimationProperty>
-KeyframeEffectReadOnly::BuildProperties(StyleType&& aStyle)
+KeyframeEffectReadOnly::BuildProperties(StyleType* aStyle)
{
- static_assert(IsSame<StyleType, nsStyleContext*>::value ||
- IsSame<StyleType, const ServoComputedValuesWithParent&>::value,
+ static_assert(IsSame<StyleType, nsStyleContext>::value ||
+ IsSame<StyleType, const ServoComputedValues>::value,
"StyleType should be nsStyleContext* or "
- "const ServoComputedValuesWithParent&");
+ "const ServoComputedValues*");
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
@@ -38,17 +38,16 @@ class nsIFrame;
class nsIPresShell;
namespace mozilla {
class AnimValuesStyleRule;
enum class CSSPseudoElementType : uint8_t;
class ErrorResult;
struct AnimationRule;
-struct ServoComputedValuesWithParent;
struct TimingParams;
class EffectSet;
namespace dom {
class ElementOrCSSPseudoElement;
class GlobalObject;
class OwningElementOrCSSPseudoElement;
class UnrestrictedDoubleOrKeyframeAnimationOptions;
@@ -166,17 +165,17 @@ public:
void NotifyAnimationTimingUpdated();
void RequestRestyle(EffectCompositor::RestyleType aRestyleType);
void SetAnimation(Animation* aAnimation) override;
void SetKeyframes(JSContext* aContext, JS::Handle<JSObject*> aKeyframes,
ErrorResult& aRv);
void SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
nsStyleContext* aStyleContext);
void SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
- const ServoComputedValuesWithParent& aServoValues);
+ const ServoComputedValues* aComputedValues);
// Returns true if the effect includes |aProperty| regardless of whether the
// property is overridden by !important rule.
bool HasAnimationOfProperty(nsCSSPropertyID aProperty) const;
// GetEffectiveAnimationOfProperty returns AnimationProperty corresponding
// to a given CSS property if the effect includes the property and the
// property is not overridden by !important rules.
@@ -195,17 +194,17 @@ public:
{
return mProperties;
}
// Update |mProperties| by recalculating from |mKeyframes| using
// |aStyleContext| to resolve specified values.
void UpdateProperties(nsStyleContext* aStyleContext);
// Servo version of the above function.
- void UpdateProperties(const ServoComputedValuesWithParent& aServoValues);
+ void UpdateProperties(const ServoComputedValues* aComputedValues);
// Update various bits of state related to running ComposeStyle().
// We need to update this outside ComposeStyle() because we should avoid
// mutating any state in ComposeStyle() since it might be called during
// parallel traversal.
void WillComposeStyle();
// Updates |aComposeResult| with the animation values produced by this
@@ -234,18 +233,17 @@ public:
//
// For example, if we have an animation of geometric properties like 'left'
// and 'top' on an element, we force all 'transform' animations running at
// the same time on the same element to run on the main thread.
//
// When returning true, |aPerformanceWarning| stores the reason why
// we shouldn't run the transform animations.
bool ShouldBlockAsyncTransformAnimations(
- const nsIFrame* aFrame,
- AnimationPerformanceWarning::Type& aPerformanceWarning) const;
+ const nsIFrame* aFrame, AnimationPerformanceWarning::Type& aPerformanceWarning) const;
bool HasGeometricProperties() const;
bool AffectsGeometry() const override
{
return GetTarget() && HasGeometricProperties();
}
nsIDocument* GetRenderedDocument() const;
nsIPresShell* GetPresShell() const;
@@ -259,18 +257,17 @@ public:
const AnimationPerformanceWarning& aWarning);
// Record telemetry about the size of the content being animated.
void RecordFrameSizeTelemetry(uint32_t aPixelArea);
// Cumulative change hint on each segment for each property.
// This is used for deciding the animation is paint-only.
void CalculateCumulativeChangeHint(nsStyleContext* aStyleContext);
- void CalculateCumulativeChangeHint(
- const ServoComputedValuesWithParent& aServoValues)
+ void CalculateCumulativeChangeHint(const ServoComputedValues* aComputedValues)
{
}
// Returns true if all of animation properties' change hints
// can ignore painting if the animation is not visible.
// See nsChangeHint_Hints_CanIgnoreIfNotVisible in nsChangeHint.h
// in detail which change hint can be ignored.
bool CanIgnoreIfNotVisible() const;
@@ -319,17 +316,17 @@ protected:
ConstructKeyframeEffect(const GlobalObject& aGlobal,
KeyframeEffectReadOnly& aSource,
ErrorResult& aRv);
// Build properties by recalculating from |mKeyframes| using |aStyleContext|
// to resolve specified values. This function also applies paced spacing if
// needed.
template<typename StyleType>
- nsTArray<AnimationProperty> BuildProperties(StyleType&& aStyle);
+ nsTArray<AnimationProperty> BuildProperties(StyleType* 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
@@ -370,17 +367,17 @@ protected:
// Returns underlying style animation value for |aProperty|.
StyleAnimationValue GetUnderlyingStyle(
nsCSSPropertyID aProperty,
const RefPtr<AnimValuesStyleRule>& aAnimationRule);
// Ensure the base styles is available for any properties in |aProperties|.
void EnsureBaseStyles(nsStyleContext* aStyleContext,
const nsTArray<AnimationProperty>& aProperties);
- void EnsureBaseStyles(const ServoComputedValuesWithParent& aServoValues,
+ void EnsureBaseStyles(const ServoComputedValues* aComputedValues,
const nsTArray<AnimationProperty>& aProperties);
// If no base style is already stored for |aProperty|, resolves the base style
// for |aProperty| using |aStyleContext| and stores it in mBaseStyleValues.
// If |aCachedBaseStyleContext| is non-null, it will be used, otherwise the
// base style context will be resolved and stored in
// |aCachedBaseStyleContext|.
void EnsureBaseStyle(nsCSSPropertyID aProperty,
@@ -432,20 +429,20 @@ protected:
// we get a "ContentTooLarge" warning, but again only once per effect:target
// pair.
bool mRecordedFrameSize = false;
private:
nsChangeHint mCumulativeChangeHint;
template<typename StyleType>
- void DoSetKeyframes(nsTArray<Keyframe>&& aKeyframes, StyleType&& aStyle);
+ void DoSetKeyframes(nsTArray<Keyframe>&& aKeyframes, StyleType* aStyle);
template<typename StyleType>
- void DoUpdateProperties(StyleType&& aStyle);
+ void DoUpdateProperties(StyleType* aStyle);
void ComposeStyleRule(RefPtr<AnimValuesStyleRule>& aStyleRule,
const AnimationProperty& aProperty,
const AnimationPropertySegment& aSegment,
const ComputedTiming& aComputedTiming);
void ComposeStyleRule(RawServoAnimationValueMap& aAnimationValues,
const AnimationProperty& aProperty,
--- a/dom/animation/KeyframeUtils.cpp
+++ b/dom/animation/KeyframeUtils.cpp
@@ -6,17 +6,16 @@
#include "mozilla/KeyframeUtils.h"
#include "mozilla/AnimationUtils.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Move.h"
#include "mozilla/RangedArray.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/ServoBindingTypes.h"
-#include "mozilla/ServoComputedValuesWithParent.h"
#include "mozilla/StyleAnimationValue.h"
#include "mozilla/TimingParams.h"
#include "mozilla/dom/BaseKeyframeTypesBinding.h" // For FastBaseKeyframe etc.
#include "mozilla/dom/Element.h"
#include "mozilla/dom/KeyframeEffectBinding.h"
#include "mozilla/dom/KeyframeEffectReadOnly.h" // For PropertyValuesPair etc.
#include "jsapi.h" // For ForOfIterator etc.
#include "nsClassHashtable.h"
@@ -592,26 +591,26 @@ KeyframeUtils::ApplyDistributeSpacing(ns
ApplySpacing(aKeyframes, SpacingMode::distribute, eCSSProperty_UNKNOWN,
emptyArray, static_cast<nsStyleContext*>(nullptr));
}
/* static */ nsTArray<ComputedKeyframeValues>
KeyframeUtils::GetComputedKeyframeValues(
const nsTArray<Keyframe>& aKeyframes,
dom::Element* aElement,
- const ServoComputedValuesWithParent& aServoValues)
+ const ServoComputedValues* aComputedValues)
{
MOZ_ASSERT(aElement);
MOZ_ASSERT(aElement->IsStyledByServo());
nsPresContext* presContext = nsContentUtils::GetContextForContent(aElement);
MOZ_ASSERT(presContext);
return presContext->StyleSet()->AsServo()
- ->GetComputedKeyframeValuesFor(aKeyframes, aElement, aServoValues);
+ ->GetComputedKeyframeValuesFor(aKeyframes, aElement, aComputedValues);
}
/* static */ nsTArray<ComputedKeyframeValues>
KeyframeUtils::GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
dom::Element* aElement,
nsStyleContext* aStyleContext)
{
MOZ_ASSERT(aStyleContext);
--- a/dom/animation/KeyframeUtils.h
+++ b/dom/animation/KeyframeUtils.h
@@ -19,17 +19,16 @@ struct ServoComputedValues;
struct RawServoDeclarationBlock;
namespace mozilla {
struct AnimationProperty;
enum class CSSPseudoElementType : uint8_t;
class ErrorResult;
struct Keyframe;
struct PropertyStyleAnimationValuePair;
-struct ServoComputedValuesWithParent;
namespace dom {
class Element;
} // namespace dom
} // namespace mozilla
namespace mozilla {
@@ -84,17 +83,17 @@ public:
static nsTArray<ComputedKeyframeValues>
GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
dom::Element* aElement,
nsStyleContext* aStyleContext);
static nsTArray<ComputedKeyframeValues>
GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
dom::Element* aElement,
- const ServoComputedValuesWithParent& aServoValues);
+ const ServoComputedValues* aComputedValues);
/**
* Fills in the mComputedOffset member of each keyframe in the given array
* using the specified spacing mode.
*
* https://w3c.github.io/web-animations/#spacing-keyframes
*
* @param aKeyframes The set of keyframes to adjust.
@@ -113,17 +112,17 @@ public:
SpacingMode aSpacingMode,
nsCSSPropertyID aProperty,
nsTArray<ComputedKeyframeValues>& aComputedValues,
nsStyleContext* aStyleContext);
static void ApplySpacing(nsTArray<Keyframe>& aKeyframes,
SpacingMode aSpacingMode,
nsCSSPropertyID aProperty,
nsTArray<ComputedKeyframeValues>& aComputedValues,
- const ServoComputedValuesWithParent& aServoValues)
+ const ServoComputedValues* aServoValues)
{
NS_WARNING("stylo: ApplySpacing not implemented yet");
}
/**
* Wrapper for ApplySpacing to simplify using distribute spacing.
*
* @param aKeyframes The set of keyframes to adjust.
--- a/dom/smil/nsSMILCSSValueType.cpp
+++ b/dom/smil/nsSMILCSSValueType.cpp
@@ -13,17 +13,16 @@
#include "nsSMILParserUtils.h"
#include "nsSMILValue.h"
#include "nsCSSProps.h"
#include "nsCSSValue.h"
#include "nsColor.h"
#include "nsPresContext.h"
#include "mozilla/Keyframe.h" // For PropertyValuePair
#include "mozilla/ServoBindings.h"
-#include "mozilla/ServoComputedValuesWithParent.h"
#include "mozilla/StyleAnimationValue.h" // For AnimationValue
#include "mozilla/StyleSetHandleInlines.h"
#include "mozilla/dom/Element.h"
#include "nsDebug.h"
#include "nsStyleUtil.h"
#include "nsIDocument.h"
using namespace mozilla::dom;
@@ -486,34 +485,26 @@ ValueFromStringHelper(nsCSSPropertyID aP
doc->GetCompatibilityMode()).Consume();
if (!servoDeclarationBlock) {
return nullptr;
}
// Get a suitable style context for Servo
const ServoComputedValues* currentStyle =
aStyleContext->StyleSource().AsServoComputedValues();
- // Bug 1349004: Remove GetParentAllowServo
- const ServoComputedValues* parentStyle =
- aStyleContext->GetParentAllowServo()
- ? aStyleContext->GetParentAllowServo()->StyleSource()
- .AsServoComputedValues()
- : nullptr;
- const ServoComputedValuesWithParent servoStyles =
- { currentStyle, parentStyle };
// Compute value
PropertyValuePair propValuePair;
propValuePair.mProperty = aPropID;
propValuePair.mServoDeclarationBlock = servoDeclarationBlock;
AutoTArray<Keyframe, 1> keyframes;
keyframes.AppendElement()->mPropertyValues.AppendElement(Move(propValuePair));
nsTArray<ComputedKeyframeValues> computedValues =
aPresContext->StyleSet()->AsServo()
- ->GetComputedKeyframeValuesFor(keyframes, aTargetElement, servoStyles);
+ ->GetComputedKeyframeValuesFor(keyframes, aTargetElement, currentStyle);
// Pull out the appropriate value
if (computedValues.IsEmpty() || computedValues[0].IsEmpty()) {
return nullptr;
}
// So long as we don't support shorthands (bug 1358966) the following
// assertion should hold.
MOZ_ASSERT(computedValues.Length() == 1 &&
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -51,17 +51,16 @@
#include "mozilla/EventStates.h"
#include "mozilla/Keyframe.h"
#include "mozilla/Mutex.h"
#include "mozilla/ServoElementSnapshot.h"
#include "mozilla/ServoRestyleManager.h"
#include "mozilla/StyleAnimationValue.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/ServoMediaList.h"
-#include "mozilla/ServoComputedValuesWithParent.h"
#include "mozilla/RWLock.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ElementInlines.h"
#include "mozilla/dom/HTMLTableCellElement.h"
#include "mozilla/dom/HTMLBodyElement.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/URLExtraData.h"
@@ -552,50 +551,46 @@ Gecko_UpdateAnimations(RawGeckoElementBo
nsPresContext* presContext = nsContentUtils::GetContextForContent(aElement);
if (!presContext) {
return;
}
nsIAtom* pseudoTag = PseudoTagAndCorrectElementForAnimation(aElement);
if (presContext->IsDynamic() && aElement->IsInComposedDoc()) {
- const ServoComputedValuesWithParent servoValues =
- { aComputedValues, aParentComputedValues };
CSSPseudoElementType pseudoType =
nsCSSPseudoElements::GetPseudoType(pseudoTag,
CSSEnabledState::eForAllContent);
if (aTasks & UpdateAnimationsTasks::CSSAnimations) {
presContext->AnimationManager()->
UpdateAnimations(const_cast<dom::Element*>(aElement), pseudoType,
- servoValues);
+ aComputedValues);
}
// aComputedValues might be nullptr if the target element is now in a
// display:none subtree. We still call Gecko_UpdateAnimations in this case
// because we need to stop CSS animations in the display:none subtree.
// However, we don't need to update transitions since they are stopped by
// RestyleManager::AnimationsWithDestroyedFrame so we just return early
// here.
if (!aComputedValues) {
return;
}
if (aTasks & UpdateAnimationsTasks::CSSTransitions) {
MOZ_ASSERT(aOldComputedValues);
- const ServoComputedValuesWithParent oldServoValues =
- { aOldComputedValues, nullptr };
presContext->TransitionManager()->
UpdateTransitions(const_cast<dom::Element*>(aElement), pseudoType,
- oldServoValues, servoValues);
+ aOldComputedValues, aComputedValues);
}
if (aTasks & UpdateAnimationsTasks::EffectProperties) {
presContext->EffectCompositor()->UpdateEffectProperties(
- servoValues, const_cast<dom::Element*>(aElement), pseudoType);
+ aComputedValues, const_cast<dom::Element*>(aElement), pseudoType);
}
if (aTasks & UpdateAnimationsTasks::CascadeResults) {
// This task will be scheduled if we detected any changes to !important
// rules. We post a restyle here so that we can update the cascade
// results in the pre-traversal of the next restyle.
presContext->EffectCompositor()
->RequestRestyle(const_cast<Element*>(aElement),
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -9,17 +9,16 @@
#include "gfxPlatformFontList.h"
#include "mozilla/DocumentStyleRootIterator.h"
#include "mozilla/ServoRestyleManager.h"
#include "mozilla/dom/AnonymousContent.h"
#include "mozilla/dom/ChildIterator.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ElementInlines.h"
#include "mozilla/RestyleManagerInlines.h"
-#include "mozilla/ServoComputedValuesWithParent.h"
#include "nsCSSAnonBoxes.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSRuleProcessor.h"
#include "nsDeviceContext.h"
#include "nsHTMLStyleSheet.h"
#include "nsIDocumentInlines.h"
#include "nsPrintfCString.h"
#include "nsSMILAnimationController.h"
@@ -1016,26 +1015,26 @@ ServoStyleSet::GetKeyframesForName(const
aComputedValues,
&aKeyframes);
}
nsTArray<ComputedKeyframeValues>
ServoStyleSet::GetComputedKeyframeValuesFor(
const nsTArray<Keyframe>& aKeyframes,
Element* aElement,
- const ServoComputedValuesWithParent& aServoValues)
+ ServoComputedValuesBorrowed aComputedValues)
{
nsTArray<ComputedKeyframeValues> result(aKeyframes.Length());
// Construct each nsTArray<PropertyStyleAnimationValuePair> here.
result.AppendElements(aKeyframes.Length());
Servo_GetComputedKeyframeValues(&aKeyframes,
aElement,
- aServoValues.mCurrentStyle,
+ aComputedValues,
mRawSet.get(),
&result);
return result;
}
already_AddRefed<ServoComputedValues>
ServoStyleSet::GetBaseComputedValuesForElement(Element* aElement,
CSSPseudoElementType aPseudoType)
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -27,17 +27,16 @@
namespace mozilla {
namespace dom {
class Element;
} // namespace dom
class CSSStyleSheet;
class ServoRestyleManager;
class ServoStyleSheet;
struct Keyframe;
-struct ServoComputedValuesWithParent;
class ServoElementSnapshotTable;
} // namespace mozilla
class nsCSSCounterStyleRule;
class nsIContent;
class nsIDocument;
class nsStyleContext;
class nsPresContext;
struct nsTimingFunction;
@@ -352,18 +351,17 @@ public:
bool GetKeyframesForName(const nsString& aName,
const nsTimingFunction& aTimingFunction,
const ServoComputedValues* aComputedValues,
nsTArray<Keyframe>& aKeyframes);
nsTArray<ComputedKeyframeValues>
GetComputedKeyframeValuesFor(const nsTArray<Keyframe>& aKeyframes,
dom::Element* aElement,
- const ServoComputedValuesWithParent&
- aServoValues);
+ ServoComputedValuesBorrowed aComputedValues);
bool AppendFontFaceRules(nsTArray<nsFontFaceRuleContainer>& aArray);
nsCSSCounterStyleRule* CounterStyleRuleForName(nsIAtom* aName);
already_AddRefed<ServoComputedValues>
GetBaseComputedValuesForElement(dom::Element* aElement,
CSSPseudoElementType aPseudoType);
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -6,17 +6,16 @@
#include "nsAnimationManager.h"
#include "nsTransitionManager.h"
#include "mozilla/dom/CSSAnimationBinding.h"
#include "mozilla/AnimationTarget.h"
#include "mozilla/EffectCompositor.h"
#include "mozilla/EffectSet.h"
#include "mozilla/MemoryReporting.h"
-#include "mozilla/ServoComputedValuesWithParent.h"
#include "mozilla/ServoStyleSet.h"
#include "mozilla/StyleAnimationValue.h"
#include "mozilla/dom/DocumentTimeline.h"
#include "mozilla/dom/KeyframeEffectReadOnly.h"
#include "nsPresContext.h"
#include "nsStyleSet.h"
#include "nsStyleChangeList.h"
@@ -400,21 +399,18 @@ ResolvedStyleCache::Get(nsPresContext *a
mCache.Put(aKeyframeDeclaration, resultStrong);
result = resultStrong;
}
return result;
}
class MOZ_STACK_CLASS ServoCSSAnimationBuilder final {
public:
- ServoCSSAnimationBuilder(
- const ServoComputedValues* aComputedValues,
- const ServoComputedValues* aParentComputedValues)
+ explicit ServoCSSAnimationBuilder(const ServoComputedValues* aComputedValues)
: mComputedValues(aComputedValues)
- , mParentComputedValues(aParentComputedValues)
{
MOZ_ASSERT(aComputedValues);
}
bool BuildKeyframes(nsPresContext* aPresContext,
const StyleAnimation& aSrc,
nsTArray<Keyframe>& aKeyframes)
{
@@ -424,23 +420,21 @@ public:
return styleSet->GetKeyframesForName(aSrc.GetName(),
timingFunction,
mComputedValues,
aKeyframes);
}
void SetKeyframes(KeyframeEffectReadOnly& aEffect,
nsTArray<Keyframe>&& aKeyframes)
{
- aEffect.SetKeyframes(Move(aKeyframes),
- { mComputedValues, mParentComputedValues });
+ aEffect.SetKeyframes(Move(aKeyframes), mComputedValues);
}
private:
const ServoComputedValues* mComputedValues;
- const ServoComputedValues* mParentComputedValues;
};
class MOZ_STACK_CLASS GeckoCSSAnimationBuilder final {
public:
GeckoCSSAnimationBuilder(nsStyleContext* aStyleContext,
const NonOwningAnimationTarget& aTarget)
: mStyleContext(aStyleContext)
, mTarget(aTarget)
@@ -1018,38 +1012,37 @@ nsAnimationManager::UpdateAnimations(nsS
const nsStyleDisplay* disp = aStyleContext->StyleDisplay();
DoUpdateAnimations(target, *disp, builder);
}
void
nsAnimationManager::UpdateAnimations(
dom::Element* aElement,
CSSPseudoElementType aPseudoType,
- const ServoComputedValuesWithParent& aServoValues)
+ const ServoComputedValues* aComputedValues)
{
MOZ_ASSERT(mPresContext->IsDynamic(),
"Should not update animations for print or print preview");
MOZ_ASSERT(aElement->IsInComposedDoc(),
"Should not update animations that are not attached to the "
"document tree");
- if (!aServoValues.mCurrentStyle) {
+ if (!aComputedValues) {
// If we are in a display:none subtree we will have no computed values.
// Since CSS animations should not run in display:none subtrees we should
// stop (actually, destroy) any animations on this element here.
StopAnimationsForElement(aElement, aPseudoType);
return;
}
NonOwningAnimationTarget target(aElement, aPseudoType);
- ServoCSSAnimationBuilder builder(aServoValues.mCurrentStyle,
- aServoValues.mParentStyle);
+ ServoCSSAnimationBuilder builder(aComputedValues);
const nsStyleDisplay *disp =
- Servo_GetStyleDisplay(aServoValues.mCurrentStyle);
+ Servo_GetStyleDisplay(aComputedValues);
DoUpdateAnimations(target, *disp, builder);
}
template<class BuilderType>
void
nsAnimationManager::DoUpdateAnimations(
const NonOwningAnimationTarget& aTarget,
const nsStyleDisplay& aStyleDisplay,
--- a/layout/style/nsAnimationManager.h
+++ b/layout/style/nsAnimationManager.h
@@ -15,17 +15,16 @@
#include "mozilla/TimeStamp.h"
class nsIGlobalObject;
class nsStyleContext;
struct nsStyleDisplay;
struct ServoComputedValues;
namespace mozilla {
-struct ServoComputedValuesWithParent;
namespace css {
class Declaration;
} /* namespace css */
namespace dom {
class KeyframeEffectReadOnly;
class Promise;
} /* namespace dom */
@@ -327,17 +326,17 @@ public:
/**
* This function does the same thing as the above UpdateAnimations()
* but with servo's computed values.
*/
void UpdateAnimations(
mozilla::dom::Element* aElement,
mozilla::CSSPseudoElementType aPseudoType,
- const mozilla::ServoComputedValuesWithParent& aServoValues);
+ const ServoComputedValues* aComputedValues);
/**
* Add a pending event.
*/
void QueueEvent(mozilla::AnimationEventInfo&& aEventInfo)
{
mEventDispatcher.QueueEvent(
mozilla::Forward<mozilla::AnimationEventInfo>(aEventInfo));
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -967,17 +967,17 @@ nsStyleSet::GetContext(nsStyleContext* a
// Ignore animations for print or print preview, and for elements
// that are not attached to the document tree.
if (PresContext()->IsDynamic() &&
aElementForAnimation->IsInComposedDoc()) {
// Update CSS animations in case the animation-name has just changed.
PresContext()->AnimationManager()->UpdateAnimations(result,
aElementForAnimation);
PresContext()->EffectCompositor()->UpdateEffectProperties(
- result, aElementForAnimation, result->GetPseudoType());
+ result.get(), aElementForAnimation, result->GetPseudoType());
animRule = PresContext()->EffectCompositor()->
GetAnimationRule(aElementForAnimation,
result->GetPseudoType(),
EffectCompositor::CascadeLevel::Animations,
result);
}
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -18,17 +18,16 @@
#include "nsRefreshDriver.h"
#include "nsRuleProcessorData.h"
#include "nsRuleWalker.h"
#include "nsCSSPropertyIDSet.h"
#include "mozilla/EffectCompositor.h"
#include "mozilla/EffectSet.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/ServoBindings.h"
-#include "mozilla/ServoComputedValuesWithParent.h"
#include "mozilla/StyleAnimationValue.h"
#include "mozilla/dom/DocumentTimeline.h"
#include "mozilla/dom/Element.h"
#include "nsIFrame.h"
#include "Layers.h"
#include "FrameLayerBuilder.h"
#include "nsCSSProps.h"
#include "nsCSSPseudoElements.h"
@@ -441,27 +440,26 @@ ExtractNonDiscreteComputedValue(nsCSSPro
return (nsCSSProps::kAnimTypeTable[aProperty] != eStyleAnimType_Discrete ||
aProperty == eCSSProperty_visibility) &&
StyleAnimationValue::ExtractComputedValue(aProperty, aStyleContext,
aAnimationValue.mGecko);
}
static inline bool
ExtractNonDiscreteComputedValue(nsCSSPropertyID aProperty,
- const ServoComputedValuesWithParent&
- aComputedStyle,
+ const ServoComputedValues* aComputedStyle,
AnimationValue& aAnimationValue)
{
if (Servo_Property_IsDiscreteAnimatable(aProperty) &&
aProperty != eCSSProperty_visibility) {
return false;
}
aAnimationValue.mServo =
- Servo_ComputedValues_ExtractAnimationValue(aComputedStyle.mCurrentStyle,
+ Servo_ComputedValues_ExtractAnimationValue(aComputedStyle,
aProperty).Consume();
return !!aAnimationValue.mServo;
}
void
nsTransitionManager::StyleContextChanged(dom::Element *aElement,
nsStyleContext *aOldStyleContext,
RefPtr<nsStyleContext>* aNewStyleContext /* inout */)
@@ -621,27 +619,27 @@ nsTransitionManager::StyleContextChanged
cascadeLevel);
}
}
bool
nsTransitionManager::UpdateTransitions(
dom::Element *aElement,
CSSPseudoElementType aPseudoType,
- const ServoComputedValuesWithParent& aOldStyle,
- const ServoComputedValuesWithParent& aNewStyle)
+ const ServoComputedValues* aOldStyle,
+ const ServoComputedValues* aNewStyle)
{
if (!mPresContext->IsDynamic()) {
// For print or print preview, ignore transitions.
return false;
}
CSSTransitionCollection* collection =
CSSTransitionCollection::GetAnimationCollection(aElement, aPseudoType);
- const nsStyleDisplay *disp = Servo_GetStyleDisplay(aNewStyle.mCurrentStyle);
+ const nsStyleDisplay *disp = Servo_GetStyleDisplay(aNewStyle);
return DoUpdateTransitions(disp,
aElement, aPseudoType,
collection,
aOldStyle, aNewStyle);
}
template<typename StyleType>
bool
--- a/layout/style/nsTransitionManager.h
+++ b/layout/style/nsTransitionManager.h
@@ -20,17 +20,16 @@
class nsIGlobalObject;
class nsStyleContext;
class nsPresContext;
class nsCSSPropertyIDSet;
namespace mozilla {
enum class CSSPseudoElementType : uint8_t;
struct Keyframe;
-struct ServoComputedValuesWithParent;
struct StyleTransition;
} // namespace mozilla
/*****************************************************************************
* Per-Element data *
*****************************************************************************/
namespace mozilla {
@@ -373,18 +372,18 @@ public:
RefPtr<nsStyleContext>* aNewStyleContext /* inout */);
/**
* Update transitions for stylo.
*/
bool UpdateTransitions(
mozilla::dom::Element *aElement,
mozilla::CSSPseudoElementType aPseudoType,
- const mozilla::ServoComputedValuesWithParent& aOldStyle,
- const mozilla::ServoComputedValuesWithParent& aNewStyle);
+ const ServoComputedValues* aOldStyle,
+ const ServoComputedValues* aNewStyle);
/**
* When we're resolving style for an element that previously didn't have
* style, we might have some old finished transitions for it, if,
* say, it was display:none for a while, but previously displayed.
*
* This method removes any finished transitions that don't match the
* new style.