diff --git a/content/smil/crashtests/572938-1.svg b/content/smil/crashtests/572938-1.svg
new file mode 100644
index 00000000000..d759944c7d3
--- /dev/null
+++ b/content/smil/crashtests/572938-1.svg
@@ -0,0 +1,12 @@
+
diff --git a/content/smil/crashtests/572938-2.svg b/content/smil/crashtests/572938-2.svg
new file mode 100644
index 00000000000..8b9cf7b70ef
--- /dev/null
+++ b/content/smil/crashtests/572938-2.svg
@@ -0,0 +1,22 @@
+
diff --git a/content/smil/crashtests/572938-3.svg b/content/smil/crashtests/572938-3.svg
new file mode 100644
index 00000000000..642ad32fba5
--- /dev/null
+++ b/content/smil/crashtests/572938-3.svg
@@ -0,0 +1,10 @@
+
diff --git a/content/smil/crashtests/572938-4.svg b/content/smil/crashtests/572938-4.svg
new file mode 100644
index 00000000000..549d43dd625
--- /dev/null
+++ b/content/smil/crashtests/572938-4.svg
@@ -0,0 +1,10 @@
+
diff --git a/content/smil/crashtests/crashtests.list b/content/smil/crashtests/crashtests.list
index af5c4249e55..8c40a0e7c35 100644
--- a/content/smil/crashtests/crashtests.list
+++ b/content/smil/crashtests/crashtests.list
@@ -16,6 +16,10 @@ load 554202-2.svg
load 554141-1.svg
load 555026-1.svg
load 556841-1.svg
+load 572938-1.svg
+load 572938-2.svg
+load 572938-3.svg
+load 572938-4.svg
load 588287-1.svg
load 588287-2.svg
load 590425-1.html
diff --git a/content/smil/nsSMILAnimationController.cpp b/content/smil/nsSMILAnimationController.cpp
index ee901bf0166..535814906ee 100644
--- a/content/smil/nsSMILAnimationController.cpp
+++ b/content/smil/nsSMILAnimationController.cpp
@@ -74,9 +74,7 @@ GetRefreshDriverForDoc(nsIDocument* aDoc)
nsSMILAnimationController::nsSMILAnimationController()
: mResampleNeeded(PR_FALSE),
mDeferredStartSampling(PR_FALSE),
-#ifdef DEBUG
mRunningSample(PR_FALSE),
-#endif
mDocument(nsnull)
{
mAnimationElementTable.Init();
@@ -189,7 +187,6 @@ void
nsSMILAnimationController::RegisterAnimationElement(
nsISMILAnimationElement* aAnimationElement)
{
- NS_ASSERTION(!mRunningSample, "Registering content during sample.");
mAnimationElementTable.PutEntry(aAnimationElement);
if (mDeferredStartSampling) {
mDeferredStartSampling = PR_FALSE;
@@ -207,7 +204,6 @@ void
nsSMILAnimationController::UnregisterAnimationElement(
nsISMILAnimationElement* aAnimationElement)
{
- NS_ASSERTION(!mRunningSample, "Unregistering content during sample.");
mAnimationElementTable.RemoveEntry(aAnimationElement);
}
@@ -362,16 +358,11 @@ nsSMILAnimationController::DoSample()
void
nsSMILAnimationController::DoSample(PRBool aSkipUnchangedContainers)
{
- // Reset resample flag -- do this before flushing styles since flushing styles
- // will also flush animation resample requests
mResampleNeeded = PR_FALSE;
- mDocument->FlushPendingNotifications(Flush_Style);
-#ifdef DEBUG
+ // Set running sample flag -- do this before flushing styles so that when we
+ // flush styles we don't end up requesting extra samples
mRunningSample = PR_TRUE;
-#endif
- // Reset resample flag again -- flushing styles may have set this flag but
- // since we're about to do a sample now, reset it
- mResampleNeeded = PR_FALSE;
+ mDocument->FlushPendingNotifications(Flush_Style);
// STEP 1: Bring model up to date
// (i) Rewind elements where necessary
@@ -445,9 +436,7 @@ nsSMILAnimationController::DoSample(PRBool aSkipUnchangedContainers)
// when the inherited value is *also* being animated, we really should be
// traversing our animated nodes in an ancestors-first order (bug 501183)
currentCompositorTable->EnumerateEntries(DoComposeAttribute, nsnull);
-#ifdef DEBUG
mRunningSample = PR_FALSE;
-#endif
// Update last compositor table
mLastCompositorTable = currentCompositorTable.forget();
diff --git a/content/smil/nsSMILAnimationController.h b/content/smil/nsSMILAnimationController.h
index 504c244f9bd..9bb04ddc8e3 100644
--- a/content/smil/nsSMILAnimationController.h
+++ b/content/smil/nsSMILAnimationController.h
@@ -94,7 +94,12 @@ public:
// (A resample performs the same operations as a sample but doesn't advance
// the current time and doesn't check if the container is paused)
void Resample() { DoSample(PR_FALSE); }
- void SetResampleNeeded() { mResampleNeeded = PR_TRUE; }
+ void SetResampleNeeded()
+ {
+ if (!mRunningSample) {
+ mResampleNeeded = PR_TRUE;
+ }
+ }
void FlushResampleRequests()
{
if (!mResampleNeeded)
@@ -203,9 +208,7 @@ protected:
// record the time, set the following flag, and then wait until we have an
// animation element. Then we'll reset this flag and actually start sampling.
PRPackedBool mDeferredStartSampling;
-#ifdef DEBUG
PRPackedBool mRunningSample;
-#endif
// Store raw ptr to mDocument. It owns the controller, so controller
// shouldn't outlive it
diff --git a/content/smil/nsSMILCSSProperty.cpp b/content/smil/nsSMILCSSProperty.cpp
index 9241dcbfd2a..4b29f999088 100644
--- a/content/smil/nsSMILCSSProperty.cpp
+++ b/content/smil/nsSMILCSSProperty.cpp
@@ -102,8 +102,9 @@ nsSMILCSSProperty::GetBaseValue() const
// from ALL return points. This function must only return THIS variable:
nsSMILValue baseValue;
- // SPECIAL CASE: Shorthands
- if (nsCSSProps::IsShorthand(mPropID)) {
+ // SPECIAL CASE: (a) Shorthands
+ // (b) 'display'
+ if (nsCSSProps::IsShorthand(mPropID) || mPropID == eCSSProperty_display) {
// We can't look up the base (computed-style) value of shorthand
// properties, because they aren't guaranteed to have a consistent computed
// value. However, that's not a problem, because it turns out the caller
@@ -112,6 +113,10 @@ nsSMILCSSProperty::GetBaseValue() const
// properties we know about don't support those operations. So, we can just
// return a dummy value (initialized with the right type, so as not to
// indicate failure).
+ // For 'display' we'd like to avoid clearing and setting this property since
+ // it can cause frames to be recreated, so instead we just return a dummy
+ // value. As with shorthand properties this is ok as we never interpolate or
+ // add display properties.
nsSMILValue tmpVal(&nsSMILCSSValueType::sSingleton);
baseValue.Swap(tmpVal);
return baseValue;