From faa7a6f3cbce42fc6e09b6794e1e67b74b8037d5 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Fri, 17 Mar 2017 12:48:51 +0900 Subject: [PATCH] Bug 1340958 - Allocate StyleRule only if we need to compose styles. r=birtles MozReview-Commit-ID: 6ucsxBAaYRp --HG-- extra : rebase_source : ec0bd4627d40335c353b79720f7dfb2e4f3c304c --- dom/animation/KeyframeEffectReadOnly.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dom/animation/KeyframeEffectReadOnly.cpp b/dom/animation/KeyframeEffectReadOnly.cpp index f32252ceb6e0..486dbe9c0919 100644 --- a/dom/animation/KeyframeEffectReadOnly.cpp +++ b/dom/animation/KeyframeEffectReadOnly.cpp @@ -440,7 +440,7 @@ KeyframeEffectReadOnly::GetUnderlyingStyle( { StyleAnimationValue result; - if (aAnimationRule->HasValue(aProperty)) { + if (aAnimationRule && aAnimationRule->HasValue(aProperty)) { // If we have already composed style for the property, we use the style // as the underlying style. DebugOnly success = aAnimationRule->GetValue(aProperty, result); @@ -623,11 +623,6 @@ KeyframeEffectReadOnly::ComposeStyle( } else { // Gecko backend - if (!aStyleRule.mGecko) { - // Allocate the style rule now that we know we have animation data. - aStyleRule.mGecko = new AnimValuesStyleRule(); - } - StyleAnimationValue fromValue = CompositeValue(prop.mProperty, aStyleRule.mGecko, segment->mFromValue.mGecko, @@ -640,6 +635,11 @@ KeyframeEffectReadOnly::ComposeStyle( continue; } + if (!aStyleRule.mGecko) { + // Allocate the style rule now that we know we have animation data. + aStyleRule.mGecko = new AnimValuesStyleRule(); + } + // Iteration composition for accumulate if (mEffectOptions.mIterationComposite == IterationCompositeOperation::Accumulate &&