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

20 Коммитов

Автор SHA1 Сообщение Дата
Boris Chiou 80e27fb970 Bug 1754897 - Part 6: Add Scroller::Type to the HashMap key for ScrollTimeline. r=emilio
Different types of scrollers may need some special manipulation, e.g. we may
need to handle some special cases for `scroller(nearest)` in the
future (e.g. Bug 1765211). So making the hash key as a pair of scroller type
and scroller axis.

Differential Revision: https://phabricator.services.mozilla.com/D147773
2022-06-13 20:26:46 +00:00
Boris Chiou b6e80527ff Bug 1754897 - Part 5: Factor out the creation of ScrollTimeline object. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D146967
2022-06-13 20:26:46 +00:00
Boris Chiou 2b8751f919 Bug 1754897 - Part 4: Hook named scroll timelines to animation-timeline. r=emilio
Basically, animation-timeline could be
1. auto
2. none
3. <timeline-name>

We extend the <timeline-name> to cover both @scroll-timeline rule and
scroll-timeline-name property. We check @scroll-timeline rule first. If
it doesn't exist, we check scroll-timeline-name of the element itself,
the previous silbings, and their ancestors.

Differential Revision: https://phabricator.services.mozilla.com/D146358
2022-06-13 20:26:45 +00:00
Boris Chiou 8e54e21d3a Bug 1737918 - Part 4: Implement scroll() in layout and support nearest scroller. r=emilio
There is a known issue: if we change overflow property of the
scroll-container, we may have to update the scroll-linked animations of
its descendants. This may be very tricky, so I filled Bug 1765211 for it.

Differential Revision: https://phabricator.services.mozilla.com/D143420
2022-04-21 17:05:19 +00:00
Boris Chiou 3efc8e6e9c Bug 1737918 - Part 3: Replace Scroller::Type with StyleScroller. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D143419
2022-04-21 17:05:18 +00:00
Boris Chiou 8efa1324d7 Bug 1737918 - Part 2: Replace StyleScrollDirection with StyleAxis. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D143418
2022-04-21 17:05:18 +00:00
Noemi Erli 560b5ccdb5 Backed out 4 changesets (bug 1737918) for causing bustages in ScrollTimeline.cpp CLOSED TREE
Backed out changeset cecdd071c1aa (bug 1737918)
Backed out changeset fcc5ecd364e4 (bug 1737918)
Backed out changeset f7bf3143e4a7 (bug 1737918)
Backed out changeset a143d2e54fb9 (bug 1737918)
2022-04-21 01:21:14 +03:00
Boris Chiou 512b4a3fb3 Bug 1737918 - Part 4: Implement scroll() in layout and support nearest scroller. r=emilio
There is a known issue: if we change overflow property of the
scroll-container, we may have to update the scroll-linked animations of
its descendants. This may be very tricky, so I filled Bug 1765211 for it.

Differential Revision: https://phabricator.services.mozilla.com/D143420
2022-04-20 20:28:53 +00:00
Boris Chiou 0567aa6b83 Bug 1737918 - Part 3: Replace Scroller::Type with StyleScroller. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D143419
2022-04-20 20:28:53 +00:00
Boris Chiou 53830b1b34 Bug 1737918 - Part 2: Replace StyleScrollDirection with StyleAxis. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D143418
2022-04-20 20:28:53 +00:00
Boris Chiou 487a100dbb Bug 1737180 - Part 4: Enable OMTA for scroll animations. r=hiro
We fallback to use main-thread animations if the timeline is inactive or we
cannot get scroll offsets or the scroll range from APZC on the compositor
thread.

Differential Revision: https://phabricator.services.mozilla.com/D141168
2022-04-05 18:48:17 +00:00
Boris Chiou d31e49ca18 Bug 1737180 - Part 1: Populate scroll timeline information when adding animations for webrender r=hiro
We don't send the animation to the compositor if it's scroll-timeline is
inactive (e.g. no layout frame or no scrollable frame).

Besdies, we also add a new struct, ScrollTimelineOptions, to represent
scroll timeline information in the IPC messages.

This patch handles the main thread side, and extract the information
from the transaction and store into AnimationStorageData.
We will sample ths scroll animations later in the patch series.

Differential Revision: https://phabricator.services.mozilla.com/D140548
2022-04-05 18:48:16 +00:00
Boris Chiou 20a964e3ea Bug 1738135 - Don't create ScrollTimeline for each Animation. r=hiro
We use a HashMap to keep the ScrollTimeline, and use scroll-direction as
the key, so a specific Element and a fixed scroll direction map to a specific
ScrollTimeline object. This means a maximum of one ScrollTimeline objects per
@scroll-timeline declaration.

If @scroll-timeline rule gets updated, we rebuild all the CSS
animations, and then re-check their ScrollTimeline objects. If there are
any unused old ScrollTimeline objects, their ref-counts will be zero
because only Animation object holds the strong reference,
so they will be removed from the associated ScrollTimelineSet and be
deleted automatically.

Note: We may have to update this once we support more descriptors in
@scroll-timeline. However, the syntax update is to obsolute @scroll-timeline,
so we don't have to address too many cases for now. This should be enough.

This is an internal optimization, and we can probably just rely on the existing
WPTs to test this without any memory leaks.

Differential Revision: https://phabricator.services.mozilla.com/D137236
2022-02-08 18:35:23 +00:00
Boris Chiou 9005af910b Bug 1676791 - Part 9: Define Scroller to handle the source of ScrollTimeline. r=emilio
Per spec, "auto" represents the scrolling element of the document.
However, the scrolling element might be changed, based on the layout, in
quirks mode. Besides, the content of the root scroll frame is the root
element, instead of the scrolling element (e.g. body element) in both
standard and quirks modes. So now we define a special type, Scroller, to
represent the source of scroll-timeline, and use its |mType| to decide
which scroll frame we would like to use. In addition, hope this change let
us easier to implement nearest scroller.

Note: for auto scroller, we register this ScrollTimeline to the root
element, in both modes. Once we expose ScrollTimeline interface to the
script, we can rely on the |mType| of Scroller to return the correct
source element, whether it is scrolling element or not.

Differential Revision: https://phabricator.services.mozilla.com/D131578
2021-12-08 01:16:31 +00:00
Boris Chiou 74f0bd8a0c Bug 1676791 - Part 8: Hook scroll-timeline rule into Cascade data and use it for CSS animations. r=emilio,hiro
We hook the rule into cascade data, and so we can look it up by timeline
name. Now we only use StyleScrollDirection from @scroll-timeline rule.
`source` and `scroll-offsets` are skipped now and use the default values
instead because I'm pretty sure the syntax will be changed in Bug 1733260,
and `scroll-offsets` may be obsolete because the spec proposal intents to
make it be always 0% ~ 100%.

Also, add some reftests for the default `source` and `scroll-offsets`,
and different `orientation`s.

Besides, we disable at-scroll-timeline-start-end.html in Gecko because
we don't support start/end descriptors, and there are too many
intermittents in it.

Differential Revision: https://phabricator.services.mozilla.com/D126452
2021-12-08 01:16:31 +00:00
Boris Chiou fcbeb1d2b0 Bug 1676791 - Part 5: Define the finite timeline and use it in Play() and Pause(). r=hiro
Based on https://github.com/w3c/csswg-drafts/pull/4842, we define
"has finite timeline", which is a timeline that's not monotonically increasing.
We need this to update start time and hold time for scroll-timeline, so
we play scroll-linked animations as we expected, e.g. GetLocalTime() returns
the correct time value from GetCurrentTimeAsDuration().

Known issue: we still have bugs when setting "animation-play-state:paused".
Will do that in Bug 1741255.

Differential Revision: https://phabricator.services.mozilla.com/D131168
2021-12-08 01:16:30 +00:00
Boris Chiou 7ea5fa0013 Bug 1676791 - Part 4: Make TimingParams be a LiteralType. r=hiro
And so we can make ScrollTimeline::GetTiming() be a constexpr function.

Differential Revision: https://phabricator.services.mozilla.com/D131449
2021-12-08 01:16:29 +00:00
Boris Chiou 193a6c3d7a Bug 1676791 - Part 3: Implement the computation of timing. r=hiro
This patch focus on the timing computation of animation effects. We have
to compute the correct progress based on the scroll offsets. Now we
simplify the implementation only from 0% to 100%. The test cases will be
added in the last patch once we hook the scroll timeline to the CSS
animation.

Differential Revision: https://phabricator.services.mozilla.com/D129101
2021-12-08 01:16:29 +00:00
Boris Chiou 8604a51732 Bug 1676791 - Part 2: Implement the infrastructure of scroll-linked animations. r=emilio,hiro
The basic part of the infrastructure of scroll-linked animations. This is
designed based on scroll-linked animation generated by CSS. We will
implement the timing computation and hook the ScrollTimeline to the CSS
animations in the following patches.

All the tests are in the patch that hooks ScrollTimeline to CSS Animation.

Differential Revision: https://phabricator.services.mozilla.com/D129100
2021-12-08 01:16:28 +00:00
Boris Chiou 470f574f58 Bug 1676791 - Part 1: Add ScrollTimeline class. r=hiro
Define a simple version of ScrollTimeline.

Differential Revision: https://phabricator.services.mozilla.com/D129099
2021-12-08 01:16:28 +00:00