Skip to content

Commit

Permalink
Bug 1209405 - Part 2: High CPU load on Kickstarter, even without JS, …
Browse files Browse the repository at this point in the history
…CSS and images. r=birtles

MozReview-Commit-ID: 91q0F9u2T4t
  • Loading branch information
dadaa committed May 23, 2016
1 parent 04e9d8a commit e5a0ffd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion dom/smil/nsSMILCompositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@ nsSMILCompositor::CreateSMILAttr()
uint32_t
nsSMILCompositor::GetFirstFuncToAffectSandwich()
{
// canThrottle is true when attributeName is not 'display' and
// the element or subtree is display:none
RefPtr<nsStyleContext> styleContext =
nsComputedDOMStyle::GetStyleContextForElementNoFlush(mKey.mElement,
nullptr, nullptr);
bool canThrottle = mKey.mAttributeName != nsGkAtoms::display &&
styleContext &&
styleContext->IsInDisplayNoneSubtree();

uint32_t i;
for (i = mAnimationFunctions.Length(); i > 0; --i) {
nsSMILAnimationFunction* curAnimFunc = mAnimationFunctions[i-1];
Expand All @@ -150,14 +159,15 @@ nsSMILCompositor::GetFirstFuncToAffectSandwich()
// changes to the target in subsequent samples.
mForceCompositing |=
curAnimFunc->UpdateCachedTarget(mKey) ||
curAnimFunc->HasChanged() ||
(curAnimFunc->HasChanged() && !canThrottle) ||
curAnimFunc->WasSkippedInPrevSample();

if (curAnimFunc->WillReplace()) {
--i;
break;
}
}

// Mark remaining animation functions as having been skipped so if we later
// use them we'll know to force compositing.
// Note that we only really need to do this if something has changed
Expand Down

0 comments on commit e5a0ffd

Please sign in to comment.