Граф коммитов

106 Коммитов

Автор SHA1 Сообщение Дата
Hiroyuki Ikezoe 4c0263a3ed Bug 1096774 - Part 1: Implement Animation Constructor. r=birtles, r=smaug 2016-01-16 19:02:00 -05:00
Brian Birtles 02e4c93ce9 Bug 1234095 - Rework sorting to handle to script-generated animations; r=heycam 2016-01-14 10:24:24 +09:00
Brian Birtles 2a70c0a477 Bug 1232577 part 12 - Move the remainder of RequestRestyle from AnimationCollection to EffectCompositor; r=heycam
This also allows us to remove all references to AnimationCollection and the
animation managers from Animation.
2016-01-13 07:54:54 +09:00
Brian Birtles b29e0fc6c2 Bug 1232577 part 10 - Remove AnimationCollection::mStyleChanging; r=heycam
This flag is no longer needed because in bug 1232563 we introduced a more
thorough optimization that detects when the animation is not changing by
comparing the progress value between samples and avoids requesting restyles
when it does not change.
2016-01-13 07:54:54 +09:00
N.Shimizu 9c1354440b Bug 1179627 - Part 1: Implement Animation.id. r=smaug, r=birtles 2016-01-08 03:17:00 -05:00
Brian Birtles cb3f0f2256 Bug 1232561 part 1 - Replace AppliesToTransitionsLevel() with a cascade level enumeration; r=heycam
Introducing an enum will simplify further patches in this series by providing
a common vocabulary for this distinction.

--HG--
extra : rebase_source : 4afbd358a401853df3ad401f2b1c3454ccff26cd
2016-01-06 11:04:05 +09:00
Brian Birtles 144a09f431 Bug 1228229 part 7 - Add a method to Animation to indicate if it applies to the transitions level of the cascade; r=dbaron
For transitions, this method returns true so long as the transition is
bound to markup. This is based on the below discussion,

  https://github.com/w3c/web-animations/issues/97
  https://github.com/w3c/web-animations/issues/62#issuecomment-117357703
  https://github.com/w3c/web-animations/issues/62#issuecomment-117374689

We will likely reuse this method when we come to implement animation style rule
generation in a more generic manner.

--HG--
extra : rebase_source : fe8a3d09296d7f74cabd59c605cf568d200bb240
2016-01-06 11:04:05 +09:00
Hiroyuki Ikezoe 1e734eff34 Bug 1223255 - Use Animation::AnimationTimeToTimeStamp instead of timeline->ToTimeStamp. r=bbirtles
Otherwise delay value is multiplied by playbackRate twice.

--HG--
extra : rebase_source : 42b088e65c2ce3986bc36fa1c41a06e38f1c133a
2015-11-18 01:50:00 +01:00
Olli Pettay f50a8c0983 Bug 1223445 - KeyframeEffectReadOnly objects end up keeping lots of other objects alive too long, r=birtles
--HG--
extra : rebase_source : df6828ce26e22e53b632f25952fd1741a693c36a
2015-11-16 19:44:55 +02:00
Hiroyuki Ikezoe 6e809a002a Bug 1216030 - Part 15: Add KeyframeEffectReadOnly::GetCollection. r=bbirtles 2015-11-06 02:53:00 +01:00
Nathan Froyd 01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Brian Birtles 0ea5e5c7c8 Bug 1208938 part 2 - Remove Animation::HasEndEventToQueue; r=heycam 2015-10-07 14:30:28 +09:00
Brian Birtles 9590e60a48 Bug 1208938 part 1 - Rename AnimationCollection::mNeedsRefreshes to mStyleChanging; r=heycam
This patch renames AnimationCollection::mNeedsRefreshes to indicate that it
no longer has any relationship to whether or not we observe the refresh driver.
2015-09-17 15:43:15 +09:00
Brian Birtles d89f0d836b Bug 1208385 part 1 - Store a pointer to the owning animation on each KeyframeEffect; r=heycam
We need to do this so effects can query their owning animation for the current
time and avoid falling out of sync. Furthermore, this pointer is needed
for a number of other bugs (e.g. bug 1166500 comment 12, or bug 1190235)
anyway.
2015-10-07 14:30:27 +09:00
Brian Birtles 534ef7e86c Bug 1195180 part 1 - Add Animation::NeedsTicks; r=heycam
Adds a method to determine if an animation requires refresh driver ticks.
We will use this function later to determine when it is safe to stop
observing the refresh driver.
2015-09-28 12:38:40 +09:00
Hiroyuki Ikezoe 41ec8da9f3 Bug 1151694 - Part 3: Manage mIsRunningOnCompositor flags for each properties respectively. r=bbirtles
--HG--
extra : rebase_source : d189d779ef14e8ae5497b03b01e3d4d994803fe1
2015-09-16 16:05:00 +02:00
Brian Birtles 8bf9ca19e0 Bug 1183461 part 3 - Add Animation::AnimationTimeToTimeStamp; r=heycam
This patch adds a utility method to Animation which takes a time in the
same time space as "current time", i.e. "animation time" and convert it to
a TimeStamp. Subsequent patches in this series will use this method to
take the time when an event was scheduled to occur and convert it to a
TimeStamp so it can be compared with other event times. This allows us to
dispatch events in the order they would have fired given an infinitely
frequent sample rate.

--HG--
extra : rebase_source : 0b4f98b932bb2751bac24b4383fe20613176f0c4
2015-09-15 14:04:08 +09:00
Brian Birtles 1bb17c4634 Bug 1203009 part 5 - Remove IsUsingCustomCompositeOrder; r=heycam 2015-09-15 13:32:12 +09:00
Brian Birtles 25e9bf79fe Bug 1203009 part 4 - Implement new composite ordering; r=heycam 2015-09-15 11:20:56 +09:00
Brian Birtles 3d0a063444 Bug 1203009 part 1 - Rename sequence number to animation index; r=heycam
The Web Animations specification has replaced the term "sequence number" with
references to a global animation list. This patch applies similar naming
to our animation structures.
2015-09-15 11:20:26 +09:00
Brian Birtles a362d9f14e Bug 1194037 part 3 - Add Animation::HasEndEventToQueue(); r=dholbert
We currently determine if we need refresh driver ticks when composing style
but sometimes we might not need ticks for composing style but we might need
one more tick in order to queue a final end event. Currently, this doesn't
seem to be a problem because FlushAnimations calls Animation::Tick where we
queue up events. When we remove the call to Animation::Tick from
FlushAnimations in order to make FlushAnimations purely responsible for
posting restyles, however, we will create a situation where we might mark an
animation collection as no longer needing refreshes and not simultaneously
queueing the corresponding event. If another animation collection is deleted in
the meantime we may trigger the code that causes us to disassociate from the
refresh driver and the corresponding event will never be dispatched.

Long-term (bug 1195180) we will check if it we can stop observing the refresh
driver and queue events in the same step. Until then, this patch adds a method
to detect this particular situation and uses it to avoid unregistering from
the refresh driver while we still have end events to queue.
2015-08-31 16:21:55 +09:00
Hiroyuki Ikezoe a4077879ac Bug 1194028 - Part 1: Implement Animation NotifyEffectTimingUpdate and KeyframeEffect SetTiming. r=bbirtles 2015-08-17 14:28:00 -04:00
Brian Birtles 774abfc8fe Bug 1180125 part 2 - Move AnimationCommon classes out of CSS namespace; r=dbaron
The long-term plan is to drop the mozilla::css namespace altogether. Before we
go to much further with refactoring code in AnimationCommon, we should drop
usage of the mozilla::css namespace. Specifically, this patch moves the
CommonAnimationManager and AnimValuesStyleRule classes to the mozilla namespace.
2015-07-29 10:57:39 +09:00
Brian Birtles 0d79f0c537 Bug 1180125 part 1 - Queue and dispatch CSS animation events as a separate step; r=dbaron
This patch prepares the way for script-generated events by making
event dispatch a separate process that happens after sampling animations.
This will allow us to sample animations from their associated timeline
(removing the need for a further manager to tracker script-generated
animations).

Furthermore, once we sample animations from timelines the order in which they
are sampled is likely to be more or less random so by making event dispatch at
separate step, we have an opportunity to sort the events and dispatch in
a consistent and sensible order. It also ensures that event callbacks will
not be run until all animations (including transitions) have been updated
ensuring they see a consistent view of timing properties.

This patch only affects event handling for CSS animations. Transitions will
be dealt with in a subsequent patch.
2015-07-29 10:57:39 +09:00
Hiroyuki Ikezoe 5119cec74f Bug 1178664 - Part 4 -Implement Animation.oncancel event. r=bbirtles, r=smaug
--HG--
extra : rebase_source : 2885fc984f652ecd086b9ec4f9b57190375c965c
2015-07-30 23:26:00 +02:00
Hiroyuki Ikezoe 189c64b196 Bug 1178664 - Part 3 - Implement Animation.onfinish event. r=bbirtles, r=smaug
--HG--
extra : rebase_source : d78f3a6d58f26a46dfdd726f30590bc8a4e9137d
2015-07-30 23:25:00 +02:00
Hiroyuki Ikezoe d2e5ec96d8 Bug 1178664 - Part 1 - Make Animation interface EventTarget inheritance. r=smaug
--HG--
extra : rebase_source : e182dc4757a19ec4e55e4e3d9d7a893a190929cf
2015-07-30 23:23:00 +02:00
Hiroyuki Ikezoe 77aabfc80f Bug 1178665 - Part 3: Make finish notifications asynchronously in most cases. r=bbirtles, r=smaug 2015-07-29 23:21:00 +02:00
Carsten "Tomcat" Book 61664e5c9a Backed out changeset 79bcd4f744c0 (bug 1180125) 2015-07-29 17:32:24 +02:00
Carsten "Tomcat" Book c86b8ab1b4 Backed out changeset a4fb4e4b1c8b (bug 1180125) 2015-07-29 17:32:19 +02:00
Brian Birtles 9b391b0177 Bug 1180125 part 2 - Move AnimationCommon classes out of CSS namespace; r=dbaron
The long-term plan is to drop the mozilla::css namespace altogether. Before we
go to much further with refactoring code in AnimationCommon, we should drop
usage of the mozilla::css namespace. Specifically, this patch moves the
CommonAnimationManager and AnimValuesStyleRule classes to the mozilla namespace.
2015-07-29 10:57:39 +09:00
Brian Birtles 880fd89013 Bug 1180125 part 1 - Queue and dispatch CSS animation events as a separate step; r=dbaron
This patch prepares the way for script-generated events by making
event dispatch a separate process that happens after sampling animations.
This will allow us to sample animations from their associated timeline
(removing the need for a further manager to tracker script-generated
animations).

Furthermore, once we sample animations from timelines the order in which they
are sampled is likely to be more or less random so by making event dispatch at
separate step, we have an opportunity to sort the events and dispatch in
a consistent and sensible order. It also ensures that event callbacks will
not be run until all animations (including transitions) have been updated
ensuring they see a consistent view of timing properties.

This patch only affects event handling for CSS animations. Transitions will
be dealt with in a subsequent patch.
2015-07-29 10:57:39 +09:00
Hiroyuki Ikezoe d097a2d673 Bug 1150808 - Implement Animation.reverse(). r=smaug r=birtles
--HG--
extra : rebase_source : 593ef5ed090d016260f6ca07008ff036effe7fd6
2015-07-09 22:54:00 +02:00
Hiroyuki Ikezoe 56a826cd0a Bug 1181905 - Animation::IsPlaying should check playbackRate != 0 to stop playing on compositor animation. r=bbirtles 2015-07-09 20:54:00 +02:00
Brian Birtles 5550db670f Bug 1150810 part 7 - Add Animation::SetTimeline; r=jwatt
--HG--
extra : commitid : 3QENfb2DzCC
extra : rebase_source : 4928061558e689ae40d0976b9dd13e480279c2d1
2015-04-28 17:21:58 +09:00
Brian Birtles 37506d5652 Bug 1150810 part 6 - Rename Timeline() to GetTimeline(); r=smaug
This is in anticipation of adding Animation::SetTimeline(). Once we set the
timeline out of band, there's a chance that getting it could return null so
this patch makes the WebIDL and method name reflect that.

--HG--
extra : commitid : FSiwvrGRV1v
extra : rebase_source : 4c4004f58bbfd340642277b0a0b547a7de692dac
2015-04-28 16:25:07 +09:00
Brian Birtles 6d3dd1a595 Bug 1150810 part 4 - Store global on Animation; r=smaug, jwatt
The connection between an Animation and an AnimationTimeline is optional. That
is, it is possible to have an Animation without an AnimationTimeline. Until now
we have often just assumed the timeline will be set but eventually we need to
support the possibility of the timeline being null. Indeed, later in this patch
series we will set the timeline out-of-band (i.e. not in the constructor) using
SetTimeline which opens up the possibility that timeline will be null for
a period of time.

This patch paves the way for having an optional timeline by storing the global
used for, e.g. creating promises, on the Animation object itself.

--HG--
extra : commitid : Ew9Zp4t36lV
extra : rebase_source : 16c9de9525a3562ff10e41fdf1602384a4e366e3
2015-04-28 15:48:35 +09:00
Brian Birtles cd770f1b4b Bug 1150810 part 2 - Replace references to DocumentTimeline with AnimationTimeline; r=jwatt
This is needed not only for supporting other kinds of timelines, but also for
when we come to implement SetTimeline(AnimationTimeline* aTimeline).

--HG--
extra : commitid : B836jCSbgNL
extra : rebase_source : 2592e66b2a9009f85ec0189ebecf5dba3c9bf8e0
2015-04-28 11:29:13 +09:00
Brian Birtles 4ac9e57a4f Bug 1171817 part 9 - Add override of HasLowerCompositeOrderThan for CSS animations; r=dbaron
This patch also extends the tests for Element.getAnimations(). It doesn't
actually exercise the code added (it's not actually called yet since it doesn't
need to be for Element.getAnimations) but simply provides a useful regression
and interop test.

--HG--
extra : commitid : KWpAsc2Aj54
extra : rebase_source : abe26dc3d79a50239c62dd156dc0a0aa29c11d52
2015-06-09 11:13:54 +09:00
Brian Birtles 9836323890 Bug 1171817 part 7 - Add Animation::IsUsingCustomCompositeOrder; r=dbaron
Add a virtual method we can use to determine when an animation is having its
sequence number set by some other mechanism than the general logic
defined for animations.

This allows CSS animations and transitions to re-use the sequence number for
their own purposes. Typically what will happen is something like this:

1. A CSSAnimation is created corresponding to an item in the animation-name
   property.

   At this point CSSAnimation::IsUsingCustomCompositeOrder() will return true
   and nsAnimationManager will set the sequence number based on the position of
   the animation in animation-name.

2. If at a later point the animation is removed from the animation-name but kept
   alive by script, CSSAnimation::CancelFromStyle will be called which will
   clear the custom sequence number (i.e. set it to kUnsequenced) and also
   update the CSSAnimation's state such as
   CSSAnimation::IsUsingCustomCompositeOrder() returns false.

3. Then, then the CSSAnimation next transitions out of the idle state it will
   have its sequence number set just like any other Animation and be ordered
   like any other Animation (since we can no longer use animation-name to
   determine its composite order).

This behavior is added in subsequent patches in this series (and likewise for
CSS transitions too).

--HG--
extra : commitid : B8nPFXzQMfF
extra : rebase_source : 42439fb1dd32a789e270dc0c51af2c660f4593eb
2015-06-09 11:13:54 +09:00
Brian Birtles ddc1552c4a Bug 1171817 part 6 - Add Animation::HasLowerCompositeOrderThan; r=dbaron
This patch introduces a method that will be used for sorting animations based on
their composite order. The method is based on the API for Comparator objects (as
used by nsTArray and co.) which have a LessThan method. (For the
Comparator::Equals method we can used pointer equality since no two independent
objects should have equal composite order.)

--HG--
extra : commitid : 88oD4UFx5to
extra : rebase_source : 1b30272451c189161a08efac3da48d72e10d8e52
2015-06-09 11:13:53 +09:00
Brian Birtles f4bdb4f46c Bug 1171817 part 5 - Add a sequence number member to Animations; r=dbaron
Web Animations defines Animations as having a globally unique sequence number
for the purpose of prioritization:

  http://w3c.github.io/web-animations/#animation-sequence-number

As of the writing of this patch, the spec says the sequence number is updated
when the Animation is created. This is problematic and I have proposed that
actually this should be updated from each transition from idle:

  https://lists.w3.org/Archives/Public/public-fx/2015AprJun/0054.html

This doesn't seem to have met any opposition so I will update the spec to
reflect this soon.

This patch implements the behavior of updating the sequence number on each
transition from idle.

To make sure we perform this on each change to timing this patch removes
a couple of instances of early returns to ensure that UpdateTiming is called.

The current maximum sequence number is simply a class static and we make no
attempt to deal with wraparound. This is because we only update this number when
an animation transitions from idle which only happens when an animation is
created or script calls cancel() followed by play() on the animation. Supposing
that across all content this happenned an unlikely 1 billion times a second we
still wouldn't exhaust the range of the unsigned 64-bit int for about 585 years.

We'd like to make kUnsequenced be zero and make the static represent the
current maximum. This would probably be easier to understand and recognize in
a debugger. However, later in this patch series we will make CSS animations and
CSS transitions override this sequencing behavior. If we define kUnsequenced
to be zero and they accidentally assign zero as an actual sequence number then
they'll run into trouble. To avoid that we set kUnsequenced to UINT64_MAX.

--HG--
extra : commitid : DMw8uKjg4Hz
extra : rebase_source : 9e98b3346f0297efce3ecfa0b2dd8a9c13075dca
2015-06-09 11:13:53 +09:00
Brian Birtles 2378ae7083 Bug 1171817 part 4 - Add const version of AsCSSAnimation/AsCSSTransition methods; r=dbaron
These will be needed for sorting animations and transitions in a const-correct
fashion.

--HG--
extra : commitid : BhuFfkAvse7
extra : rebase_source : a97039f06b9f257ccb9b6aa206653d6b5d5d43d4
2015-06-09 11:13:53 +09:00
Brian Birtles 916a2b1a0e Bug 1171817 part 2 - Add CSSAnimation::GetOwningElement; r=dbaron
In order to sort CSS animation objects correctly, we need to know which
element's animation-name property they appear in, if any. Normally that's
simply the target element of the animation's keyframe effect but it can differ
in the following cases:

1) When script modifies a CSSAnimation's effect to target a different element
   (or simply removes the effect altogether). In this case we use the
   *owning* element to determine the priority of the animation, not the target
   element.

   This scenario does not yet occur (bug 1049975).

2) When script creates a CSSAnimation object using the CSSAnimation constructor.
   In this case, the owning element should be empty (null) and we should
   determine the priority of the animation in the same way as any other
   Animation object.

   Again, this is not yet supported (or even specced) but will be eventually.

3) When script holds a reference to a CSSAnimation object but then updates the
   animation-name property such that the animation object is cancelled. In this
   case the owning element should be cleared (null) so we know to not to try and
   sort this with regard to any animation-name property.

   This is possible using code such as the following:

     elem.style.animation = 'a 5s';
     var a = elem.getAnimations()[0];
     elem.style.animation = 'b 5s';
     a.play(); // Bring a back to life
     document.timeline.getAnimations();
     // ^ At this point we need to know how to sort 'a' and 'b' which depends
     // on recognizing that a is no longer part of an animation-name list.

Until we implement bug 1049975, we could support sorting animations without
adding the reference to the owning element by setting a flag on the CSSAnimation
object but (having tried this) it turns out to be cleaner to just introduce this
reference now, particularly since we know we will need it later.

Note that we will also need this information in future to dispatch events to the
correct element in circumstances such as (1) once we separate updating timing
information (including events) from applying animation values.

--HG--
extra : commitid : 8o9bf6l7kj7
extra : rebase_source : 391a4e8769cc96584ebd625d4b1d0e873373fd41
2015-06-09 11:13:53 +09:00
Brian Birtles 3c2d6db2da Bug 1179111 part 5 - Remove Name() methods; r=jwatt
--HG--
extra : source : 22cafa2fd162a3cbe9af7fd13a92fd82cd3a2315
2015-07-01 15:19:04 +09:00
Brian Birtles cc59f02cc9 Bug 1178186 part 1 - Add CSSAnimation and CSSTransition interfaces; r=smaug
--HG--
extra : source : 1e1ccffd51b824fb6b229def4ddb7cb1d8889bb6
2015-06-30 10:00:39 +09:00
Carsten "Tomcat" Book 0a19d00b4f Backed out changeset 1e1ccffd51b8 (bug 1178186) for suspicion of causing bc2 test failures on OSX browser_bug427559.js 2015-07-07 14:22:33 +02:00
Carsten "Tomcat" Book 297c2b6a58 Backed out changeset 22cafa2fd162 (bug 1179111) 2015-07-07 14:21:33 +02:00
Brian Birtles cd06229252 Bug 1179111 part 5 - Remove Name() methods; r=jwatt
--HG--
extra : commitid : JT0oaGODGja
extra : rebase_source : e0ff11f1f482599e5e2b7b0eac6cfbb71fd0e34b
2015-07-01 15:19:04 +09:00
Brian Birtles e298fe6b44 Bug 1178186 part 1 - Add CSSAnimation and CSSTransition interfaces; r=smaug
--HG--
extra : commitid : K0U17zTMtAz
extra : rebase_source : e3b2dc3c503144763efe41ef71b9dc3793b3172f
2015-06-30 10:00:39 +09:00