Bug 1208951 - Part 9: Implement KeyframeEffectReadOnly constructor. r=bzbarsky r=birtles

This commit is contained in:
Cameron McCormack 2015-10-22 19:22:38 +11:00
parent b9c400b0a8
commit fe6c39fd0e
10 changed files with 1099 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -226,6 +226,12 @@ public:
}
// KeyframeEffectReadOnly interface
static already_AddRefed<KeyframeEffectReadOnly>
Constructor(const GlobalObject& aGlobal,
Element* aTarget,
const Optional<JS::Handle<JSObject*>>& aFrames,
const Optional<double>& aOptions,
ErrorResult& aRv);
Element* GetTarget() const {
// Currently we never return animations from the API whose effect
// targets a pseudo-element so this should never be called when
@ -315,6 +321,15 @@ protected:
virtual ~KeyframeEffectReadOnly();
void ResetIsRunningOnCompositor();
static AnimationTiming ConvertKeyframeEffectOptions(
const Optional<double>& aOptions);
static void BuildAnimationPropertyList(
JSContext* aCx,
Element* aTarget,
const Optional<JS::Handle<JSObject*>>& aFrames,
InfallibleTArray<AnimationProperty>& aResult,
ErrorResult& aRv);
nsCOMPtr<Element> mTarget;
RefPtr<Animation> mAnimation;

View File

@ -115,6 +115,11 @@ DOM4_MSG_DEF(BtAuthFailureError, "Authentication failure", NS_ERROR_DOM_BLUETO
DOM4_MSG_DEF(BtRmtDevDownError, "Remote device down", NS_ERROR_DOM_BLUETOOTH_RMT_DEV_DOWN)
DOM4_MSG_DEF(BtAuthRejectedError, "Authentication rejected", NS_ERROR_DOM_BLUETOOTH_AUTH_REJECTED)
/* Web Animations errors */
DOM4_MSG_DEF(NotSupportedError, "Animation to or from an underlying value is not yet supported.", NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR)
DOM4_MSG_DEF(NotSupportedError, "Animation with no target is not yet supported.", NS_ERROR_DOM_ANIM_NO_TARGET_ERR)
/* common global codes (from nsError.h) */
DOM_MSG_DEF(NS_OK , "Success")

View File

@ -82,3 +82,4 @@ MSG_DEF(MSG_NO_ACTIVE_WORKER, 1, JSEXN_TYPEERR, "No active worker for scope {0}.
MSG_DEF(MSG_NOTIFICATION_PERMISSION_DENIED, 0, JSEXN_TYPEERR, "Permission to show Notification denied.")
MSG_DEF(MSG_NOTIFICATION_NO_CONSTRUCTOR_IN_SERVICEWORKER, 0, JSEXN_TYPEERR, "Notification constructor cannot be used in ServiceWorkerGlobalScope. Use registration.showNotification() instead.")
MSG_DEF(MSG_INVALID_SCOPE, 2, JSEXN_TYPEERR, "Invalid scope trying to resolve {0} with base URL {1}.")
MSG_DEF(MSG_INVALID_KEYFRAME_OFFSETS, 0, JSEXN_TYPEERR, "Keyframes with specified offsets must be in order and all be in the range [0, 1].")

View File

@ -158,6 +158,7 @@ CreateException(JSContext* aCx, nsresult aRv, const nsACString& aMessage)
case NS_ERROR_MODULE_DOM_INDEXEDDB:
case NS_ERROR_MODULE_DOM_FILEHANDLE:
case NS_ERROR_MODULE_DOM_BLUETOOTH:
case NS_ERROR_MODULE_DOM_ANIM:
if (aMessage.IsEmpty()) {
return DOMException::Create(aRv);
}

View File

@ -10,8 +10,29 @@
* liability, trademark and document use rules apply.
*/
// 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.
//
// 3. We use unrestricted double instead of
//
// (unrestricted double or KeyframeEffectOptions)
//
// since we don't support KeyframeEffectOptions yet.
[HeaderFile="mozilla/dom/KeyframeEffect.h",
Func="nsDocument::IsWebAnimationsEnabled"]
Func="nsDocument::IsWebAnimationsEnabled",
Constructor(Element? target,
optional object? frames,
optional unrestricted double options)]
interface KeyframeEffectReadOnly : AnimationEffectReadOnly {
readonly attribute Element? target;
// Not yet implemented:

View File

@ -0,0 +1,18 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://w3c.github.io/web-animations/#the-propertyindexedkeyframe-dictionary
*
* Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
// No other .webidl files references this dictionary, but we use it for
// manual JS->IDL conversions in KeyframeEffectReadOnly's implementation.
dictionary PropertyIndexedKeyframes {
DOMString easing = "linear";
CompositeOperation? composite = null;
};

View File

@ -383,6 +383,7 @@ WEBIDL_FILES = [
'ProfileTimelineMarker.webidl',
'Promise.webidl',
'PromiseDebugging.webidl',
'PropertyIndexedKeyframes.webidl',
'RadioNodeList.webidl',
'Range.webidl',
'Rect.webidl',

View File

@ -935,6 +935,14 @@
ERROR(NS_ERROR_SIGNED_APP_MANIFEST_INVALID, FAILURE(1)),
#undef MODULE
/* ======================================================================= */
/* 39: NS_ERROR_MODULE_DOM_ANIM */
/* ======================================================================= */
#define MODULE NS_ERROR_MODULE_DOM_ANIM
ERROR(NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR, FAILURE(1)),
ERROR(NS_ERROR_DOM_ANIM_NO_TARGET_ERR, FAILURE(2)),
#undef MODULE
/* ======================================================================= */
/* 51: NS_ERROR_MODULE_GENERAL */
/* ======================================================================= */

View File

@ -76,6 +76,7 @@
#define NS_ERROR_MODULE_DOM_FILESYSTEM 36
#define NS_ERROR_MODULE_DOM_BLUETOOTH 37
#define NS_ERROR_MODULE_SIGNED_APP 38
#define NS_ERROR_MODULE_DOM_ANIM 39
/* NS_ERROR_MODULE_GENERAL should be used by modules that do not
* care if return code values overlap. Callers of methods that