mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 13:57:32 +00:00
Backed out changeset e2f6d5054e20 (bug 1331704) for build bustage: unused variable hasProperty at KeyframeEffectReadOnly.h:294. r=backout on a CLOSED TREE
This commit is contained in:
parent
9a8981039c
commit
559bd6a3a1
@ -350,33 +350,6 @@ KeyframeEffectReadOnly::CompositeValue(
|
||||
return StyleAnimationValue();
|
||||
}
|
||||
|
||||
StyleAnimationValue
|
||||
KeyframeEffectReadOnly::ResolveBaseStyle(nsCSSPropertyID aProperty,
|
||||
nsStyleContext* aStyleContext)
|
||||
{
|
||||
StyleAnimationValue result;
|
||||
if (mBaseStyleValues.Get(aProperty, &result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
RefPtr<nsStyleContext> styleContextWithoutAnimation =
|
||||
aStyleContext->PresContext()->StyleSet()->AsGecko()->
|
||||
ResolveStyleByRemovingAnimation(mTarget->mElement,
|
||||
aStyleContext,
|
||||
eRestyle_AllHintsWithAnimations);
|
||||
bool success =
|
||||
StyleAnimationValue::ExtractComputedValue(aProperty,
|
||||
styleContextWithoutAnimation,
|
||||
result);
|
||||
|
||||
MOZ_ASSERT(success, "Should be able to extract computed animation value");
|
||||
MOZ_ASSERT(!result.IsNull(), "Should have a valid StyleAnimationValue");
|
||||
|
||||
mBaseStyleValues.Put(aProperty, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
StyleAnimationValue
|
||||
KeyframeEffectReadOnly::GetUnderlyingStyle(
|
||||
nsCSSPropertyID aProperty,
|
||||
@ -395,7 +368,12 @@ KeyframeEffectReadOnly::GetUnderlyingStyle(
|
||||
// the base style for the property.
|
||||
RefPtr<nsStyleContext> styleContext =
|
||||
GetTargetStyleContextWithoutAnimation();
|
||||
result = ResolveBaseStyle(aProperty, styleContext);
|
||||
result = EffectCompositor::GetBaseStyle(aProperty,
|
||||
styleContext,
|
||||
*mTarget->mElement,
|
||||
mTarget->mPseudoType);
|
||||
MOZ_ASSERT(!result.IsNull(), "The base style should be set");
|
||||
SetNeedsBaseStyle(aProperty);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -456,6 +434,12 @@ KeyframeEffectReadOnly::EnsureBaseStylesForCompositor(
|
||||
continue;
|
||||
}
|
||||
|
||||
// We only call SetNeedsBaseStyle after calling GetBaseStyle so if
|
||||
// NeedsBaseStyle is true, the base style should be already filled-in.
|
||||
if (NeedsBaseStyle(property.mProperty)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const AnimationPropertySegment& segment : property.mSegments) {
|
||||
if (segment.mFromComposite == dom::CompositeOperation::Replace &&
|
||||
segment.mToComposite == dom::CompositeOperation::Replace) {
|
||||
@ -467,8 +451,13 @@ KeyframeEffectReadOnly::EnsureBaseStylesForCompositor(
|
||||
}
|
||||
MOZ_RELEASE_ASSERT(styleContext);
|
||||
|
||||
StyleAnimationValue result =
|
||||
ResolveBaseStyle(property.mProperty, styleContext);
|
||||
Unused << EffectCompositor::GetBaseStyle(property.mProperty,
|
||||
styleContext,
|
||||
*mTarget->mElement,
|
||||
mTarget->mPseudoType);
|
||||
// Make this property as needing a base style so that we send the (now
|
||||
// cached) base style to the compositor.
|
||||
SetNeedsBaseStyle(property.mProperty);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -511,6 +500,8 @@ KeyframeEffectReadOnly::ComposeStyle(
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
bool isServoBackend = presContext && presContext->StyleSet()->IsServo();
|
||||
|
||||
mNeedsBaseStyleSet.Empty();
|
||||
|
||||
for (size_t propIdx = 0, propEnd = mProperties.Length();
|
||||
propIdx != propEnd; ++propIdx)
|
||||
{
|
||||
@ -614,9 +605,6 @@ KeyframeEffectReadOnly::ComposeStyle(
|
||||
CompositeValue(prop.mProperty, aStyleRule.mGecko,
|
||||
segment->mToValue.mGecko,
|
||||
segment->mToComposite);
|
||||
if (fromValue.IsNull() || toValue.IsNull()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Iteration composition for accumulate
|
||||
if (mEffectOptions.mIterationComposite ==
|
||||
@ -1744,6 +1732,31 @@ KeyframeEffectReadOnly::HasComputedTimingChanged() const
|
||||
mCurrentIterationOnLastCompose);
|
||||
}
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::SetNeedsBaseStyle(nsCSSPropertyID aProperty)
|
||||
{
|
||||
for (size_t i = 0; i < LayerAnimationInfo::kRecords; i++) {
|
||||
if (LayerAnimationInfo::sRecords[i].mProperty == aProperty) {
|
||||
mNeedsBaseStyleSet.AddProperty(aProperty);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
KeyframeEffectReadOnly::NeedsBaseStyle(nsCSSPropertyID aProperty) const
|
||||
{
|
||||
for (size_t i = 0; i < LayerAnimationInfo::kRecords; i++) {
|
||||
if (LayerAnimationInfo::sRecords[i].mProperty == aProperty) {
|
||||
return mNeedsBaseStyleSet.HasProperty(aProperty);
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"Expected a property that can be run on the compositor");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
KeyframeEffectReadOnly::ContainsAnimatedScale(const nsIFrame* aFrame) const
|
||||
{
|
||||
@ -1756,15 +1769,19 @@ KeyframeEffectReadOnly::ContainsAnimatedScale(const nsIFrame* aFrame) const
|
||||
continue;
|
||||
}
|
||||
|
||||
StyleAnimationValue 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.
|
||||
return true;
|
||||
}
|
||||
gfxSize size = baseStyle.GetScaleValue(aFrame);
|
||||
if (size != gfxSize(1.0f, 1.0f)) {
|
||||
return true;
|
||||
if (NeedsBaseStyle(prop.mProperty)) {
|
||||
StyleAnimationValue baseStyle =
|
||||
EffectCompositor::GetBaseStyle(prop.mProperty, aFrame);
|
||||
MOZ_ASSERT(!baseStyle.IsNull(), "The base value should be set");
|
||||
if (baseStyle.IsNull()) {
|
||||
// If we failed to get the base style, we consider it has scale value
|
||||
// here for the safety.
|
||||
return true;
|
||||
}
|
||||
gfxSize size = baseStyle.GetScaleValue(aFrame);
|
||||
if (size != gfxSize(1.0f, 1.0f)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// This is actually overestimate because there are some cases that combining
|
||||
|
@ -284,18 +284,14 @@ public:
|
||||
// in detail which change hint can be ignored.
|
||||
bool CanIgnoreIfNotVisible() const;
|
||||
|
||||
// Returns true if the effect is run on the compositor for |aProperty| and
|
||||
// needs a base style to composite with.
|
||||
bool NeedsBaseStyle(nsCSSPropertyID aProperty) const;
|
||||
|
||||
// Returns true if the effect is current state and has scale animation.
|
||||
// |aFrame| is used for calculation of scale values.
|
||||
bool ContainsAnimatedScale(const nsIFrame* aFrame) const;
|
||||
|
||||
StyleAnimationValue BaseStyle(nsCSSPropertyID aProperty) const
|
||||
{
|
||||
StyleAnimationValue result;
|
||||
bool hasProperty = mBaseStyleValues.Get(aProperty, &result);
|
||||
MOZ_ASSERT(hasProperty || result.IsNull());
|
||||
return result;
|
||||
}
|
||||
|
||||
protected:
|
||||
KeyframeEffectReadOnly(nsIDocument* aDocument,
|
||||
const Maybe<OwningAnimationTarget>& aTarget,
|
||||
@ -386,15 +382,15 @@ protected:
|
||||
nsCSSPropertyID aProperty,
|
||||
const RefPtr<AnimValuesStyleRule>& aAnimationRule);
|
||||
|
||||
// Set a bit in mNeedsBaseStyleSet if |aProperty| can be run on the
|
||||
// compositor.
|
||||
void SetNeedsBaseStyle(nsCSSPropertyID aProperty);
|
||||
|
||||
// Ensure the base styles is available for any properties that can be run on
|
||||
// the compositor and which are not includes in |aPropertiesToSkip|.
|
||||
void EnsureBaseStylesForCompositor(
|
||||
const nsCSSPropertyIDSet& aPropertiesToSkip);
|
||||
|
||||
// Returns the base style resolved by |aStyleContext| for |aProperty|.
|
||||
StyleAnimationValue ResolveBaseStyle(nsCSSPropertyID aProperty,
|
||||
nsStyleContext* aStyleContext);
|
||||
|
||||
Maybe<OwningAnimationTarget> mTarget;
|
||||
|
||||
KeyframeEffectParams mEffectOptions;
|
||||
@ -419,10 +415,10 @@ protected:
|
||||
// we need to re-evaluate the cascade of animations when that changes.
|
||||
bool mInEffectOnLastAnimationTimingUpdate;
|
||||
|
||||
// The non-animated values for properties in this effect that contain at
|
||||
// least one animation value that is composited with the underlying value
|
||||
// (i.e. it uses the additive or accumulate composite mode).
|
||||
nsDataHashtable<nsUint32HashKey, StyleAnimationValue> mBaseStyleValues;
|
||||
// Represents whether or not the corresponding property requires a base style
|
||||
// to composite with. This is only set when the property is run on the
|
||||
// compositor.
|
||||
nsCSSPropertyIDSet mNeedsBaseStyleSet;
|
||||
|
||||
private:
|
||||
nsChangeHint mCumulativeChangeHint;
|
||||
|
@ -580,11 +580,6 @@ ApplyAnimatedValue(Layer* aLayer,
|
||||
const AnimationData& aAnimationData,
|
||||
const StyleAnimationValue& aValue)
|
||||
{
|
||||
if (aValue.IsNull()) {
|
||||
// Return gracefully if we have no valid StyleAnimationValue.
|
||||
return;
|
||||
}
|
||||
|
||||
HostLayer* layerCompositor = aLayer->AsHostLayer();
|
||||
switch (aProperty) {
|
||||
case eCSSProperty_opacity: {
|
||||
|
@ -587,8 +587,10 @@ 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);
|
||||
if (!baseStyle.IsNull()) {
|
||||
if (effect->NeedsBaseStyle(prop.mProperty)) {
|
||||
StyleAnimationValue baseStyle =
|
||||
EffectCompositor::GetBaseStyle(prop.mProperty, aFrame);
|
||||
MOZ_ASSERT(!baseStyle.IsNull(), "The base value should be set");
|
||||
// FIXME: Bug 1311257: We need to get the baseStyle for
|
||||
// RawServoAnimationValue.
|
||||
UpdateMinMaxScale(aFrame, { baseStyle, nullptr }, aMinScale, aMaxScale);
|
||||
|
@ -468,6 +468,24 @@ SetAnimatable(nsCSSPropertyID aProperty,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
SetBaseAnimationStyle(nsCSSPropertyID aProperty,
|
||||
nsIFrame* aFrame,
|
||||
TransformReferenceBox& aRefBox,
|
||||
layers::Animatable& aBaseStyle)
|
||||
{
|
||||
MOZ_ASSERT(aFrame);
|
||||
|
||||
StyleAnimationValue baseValue =
|
||||
EffectCompositor::GetBaseStyle(aProperty, aFrame);
|
||||
MOZ_ASSERT(!baseValue.IsNull(),
|
||||
"The base value should be already there");
|
||||
|
||||
// FIXME: Bug 1311257: We need to get the baseValue for
|
||||
// RawServoAnimationValue.
|
||||
SetAnimatable(aProperty, { baseValue, nullptr }, aFrame, aRefBox, aBaseStyle);
|
||||
}
|
||||
|
||||
static void
|
||||
AddAnimationForProperty(nsIFrame* aFrame, const AnimationProperty& aProperty,
|
||||
dom::Animation* aAnimation, Layer* aLayer,
|
||||
@ -543,16 +561,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 =
|
||||
aAnimation->GetEffect()->AsKeyframeEffect()->BaseStyle(aProperty.mProperty);
|
||||
if (!baseStyle.IsNull()) {
|
||||
// FIXME: Bug 1311257: We need to get the baseValue for
|
||||
// RawServoAnimationValue.
|
||||
SetAnimatable(aProperty.mProperty,
|
||||
{ baseStyle, nullptr },
|
||||
aFrame, refBox,
|
||||
animation->baseStyle());
|
||||
if (aAnimation->GetEffect()->AsKeyframeEffect()->
|
||||
NeedsBaseStyle(aProperty.mProperty)) {
|
||||
SetBaseAnimationStyle(aProperty.mProperty,
|
||||
aFrame, refBox,
|
||||
animation->baseStyle());
|
||||
} else {
|
||||
animation->baseStyle() = null_t();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user