author | Brian Birtles <birtles@gmail.com> |
Mon, 07 May 2018 11:07:01 +0900 | |
changeset 417842 | 5f8a3f4a435a734c4fd954cb55b8780395ac1b4a |
parent 417841 | 831f34bd841d593041fac84ca07d852a2f72339c |
child 417843 | ede7f6c30b62fa74d2f49ad841e08b1d65124700 |
push id | 33980 |
push user | ebalazs@mozilla.com |
push date | Fri, 11 May 2018 09:35:12 +0000 |
treeherder | mozilla-central@8e9a4a323f0c [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bz, hiro |
bugs | 1456394 |
milestone | 62.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
dom/animation/KeyframeEffect.cpp | file | annotate | diff | comparison | revisions | |
dom/animation/KeyframeEffect.h | file | annotate | diff | comparison | revisions | |
dom/animation/KeyframeEffectReadOnly.cpp | file | annotate | diff | comparison | revisions | |
dom/animation/KeyframeEffectReadOnly.h | file | annotate | diff | comparison | revisions | |
dom/animation/moz.build | file | annotate | diff | comparison | revisions | |
dom/base/Element.cpp | file | annotate | diff | comparison | revisions | |
dom/webidl/KeyframeEffect.webidl | file | annotate | diff | comparison | revisions |
deleted file mode 100644 --- a/dom/animation/KeyframeEffect.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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/. */ - -#include "mozilla/dom/KeyframeEffect.h" - -#include "mozilla/ComputedStyle.h" -#include "mozilla/dom/KeyframeAnimationOptionsBinding.h" - // For UnrestrictedDoubleOrKeyframeAnimationOptions -#include "mozilla/dom/AnimationEffectTiming.h" -#include "mozilla/dom/KeyframeEffectBinding.h" -#include "nsDocument.h" // For nsDocument::IsWebAnimationsEnabled -#include "nsDOMMutationObserver.h" // For nsAutoAnimationMutationBatch - -namespace mozilla { -namespace dom { - -KeyframeEffect::KeyframeEffect(nsIDocument* aDocument, - const Maybe<OwningAnimationTarget>& aTarget, - const TimingParams& aTiming, - const KeyframeEffectParams& aOptions) - : KeyframeEffectReadOnly(aDocument, aTarget, - new AnimationEffectTiming(aDocument, aTiming, this), - aOptions) -{ -} - -JSObject* -KeyframeEffect::WrapObject(JSContext* aCx, - JS::Handle<JSObject*> aGivenProto) -{ - return KeyframeEffectBinding::Wrap(aCx, this, aGivenProto); -} - -/* static */ already_AddRefed<KeyframeEffect> -KeyframeEffect::Constructor( - const GlobalObject& aGlobal, - const Nullable<ElementOrCSSPseudoElement>& aTarget, - JS::Handle<JSObject*> aKeyframes, - const UnrestrictedDoubleOrKeyframeEffectOptions& aOptions, - ErrorResult& aRv) -{ - return ConstructKeyframeEffect<KeyframeEffect>(aGlobal, aTarget, aKeyframes, - aOptions, aRv); -} - -/* static */ already_AddRefed<KeyframeEffect> -KeyframeEffect::Constructor(const GlobalObject& aGlobal, - KeyframeEffectReadOnly& aSource, - ErrorResult& aRv) -{ - return ConstructKeyframeEffect<KeyframeEffect>(aGlobal, aSource, aRv); -} - -/* static */ already_AddRefed<KeyframeEffect> -KeyframeEffect::Constructor( - const GlobalObject& aGlobal, - const Nullable<ElementOrCSSPseudoElement>& aTarget, - JS::Handle<JSObject*> aKeyframes, - const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions, - ErrorResult& aRv) -{ - return ConstructKeyframeEffect<KeyframeEffect>(aGlobal, aTarget, aKeyframes, - aOptions, aRv); -} - -} // namespace dom -} // namespace mozilla
deleted file mode 100644 --- a/dom/animation/KeyframeEffect.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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/. */ - -#ifndef mozilla_dom_KeyframeEffect_h -#define mozilla_dom_KeyframeEffect_h - -#include "nsWrapperCache.h" -#include "mozilla/dom/BindingDeclarations.h" -#include "mozilla/dom/KeyframeEffectReadOnly.h" -#include "mozilla/AnimationTarget.h" // For (Non)OwningAnimationTarget -#include "mozilla/Maybe.h" - -struct JSContext; -class JSObject; -class nsIDocument; - -namespace mozilla { - -class ErrorResult; -struct KeyframeEffectParams; -struct TimingParams; - -namespace dom { - -class ElementOrCSSPseudoElement; -class GlobalObject; -class UnrestrictedDoubleOrKeyframeAnimationOptions; -class UnrestrictedDoubleOrKeyframeEffectOptions; - -class KeyframeEffect : public KeyframeEffectReadOnly -{ -public: - KeyframeEffect(nsIDocument* aDocument, - const Maybe<OwningAnimationTarget>& aTarget, - const TimingParams& aTiming, - const KeyframeEffectParams& aOptions); - - JSObject* WrapObject(JSContext* aCx, - JS::Handle<JSObject*> aGivenProto) override; - - static already_AddRefed<KeyframeEffect> - Constructor(const GlobalObject& aGlobal, - const Nullable<ElementOrCSSPseudoElement>& aTarget, - JS::Handle<JSObject*> aKeyframes, - const UnrestrictedDoubleOrKeyframeEffectOptions& aOptions, - ErrorResult& aRv); - - static already_AddRefed<KeyframeEffect> - Constructor(const GlobalObject& aGlobal, - KeyframeEffectReadOnly& aSource, - ErrorResult& aRv); - - // Variant of Constructor that accepts a KeyframeAnimationOptions object - // for use with for Animatable.animate. - // Not exposed to content. - static already_AddRefed<KeyframeEffect> - Constructor(const GlobalObject& aGlobal, - const Nullable<ElementOrCSSPseudoElement>& aTarget, - JS::Handle<JSObject*> aKeyframes, - const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions, - ErrorResult& aRv); -}; - -} // namespace dom -} // namespace mozilla - -#endif // mozilla_dom_KeyframeEffect_h
--- a/dom/animation/KeyframeEffectReadOnly.cpp +++ b/dom/animation/KeyframeEffectReadOnly.cpp @@ -1799,11 +1799,59 @@ KeyframeEffectReadOnly::UpdateEffectSet( if (HasAnimationOfProperty(eCSSProperty_transform)) { effectSet->SetMayHaveTransformAnimation(); if (frame) { frame->SetMayHaveTransformAnimation(); } } } +KeyframeEffect::KeyframeEffect(nsIDocument* aDocument, + const Maybe<OwningAnimationTarget>& aTarget, + const TimingParams& aTiming, + const KeyframeEffectParams& aOptions) + : KeyframeEffectReadOnly(aDocument, aTarget, + new AnimationEffectTiming(aDocument, aTiming, this), + aOptions) +{ +} + +JSObject* +KeyframeEffect::WrapObject(JSContext* aCx, + JS::Handle<JSObject*> aGivenProto) +{ + return KeyframeEffectBinding::Wrap(aCx, this, aGivenProto); +} + +/* static */ already_AddRefed<KeyframeEffect> +KeyframeEffect::Constructor( + const GlobalObject& aGlobal, + const Nullable<ElementOrCSSPseudoElement>& aTarget, + JS::Handle<JSObject*> aKeyframes, + const UnrestrictedDoubleOrKeyframeEffectOptions& aOptions, + ErrorResult& aRv) +{ + return ConstructKeyframeEffect<KeyframeEffect>(aGlobal, aTarget, aKeyframes, + aOptions, aRv); +} + +/* static */ already_AddRefed<KeyframeEffect> +KeyframeEffect::Constructor(const GlobalObject& aGlobal, + KeyframeEffectReadOnly& aSource, + ErrorResult& aRv) +{ + return ConstructKeyframeEffect<KeyframeEffect>(aGlobal, aSource, aRv); +} + +/* static */ already_AddRefed<KeyframeEffect> +KeyframeEffect::Constructor( + const GlobalObject& aGlobal, + const Nullable<ElementOrCSSPseudoElement>& aTarget, + JS::Handle<JSObject*> aKeyframes, + const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions, + ErrorResult& aRv) +{ + return ConstructKeyframeEffect<KeyframeEffect>(aGlobal, aTarget, aKeyframes, + aOptions, aRv); +} } // namespace dom } // namespace mozilla
--- a/dom/animation/KeyframeEffectReadOnly.h +++ b/dom/animation/KeyframeEffectReadOnly.h @@ -449,12 +449,46 @@ private: // Returns true if this effect causes visibility change. // (i.e. 'visibility: hidden' -> 'visibility: visible' and vice versa.) bool HasVisibilityChange() const { return mCumulativeChangeHint & nsChangeHint_VisibilityChange; } }; +class KeyframeEffect : public KeyframeEffectReadOnly +{ +public: + KeyframeEffect(nsIDocument* aDocument, + const Maybe<OwningAnimationTarget>& aTarget, + const TimingParams& aTiming, + const KeyframeEffectParams& aOptions); + + JSObject* WrapObject(JSContext* aCx, + JS::Handle<JSObject*> aGivenProto) override; + + static already_AddRefed<KeyframeEffect> + Constructor(const GlobalObject& aGlobal, + const Nullable<ElementOrCSSPseudoElement>& aTarget, + JS::Handle<JSObject*> aKeyframes, + const UnrestrictedDoubleOrKeyframeEffectOptions& aOptions, + ErrorResult& aRv); + + static already_AddRefed<KeyframeEffect> + Constructor(const GlobalObject& aGlobal, + KeyframeEffectReadOnly& aSource, + ErrorResult& aRv); + + // Variant of Constructor that accepts a KeyframeAnimationOptions object + // for use with for Animatable.animate. + // Not exposed to content. + static already_AddRefed<KeyframeEffect> + Constructor(const GlobalObject& aGlobal, + const Nullable<ElementOrCSSPseudoElement>& aTarget, + JS::Handle<JSObject*> aKeyframes, + const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions, + ErrorResult& aRv); +}; + } // namespace dom } // namespace mozilla #endif // mozilla_dom_KeyframeEffectReadOnly_h
--- a/dom/animation/moz.build +++ b/dom/animation/moz.build @@ -13,17 +13,16 @@ MOCHITEST_CHROME_MANIFESTS += ['test/chr EXPORTS.mozilla.dom += [ 'Animation.h', 'AnimationEffectReadOnly.h', 'AnimationEffectTiming.h', 'AnimationEffectTimingReadOnly.h', 'AnimationTimeline.h', 'CSSPseudoElement.h', 'DocumentTimeline.h', - 'KeyframeEffect.h', 'KeyframeEffectReadOnly.h', ] EXPORTS.mozilla += [ 'AnimationComparator.h', 'AnimationEventDispatcher.h', 'AnimationPerformanceWarning.h', 'AnimationPropertySegment.h', @@ -50,17 +49,16 @@ UNIFIED_SOURCES += [ 'AnimationPerformanceWarning.cpp', 'AnimationTimeline.cpp', 'AnimationUtils.cpp', 'ComputedTimingFunction.cpp', 'CSSPseudoElement.cpp', 'DocumentTimeline.cpp', 'EffectCompositor.cpp', 'EffectSet.cpp', - 'KeyframeEffect.cpp', 'KeyframeEffectReadOnly.cpp', 'KeyframeUtils.cpp', 'PendingAnimationTracker.cpp', 'TimingParams.cpp', ] LOCAL_INCLUDES += [ '/dom/base',
--- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -131,18 +131,18 @@ #include "nsStyledElement.h" #include "nsXBLService.h" #include "nsITextControlElement.h" #include "nsITextControlFrame.h" #include "nsISupportsImpl.h" #include "mozilla/dom/CSSPseudoElement.h" #include "mozilla/dom/DocumentFragment.h" #include "mozilla/dom/ElementBinding.h" -#include "mozilla/dom/KeyframeEffect.h" #include "mozilla/dom/KeyframeEffectBinding.h" +#include "mozilla/dom/KeyframeEffectReadOnly.h" #include "mozilla/dom/MouseEventBinding.h" #include "mozilla/dom/WindowBinding.h" #include "mozilla/dom/VRDisplay.h" #include "mozilla/IntegerPrintfMacros.h" #include "mozilla/Preferences.h" #include "nsComputedDOMStyle.h" #include "nsDOMStringMap.h" #include "DOMIntersectionObserver.h"
--- a/dom/webidl/KeyframeEffect.webidl +++ b/dom/webidl/KeyframeEffect.webidl @@ -57,16 +57,17 @@ dictionary AnimationPropertyDetails { 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, + HeaderFile="mozilla/dom/KeyframeEffectReadOnly.h", Constructor ((Element or CSSPseudoElement)? target, object? keyframes, optional (unrestricted double or KeyframeEffectOptions) options), Constructor (KeyframeEffectReadOnly source)] interface KeyframeEffect : KeyframeEffectReadOnly { [Throws] void setKeyframes (object? keyframes); };