зеркало из https://github.com/mozilla/pjs.git
Bug 553075: Don't register for periodic SMIL sample callbacks until we've got some animations registered. r=roc
This commit is contained in:
Родитель
3ddf56a8f4
Коммит
cb0bbd773e
|
@ -81,6 +81,7 @@ GetRefreshDriverForDoc(nsIDocument* aDoc)
|
||||||
|
|
||||||
nsSMILAnimationController::nsSMILAnimationController()
|
nsSMILAnimationController::nsSMILAnimationController()
|
||||||
: mResampleNeeded(PR_FALSE),
|
: mResampleNeeded(PR_FALSE),
|
||||||
|
mDeferredStartSampling(PR_FALSE),
|
||||||
mDocument(nsnull)
|
mDocument(nsnull)
|
||||||
{
|
{
|
||||||
mAnimationElementTable.Init();
|
mAnimationElementTable.Init();
|
||||||
|
@ -150,7 +151,11 @@ nsSMILAnimationController::Resume(PRUint32 aType)
|
||||||
|
|
||||||
if (wasPaused && !mPauseState && mChildContainerTable.Count()) {
|
if (wasPaused && !mPauseState && mChildContainerTable.Count()) {
|
||||||
Sample(); // Run the first sample manually
|
Sample(); // Run the first sample manually
|
||||||
|
if (mAnimationElementTable.Count()) {
|
||||||
StartSampling(GetRefreshDriverForDoc(mDocument));
|
StartSampling(GetRefreshDriverForDoc(mDocument));
|
||||||
|
} else {
|
||||||
|
mDeferredStartSampling = PR_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,6 +190,14 @@ nsSMILAnimationController::RegisterAnimationElement(
|
||||||
nsISMILAnimationElement* aAnimationElement)
|
nsISMILAnimationElement* aAnimationElement)
|
||||||
{
|
{
|
||||||
mAnimationElementTable.PutEntry(aAnimationElement);
|
mAnimationElementTable.PutEntry(aAnimationElement);
|
||||||
|
if (mDeferredStartSampling) {
|
||||||
|
// mAnimationElementTable was empty until we just inserted its first element
|
||||||
|
NS_ABORT_IF_FALSE(mAnimationElementTable.Count() == 1,
|
||||||
|
"we shouldn't have deferred sampling if we already had "
|
||||||
|
"animations registered");
|
||||||
|
mDeferredStartSampling = PR_FALSE;
|
||||||
|
StartSampling(GetRefreshDriverForDoc(mDocument));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -695,7 +708,11 @@ nsSMILAnimationController::AddChild(nsSMILTimeContainer& aChild)
|
||||||
|
|
||||||
if (!mPauseState && mChildContainerTable.Count() == 1) {
|
if (!mPauseState && mChildContainerTable.Count() == 1) {
|
||||||
Sample(); // Run the first sample manually
|
Sample(); // Run the first sample manually
|
||||||
|
if (mAnimationElementTable.Count()) {
|
||||||
StartSampling(GetRefreshDriverForDoc(mDocument));
|
StartSampling(GetRefreshDriverForDoc(mDocument));
|
||||||
|
} else {
|
||||||
|
mDeferredStartSampling = PR_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -183,6 +183,7 @@ protected:
|
||||||
AnimationElementHashtable mAnimationElementTable;
|
AnimationElementHashtable mAnimationElementTable;
|
||||||
TimeContainerHashtable mChildContainerTable;
|
TimeContainerHashtable mChildContainerTable;
|
||||||
PRPackedBool mResampleNeeded;
|
PRPackedBool mResampleNeeded;
|
||||||
|
PRPackedBool mDeferredStartSampling;
|
||||||
|
|
||||||
// Store raw ptr to mDocument. It owns the controller, so controller
|
// Store raw ptr to mDocument. It owns the controller, so controller
|
||||||
// shouldn't outlive it
|
// shouldn't outlive it
|
||||||
|
|
Загрузка…
Ссылка в новой задаче