gecko-dev/dom/smil
Brian Birtles c0aa9c7ed3 Bug 1411963 - Drop assertion about GetBaseValue not returning null in nsSMILCompositor::ComposeAttribute; r=dholbert
This assertion was originally added in bug 1353208 because in that bug we
changed the type of nsSMILCompositor::mCachedBaseValue from
nsAutoPtr<nsSMILValue> to just nsSMILValue. When using nsAutoPtr,
mCachedBaseValue had two null states: one where the pointer is null, and one
where the pointed-to nsSMILValue is null. Coalescing these two states simplifies
the code but there is one case where the difference is significant as described
in the commit message for that changeset (mozilla-central changeset
ad7060dae117):

  "There's a subtle difference in behavior with regards to the first sample.
  Previously we would compare the (initially) null mCachedBaseValue pointer with
  the passed-in nsSMILValue and set mForceCompositing to true. With this patch,
  however, we will only set mForceCompositing to true if the passed-in
  mCachedBaseValue is not null."

That is, if the base value we get back is a null nsSMILValue, previously we
would set mForceCompositing to true unconditionally, but with the changes in bug
1353208 we would only set that to true if the passed-in nsSMILValue was not
null.

We believed that would never matter since the passed-in nsSMILValue would never
be null if we called GetBaseValue. Quoting from that same commit message:

  "... if we do call GetBaseValue the result should not be a null nsSMILValue
  (except in some OOM cases where we don't really care if we miss a sample).
  This patch adds an assertion to check that GetBaseValue does, in fact, return
  a non-null value. (I checked the code and this appears to be the case. Even in
  error cases we typically return an empty nsSMILValue of a non-null type. For
  example, the early return in nsSMILCSSProperty::GetBaseValue() does this.)"

We added an assertion to validate that assumption but the crashtest included in
this patch demonstrates a case where it does not hold (specifically, when
nsStyleUtil::CSPAllowsInlineStyle returns false, nsCSSProperty::GetBaseValue
will return a null nsSMILValue).

That would seem to suggest that there is at least one case where we might fail
to set mForceIsCompositing to true and hence fail to update style on this first
sample (and presumably thereonwards too since future comparisons of
mCachedBaseValue will compare equal). However, for the case of an initial sample
mForceCompositing should already be set to true since set we update
mForceCompositing in nsSMILCompositor::GetFirstFuncToAffectSandwich() and will
make it true if *anything* in the animation function has changed and at this
point, the initial sample, *everything* will have changed. Hence, I believe
dropping this assertion is acceptable.

I have confirmed that in the crashtest in this patch, during the first sample
mForceCompositing is set to true.

I would create a reftest to test the behavior on the first sample but, at least
for the specific case where inline style is disabled due to CSP, not updating
style *is* the expected behavior so there will be no difference in behavior
regardless of whether or not the mForceCompositing flag is set.



MozReview-Commit-ID: Li0pZEH2PNl

--HG--
extra : rebase_source : a1c12a019b8481600afa4295447dc1e6fb281b22
2017-10-31 16:22:04 +09:00
..
crashtests Bug 1411963 - Drop assertion about GetBaseValue not returning null in nsSMILCompositor::ComposeAttribute; r=dholbert 2017-10-31 16:22:04 +09:00
test Bug 1404803 - Convert empty values to suitable zero values even when using discrete interpolation; r=hiro 2017-10-04 15:04:23 +09:00
moz.build Bug 1062106 part 3 - Remove SMIL MappedAttribute mechanism. r=birtles 2017-03-21 15:45:58 +09:00
nsISMILAttr.h Bug 1391803 - Use nsStringFwd.h for forward declaring string classes. r=froydnj 2017-08-16 16:48:52 -07:00
nsISMILType.h
nsSMILAnimationController.cpp Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
nsSMILAnimationController.h Bug 1355348 - Add SMIL restyles in the stylo pretraverse; r=heycam 2017-04-26 13:00:11 +09:00
nsSMILAnimationFunction.cpp Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
nsSMILAnimationFunction.h Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
nsSMILCompositor.cpp Bug 1411963 - Drop assertion about GetBaseValue not returning null in nsSMILCompositor::ComposeAttribute; r=dholbert 2017-10-31 16:22:04 +09:00
nsSMILCompositor.h Bug 1406441 - provide nsSMILCompositor with a move constructor, rather than a copy constructor; r=dholbert 2017-10-09 10:39:38 -04:00
nsSMILCompositorTable.h
nsSMILCSSProperty.cpp Bug 1381844: Be more explicit about the kind of style context we handle all the time. r=bholley 2017-07-22 18:02:57 +02:00
nsSMILCSSProperty.h Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
nsSMILCSSValueType.cpp Bug 1404803 - Convert empty values to suitable zero values even when using discrete interpolation; r=hiro 2017-10-04 15:04:23 +09:00
nsSMILCSSValueType.h Bug 1404803 - Convert empty values to suitable zero values even when using discrete interpolation; r=hiro 2017-10-04 15:04:23 +09:00
nsSMILFloatType.cpp
nsSMILFloatType.h
nsSMILInstanceTime.cpp
nsSMILInstanceTime.h
nsSMILInterval.cpp
nsSMILInterval.h
nsSMILKeySpline.cpp
nsSMILKeySpline.h
nsSMILMilestone.h
nsSMILNullType.cpp Bug 1406440 - don't inline nsSMILNullType::Singleton(); r=dholbert 2017-10-09 10:39:38 -04:00
nsSMILNullType.h Bug 1406440 - don't inline nsSMILNullType::Singleton(); r=dholbert 2017-10-09 10:39:38 -04:00
nsSMILParserUtils.cpp Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
nsSMILParserUtils.h
nsSMILRepeatCount.cpp
nsSMILRepeatCount.h
nsSMILSetAnimationFunction.cpp Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
nsSMILSetAnimationFunction.h Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
nsSMILTargetIdentifier.h Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
nsSMILTimeContainer.cpp Bug 1062106 part 3 - Remove SMIL MappedAttribute mechanism. r=birtles 2017-03-21 15:45:58 +09:00
nsSMILTimeContainer.h
nsSMILTimedElement.cpp Bug 849593 - Skip samples of active SMIL timed elements when the sample time precedes the current interval; r=dholbert 2017-10-24 13:06:04 +09:00
nsSMILTimedElement.h Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
nsSMILTimeValue.cpp Bug 1322849 - Add a range check when the duration is multiplied by the repeat count. r=birtles 2017-10-17 22:19:54 +01:00
nsSMILTimeValue.h Bug 1374861 - add const keyword where appropriate. r=birtles 2017-07-01 10:55:27 +01:00
nsSMILTimeValueSpec.cpp
nsSMILTimeValueSpec.h Bug 1403500, part 5 - Document and do some renaming for nsSMILTimeValueSpec's TimeReferenceElement. r=longsonr 2017-09-13 08:22:55 +01:00
nsSMILTimeValueSpecParams.h Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
nsSMILTypes.h
nsSMILValue.cpp Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
nsSMILValue.h
SMILBoolType.cpp
SMILBoolType.h
SMILEnumType.cpp
SMILEnumType.h
SMILIntegerType.cpp
SMILIntegerType.h
SMILStringType.cpp
SMILStringType.h
TimeEvent.cpp Bug 1391005 - Eliminate NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED. r=peterv 2017-08-29 16:02:48 -07:00
TimeEvent.h