Commit Graph

254 Commits

Author SHA1 Message Date
Simon Giesecke
a69d79b6db Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Emily McDonough
f8928e108c Bug 1626794 - Add strong ref to document and MOZ_CAN_RUN_SCRIPT annotation to Animation::CommitStyles r=hiro
Differential Revision: https://phabricator.services.mozilla.com/D75418
2020-05-17 20:47:37 +00:00
Emily McDonough
a6dea63c4c Bug 1564128 part 1 - Add clone function for Animation and constructor for KeyframeEffect to copy properties but not the target. r=hiro
This is needed for copying animations from an original document to a static
clone during printing/print preview.

Differential Revision: https://phabricator.services.mozilla.com/D73139
2020-05-14 19:41:01 +00:00
Sylvestre Ledru
3ce73036e5 Bug 1519636 - Reformat recent changes to the Google coding style r=jgilbert
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D67574
2020-04-05 13:34:58 +00:00
Emilio Cobos Álvarez
1d36429ad7 Bug 1625608 - Improve some web-animations error messages. r=birtles
Differential Revision: https://phabricator.services.mozilla.com/D68695
2020-03-30 09:48:06 +00:00
André Bargull
5ec91f8150 Bug 1625138 - Part 41: Remove no longer needed includes for mozilla/TypeTraits. r=froydnj
Also adds missing includes in some files, these were previously only transivitely
included through mozilla/TypeTraits.h.

Differential Revision: https://phabricator.services.mozilla.com/D68561
2020-03-28 16:00:09 +00:00
Hiroyuki Ikezoe
de0430a9f6 Bug 1623469 - Add a pref to disable synchronization transform animations with geometric animations. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D67391
2020-03-19 03:36:54 +00:00
Brian Birtles
ea035be080 Bug 1622184 - Mark Animation.finished and Animation.ready as handled when they are rejected; r=boris
As per spec change: 7bcad3219c

Differential Revision: https://phabricator.services.mozilla.com/D67104
2020-03-18 02:22:36 +00:00
Boris Zbarsky
e62a6fc4d1 Bug 1619112 part 2. Pass char literals instead of char16_t literals into ErrorResult throwing methods. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D65538
2020-03-06 21:04:58 +00:00
Boris Chiou
3b6babf311 Bug 1611847 - Update relevance and its effect set in the early return of UpdatePlaybackRate(). r=birtles
To avoid hitting the assertion because of out-of-dated relevance.

Differential Revision: https://phabricator.services.mozilla.com/D63582
2020-02-25 19:41:14 +00:00
Boris Chiou
2e8146eca6 Bug 1612106 - Use NIGHTLY build flag to distinguish the writable/readonly Animation.timeline. r=birtles,bzbarsky
We only support writable Animation.timeline attribute on nightly
build, so use nightly build flag in WebIDL and Animation.h/cpp.
For the test expectations, we also use this build flag to skip them or
mark them as expected fail if necessary.

Differential Revision: https://phabricator.services.mozilla.com/D63432
2020-02-24 23:07:09 +00:00
Boris Chiou
1377970ec8 Bug 1610981 - Eliminate usage of CSSPseudoElement from KeyframeEffect. r=birtles,smaug
Replace ElementOrCSSPseudoElement with Element and add PseudoElement (which is
a DOMString) into KeyframeAnimationOptions and KeyframeEffect.

Differential Revision: https://phabricator.services.mozilla.com/D62667
2020-02-18 20:44:14 +00:00
Simon Giesecke
9bcfd47601 Bug 1611415 - Prefer using std::move over forget. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980
2020-02-13 14:38:48 +00:00
shindli
6bb3487209 Backed out changeset 0c982bc69cb3 (bug 1611415) for causing build bustages in /builds/worker/workspace/build/src/obj-firefox/dist/include/nsCOMPtr CLOSED TREE 2020-02-12 20:13:29 +02:00
Simon Giesecke
d45525793f Bug 1611415 - Applied FixItHints from mozilla-non-std-move. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980
2020-02-12 17:24:41 +00:00
Brian Birtles
1b399af497 Bug 1608858 - Update the effect set when an animation changes relevance due to a call to updatePlaybackRate; r=boris
In this particular case where we're paused, we don't need to repaint or
synchronize animations on layers, but we do need to update the effect set so
that getAnimations() returns the correct result.

Differential Revision: https://phabricator.services.mozilla.com/D61258
2020-01-30 23:39:12 +00:00
Boris Zbarsky
0ec1658e7e Bug 1610140. Stop using NS_ERROR_DOM_TYPE_ERR in Animation. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D60362
2020-01-19 05:43:10 +00:00
Brian Birtles
2581993753 Bug 1604500 - Update relevance when synchronously updating the playback rate in UpdatePlaybackRate; r=boris
Differential Revision: https://phabricator.services.mozilla.com/D58737
2020-01-06 05:56:54 +00:00
Mirko Brodesser
8462bc2a30 Bug 1593222: part 12) Rename "nsNodeUtils.*" to "MutationObservers.*". r=smaug
Depends on D51827

Differential Revision: https://phabricator.services.mozilla.com/D51828
2019-11-06 09:08:06 +00:00
Mirko Brodesser
723780d87b Bug 1593222: part 10) Move Animation* methods to MutationObservers. r=smaug
Depends on D51825

Differential Revision: https://phabricator.services.mozilla.com/D51826
2019-11-05 20:39:22 +00:00
Mirko Brodesser
a3a7686b0b Bug 1593222: part 2) Move nsNodeUtils::GetTargetForAnimation to Animation class. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D51607
2019-11-05 14:23:13 +00:00
Boris Chiou
b09809f7b8 Bug 1534884 - Add new animation warning for animations overridden by important rules. r=birtles
We move the check of important rule and animation level into
KeyframeEffect::ShouldBlockAsyncTransformAnimations(), and add a new warning
for it.

Note:
1. ShouldBlockAsyncTransformAnimations() only cares about transforms. And
   for other compositor animation properties, we count on
   HasEffectiveAnimationOfPropertySet() (in IsMatchForCompositor()).
2. If we check the important rules in both
   EffectCompositor::HasAnimationsForCompositor() and
   ActiveLayerTracker::IsTransformMaybeAnimated(), we may get the incorrect
   animation warnings (i.e. TransformFrameInactive). In most cases, we
   check these two functions together, so perhaps move the check of important
   rules outside HasEffectiveAnimationOfPropertySet() is fine.
   Besides, ActiveLayerTracker just tracks if there is a style change on this
   property (or display item) on the active layers, so should be OK to not
   check important rules in it.

So IsMatchForCompositor() should check all transform-like properties,
instead of each one, to get the correct result. (That's why we have to
refactor KeyframeEffect::GetPropertiesForCompositor() as well.)

Differential Revision: https://phabricator.services.mozilla.com/D34432
2019-06-28 18:18:08 +00:00
Brian Birtles
c30bdaedc2 Bug 1253476 - Use update() to update declarations from Servo_DeclarationBlock_SetPropertyToAnimationValue; r=emilio
This method is used when updating the SMIL override style and from Web
Animations' Animation.commitStyles method. By using update we accurately return
false when no change is made to a declaration block.

For SMIL this simply acts as an optimization, meaning we can avoid updating the
SMIL override style ub some cases.

For Animation.commitStyles, however, this allows us to avoid generating
a mutation record. Normally making a redundant change to an attribute *does*
generate a mutation record but the style attribute is different. All browsers
avoid generating a mutation record for a redundant change to inline style.
This is specified in the behavior for setProperty[1] which does not update the
style attribute if updated is false.

[1] https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-setproperty

Differential Revision: https://phabricator.services.mozilla.com/D30871
2019-05-20 05:22:39 +00:00
Brian Birtles
0f1beb0a8a Bug 1253476 - Implement Animation.commitStyles; r=boris,emilio,bzbarsky,smaug
Differential Revision: https://phabricator.services.mozilla.com/D30327
2019-05-20 06:04:23 +00:00
Brian Birtles
da57e655f3 Bug 1253476 - Implement Animation::Persist; r=boris,bzbarsky
https://drafts.csswg.org/web-animations-1/#dom-animation-persist

Differential Revision: https://phabricator.services.mozilla.com/D30325
2019-05-20 05:22:22 +00:00
Brian Birtles
0a02966cf4 Bug 1253476 - Don't composite removed animations; r=boris
Differential Revision: https://phabricator.services.mozilla.com/D30324
2019-05-20 05:55:52 +00:00
Brian Birtles
caef0cb453 Bug 1253476 - Add remove events; r=boris,bzbarsky
This patch introduces the machinery for dispatching remove events but does not
actually cause removing to do anything to the output of the animation beyond
updating its replaceState member.

The expected behavior is defined in:

  https://drafts.csswg.org/web-animations-1/#removing-replaced-animations

And the corresponding IDL members are defined in:

  https://drafts.csswg.org/web-animations-1/#animation
  https://drafts.csswg.org/web-animations-1/#enumdef-animationreplacestate

Tests for these events are added in the next patch in this series.

Differential Revision: https://phabricator.services.mozilla.com/D30322
2019-05-20 05:48:29 +00:00
Brian Birtles
833497491f Bug 1253476 - Make Animation::Tick do finish actions synchronously; r=hiro
Animation::UpdateTiming takes a SyncNotifyFlag parameter. This is passed to
UpdateFinishedState where it determines how we handle finish actions.

If it is async we queue a microtask where we re-evaluate if the animation is
finished or not before queuing events / resolving promises.

That allows code like the following to _not_ trigger finish events:

```
const animation = elem.animate({...}, 1000);
animation.currentTime += 1000;
animation.effect.updateTiming({ duration: 2000 });
```

(Since the check that the animation is finished will run in a microtask _after_
the call to updateTiming.)

When the flag is "sync" we still don't _actually_ run the finish actions
entirely synchronously: the finished promise is resolved synchronously, but
resolving a promise actually queues a microtask for each callback. Likewise, the
finish event is queued synchronously, but not dispatched.

Since there should be no opportunity for script to run between when we call
Animation::Tick and when we run the next microtask checkpoint (currently at the
end of DocumentTimeline::WillRefresh but that will change slightly in the next
patch in this series) there is no need to introduce the extra "async" microtask
for re-evaluating an animation's finished state. Instead it should be possible
to use the "sync" finishing behavior. Such a change should be unobservable to
Web content but will reduce indirection somewhat.

Differential Revision: https://phabricator.services.mozilla.com/D30318
2019-05-20 05:20:17 +00:00
Brian Birtles
89c428a2ad Bug 1541767 - Don't post animation restyles when unbinding an element; r=hiro
Currently we avoid posting animation restyles when unbinding an element by
removing the element from the document before deleting its animation
collections. As a result, when canceled animations go to post a restyle, they
can't find a pres context and give up posting a restyle.

However, this is problematic for two reasons:

* It means we can't remove such canceled animations from the
  PendingAnimationTracker if they are present there (i.e. it regresses the fix
  from bug 1223445).

* It means we can't post cancel events for such animations/transitions since we
  can't lookup the appropriate AnimationEventDispatcher.

In the next patch in this series we will change that order to fix the above
problems but before we do that, we need to introduce another mechanism to make
sure that we don't post restyles when unbinding an element or else we will
regress bug 1396041.

This patch does that by introducing a flag which causes us to not post restyles
when we are doing DOM surgery. For all other cases we actually _do_ need to post
restyles in order to update the style correctly.

Without this patch, layout/style/crashtests/1396041.html would fail after
applying the next patch in this series.

Differential Revision: https://phabricator.services.mozilla.com/D28021
2019-04-18 06:49:25 +00:00
Brian Birtles
0765adeafa Bug 1541767 - Make Animation::Cancel line up with the spec a little better; r=hiro
Animation::Cancel calls UpdateTiming() which in turns runs the procedure to
update the finished state. However, the spec[1] doesn't require that.
Furthermore, calling UpdateTiming here hides the fact that we end up triggering
a restyle.

It would be better to move the parts of UpdateTiming we require into Cancel
itself so that we align better with the spec and to make it a bit more clear
what side-effects of UpdateTiming we actually rely on.

[1] https://drafts.csswg.org/web-animations-1/#cancel-an-animation

Differential Revision: https://phabricator.services.mozilla.com/D28020
2019-04-18 06:25:54 +00:00
Brian Birtles
44be4af5b9 Bug 1541767 - Drop Animation::CancelNoUpdate; r=hiro
CancelNoUpdate actually can and does trigger restyles via its call to
KeyframeEffect::NotifyAnimationTimingUpdated so at very least its name is wrong.

Furthermore, we actually want canceling to trigger restyles in most cases since
when an animation is canceled we need to trigger a subsequent restyle to apply
the (no-longer-animated) result.

This wasn't necessary when CancelNoUpdate was first introduced but since then we
have introduced the Servo style engine where we use a separate traversal to
apply the result from creating/deleting/modifying animations.

This change will mean that we now trigger a "layer" restyle when canceling an
animation when we previously didn't. That, however, seems more correct if
anything.

This patch also makes CancelFromStyle no longer virtual since it doesn't seem
necessary anymore (perhaps because we now point to the concrete type:
CSSAnimation/CSSTransition from nsAnimationManager/nsTransitionManager whereas
previously we didn't).

Differential Revision: https://phabricator.services.mozilla.com/D28019
2019-04-18 06:24:52 +00:00
Masayuki Nakano
dbcabe5901 Bug 1540990 - Get rid of unnecessary nsIPresShell.h inclusions r=emilio
A lot of files include `nsIPresShell.h` even though currently they don't
need it.  This patch removes the unnecessary inclusions.

Differential Revision: https://phabricator.services.mozilla.com/D25744
2019-04-04 00:19:48 +00:00
Razvan Maries
5e691f8a46 Backed out changeset 3b94c20ba873 (bug 1540990) for build bustages. CLOSED TREE 2019-04-04 02:44:00 +03:00
Masayuki Nakano
0fd36d1719 Bug 1540990 - Get rid of unnecessary nsIPresShell.h inclusions r=emilio
A lot of files include `nsIPresShell.h` even though currently they don't
need it.  This patch removes the unnecessary inclusions.

Differential Revision: https://phabricator.services.mozilla.com/D25744
2019-04-03 23:29:38 +00:00
Masayuki Nakano
5b1ecc8b12 Bug 1540015 - part 1: Make Document.h stop including nsIPresShell.h r=smaug
If `Document::GetShell()` returns `PresShell*` rather than `nsIPresShell`, it's
a good step to deCOMTaminate `PresShell`.

This patch makes `Document.h` stop including `nsIPresShell.h` since
`nsIPresShell.h` includes `Document.h` indirectly and that causes bustage
when we make `Document::GetShell()` return `PresShell*`.

Differential Revision: https://phabricator.services.mozilla.com/D25332
2019-03-29 15:11:04 +00:00
Dorel Luca
6cd4166b18 Backed out 3 changesets (bug 1540015) for build bustage. CLOSED TREE
Backed out changeset 7b71c9da0214 (bug 1540015)
Backed out changeset 5723ddbc5c44 (bug 1540015)
Backed out changeset 9561d2c36fa5 (bug 1540015)
2019-03-29 16:14:26 +02:00
Masayuki Nakano
12b497174b Bug 1540015 - part 1: Make Document.h stop including nsIPresShell.h r=smaug
If `Document::GetShell()` returns `PresShell*` rather than `nsIPresShell`, it's
a good step to deCOMTaminate `PresShell`.

This patch makes `Document.h` stop including `nsIPresShell.h` since
`nsIPresShell.h` includes `Document.h` indirectly and that causes bustage
when we make `Document::GetShell()` return `PresShell*`.

Differential Revision: https://phabricator.services.mozilla.com/D25332
2019-03-29 12:12:20 +00:00
Boris Chiou
94255ed149 Bug 1526850 - Part 2: Let FindAnimationsForCompositor take nsCSSPropertyIDSet. r=hiro
We use DisplayItemType as the input of HasAnimationsForCompositor, and
nsCSSPropertyIDSet as the input of GetAnimationsForCompositor.

The caller of HasAnimationsForCompositor just wants to check if there is
any compositor animation for a display item, so we can replace it by the
display item, and get the properties from this display item.

However, the caller of GetAnimationsForCompositor may use a subset of
transform-like properties for getting scale factors, or use all the
transform-like properties for sending all transform animations to the
compositor thread.

Depends on D19630

Differential Revision: https://phabricator.services.mozilla.com/D19628
2019-03-01 21:13:03 +00:00
Ryan Hunt
ad7b7dbb30 Bug 1523969 part 6 - Move method definition inline comments to new line in 'dom/'. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D21106
2019-02-25 16:05:29 -06:00
Boris Chiou
03e0c65876 Bug 1505225 - Part 1: Make sure we also check the existence of individual transform animations. r=hiro
nsIFrame::BuildDisplayListForStackingContext() will check the existence
of transform animations, so we need to update
nsLayoutUtils::HasAnimationsOfPoperty(). However, checking only
eCSSProperty_transform is not enough. We have to check all the transform-like
properties. Therefore, we update these functions to accept a property
set as the argument, and pass a collection of transform-like properties
into them.

Differential Revision: https://phabricator.services.mozilla.com/D20412
2019-02-20 02:14:39 +00:00
Brian Birtles
a9ac7c270b Bug 1518374 - Fix a bunch of fallout from changes to mozilla::dom::Document; r=hiro
Bug 1517241 renamed nsIDocument to mozilla::dom::Document but unfortunately in
the process it messed up the ordering of includes which, according to the coding
style[1], should be alphabetically sorted.

Also, in TimingParams.cpp it didn't add the dom::* prefix so when the unified
build chunking changes, if the "using namespace mozilla::dom" declaration
disappears from the chunk, it will fail to build.

[1] https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#CC_practices

Depends on D15902

Differential Revision: https://phabricator.services.mozilla.com/D15903
2019-01-08 06:45:18 +00:00
Emilio Cobos Álvarez
dc336a73ba Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug
Summary: Really sorry for the size of the patch. It's mostly automatic
s/nsIDocument/Document/ but I had to fix up in a bunch of places manually to
add the right namespacing and such.

Overall it's not a very interesting patch I think.

nsDocument.cpp turns into Document.cpp, nsIDocument.h into Document.h and
nsIDocumentInlines.h into DocumentInlines.h.

I also changed a bunch of nsCOMPtr usage to RefPtr, but not all of it.

While fixing up some of the bits I also removed some unneeded OwnerDoc() null
checks and such, but I didn't do anything riskier than that.
2019-01-03 17:48:33 +01:00
Brian Birtles
9e3706e5e3 Bug 1433705 - Rename GetCurrentTime to GetCurrentTimeAsDuration; r=hiro
To avoid having to always work around conflicts with winbase.h.

Differential Revision: https://phabricator.services.mozilla.com/D13951
2018-12-06 22:16:48 +00:00
Sylvestre Ledru
e5a134f73a Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset
2018-11-30 11:46:48 +01:00
Brian Birtles
56e0a778f8 Bug 1495647 - Use the effective playback rate when calculating the playState; r=hiro
This corresponds to the following change to the Web Animations spec:

  abdebabf7f

Depends on D7573

Differential Revision: https://phabricator.services.mozilla.com/D7574
2018-10-03 06:13:52 +00:00
shindli
f3d8c63e5f Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-07-26 14:21:26 +03:00
Brian Birtles
2c290f9002 Bug 1478213 - Don't ignore a redundant change to setting the animation start time if we are pending; r=hiro
As discussed here:

  https://github.com/w3c/csswg-drafts/issues/2691

We have a similar check in SetCurrentTime (with the exception that, according to
the spec, this behavior applies to either play OR pause pending, instead of just
pause-pending) so this patch tries to match the comment and format of that
check.

Differential Revision: https://phabricator.services.mozilla.com/D2410
2018-07-26 15:07:52 +09:00
Brian Birtles
ea41ec822f Bug 1478266 - Don't reset pending tasks when setting the target effect to null r=boris
This updates our implementation and tests to match the following spec change:

  2e56cd7d77

Differential Revision: https://phabricator.services.mozilla.com/D2407
2018-07-26 05:20:41 +00:00
Hiroyuki Ikezoe
de9af5ff78 Bug 1474247 - Check mPendingState instead of mPendingReadyTime in Animation::ReschedulePendingTasks(). r=birtles
When the pending animation having no target element sets a new effect having
a target element associated with a document, PendingAnimationTracker has to
start tracking the animation regardless of mPendingReadyTime.

MozReview-Commit-ID: DxmbXtLhjCT
2018-07-12 17:05:34 +09:00
Hiroyuki Ikezoe
cd2cae620a Bug 1474247 - Factor out Animation::ReschedulePendingAnimations and make it public. r=birtles
The function will be used in the case of KeyframeEffect::SetTarget too.

MozReview-Commit-ID: G6ipjxaIJsW
2018-07-12 17:05:13 +09:00