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
This commit is contained in:
@@ -657,14 +657,14 @@ void ViewTransition::SetupTransitionPseudoElements() {
|
||||
mViewTransitionRoot->SetProperty(nsGkAtoms::restylableAnonymousNode,
|
||||
reinterpret_cast<void*>(true));
|
||||
#endif
|
||||
|
||||
MOZ_ASSERT(mNames.Length() == mNamedElements.Count());
|
||||
// Step 3: For each transitionName -> capturedElement of transition’s named
|
||||
// elements:
|
||||
for (auto& entry : mNamedElements) {
|
||||
for (nsAtom* transitionName : mNames) {
|
||||
// We don't need to notify while constructing the tree.
|
||||
constexpr bool kNotify = false;
|
||||
|
||||
nsAtom* transitionName = entry.GetKey();
|
||||
CapturedElement& capturedElement = *entry.GetData();
|
||||
CapturedElement& capturedElement = *mNamedElements.Get(transitionName);
|
||||
// Let group be a new ::view-transition-group(), with its view transition
|
||||
// name set to transitionName.
|
||||
RefPtr<Element> group = MakePseudo(
|
||||
@@ -1123,6 +1123,7 @@ Maybe<SkipTransitionReason> ViewTransition::CaptureOldState() {
|
||||
auto capture =
|
||||
MakeUnique<CapturedElement>(f, mInitialSnapshotContainingBlockSize);
|
||||
mNamedElements.InsertOrUpdate(name, std::move(capture));
|
||||
mNames.AppendElement(name);
|
||||
f->RemoveStateBits(NS_FRAME_CAPTURED_IN_VIEW_TRANSITION);
|
||||
}
|
||||
|
||||
@@ -1153,8 +1154,14 @@ Maybe<SkipTransitionReason> ViewTransition::CaptureNewState() {
|
||||
SkipTransitionReason::DuplicateTransitionNameCapturingNewState);
|
||||
return false;
|
||||
}
|
||||
auto& capturedElement = mNamedElements.LookupOrInsertWith(
|
||||
name, [&] { return MakeUnique<CapturedElement>(); });
|
||||
bool wasPresent = true;
|
||||
auto& capturedElement = mNamedElements.LookupOrInsertWith(name, [&] {
|
||||
wasPresent = false;
|
||||
return MakeUnique<CapturedElement>();
|
||||
});
|
||||
if (!wasPresent) {
|
||||
mNames.AppendElement(name);
|
||||
}
|
||||
capturedElement->mNewElement = aFrame->GetContent()->AsElement();
|
||||
capturedElement->mNewSnapshotSize =
|
||||
aFrame->InkOverflowRectRelativeToSelf().Size();
|
||||
@@ -1335,6 +1342,7 @@ void ViewTransition::ClearNamedElements() {
|
||||
}
|
||||
}
|
||||
mNamedElements.Clear();
|
||||
mNames.Clear();
|
||||
}
|
||||
|
||||
static void ClearViewTransitionsAnimationData(Element* aRoot) {
|
||||
|
||||
@@ -134,6 +134,8 @@ class ViewTransition final : public nsISupports, public nsWrapperCache {
|
||||
// https://drafts.csswg.org/css-view-transitions/#viewtransition-named-elements
|
||||
using NamedElements = nsClassHashtable<nsAtomHashKey, CapturedElement>;
|
||||
NamedElements mNamedElements;
|
||||
// mNamedElements is an unordered map, we need to keep the tree order.
|
||||
AutoTArray<RefPtr<nsAtom>, 8> mNames;
|
||||
|
||||
// https://drafts.csswg.org/css-view-transitions/#viewtransition-initial-snapshot-containing-block-size
|
||||
nsSize mInitialSnapshotContainingBlockSize;
|
||||
|
||||
@@ -1,6 +1,2 @@
|
||||
[content-with-transparent-background.html]
|
||||
expected:
|
||||
if os == "android": PASS
|
||||
if os == "linux": [PASS, FAIL]
|
||||
if (os == "win") and swgl: [FAIL, PASS]
|
||||
FAIL
|
||||
expected: FAIL
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
[css-tags-paint-order-with-entry.html]
|
||||
expected: FAIL
|
||||
@@ -0,0 +1,2 @@
|
||||
[css-tags-paint-order.html]
|
||||
expected: FAIL
|
||||
@@ -0,0 +1,2 @@
|
||||
[dialog-in-top-layer-during-transition-old.html]
|
||||
expected: FAIL
|
||||
@@ -1,3 +1,2 @@
|
||||
[fractional-translation-from-transform.html]
|
||||
expected:
|
||||
FAIL
|
||||
expected: FAIL
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[iframe-and-main-frame-transition-old-main.html]
|
||||
expected:
|
||||
if not fission and (os == "linux") and debug and not swgl: [FAIL, ERROR]
|
||||
if (os == "linux") and debug: [FAIL, ERROR]
|
||||
FAIL
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
[japanese-tag.html]
|
||||
expected:
|
||||
if os == "win": FAIL
|
||||
expected: FAIL
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
[new-content-scaling.html]
|
||||
expected:
|
||||
if (os == "win") and not swgl: FAIL
|
||||
expected: FAIL
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
[old-content-captures-opacity.html]
|
||||
bug: Fuzz
|
||||
expected:
|
||||
if os == "android": FAIL
|
||||
if os == "mac": FAIL
|
||||
if os == "win": FAIL
|
||||
expected: FAIL
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[old-content-container-writing-modes.html]
|
||||
expected:
|
||||
if (os == "mac") and debug: TIMEOUT
|
||||
if os == "win": FAIL
|
||||
if os == "android": [PASS, TIMEOUT]
|
||||
if os == "android": [FAIL, PASS, TIMEOUT]
|
||||
FAIL
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
[old-content-element-writing-modes.html]
|
||||
expected:
|
||||
if (os == "android") and debug and not swgl: [PASS, TIMEOUT]
|
||||
if (os == "android") and debug and not swgl: [FAIL, PASS, TIMEOUT]
|
||||
if os == "win": FAIL
|
||||
FAIL
|
||||
|
||||
@@ -2,5 +2,4 @@
|
||||
expected:
|
||||
if os == "win": FAIL
|
||||
if os == "android": [TIMEOUT, PASS]
|
||||
if (os == "linux") and swgl and fission: FAIL
|
||||
if (os == "linux") and swgl and not fission: [FAIL, PASS]
|
||||
if (os == "linux") and swgl: [FAIL, PASS]
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
[set-current-time-transform.html]
|
||||
expected: FAIL
|
||||
@@ -1,5 +1,4 @@
|
||||
[snapshot-containing-block-absolute.html]
|
||||
expected:
|
||||
if not fission and (os == "linux") and debug and not swgl: [FAIL, ERROR]
|
||||
if (os == "linux") and fission and swgl: [FAIL, ERROR]
|
||||
if os == "linux" and debug: [FAIL, ERROR]
|
||||
FAIL
|
||||
|
||||
Reference in New Issue
Block a user