Bug 1340958 - Allocate StyleRule only if we need to compose styles. r=birtles

MozReview-Commit-ID: 6ucsxBAaYRp

--HG--
extra : rebase_source : ec0bd4627d40335c353b79720f7dfb2e4f3c304c
This commit is contained in:
Hiroyuki Ikezoe 2017-03-17 12:48:51 +09:00
parent a3c9c5051e
commit faa7a6f3cb

View File

@ -440,7 +440,7 @@ KeyframeEffectReadOnly::GetUnderlyingStyle(
{ {
StyleAnimationValue result; StyleAnimationValue result;
if (aAnimationRule->HasValue(aProperty)) { if (aAnimationRule && aAnimationRule->HasValue(aProperty)) {
// If we have already composed style for the property, we use the style // If we have already composed style for the property, we use the style
// as the underlying style. // as the underlying style.
DebugOnly<bool> success = aAnimationRule->GetValue(aProperty, result); DebugOnly<bool> success = aAnimationRule->GetValue(aProperty, result);
@ -623,11 +623,6 @@ KeyframeEffectReadOnly::ComposeStyle(
} else { } else {
// Gecko backend // Gecko backend
if (!aStyleRule.mGecko) {
// Allocate the style rule now that we know we have animation data.
aStyleRule.mGecko = new AnimValuesStyleRule();
}
StyleAnimationValue fromValue = StyleAnimationValue fromValue =
CompositeValue(prop.mProperty, aStyleRule.mGecko, CompositeValue(prop.mProperty, aStyleRule.mGecko,
segment->mFromValue.mGecko, segment->mFromValue.mGecko,
@ -640,6 +635,11 @@ KeyframeEffectReadOnly::ComposeStyle(
continue; continue;
} }
if (!aStyleRule.mGecko) {
// Allocate the style rule now that we know we have animation data.
aStyleRule.mGecko = new AnimValuesStyleRule();
}
// Iteration composition for accumulate // Iteration composition for accumulate
if (mEffectOptions.mIterationComposite == if (mEffectOptions.mIterationComposite ==
IterationCompositeOperation::Accumulate && IterationCompositeOperation::Accumulate &&