Bug 1166500 - Part 3: Add KeyframeEffectReadOnly::CanIgnoreIfNotVisible(). r=dbaron

This commit is contained in:
Hiroyuki Ikezoe 2016-05-24 12:57:42 +09:00
parent caa5bb7b54
commit eec4931934
3 changed files with 22 additions and 0 deletions

View File

@ -1329,6 +1329,15 @@ KeyframeEffectReadOnly::CalculateCumulativeChangeHint()
}
}
bool
KeyframeEffectReadOnly::CanIgnoreIfNotVisible() const
{
// FIXME: For further sophisticated optimization we need to check
// change hint on the segment corresponding to computedTiming.progress.
return NS_IsHintSubset(
mCumulativeChangeHint, nsChangeHint_Hints_CanIgnoreIfNotVisible);
}
//---------------------------------------------------------------------
//
// KeyframeEffect

View File

@ -345,6 +345,12 @@ public:
// This is used for deciding the animation is paint-only.
void CalculateCumulativeChangeHint();
// 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;
protected:
KeyframeEffectReadOnly(nsIDocument* aDocument,
const Maybe<OwningAnimationTarget>& aTarget,

View File

@ -359,6 +359,13 @@ inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint)
#define NS_STYLE_HINT_FRAMECHANGE \
nsChangeHint(NS_STYLE_HINT_REFLOW | nsChangeHint_ReconstructFrame)
#define nsChangeHint_Hints_CanIgnoreIfNotVisible \
nsChangeHint(NS_STYLE_HINT_VISUAL | \
nsChangeHint_NeutralChange | \
nsChangeHint_UpdateOpacityLayer | \
nsChangeHint_UpdateTransformLayer | \
nsChangeHint_UpdateUsesOpacity)
/**
* |nsRestyleHint| is a bitfield for the result of
* |HasStateDependentStyle| and |HasAttributeDependentStyle|. When no