55 Commits

Author SHA1 Message Date
Boris Chiou
a5edd70830 Bug 1964187 - Invalidate the timing function of dynamic group keyframes when retrieving it. r=emilio
Basically, we call `ViewTransition::GetGroupKeyframes()` when any
computed values get changed on this element. For general CSS Animation
cases, we rebuild Keyframes because any of the property values (including
timing function) may be different.

Therefore, we have to do the similar things for dynamic group keyframes.
The size and transform are set from the captured elements, so I think they are
immutatable (and once they get changed, we should skip view transitions).
The only exception is `animation-timing-function`. We have to update the
timing function when invaliding the animations.

Note that `animation-composition` can also be keyframe-specific but we use
`Auto` value for it by default, and it means we are always using the
computed values from the element, so we don't have to worry about it.
Only timing function is special.

Differential Revision: https://phabricator.services.mozilla.com/D248366
2025-05-08 23:34:59 +00:00
Emilio Cobos Álvarez
a6545b8f13 Bug 1963374 - Skip view transition when root element gets removed. r=view-transitions-reviewers,boris
Since the view transition pseudo tree is parented to it.

See https://github.com/w3c/csswg-drafts/issues/12149

Differential Revision: https://phabricator.services.mozilla.com/D247592
2025-05-05 19:33:49 +00:00
Emilio Cobos Álvarez
6285e9bd4e Bug 1963368 - Remove usage of live capture pref that I forgot to remove. 2025-05-05 07:14:05 +00:00
Boris Chiou
7d1d1a44f5 Bug 1962617 - Use snapshot containing block size for root when capturing the old/new states. r=view-transitions-reviewers,emilio
It seems we forgot to use the size of snapshot containing block when
capturing the root element. Refactor the code a little bit to make sure
we do the check every time.

Differential Revision: https://phabricator.services.mozilla.com/D247514
2025-05-05 04:16:54 +00:00
Boris Chiou
6167f461bd Bug 1922299 - Add ::-moz-snapshot-containing-block to wrap the view transition pseudo element tree. r=view-transitions-reviewers,emilio
We introduce `::-moz-snapshot-containing-block` pseudo-element to wrap
the view transition pseudo-element tree. This pseudo-element is only for
internal usage and cannot be accessed from outside.

Note that the related wpt,
`snapshot-containing-block-static.html`
`snapshot-containing-block-absolute.html`
are still failed because of Bug 1960755.

Also, add a test to check the snapshot containing block in the iframe,
and avoid hitting the issue of Bug 1960755.

There is no better way to verify that we do establish the fixed
positioning containing block, because it's unlikely to make the size of the
snapshot containing block be different from the viewport size on desktop
(note: this pseudo-element doesn't expose to the web), so I verified this
patch by changing the size of snapshot containing block manually in the UA
stylesheet, to see if it establish the fixed positioning containing block.

Differential Revision: https://phabricator.services.mozilla.com/D245648
2025-05-01 02:29:10 +00:00
Emilio Cobos Álvarez
e930a03b8d Bug 1961010 - Use ink overflow sizes more often in view transitions. r=view-transitions-reviewers,boris
This fixes the rendering of new-content-ancestor-clipped.html (with
D245770).

Differential Revision: https://phabricator.services.mozilla.com/D245802
2025-04-21 12:09:38 +00:00
Emilio Cobos Álvarez
388cdb262e Bug 1954803 - Hook view transitions "old snapshot" code path to webrender as well. r=nical
No behavior change because it's not on by default.

Also adds some logging infrastructure.

Differential Revision: https://phabricator.services.mozilla.com/D242032
2025-03-25 14:04:09 +00:00
Emilio Cobos Álvarez
d025ded17c Bug 1953823 - When the root is snapshotted, snapshot the root contents but not top layer(s). r=view-transitions-reviewers,boris
For fallback snapshots, for now just snapshot the canvas frame.

Differential Revision: https://phabricator.services.mozilla.com/D242016
2025-03-25 14:03:19 +00:00
Boris Chiou
3e0e99044c Bug 1951797 - Flush the pending update callbacks before capturing the old state. r=view-transitions-reviewers,emilio
Per spec, now we flush the update callback queue before scheduling the new
update callback in Setup() to make sure the previous update callbacks get
invoked before we do capturing.

Differential Revision: https://phabricator.services.mozilla.com/D241328
2025-03-18 19:31:48 +00:00
Boris Chiou
d1409c97b2 Bug 1951797 - Fix the typo that we should set height value into the proper declartion. r=view-transitions-reviewers,emilio
Otherwise, when calling getKeyframes(), we may serialize the empty
declaration (for height) which causes a debug assertion.

Differential Revision: https://phabricator.services.mozilla.com/D241308
2025-03-18 19:31:47 +00:00
Norisz Fay
1ec853e4bf Backed out 2 changesets (bug 1951797) for causing wpt failures on start-view-transtion-skips-active.html CLOSED TREE
Backed out changeset 97f0dc799a56 (bug 1951797)
Backed out changeset 20d6fcfc4372 (bug 1951797)
2025-03-18 02:38:01 +02:00
Boris Chiou
b39e4558a2 Bug 1951797 - Flush the pending update callbacks before capturing the old state. r=view-transitions-reviewers,emilio
Per spec, now we flush the update callback queue before scheduling the new
update callback in Setup() to make sure the previous update callbacks get
invoked before we do capturing.

The test is in css-view-transitions/start-view-transtion-skips-active.html,
which is not merged into Gecko yet, so I only can verify it in the try server.

Differential Revision: https://phabricator.services.mozilla.com/D241328
2025-03-17 22:56:40 +00:00
Boris Chiou
509d157c6d Bug 1951797 - Fix the typo that we should set height value into the proper declartion. r=view-transitions-reviewers,emilio
Otherwise, when calling getKeyframes(), we may serialize the empty
declaration (for height) which causes a debug assertion.

Differential Revision: https://phabricator.services.mozilla.com/D241308
2025-03-17 22:56:38 +00:00
Emilio Cobos Álvarez
cc2e56ebdb Bug 1953016 - Ensure consistent tree order of view transition tree. r=view-transitions-reviewers,boris
The issue is just that the DOM order is not correct. Fix it by making
sure that the view transition names we capture are in order.

Differential Revision: https://phabricator.services.mozilla.com/D241009
2025-03-12 09:37:45 +00:00
Goloman Adrian
8c3b6d48b8 Backed out changeset 1f412e42d565 (bug 1953016) for causing wpt failures @group-animation-for-root-transition.htm. 2025-03-12 02:35:54 +02:00
Emilio Cobos Álvarez
73ed4eb8a5 Bug 1953122 - Make view transition root fire devtools mutation events. r=view-transitions-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D241008
2025-03-11 19:51:44 +00:00
Emilio Cobos Álvarez
3d57da7e38 Bug 1950791 - Avoid setting up view transition twice. r=view-transitions-reviewers,boris
See https://github.com/w3c/csswg-drafts/issues/11907

Differential Revision: https://phabricator.services.mozilla.com/D241038
2025-03-11 19:50:49 +00:00
Emilio Cobos Álvarez
4e44066e2f Bug 1953016 - Ensure consistent tree order of view transition tree. r=view-transitions-reviewers,boris
The issue is just that the DOM order is not correct. Fix it by making
sure that the view transition names we capture are in order.

Differential Revision: https://phabricator.services.mozilla.com/D241009
2025-03-11 18:38:15 +00:00
Boris Chiou
584caf8dca Bug 1950719 - Update the rest of view transition pseudo-element styles. r=view-transitions-reviewers,emilio
Update the styles for writing-mode, direction, text-orientation,
mix-blend-mode, backdrop-filter, and color-scheme.

Also, update the test, pseudo-get-computed-style.html, because it
doesn't really match the spec. For example, we update the pseudo-element
styles after we invoke the update callback, so the computed values of
these pseudo elements should be the default values inside the update callback.

Now the behavior of Gecko is the same as that of WebKit.

Differential Revision: https://phabricator.services.mozilla.com/D240406
2025-03-06 03:26:55 +00:00
Emilio Cobos Álvarez
0ff8015e82 Bug 1922333 - Land view transition plumbing for live capture behind a default-off pref. r=view-transitions-reviewers,boris
It is mostly working, but there are some tests that hit crashes and
asserts that we should sort out. For now, land it default-off.

This does implement other bits that are on by default tho, like creating
image frames for ::view-transition-new() pseudo-elements and so on. I
think that is fine (it's just that for now they are all transparent).

Differential Revision: https://phabricator.services.mozilla.com/D239382
2025-03-05 11:18:18 +00:00
Emilio Cobos Álvarez
124210d387 Bug 1919333 - Update test expectations. r=view-transitions-reviewers,boris
The timeouts are bug 1950378. I'm looking into addressing that
(separately). Now we trigger more opacity animations and that
invalidates even after reftest-wait has been removed.

The layered-capture regressions are antialiasing in the borders, these
should go away once we use webrender for the snapshots, I hope.

Differential Revision: https://phabricator.services.mozilla.com/D239545
2025-02-26 12:29:50 +00:00
Emilio Cobos Álvarez
b8d8170320 Bug 1950362 - Fix transition-in-hidden-page.html. r=view-transitions-reviewers,boris
Reject InvalidStateError for this case as per spec, and run the view
transition page visibility change steps.

Differential Revision: https://phabricator.services.mozilla.com/D239529
2025-02-26 12:29:49 +00:00
Emilio Cobos Álvarez
f5b2976c45 Bug 1922298 - Add a fast way of tagging frames as captured, and make that view-transition-name a stacking-context-creating property. r=view-transitions-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D239377
2025-02-26 12:29:49 +00:00
Emilio Cobos Álvarez
fb7aa3a068 Bug 1948058 - Add dynamic keyframe support for view transitions. r=view-transitions-reviewers,boris
Could be a bit cleaner I suppose, though this does the trick and seems fine.

Differential Revision: https://phabricator.services.mozilla.com/D239376
2025-02-26 12:29:48 +00:00
Emilio Cobos Álvarez
882bc6ce68 Bug 1950176 - Add a debugging pref to keep view transitions active. r=view-transitions-reviewers,boris
No behavior change, just for debugging purposes.

Differential Revision: https://phabricator.services.mozilla.com/D239380
2025-02-26 12:29:47 +00:00
Cristina Horotan
5bc51022a0 Backed out 9 changesets (bug 1922300, bug 1950362, bug 1919333, bug 1950176, bug 1948058, bug 1950177, bug 1922298) for causing multiple Wr failures
Backed out changeset 54c87e09251a (bug 1919333)
Backed out changeset 813274ba35a0 (bug 1919333)
Backed out changeset a37d91fc2a7a (bug 1950362)
Backed out changeset 97f67f9048b5 (bug 1922298)
Backed out changeset 4c11b366fcaf (bug 1919333)
Backed out changeset dbde76fa73a9 (bug 1948058)
Backed out changeset ba3d9d95cd56 (bug 1922300)
Backed out changeset 0fe786bf2709 (bug 1950177)
Backed out changeset 8d9f52e91779 (bug 1950176)
2025-02-26 06:23:09 +02:00
Emilio Cobos Álvarez
4f7bc12c71 Bug 1950362 - Fix transition-in-hidden-page.html. r=view-transitions-reviewers,boris
Reject InvalidStateError for this case as per spec, and run the view
transition page visibility change steps.

Differential Revision: https://phabricator.services.mozilla.com/D239529
2025-02-25 22:48:31 +00:00
Emilio Cobos Álvarez
90fa7916f7 Bug 1922298 - Add a fast way of tagging frames as captured, and make that view-transition-name a stacking-context-creating property. r=view-transitions-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D239377
2025-02-25 22:48:31 +00:00
Emilio Cobos Álvarez
f92fe9e705 Bug 1948058 - Add dynamic keyframe support for view transitions. r=view-transitions-reviewers,boris
Could be a bit cleaner I suppose, though this does the trick and seems fine.

Differential Revision: https://phabricator.services.mozilla.com/D239376
2025-02-25 22:48:30 +00:00
Emilio Cobos Álvarez
4e8a3f032c Bug 1950176 - Add a debugging pref to keep view transitions active. r=view-transitions-reviewers,boris
No behavior change, just for debugging purposes.

Differential Revision: https://phabricator.services.mozilla.com/D239380
2025-02-25 22:48:29 +00:00
Boris Chiou
2a9c14cc60 Bug 1949867 - Use TimeoutError when calling SkipTransition with timeout. r=view-transitions-reviewers,emilio
Per spec, we should use TimeoutError DOMException.

Differential Revision: https://phabricator.services.mozilla.com/D239215
2025-02-22 03:21:49 +00:00
Boris Chiou
11b23adf0f Bug 1919356 - Skip view transitions when we resize the viewport size. r=view-transitions-reviewers,emilio
Also, we have to make sure we resolve or reject the finished promise in
`SkipTransition()` because `mPhase` may not be Done in
`CallUpdateCallback()`.

Besides, we have to update tests to wait for the load event of the popup
window because the original document of this popup window may get replaced
by a new blank one. In order to make sure we start view transitions in the
correct document, we have to wait until the popup window is loaded.

If we don't wait the load event, it may cause timeout because we destroy
the original document (which runs view tranistions) after some animation
frames, and so we keep waiting the new animation frames or any promises
of the view transitions (but they are skipped because the original
doucment has been destroy).

Note that the `resizeTo()` API may not work on mobile, e.g. Android, so
we may get timeout when waiting for `resize` event. That's why we expect
TIMEOUT in window-resize-aborts-transition.html and expect FAIL in
window-resize-aborts-transition-before-ready.html for android.

Differential Revision: https://phabricator.services.mozilla.com/D237995
2025-02-18 23:22:11 +00:00
Emilio Cobos Álvarez
ecc0677523 Bug 1947961 - Implement basic "update pseudo-element styles" steps. r=view-transitions-reviewers,boris
Pretty bare bones (some properties missing), but this allows the
transition pseudo-elements to be in the right place.

We need to implement live capturing / integrate nical's work to display
the "new" image properly, but we'll get to that. Meanwhile this should
be uncontroversial.

Differential Revision: https://phabricator.services.mozilla.com/D238005
2025-02-14 07:50:18 +00:00
Emilio Cobos Álvarez
edf65b2923 Bug 1947746 - View transition dynamic style rules. r=view-transitions-reviewers,firefox-style-system-reviewers,boris
This should be rather uncontroversial. I filed bug 1947747 for inspector
support for this (which should work similarly than for presentational
hints).

Differential Revision: https://phabricator.services.mozilla.com/D237886
2025-02-13 09:57:35 +00:00
Emilio Cobos Álvarez
5f353ee586 Bug 1947743 - Flush frames before ViewTransition::Activate(). r=view-transitions-reviewers,boris
See the comment. This is needed so that style changes from the update
callback get taken into account consistently.

Differential Revision: https://phabricator.services.mozilla.com/D237885
2025-02-13 09:57:34 +00:00
Boris Chiou
e845887837 Bug 1914322 - Perform pending operations when the view transition is animating. r=view-transitions-reviewers,emilio
Basically, we have to schedule the performing pending operations after
activating the view transitions, and stop to do that once we don't have
active animations.

There is one known issue: we always timeout even if we activate the view
transitions successfully, so I clear the timeout once we start the animations.
Otherwise, we may always interrupt the long animations whose
durations are longer than `dom.viewTransitions.timeout-ms`. However, I
guess we may still need a timeout for it. We probably need to figure out
what to do in the future.

Note that `/css/css-view-transitions/paused-animation-at-end.html.ini`
is failed because we don't have any animations. This is probably blocked by
the dynamic UA stylesheet (Bug 1914324).

Also, update some other tests to avoid getting javascript errors:
`JavaScript error: , line 0: uncaught exception: Object`.

Differential Revision: https://phabricator.services.mozilla.com/D236215
2025-01-31 02:32:03 +00:00
Boris Chiou
a583c59406 Bug 1921116 - Use a hash map to handle animation data for pseudo elements. r=view-transitions-reviewers,emilio
Also, we put view transition psuedo element into
`AnimationUtils::IsSupportedPseudoForAnimations()`, and update the handling
of getting the pseudo request from a frame, to make sure we retrieve the
correct data for all supported psueod elements.

Besides, we have to update `SortingIndex` so we sort the events properly and
avoid hitting the assertion when using view-transitions.

The tests will be added when we support getAnimations() (Bug 1921109).

Differential Revision: https://phabricator.services.mozilla.com/D231536
2025-01-21 22:17:30 +00:00
Emilio Cobos Álvarez
3c1b64acfe Bug 1940412 - Add batch removal information to nsIMutationObserver::ContentWillBeRemoved, and use it in some trivial-ish places. r=dom-core,credential-management-reviewers,sefeng
The idea is to use it on the style (via PresShell->RestyleManager) to do
invalidation faster in cases like bug 1940405.

Differential Revision: https://phabricator.services.mozilla.com/D233547
2025-01-15 20:39:40 +00:00
Emilio Cobos Álvarez
2fbd4d89f9 Bug 1922335 - Implement basic support for DataSourceSurface-based snapshotting of old contents. r=nical
This implements some basic snapshotting functionality, and hooks it to
the ::view-transition-old pseudo-elements.

Some tests that now fail because we start rendering the old snapshot,
but not at the right position, as for now the view transition pseudo
tree is all statically-positioned. That's all expected for now until we
implement the right styling for them, the top layer behavior, etc.

Main remaining question is how to get a hand on the right layer manager
from nsImageFrame::Destroy.

Differential Revision: https://phabricator.services.mozilla.com/D231977
2025-01-14 14:57:57 +00:00
Boris Chiou
383fbdf464 Bug 1919347 - Support getComputedStyle() for named view transition pseudo elements if the style is not available. r=view-transitions-reviewers,emilio
First, we have to allow the functional parameter for named view
transition pseudo elements.

In this patch, we fix the case when `getComputedStyle()` resolve the style
lazily (i.e. call `Servo_ResolveStyleLazily()`) if its style is not available.
In this case, we have to make sure the matching function work.

We will make sure `aElement->GetPseudoElement(aPseudo)` work in the next
patch so we can retrieve the computed style from the pseudo elements
directly.

Differential Revision: https://phabricator.services.mozilla.com/D230354
2024-11-28 22:19:45 +00:00
Emilio Cobos Álvarez
539611ead9 Bug 1931301 - Notify of removals on a stable state, not mid-remove. r=smaug,masayuki,dshin
This simplifies some observers, and makes others a bit more subtle, but I think
over-all it is an improvement.

Differential Revision: https://phabricator.services.mozilla.com/D229008
2024-11-26 09:39:52 +00:00
Sandor Molnar
4edbb82211 Backed out changeset 3d4472548fb9 (bug 1931301) for causing assertion failures @ Document.cpp 2024-11-25 23:06:55 +02:00
Emilio Cobos Álvarez
0651582f86 Bug 1931301 - Notify of removals on a stable state, not mid-remove. r=smaug,masayuki,dshin
This simplifies some observers, and makes others a bit more subtle, but I think
over-all it is an improvement.

Differential Revision: https://phabricator.services.mozilla.com/D229008
2024-11-25 17:58:40 +00:00
Emilio Cobos Álvarez
11a8b7baf2 Bug 1914321 - Build view transition pseudo-element tree. r=view-transitions-reviewers,boris
Reuse the editor's manual NAC machinery for now, and hook it into
StyleChildrenIterator and co.

We might need to slightly tweak the setup for selector-matching, not
sure yet, but that should be fine.

Differential Revision: https://phabricator.services.mozilla.com/D228255
2024-11-14 10:17:52 +00:00
Butkovits Atila
3616798bb1 Backed out changeset cb8acf4c8893 (bug 1914321) for causing failures at browser_markup_search_01.js. CLOSED TREE 2024-11-14 02:42:39 +02:00
Emilio Cobos Álvarez
f475361154 Bug 1914321 - Build view transition pseudo-element tree. r=view-transitions-reviewers,boris
Reuse the editor's manual NAC machinery for now, and hook it into
StyleChildrenIterator and co.

We might need to slightly tweak the setup for selector-matching, not
sure yet, but that should be fine.

Differential Revision: https://phabricator.services.mozilla.com/D228255
2024-11-13 22:11:58 +00:00
Butkovits Atila
6ae954d86e Backed out changeset 4fc43467210b (bug 1914321) for causing failures at PresShell.cpp. CLOSED TREE 2024-11-13 21:24:29 +02:00
Emilio Cobos Álvarez
3f41e0c52d Bug 1914321 - Build view transition pseudo-element tree. r=view-transitions-reviewers,boris
Reuse the editor's manual NAC machinery for now, and hook it into
StyleChildrenIterator and co.

We might need to slightly tweak the setup for selector-matching, not
sure yet, but that should be fine.

Differential Revision: https://phabricator.services.mozilla.com/D228255
2024-11-13 18:06:34 +00:00
Emilio Cobos Álvarez
058deb6ea4 Bug 1918402 - Implement more of view transition's "capture the new state". r=view-transitions-reviewers,boris
This should be enough to start setting up the pseudo-element tree.

Differential Revision: https://phabricator.services.mozilla.com/D226362
2024-10-23 19:41:36 +00:00
Emilio Cobos Álvarez
94e21d77ab Bug 1918400 - Implement most of "capture the old state". r=view-transitions-reviewers,boris
See TODO's for follow-up work. We're still not using this, so no
behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D226350
2024-10-23 11:48:05 +00:00