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
Note that when we actually compute values, we will use the composed document of
the target element (see the next patch in this series).
MozReview-Commit-ID: 8Pp3y19pltP
--HG--
extra : rebase_source : bb1c21f3fdcf2e831213d2f278d70e4ca2637028
We already have a wrapper named nsIFrame::BackfaceIsHidden().
MozReview-Commit-ID: 5L49W6wtXs1
--HG--
extra : rebase_source : d3be8d028453e63fb2d3d96b5956262d352385ef
This implements the changes to the specified behavior from the following
changeset:
a9ba51338e
It also updates test expectations based on the tests updated in part 1 of this
patch series.
MozReview-Commit-ID: HyJC8tHXLYc
--HG--
extra : rebase_source : 6d0f5eb03a2bb4c3938d79dfae7ee433d33fd2b1
Handle these cases:
1. When creating null-target effect whose spacing mode is "paced":
- Fall back to distribute spacing. This case is already included by previous
patches.
2. When setting a target to null:
- Apply distribute spacing.
3. When style context is null.
- Fall back to distribute spacing.
4. When setting a new valid target:
- Use this new target as the context element and re-calculate the computed
offsets. This case is already included by previous patches.
MozReview-Commit-ID: 1zhSOAylnZb
--HG--
extra : rebase_source : e2988f433f395a398090dc08f262b0154de3dc50
Do a simple refactor, so we can reuse the getter of nsStyleContext.
MozReview-Commit-ID: 4BQ7f8HuFns
--HG--
extra : rebase_source : 37bbf6af795484c5d80d308683e4fcdfe23c7a1a
Calculate the paced spacing for each Keyframes by the context element. Use the
algorithm in the spec.
MozReview-Commit-ID: HFWQwoKhKWt
--HG--
extra : rebase_source : 40112eb1f722179cfc0a4ccbd188e22bc7af9b9b
We want to reuse the StyleAnimationValues of properties of each keyframe when
applying spacing and building animation property segments, so refactor this
part.
MozReview-Commit-ID: 8G56C3BU3FR
--HG--
extra : rebase_source : 73b6d374ac8bd25645d1b1b2f15f4e778b3ec949
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
Rename it to ApplySpacing, and let it handle both distribute and paced mode.
MozReview-Commit-ID: 2kGA6LMHUsz
--HG--
extra : rebase_source : ebd5566392b1ea6a4a445ff7c3ed81cdc94bdded
We only support spacing mode from Web Animations API, so add a simple parser and
use it only from the API. In this patch, parse spacing mode from the constructor
and throw TypeError if we have any parse error.
MozReview-Commit-ID: 9H7g80IcZfZ
--HG--
extra : rebase_source : e1bc781ff0f20a1a38c04e672832ec013edc549d
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.
Rather than defining the same type redundantly but with a name that overlaps
with a struct in KeyframeEffect.h (that has a different type).
MozReview-Commit-ID: 3MbvXWL8XlL
The test case here does not check whether requesting restyles for empty
properties are skipped or not. It just checks that whether restyles happen or
not because there is no way to check each request for restyles yet.
MozReview-Commit-ID: I5XMYfCTYU8
--HG--
extra : rebase_source : 893aaaf2c47e05f37bce9913df4f14e3021f215a
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
Use ConvertTarget() to convert Nullabe<ElementOrCSSPseudoElement> into
Maybe<OwningAnimationTarget>, so SetTarget() can use it as well. The return type
of ConvertTarget is not Maybe<NonOwningAnimationTarget> because we need to
compare the return type with KeyframeEffectReadOnly::mTarget, so using the same
type would be easier to implement.
MozReview-Commit-ID: GskbydOMoo0
--HG--
extra : rebase_source : d1a8fe2d8fe89e4ffdb79844ab5581a9af3b2ce5
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
We set a null target only from Web Animations API, so make sure
KeyframeEffectReadOnly::ConstructKeyframeEffect() can handle null target
properly.
MozReview-Commit-ID: D6PoV7PGFj3
--HG--
extra : rebase_source : 4ba2d616d6b2cdfe7985ced29e4454e818d076b8
We don't need to restyle if mTarget is nullptr, so skip it. For
nsAutoAnimationMutationBatch, we also skip it if mTarget is nullptr.
AnimationColletion, nsAnimationManager and nsTransitionManger are for
CSS Animations and CSS Transtions, so the effect should have an effective
target. Therefore, I think we don't have to revise them for
nsAutoAnimationMutationBatch.
MozReview-Commit-ID: Egzr1QVEa0v
--HG--
extra : rebase_source : 2f9125f71f67a3d50f2126fed4d1b459d938de22
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
Use the current document as the parent object of
AnimationEffectTiming(ReadOnly).
MozReview-Commit-ID: JfPLk95hsJ1
--HG--
extra : rebase_source : ee068d0eb8e26f4c1e83b87049be8060fcd27813