Bug 1096773 part 1 - Make the frames argument to the KeyframeEffectReadOnly constructor NOT optional; r=bz

This is to line up with the spec as discussed in:

  https://bugzilla.mozilla.org/show_bug.cgi?id=1096773#c6
This commit is contained in:
Brian Birtles 2016-01-29 12:37:52 +11:00
parent 9fc71ed3aa
commit fb85b0a7f3
3 changed files with 11 additions and 22 deletions

View File

@ -1641,7 +1641,7 @@ BuildAnimationPropertyListFromPropertyIndexedKeyframes(
KeyframeEffectReadOnly::BuildAnimationPropertyList(
JSContext* aCx,
Element* aTarget,
const Optional<JS::Handle<JSObject*>>& aFrames,
JS::Handle<JSObject*> aFrames,
InfallibleTArray<AnimationProperty>& aResult,
ErrorResult& aRv)
{
@ -1657,17 +1657,16 @@ KeyframeEffectReadOnly::BuildAnimationPropertyList(
// we can look at the open-ended set of properties on a
// PropertyIndexedKeyframes or Keyframe.
if (!aFrames.WasPassed() || !aFrames.Value().get()) {
// The argument was omitted, or was explicitly null. In both cases,
// the default dictionary value for PropertyIndexedKeyframes would
// result in no keyframes.
if (!aFrames) {
// The argument was explicitly null. In this case, the default dictionary
// value for PropertyIndexedKeyframes would result in no keyframes.
return;
}
// At this point we know we have an object. We try to convert it to a
// sequence<Keyframe> first, and if that fails due to not being iterable,
// we try to convert it to PropertyIndexedKeyframes.
JS::Rooted<JS::Value> objectValue(aCx, JS::ObjectValue(*aFrames.Value()));
JS::Rooted<JS::Value> objectValue(aCx, JS::ObjectValue(*aFrames));
JS::ForOfIterator iter(aCx);
if (!iter.init(objectValue, JS::ForOfIterator::AllowNonIterable)) {
aRv.Throw(NS_ERROR_FAILURE);
@ -1688,7 +1687,7 @@ KeyframeEffectReadOnly::BuildAnimationPropertyList(
KeyframeEffectReadOnly::Constructor(
const GlobalObject& aGlobal,
Element* aTarget,
const Optional<JS::Handle<JSObject*>>& aFrames,
JS::Handle<JSObject*> aFrames,
const UnrestrictedDoubleOrKeyframeEffectOptions& aOptions,
ErrorResult& aRv)
{

View File

@ -189,7 +189,7 @@ public:
static already_AddRefed<KeyframeEffectReadOnly>
Constructor(const GlobalObject& aGlobal,
Element* aTarget,
const Optional<JS::Handle<JSObject*>>& aFrames,
JS::Handle<JSObject*> aFrames,
const UnrestrictedDoubleOrKeyframeEffectOptions& aOptions,
ErrorResult& aRv);
Element* GetTarget() const {
@ -339,7 +339,7 @@ protected:
static void BuildAnimationPropertyList(
JSContext* aCx,
Element* aTarget,
const Optional<JS::Handle<JSObject*>>& aFrames,
JS::Handle<JSObject*> aFrames,
InfallibleTArray<AnimationProperty>& aResult,
ErrorResult& aRv);

View File

@ -21,22 +21,12 @@ dictionary KeyframeEffectOptions : AnimationEffectTimingProperties {
DOMString spacing = "distribute";
};
// For the constructor:
//
// 1. We use Element? for the first argument since we don't support Animatable
// for pseudo-elements yet.
//
// 2. We use object? instead of
//
// (PropertyIndexedKeyframes or sequence<Keyframe> or SharedKeyframeList)
//
// for the second argument so that we can get the property-value pairs from
// the PropertyIndexedKeyframes or Keyframe objects. We also don't support
// SharedKeyframeList yet.
// For the constructor we use Element? for the first argument since we
// don't support Animatable for pseudo-elements yet.
[HeaderFile="mozilla/dom/KeyframeEffect.h",
Func="nsDocument::IsWebAnimationsEnabled",
Constructor(Element? target,
optional object? frames,
object? frames,
optional (unrestricted double or KeyframeEffectOptions) options)]
interface KeyframeEffectReadOnly : AnimationEffectReadOnly {
readonly attribute Element? target;