-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nested view transitions: adjust for border offset
Make sure the border width is only applied once when nesting. Since the parent group receives the border width and the child group computes its target transform based on its original position, by default the top/left border widths are considered twice. Adjust for this when computing the nested group transform. See w3c/csswg-drafts#10585 Bug: 347947051 Change-Id: I2f4c42cd861d41bbd8c99586946745ffcf1a4913
- Loading branch information
1 parent
75db68b
commit 735b6c8
Showing
2 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
css/css-view-transitions/layered-capture/box-model-capture-nested-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<title>Box model is copied to group style</title> | ||
<meta name=fuzzy content="maxDifference=0-10; totalPixels=0-200000"> | ||
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-2/"> | ||
<style> | ||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
body { | ||
background: rebeccapurple; | ||
margin: 0; | ||
} | ||
|
||
div { | ||
width: 200px; | ||
height: 200px; | ||
background: green; | ||
border: 10px solid blue; | ||
padding: 48px; | ||
} | ||
|
||
.child { | ||
border: 32px solid yellow; | ||
} | ||
|
||
.parent { | ||
border-width: 15px; | ||
padding-top: 27px; | ||
padding-left: 100px; | ||
overflow: clip; | ||
} | ||
</style> | ||
<body> | ||
<div class="parent"> | ||
<div class="child"></div> | ||
</div> | ||
</body> |
66 changes: 66 additions & 0 deletions
66
css/css-view-transitions/layered-capture/box-model-capture-nested.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<!DOCTYPE html> | ||
<html class=reftest-wait> | ||
<title>Box model is copied to group style</title> | ||
<meta name=fuzzy content="maxDifference=0-10; totalPixels=0-200000"> | ||
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-2/"> | ||
<link rel="match" href="box-model-capture-nested-ref.html"> | ||
<script src="/common/reftest-wait.js"></script> | ||
<style> | ||
* { | ||
/* Will add tests for different sizing once the spec is resolved. */ | ||
box-sizing: border-box; | ||
} | ||
|
||
::view-transition { | ||
background: rebeccapurple; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
} | ||
|
||
div { | ||
width: 200px; | ||
height: 200px; | ||
background: green; | ||
border: 10px solid blue; | ||
} | ||
|
||
|
||
.parent { | ||
view-transition-name: parent; | ||
padding: 48px 48px 48px 100px; | ||
overflow: clip; | ||
} | ||
|
||
.child { | ||
view-transition-name: child; | ||
view-transition-group: parent; | ||
border: 32px solid yellow; | ||
padding: 48px; | ||
} | ||
|
||
.vt-new .parent { | ||
border-width: 20px; | ||
padding: 6px 48px 48px 100px; | ||
} | ||
|
||
::view-transition-group(*) { | ||
animation-play-state: paused; | ||
animation-timing-function: steps(2, start); | ||
} | ||
|
||
::view-transition-new(*), ::view-transition-old(*) { | ||
animation: none; | ||
} | ||
</style> | ||
<body> | ||
<div class="parent"> | ||
<div class="child"></div> | ||
</div> | ||
<script> | ||
document.startViewTransition(() => { | ||
document.documentElement.classList.add("vt-new"); | ||
}).ready.then(() => takeScreenshot()); | ||
</script> | ||
</body> |