Bug 1315874 - Add MightNeedBaseStyle helper method; r=dholbert

We will use this in a subsequent patch in this series to determine if we need to
fetch a style context at the beginning of ComposeAttribute (when we create the
nsISMILAttr) or not.

MozReview-Commit-ID: CFBNmmFNNef

--HG--
extra : rebase_source : 4729b2e1194649f461c353fa74d99b5b7829a077
This commit is contained in:
Brian Birtles 2017-04-03 16:49:09 +09:00
parent c02e19cf1f
commit 6a706e8040
2 changed files with 28 additions and 0 deletions

View File

@ -173,6 +173,24 @@ nsSMILCompositor::GetCSSPropertyToAnimate() const
return propID;
}
bool
nsSMILCompositor::MightNeedBaseStyle() const
{
if (GetCSSPropertyToAnimate() == eCSSProperty_UNKNOWN) {
return false;
}
// We should return true if at least one animation function might build on
// the base value.
for (const nsSMILAnimationFunction* func : mAnimationFunctions) {
if (!func->WillReplace()) {
return true;
}
}
return false;
}
uint32_t
nsSMILCompositor::GetFirstFuncToAffectSandwich()
{

View File

@ -80,6 +80,16 @@ public:
// eCSSProperty_UNKNOWN if this compositor does not animate a CSS property.
nsCSSPropertyID GetCSSPropertyToAnimate() const;
// Returns true if we might need to refer to base styles (i.e. we are
// targeting a CSS property and have one or more animation functions that
// don't just replace the underlying value).
//
// This might return true in some cases where we don't actually need the base
// style since it doesn't build up the animation sandwich to check if the
// functions that appear to need the base style are actually replaced by
// a function further up the stack.
bool MightNeedBaseStyle() const;
// Finds the index of the first function that will affect our animation
// sandwich. Also toggles the 'mForceCompositing' flag if it finds that any
// (used) functions have changed.