forked from mirrors/gecko-dev
		
	 9a81f2437f
			
		
	
	
		9a81f2437f
		
	
	
	
	
		
			
			KeyframeEffect and KeyframeEffectReadOnly constructors can run in the caller compartment, which is okay because the current compartment is used in the following places and all of them are safe: 1. GlobalObject::CallerType(), that is ultimately passed to nsDocument::IsWebAnimationsEnabled in KeyframeEffectParamsFromUnion, to decide whether to copy mIterationComposite/mComposite to KeyframeEffectParams. GlobalObject::CallerType() can now be different than the target window's one, if the caller has the system principal and the target is web content, and in that case nsDocument::IsWebAnimationsEnabled there always returns true while Web Animations can be disabled on web content. honoring the mIterationComposite/mComposite properties is OK, since it just changes the animation behavior, and this is disabled by default until remaining spec issues are resolved. 2. GlobalObject::Context(), that is ultimately passed to KeyframeUtils::GetKeyframesFromObject and used while extracting information from passed-in keyframe object, with iterable/iterator protocols. Performing that operation in the caller side is okay, since the same thing can be done on caller, and the operation doesn't perform any GCThing allocation on the target window global.
		
			
				
	
	
		
			75 lines
		
	
	
	
		
			2.9 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			75 lines
		
	
	
	
		
			2.9 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| /* -*- 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://drafts.csswg.org/web-animations/#the-keyframeeffect-interfaces
 | |
|  *
 | |
|  * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
 | |
|  * liability, trademark and document use rules apply.
 | |
|  */
 | |
| 
 | |
| enum IterationCompositeOperation {
 | |
|   "replace",
 | |
|   "accumulate"
 | |
| };
 | |
| 
 | |
| dictionary KeyframeEffectOptions : AnimationEffectTimingProperties {
 | |
|   IterationCompositeOperation iterationComposite = "replace";
 | |
|   CompositeOperation          composite = "replace";
 | |
| };
 | |
| 
 | |
| // KeyframeEffectReadOnly should run in the caller's compartment to do custom
 | |
| // processing on the `keyframes` object.
 | |
| [Func="nsDocument::IsWebAnimationsEnabled",
 | |
|  RunConstructorInCallerCompartment,
 | |
|  Constructor ((Element or CSSPseudoElement)? target,
 | |
|               object? keyframes,
 | |
|               optional (unrestricted double or KeyframeEffectOptions) options),
 | |
|  Constructor (KeyframeEffectReadOnly source)]
 | |
| interface KeyframeEffectReadOnly : AnimationEffectReadOnly {
 | |
|   readonly attribute (Element or CSSPseudoElement)?  target;
 | |
|   readonly attribute IterationCompositeOperation iterationComposite;
 | |
|   readonly attribute CompositeOperation          composite;
 | |
| 
 | |
|   // We use object instead of ComputedKeyframe so that we can put the
 | |
|   // property-value pairs on the object.
 | |
|   [Throws] sequence<object> getKeyframes();
 | |
| };
 | |
| 
 | |
| // Non-standard extensions
 | |
| dictionary AnimationPropertyValueDetails {
 | |
|   required double             offset;
 | |
|            DOMString          value;
 | |
|            DOMString          easing;
 | |
|   required CompositeOperation composite;
 | |
| };
 | |
| 
 | |
| dictionary AnimationPropertyDetails {
 | |
|   required DOMString                               property;
 | |
|   required boolean                                 runningOnCompositor;
 | |
|            DOMString                               warning;
 | |
|   required sequence<AnimationPropertyValueDetails> values;
 | |
| };
 | |
| 
 | |
| partial interface KeyframeEffectReadOnly {
 | |
|   [ChromeOnly, Throws] sequence<AnimationPropertyDetails> getProperties();
 | |
| };
 | |
| 
 | |
| // KeyframeEffect should run in the caller's compartment to do custom
 | |
| // processing on the `keyframes` object.
 | |
| [Func="nsDocument::IsWebAnimationsEnabled",
 | |
|  RunConstructorInCallerCompartment,
 | |
|  Constructor ((Element or CSSPseudoElement)? target,
 | |
|               object? keyframes,
 | |
|               optional (unrestricted double or KeyframeEffectOptions) options),
 | |
|  Constructor (KeyframeEffectReadOnly source)]
 | |
| interface KeyframeEffect : KeyframeEffectReadOnly {
 | |
|   inherit attribute (Element or CSSPseudoElement)? target;
 | |
|   [NeedsCallerType]
 | |
|   inherit attribute IterationCompositeOperation    iterationComposite;
 | |
|   inherit attribute CompositeOperation          composite;
 | |
|   [Throws]
 | |
|   void setKeyframes (object? keyframes);
 | |
| };
 |