mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 05:37:11 +00:00
6886edf464
- Bug 1249428 - Unlink binding properly from element , r=mccr8 (61e1084b4f) - Bug 1216842 - Part 1: Add null_t into TimingFunction to skip calculation of linear timing function. r=cam (cc284bfe07) - Bug 1216842 - Part 2: Add LayerAnimationUtils. r=cam (52b3dbcfd4) - Bug 1216842 - Part 3: Change ComputedTimingFunction* to Maybe<ComputedTimingFunction>. r=cam (3608dd0159) - Bug 1216842 - Part 4: Move ParseEasing into AnimationUtils. r=cam (1c653d9d9a) - Bug 1216842 - Part 5: Store ComputedTimingFunction in TimingParams. r=cam (9305c15a32) - Bug 1216842 - Part 6: Make mTimingFunction in OrderedKeyframeValueEntry const Maybe<>*. r=cam (b79276ad15) - Bug 1216842 - Part 7: Add easing function to laryer::Animation. r=cam (3861a1f1a6) - Bug 1216842 - Part 8: Calculate transformed progress using animation effect's timing function. r=cam (4effa68fef) - Bug 1216842 - Part 9: Tests that easing property in KeyframeEffectOptions is passed to KeyframeEffectReadOnly. r=cam (cf8beaabc1) - Bug 1216842 - Part 10: Remove the limit of the computed timing progress. r=birtles (a000603812) - Bug 1216842 - Part 11: Clamp values of step functions outside [0, 1]. r=birtles (2893588686) - Bug 1216842 - Part 12: Extrapolate bezier function outside [0,1]. r=birtles (16231dccaa) - Bug 1216842 - Part 13: Tests for effect-level easing. r=birtles (95d844046f) - Bug 1239889 part 1 - Throw if the animation target does not have a current document; r=heycam (4162ae8c5b) - Bug 1174575 - Part 2: Replace Element in KeyframeEffectReadOnly WebIDL. r=birtles, r=smaug (65cfa82b96) - Bug 1244595 - Don't check whether shorthands are non-animatable when parsing JS keyframe objects. r=birtles (749b4708c2) - Bug 1174575 - Part 3: Implement KeyframeEffectReadOnly::GetTarget(). r=birtles (19ad097a72) - Bug 1174575 - Part 4: Support CSSPseudoElement for TimingParams. r=birtles (ef76ef8cc6) - Bug 1174575 - Part 5: Support pseudo-element type in StyleAnimation. r=birtles (33f7244799) - Bug 1174575 - Part 6: Implement KeyframeEffectReadOnly Constructor for CSSPseudoElement. r=birtles (78c2bf0322) - Bug 1154791 - Remember all ranges for all selections when splitting nodes in the editor transactions; r=ehsan (ba888befe0) - Bug 1245113 - Fixed uninitialized variables warnings. r=ehsan (6ac649d296) - Bug 1184289 - Remove a spammy editor warning (f3688b4a51) - Bug 1184689 - Remove two spammy editor warnings (de2baa3ce4) - Bug 1244894: Steal the failed nsresult when bailing early. r=bz (7dce640e2d) - Bug 1158452. Pass in the right node when messing with font sizes in editor. r=ehsan (0937be30f5) - Bug 1158651 - Correctly ignore non-editable nodes in nsHTMLEditRules::GetParagraphFormatNodes; r=roc (025d58ac20) - Bug 650572 - Add crashtest. (4eef4013c6) - Bug 667321 - Add crashtest. (76b38b38cf)
146 lines
4.8 KiB
C++
146 lines
4.8 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
/* 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/AnimationEffectTimingReadOnly.h"
|
|
|
|
#include "mozilla/AnimationUtils.h"
|
|
#include "mozilla/dom/AnimatableBinding.h"
|
|
#include "mozilla/dom/AnimationEffectTimingReadOnlyBinding.h"
|
|
#include "mozilla/dom/CSSPseudoElement.h"
|
|
#include "mozilla/dom/KeyframeEffectBinding.h"
|
|
|
|
namespace mozilla {
|
|
|
|
TimingParams::TimingParams(const dom::AnimationEffectTimingProperties& aRhs,
|
|
const dom::Element* aTarget)
|
|
: mDuration(aRhs.mDuration)
|
|
, mDelay(TimeDuration::FromMilliseconds(aRhs.mDelay))
|
|
, mIterations(aRhs.mIterations)
|
|
, mDirection(aRhs.mDirection)
|
|
, mFill(aRhs.mFill)
|
|
{
|
|
mFunction = AnimationUtils::ParseEasing(aTarget, aRhs.mEasing);
|
|
}
|
|
|
|
TimingParams::TimingParams(double aDuration)
|
|
{
|
|
mDuration.SetAsUnrestrictedDouble() = aDuration;
|
|
}
|
|
|
|
template <class OptionsType>
|
|
static const dom::AnimationEffectTimingProperties&
|
|
GetTimingProperties(const OptionsType& aOptions);
|
|
|
|
template <>
|
|
/* static */ const dom::AnimationEffectTimingProperties&
|
|
GetTimingProperties(
|
|
const dom::UnrestrictedDoubleOrKeyframeEffectOptions& aOptions)
|
|
{
|
|
MOZ_ASSERT(aOptions.IsKeyframeEffectOptions());
|
|
return aOptions.GetAsKeyframeEffectOptions();
|
|
}
|
|
|
|
template <>
|
|
/* static */ const dom::AnimationEffectTimingProperties&
|
|
GetTimingProperties(
|
|
const dom::UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions)
|
|
{
|
|
MOZ_ASSERT(aOptions.IsKeyframeAnimationOptions());
|
|
return aOptions.GetAsKeyframeAnimationOptions();
|
|
}
|
|
|
|
template <class OptionsType>
|
|
static TimingParams
|
|
TimingParamsFromOptionsUnion(
|
|
const OptionsType& aOptions,
|
|
const Nullable<dom::ElementOrCSSPseudoElement>& aTarget)
|
|
{
|
|
if (aOptions.IsUnrestrictedDouble()) {
|
|
return TimingParams(aOptions.GetAsUnrestrictedDouble());
|
|
} else {
|
|
// If aTarget is a pseudo element, we pass its parent element because
|
|
// TimingParams only needs its owner doc to parse easing and both pseudo
|
|
// element and its parent element should have the same owner doc.
|
|
// Bug 1246320: Avoid passing the element for parsing the timing function
|
|
RefPtr<dom::Element> targetElement;
|
|
if (!aTarget.IsNull()) {
|
|
const dom::ElementOrCSSPseudoElement& target = aTarget.Value();
|
|
MOZ_ASSERT(target.IsElement() || target.IsCSSPseudoElement(),
|
|
"Uninitialized target");
|
|
if (target.IsElement()) {
|
|
targetElement = &target.GetAsElement();
|
|
} else {
|
|
targetElement = target.GetAsCSSPseudoElement().ParentElement();
|
|
}
|
|
}
|
|
return TimingParams(GetTimingProperties(aOptions), targetElement);
|
|
}
|
|
}
|
|
|
|
/* static */ TimingParams
|
|
TimingParams::FromOptionsUnion(
|
|
const dom::UnrestrictedDoubleOrKeyframeEffectOptions& aOptions,
|
|
const Nullable<dom::ElementOrCSSPseudoElement>& aTarget)
|
|
{
|
|
return TimingParamsFromOptionsUnion(aOptions, aTarget);
|
|
}
|
|
|
|
/* static */ TimingParams
|
|
TimingParams::FromOptionsUnion(
|
|
const dom::UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
|
|
const Nullable<dom::ElementOrCSSPseudoElement>& aTarget)
|
|
{
|
|
return TimingParamsFromOptionsUnion(aOptions, aTarget);
|
|
}
|
|
|
|
bool
|
|
TimingParams::operator==(const TimingParams& aOther) const
|
|
{
|
|
bool durationEqual;
|
|
if (mDuration.IsUnrestrictedDouble()) {
|
|
durationEqual = aOther.mDuration.IsUnrestrictedDouble() &&
|
|
(mDuration.GetAsUnrestrictedDouble() ==
|
|
aOther.mDuration.GetAsUnrestrictedDouble());
|
|
} else {
|
|
// We consider all string values and uninitialized values as meaning "auto".
|
|
// Since mDuration is either a string or uninitialized, we consider it equal
|
|
// if aOther.mDuration is also either a string or uninitialized.
|
|
durationEqual = !aOther.mDuration.IsUnrestrictedDouble();
|
|
}
|
|
return durationEqual &&
|
|
mDelay == aOther.mDelay &&
|
|
mIterations == aOther.mIterations &&
|
|
mDirection == aOther.mDirection &&
|
|
mFill == aOther.mFill &&
|
|
mFunction == aOther.mFunction;
|
|
}
|
|
|
|
namespace dom {
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(AnimationEffectTimingReadOnly, mParent)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AnimationEffectTimingReadOnly, AddRef)
|
|
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AnimationEffectTimingReadOnly, Release)
|
|
|
|
JSObject*
|
|
AnimationEffectTimingReadOnly::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
|
{
|
|
return AnimationEffectTimingReadOnlyBinding::Wrap(aCx, this, aGivenProto);
|
|
}
|
|
|
|
void
|
|
AnimationEffectTimingReadOnly::GetEasing(nsString& aRetVal) const
|
|
{
|
|
if (mTiming.mFunction.isSome()) {
|
|
mTiming.mFunction->AppendToString(aRetVal);
|
|
} else {
|
|
aRetVal.AssignLiteral("linear");
|
|
}
|
|
}
|
|
|
|
} // namespace dom
|
|
} // namespace mozilla
|