Skip to content

Commit 6a61f49

Browse files
khushalsagarChromium LUCI CQ
authored and
Chromium LUCI CQ
committed
Reland "VT: Remove containment requirement."
This reverts commit f2820f7. This was reverted earlier to wait for CSSWG feedback. The resolution aligns with the behaviour in this patch. w3c/csswg-drafts#8139 Original change's description: > Revert "VT: Remove containment requirement." > > This reverts commit e554cf3. > > Reason for revert: Decided against this feature for now. > > Original change's description: > > VT: Remove containment requirement. > > > > This patch removes the containment requirement from view-transitions. > > > > This is to align with proposed resolution > > w3c/csswg-drafts#7882 > > > > R=​[email protected], [email protected] > > > > Fixed: 1409491 > > Change-Id: Iad0eb54c8d2de503f209a58a9f438e586fcd6a36 > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4188811 > > Reviewed-by: David Bokan <[email protected]> > > Reviewed-by: Khushal Sagar <[email protected]> > > Commit-Queue: Vladimir Levin <[email protected]> > > Cr-Commit-Position: refs/heads/main@{#1096187} > > Change-Id: Id0b58230eb372a96aa1f1dff2e7d84e2f297219f > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4192788 > Commit-Queue: Vladimir Levin <[email protected]> > Bot-Commit: Rubber Stamper <[email protected]> > Cr-Commit-Position: refs/heads/main@{#1096273} (cherry picked from commit 652c5ff) Change-Id: I3da1ee9d5e00b2a9470b99b5f69704fc9b4d0105 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4233087 Commit-Queue: Vladimir Levin <[email protected]> Commit-Queue: Khushal Sagar <[email protected]> Auto-Submit: Khushal Sagar <[email protected]> Reviewed-by: Vladimir Levin <[email protected]> Cr-Original-Commit-Position: refs/heads/main@{#1102856} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4233792 Commit-Queue: Xianzhu Wang <[email protected]> Reviewed-by: Xianzhu Wang <[email protected]> Cr-Commit-Position: refs/branch-heads/5563@{#318} Cr-Branched-From: 3ac59a6-refs/heads/main@{#1097615}
1 parent 6e53c11 commit 6a61f49

39 files changed

+119
-258
lines changed

third_party/blink/renderer/core/view_transition/view_transition_style_tracker.cc

+3-32
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@
4646
namespace blink {
4747
namespace {
4848

49-
const char* kContainmentNotSatisfied =
50-
"Aborting transition. Element must contain paint or layout for "
51-
"view-transition-name : ";
5249
const char* kDuplicateTagBaseError =
5350
"Unexpected duplicate view-transition-name: ";
5451

@@ -66,11 +63,6 @@ const String& AnimationUAStyles() {
6663
return kAnimationUAStyles;
6764
}
6865

69-
bool SatisfiesContainment(const LayoutObject& object) {
70-
return object.ShouldApplyPaintContainment() ||
71-
object.ShouldApplyLayoutContainment();
72-
}
73-
7466
absl::optional<String> ComputeInsetDifference(PhysicalRect reference_rect,
7567
const LayoutRect& target_rect,
7668
float device_pixel_ratio) {
@@ -353,25 +345,6 @@ bool ViewTransitionStyleTracker::FlattenAndVerifyElements(
353345
VectorOf<Element>& elements,
354346
VectorOf<AtomicString>& transition_names,
355347
absl::optional<RootData>& root_data) {
356-
for (const auto& element : ViewTransitionSupplement::From(*document_)
357-
->ElementsWithViewTransitionName()) {
358-
DCHECK(element->ComputedStyleRef().ViewTransitionName());
359-
360-
// Ignore elements which are not rendered.
361-
if (!element->GetLayoutObject())
362-
continue;
363-
364-
// Skip the transition if containment is not satisfied.
365-
if (!element->IsDocumentElement() &&
366-
!SatisfiesContainment(*element->GetLayoutObject())) {
367-
StringBuilder message;
368-
message.Append(kContainmentNotSatisfied);
369-
message.Append(element->ComputedStyleRef().ViewTransitionName());
370-
AddConsoleError(message.ReleaseString());
371-
return false;
372-
}
373-
}
374-
375348
// We need to flatten the data first, and sort it by ordering which reflects
376349
// the setElement ordering.
377350
struct FlatData : public GarbageCollected<FlatData> {
@@ -826,11 +799,9 @@ bool ViewTransitionStyleTracker::RunPostPrePaintSteps() {
826799

827800
DCHECK_NE(element_data->target_element, document_->documentElement());
828801
auto* layout_object = element_data->target_element->GetLayoutObject();
829-
if (!layout_object || !SatisfiesContainment(*layout_object)) {
830-
StringBuilder message;
831-
message.Append(kContainmentNotSatisfied);
832-
message.Append(entry.key);
833-
AddConsoleError(message.ReleaseString());
802+
// TODO(khushalsagar): Verify that skipping a transition when things become
803+
// display none is aligned with spec.
804+
if (!layout_object) {
834805
return false;
835806
}
836807

third_party/blink/web_tests/external/wpt/css/css-view-transitions/3d-transform-incoming-ref.html

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
background: blue;
1616
}
1717
.shared {
18-
contain: layout;
1918
width: 100px;
2019
height: 100px;
2120
}

third_party/blink/web_tests/external/wpt/css/css-view-transitions/3d-transform-incoming.html

-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
}
2626
.shared {
2727
view-transition-name: shared;
28-
contain: layout;
2928
width: 100px;
3029
height: 100px;
3130
}
@@ -34,7 +33,6 @@
3433
width: 10px;
3534
height: 10px;
3635
background: red;
37-
contain: layout;
3836
}
3937

4038
::view-transition-group(hidden) { animation-duration: 300s; }

third_party/blink/web_tests/external/wpt/css/css-view-transitions/3d-transform-outgoing-ref.html

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
background: green;
1010
}
1111
.shared {
12-
contain: layout;
1312
width: 100px;
1413
height: 100px;
1514
}

third_party/blink/web_tests/external/wpt/css/css-view-transitions/3d-transform-outgoing.html

-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
}
2727
.shared {
2828
view-transition-name: shared;
29-
contain: layout;
3029
width: 100px;
3130
height: 100px;
3231
}
@@ -35,7 +34,6 @@
3534
width: 10px;
3635
height: 10px;
3736
background: red;
38-
contain: layout;
3937
}
4038

4139
::view-transition-group(hidden) { animation-duration: 300s; }

third_party/blink/web_tests/external/wpt/css/css-view-transitions/css-tags-paint-order-ref.html

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
<style>
77
div {
8-
contain: layout;
98
position: absolute;
109
top: 50px;
1110
width: 100px;

third_party/blink/web_tests/external/wpt/css/css-view-transitions/css-tags-paint-order.html

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
<script src="/common/reftest-wait.js"></script>
99
<style>
10-
div { contain: layout; }
1110
#one {
1211
background: green;
1312
width: 100px;

third_party/blink/web_tests/external/wpt/css/css-view-transitions/dialog-in-top-layer-during-transition-new.html

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
padding: 0;
1818

1919
view-transition-name: dialog;
20-
contain: layout;
2120
}
2221

2322
#target::backdrop {
@@ -26,7 +25,6 @@
2625
background: grey;
2726

2827
view-transition-name: backdrop;
29-
contain: layout;
3028
}
3129

3230
.hidden {

third_party/blink/web_tests/external/wpt/css/css-view-transitions/dialog-in-top-layer-during-transition-old.html

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
padding: 0;
1818

1919
view-transition-name: dialog;
20-
contain: layout;
2120
}
2221

2322
#target::backdrop {
@@ -26,7 +25,6 @@
2625
background: grey;
2726

2827
view-transition-name: backdrop;
29-
contain: layout;
3028
}
3129

3230
.hidden {

third_party/blink/web_tests/external/wpt/css/css-view-transitions/element-with-overflow.html

-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@
1212
height: 10px;
1313
view-transition-name: hidden;
1414
background: green;
15-
contain: layout;
1615
}
1716

1817
.target {
1918
width: 100px;
2019
height: 100px;
2120
background: lightblue;
22-
contain: layout;
2321
view-transition-name: target;
2422
}
2523
.inner {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!DOCTYPE html>
2+
<html class=reftest-wait>
3+
<title>View transitions: element with fixed position descendant</title>
4+
<link rel="help" href="https://github.com/WICG/view-transitions">
5+
<link rel="author" href="mailto:[email protected]">
6+
<link rel="match" href="named-element-with-fix-pos-child-ref.html">
7+
<script src="/common/reftest-wait.js"></script>
8+
<style>
9+
.target {
10+
width: 100px;
11+
height: 100px;
12+
background: blue;
13+
view-transition-name: target;
14+
}
15+
.child {
16+
width: 100px;
17+
height: 100px;
18+
position: fixed;
19+
top: 150px;
20+
left: 150px;
21+
background: grey;
22+
}
23+
24+
html::view-transition-group(target) { animation-duration: 300s; }
25+
html::view-transition-old(target) { animation: unset; opacity: 0; }
26+
html::view-transition-new(target) {
27+
animation: unset;
28+
opacity: 1;
29+
}
30+
</style>
31+
32+
<div class=target>
33+
<div class=child></div>
34+
</div>
35+
36+
<script>
37+
failIfNot(document.startViewTransition, "Missing document.startViewTransition");
38+
39+
async function runTest() {
40+
document.startViewTransition(() =>
41+
requestAnimationFrame(() => requestAnimationFrame(takeScreenshot)));
42+
}
43+
onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
44+
</script>
45+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!DOCTYPE html>
2+
<html class=reftest-wait>
3+
<title>View transitions: element with fixed position descendant</title>
4+
<link rel="help" href="https://github.com/WICG/view-transitions">
5+
<link rel="author" href="mailto:[email protected]">
6+
<link rel="match" href="named-element-with-fix-pos-child-ref.html">
7+
<script src="/common/reftest-wait.js"></script>
8+
<style>
9+
.target {
10+
width: 100px;
11+
height: 100px;
12+
background: blue;
13+
view-transition-name: target;
14+
}
15+
.child {
16+
width: 100px;
17+
height: 100px;
18+
position: fixed;
19+
top: 150px;
20+
left: 150px;
21+
background: grey;
22+
}
23+
24+
html::view-transition-group(target) { animation-duration: 300s; }
25+
html::view-transition-new(target) { animation: unset; opacity: 0; }
26+
html::view-transition-old(target) {
27+
animation: unset;
28+
opacity: 1;
29+
}
30+
</style>
31+
32+
<div class=target>
33+
<div class=child></div>
34+
</div>
35+
36+
<script>
37+
failIfNot(document.startViewTransition, "Missing document.startViewTransition");
38+
39+
async function runTest() {
40+
document.startViewTransition(() =>
41+
requestAnimationFrame(() => requestAnimationFrame(takeScreenshot)));
42+
}
43+
onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
44+
</script>
45+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<title>View transitions: element with fixed position descendant (ref)</title>
4+
<link rel="help" href="https://github.com/WICG/view-transitions">
5+
<link rel="author" href="mailto:[email protected]">
6+
<style>
7+
.target {
8+
width: 100px;
9+
height: 100px;
10+
background: blue;
11+
view-transition-name: target;
12+
}
13+
.child {
14+
width: 100px;
15+
height: 100px;
16+
position: fixed;
17+
top: 150px;
18+
left: 150px;
19+
background: grey;
20+
}
21+
</style>
22+
23+
<div class=target>
24+
<div class=child></div>
25+
</div>
26+

third_party/blink/web_tests/external/wpt/css/css-view-transitions/new-content-element-writing-modes.html

-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
contain: paint;
2828
border: 1px solid black;
2929
}
30-
.source {
31-
contain: layout;
32-
}
3330
#target {
3431
background: red;
3532
position: absolute;

third_party/blink/web_tests/external/wpt/css/css-view-transitions/new-content-object-fit-fill.html

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
width: 10px;
3030
height: 10px;
3131
view-transition-name: hidden;
32-
contain: layout;
3332
}
3433

3534
html::view-transition-group(target) {

third_party/blink/web_tests/external/wpt/css/css-view-transitions/new-content-object-fit-none.html

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
width: 10px;
2222
height: 10px;
2323
view-transition-name: hidden;
24-
contain: layout;
2524
}
2625

2726
html::view-transition-group(target) {

third_party/blink/web_tests/external/wpt/css/css-view-transitions/no-containment-on-new-element-mid-transition.html

-38
This file was deleted.

third_party/blink/web_tests/external/wpt/css/css-view-transitions/no-containment-on-new-element-mid-transition.html.ini

-6
This file was deleted.

0 commit comments

Comments
 (0)