Use [SetterThrows] for KeyframeEffect.spacing because it throws if the input
string is not conformed to the grammar.
MozReview-Commit-ID: CkAnPu8TnV
--HG--
extra : rebase_source : af0960391684323a25ac0b40da28dcbe5c3c2919
We mark the cascade update many times, so it's better to factor it out.
MozReview-Commit-ID: HbE980gOJ9M
--HG--
extra : rebase_source : a76dfc489f378c5bd7e711f296d0599ecf2322c5
The purpose of ResetWinsInCascade() in SetTarget() ensures that
RequestRestyle(Layer) is invoked for the new target in the case when
composite order or CSS cascading or order is changed due to chaging target
element, but RequestRestyle(Layer) will be called right after setting
the new target in SetTarget() explicitly.
MozReview-Commit-ID: 1cFJCAEEroP
--HG--
extra : rebase_source : c3008ef15d0328466f77015020c5148ef2ad07c6
Move the mTiming, mAnimation, and the implementaion of timing into
AnimationEffectReadOnly.
MozReview-Commit-ID: EZhlbphVvCo
--HG--
extra : rebase_source : 4aa4821304671a8dfc6feb047ab20b26ef2d6b11
This is a pre-patch for part 5, which is trying to make our code closer to the
spec. Some methods in KeyframeEffectReadOnly belong to AnimationEffectReadOnly,
so first, use AsKeyframeEffect() to access those keyframe-related methods, and
then add virtual methods for timing-related methods to AnimationEffectReadOnly.
MozReview-Commit-ID: 1srA1f8JYeN
--HG--
extra : rebase_source : 99a06e20a63b9c8b179fa8501690abf01271aaf4
This implements the spec change in 21de090dac
The spec change refers to a binary 'animation direction' flag. Instead of that,
however, we just pass the playback rate along and use it inside
GetComputedTimingAt since this seems simpler.
Also, this patch moves the implementation of
KeyframeEffectReadOnly::GetComputedTiming from the header file into the .cpp
file. This is because with this change, GetComputedTiming needs to call
mAnimation->PlaybackRate() and so mozilla::dom::Animation needs to be a complete
type. However, simply including Animation.h doesn't work because of a cyclic
dependency between KeyframeEffect.h and Animation.h. We might be able to fix
this later but since yet-to-land bug 1049975 moves this code around a lot, I'd
rather not touch it too much just now.
MozReview-Commit-ID: 1h6XRh4xmfI
This implements the spec change in 21de090dac
The spec change refers to a binary 'animation direction' flag. Instead of that,
however, we just pass the playback rate along and use it inside
GetComputedTimingAt since this seems simpler.
Also, this patch moves the implementation of
KeyframeEffectReadOnly::GetComputedTiming from the header file into the .cpp
file. This is because with this change, GetComputedTiming needs to call
mAnimation->PlaybackRate() and so mozilla::dom::Animation needs to be a complete
type. However, simply including Animation.h doesn't work because of a cyclic
dependency between KeyframeEffect.h and Animation.h. We might be able to fix
this later but since yet-to-land bug 1049975 moves this code around a lot, I'd
rather not touch it too much just now.
MozReview-Commit-ID: 1h6XRh4xmfI
The previous patch in this series renamed nsCSSProperty to nsCSSPropertyID.
This patch renames nsCSSPropertySet to nsCSSPropertyIDSet accordingly.
This patch is generated by the following commands (note: if you're running
using OS X's sed, which accepts slightly different flags, you'll have to
specify an actual backup suffix in -i, or use gsed from Homebrew):
hg stat -c \
| cut -c 3- \
| tr '\n' '\0' \
| xargs -0 -P 8 gsed --follow-symlinks 's/\bnsCSSPropertySet\b/nsCSSPropertyIDSet/g' -i''
Then:
hg mv layout/style/nsCSSPropertySet.h layout/style/nsCSSPropertyIDSet.h
... and finally, manually renaming nsCSSPropertySet in the include guard in
nsCSSPropertyIDSet.h.
MozReview-Commit-ID: ASUNs7FWbKP
--HG--
rename : layout/style/nsCSSPropertySet.h => layout/style/nsCSSPropertyIDSet.h
This patch is generated by the following commands (note: if you're running
using OS X's sed, which accepts slightly different flags, you'll have to
specify an actual backup suffix in -i, or use gsed from Homebrew):
hg stat -c \
| cut -c 3- \
| tr '\n' '\0' \
| xargs -0 -P 8 gsed --follow-symlinks 's/\bnsCSSProperty\b/nsCSSPropertyID/g' -i''
Then:
hg mv layout/style/nsCSSProperty.h layout/style/nsCSSPropertyID.h
... and finally, manually renaming nsCSSProperty in the include guard in
nsCSSProperty.h.
MozReview-Commit-ID: ZV6jyvmLfA
--HG--
rename : layout/style/nsCSSProperty.h => layout/style/nsCSSPropertyID.h
We don't actually need to re-calculate if the updated properties are the
same as the old one. This change avoids problematic nested calls of
nsStyleSet::GetContext() in particular cases.
MozReview-Commit-ID: JksiTGX57Fy
Previously, when fetching an nsPresShell, we would look up the current realm
document and get the pres shell for it. This patch makes us call GetPresShell()
which uses GetRenderedDocument() which corresponds to the composed document of
the target effect which seems more consistent since it is the target effect we
will use as context for computing CSS values (as required by [1]).
[1] https://w3c.github.io/web-animations/#calculating-computed-keyframes
MozReview-Commit-ID: 9S55041rfTp
--HG--
extra : rebase_source : c52d4c366d0a2891958c8f7378614a8feb5e7c70
Do a simple refactor, so we can reuse the getter of nsStyleContext.
MozReview-Commit-ID: 4BQ7f8HuFns
--HG--
extra : rebase_source : 37bbf6af795484c5d80d308683e4fcdfe23c7a1a
When we apply paced spacing, we have to check if there are still null computed
offsets after applying paced spacing to paceable Keyframes because the
calculation of distance may be failed or some Keyframes are not paceable in
the specific range. Therefore, using -1 would be easier to check it.
Also, add a const, kComputedOffsetNotSet, to represent this invalid value.
MozReview-Commit-ID: GPhj7cdiX2W
--HG--
extra : rebase_source : 8c4e7769c454fe50eb1cc08db63866dcc4ed62e5
Add a new file, KeyframeEffectParams.h, and define the basic data
members nsString for the spacing mode.
Also, add one more argument, const KeyframeEffectParams&, to the
constructors of KeyframeEffect(ReadOnly).
MozReview-Commit-ID: I7LYlnv6LLb
--HG--
extra : rebase_source : 9aebb7b9659588674c2a954eb2ce62c827bc9830
In order to raise an assertion in CanIgnoreIfNotVisible() which will be
introduced in part 3 when the cumulative hint is not properly, we should skip
the calculation when mProperties is empty.
BuildSegmentsFromValueEntries now needs base nsStyleContext to calculate
the change hints.
If the change hint is not set correctly, we will check it in
CanIgnoreIfNotVisible() introduced in a subsequent patch (part 3).
We will need to request a restyle and unregister the current target in
SetTarget(), and there are many duplicate code segments for them now, so wrap
them for reusing the code.
MozReview-Commit-ID: 33XoNspZme3
--HG--
extra : rebase_source : 881aa13d79ccc75872a6cc48d0a1da71cfdff2ae
1. Define OwningAnimationTarget.
2. Replace the KeyframeEffectReadOnly::mTarget/mPseudoType members with
a Maybe<OwningAnimationTarget> mTarget member.
MozReview-Commit-ID: 65qOoNyDRSy
--HG--
extra : rebase_source : b938dbc00c918861d4141128fad8e30f61668e40
WebIDL referes to KeyframeEffect::SetFrames(), which is derived from
KeyframeEffectReadOnly::SetFrames() in terms of implementation.
In addition, make KeyframeEffectReadOnly::ConstructKeyframeEffect call
KeyframeEffectReadOnly::SetFrames() to simplify the code.
MozReview-Commit-ID: 7ASbtoN7Tnp
--HG--
extra : rebase_source : c398ff7154c4533255f56c7ca13314e440eb6258
Add KeyframeEffectReadOnly::mTiming into the list of cycle collection to
avoid any possible memory leak.
MozReview-Commit-ID: C5mFQ7TsqC7
--HG--
extra : rebase_source : 8ee1e58d69a3becb0b8566fa3529154bb66d3064
It turns out that std::stable_sort on Mac and Android use this.
Bug 1263500 tracks doing something more efficient on those platforms.
MozReview-Commit-ID: 3tGbnoW67QP
This is needed in order to use std::stable_sort with this type since some
implementations of std::stable_sort require this (as opposed to simply a move
constructor).
MozReview-Commit-ID: 5QmcIxkC4aB
Earlier in this patch series we divided keyframe processing into two stages:
(1) Turning javascript objects into an array of Keyframe objects
(2) Calculating AnimationProperty arrays from the Keyframe objects
This patch creates a SetFrames method so that CSS animations and
CSS transitions can skip (1) and pass the frames constructed from CSS syntax
into (2).
It also adds the following additional processing:
a. Notifying animation mutation observers when the set of frames has changed.
This is currently performed by nsAnimationManager but ultimately we should
encapsulate this logic inside the effect itself. Furthermore, it will be
needed when we implement effect.setFrames() (i.e. the Javascript-facing
wrapper for this method).
b. Preserving the mWinsInCascade and mIsRunningOnCompositor state on properties
when updating them.
This is currently performed by:
bool KeyframeEffectReadOnly::UpdateProperties(
const InfallibleTArray<AnimationProperty>& aProperties)
which is what nsAnimationManager currently uses. We will ultimately remove
the above method and here we are just moving this code to the new version
of UpdateProperties.
c. Requesting a restyle when the set of AnimationProperty objects has changed.
Again, this is currently performed by the existing UpdateProperties method
so we are just moving it here. This behavior will also be required when
we implement effect.setFrames() and when we call UpdateProperties from
elsewhere in restyling code.
This is bug 1235002 but we fix it here and leave that bug to just do further
cleanup work (e.g. re-instating the check for an empty property set before
requesting a restyle in NotifyAnimationTimingUpdated).
d. Marking the cascade as needing an update when the set of AnimationProperty
objects has changed.
This is in preparation for calling UpdateProperties from elsewhere in
restyling (e.g. when the nsStyleContext is updated).
MozReview-Commit-ID: 2ll26lsWZTm
I have confirmed that by adding this, we end up calling SwapElements() on the
mPropertyValues member when we build up the nsTArray<Keyframe> result in
GetKeyframeListFromPropertyIndexedKeyframe. Without this explicit move
constructor (i.e. with only the default move constructor) the copy-constructor
for mPropertyValues is called.
MozReview-Commit-ID: 6IWkP97RFUr
--HG--
extra : rebase_source : 4ac4b6545337810a3047f2cfb1dac86074116cfb