Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-align-baseline-vertical.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-align-baseline-vertical.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-align-baseline-vertical.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3e2d5ef7846f2968837542a3ace13808ceae32a4 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-align-baseline-vertical.html |
| @@ -0,0 +1,134 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<link href="resources/grid.css" rel="stylesheet"> |
| +<script src="../../resources/check-layout.js"></script> |
| +<style> |
| +body { |
| + margin: 0; |
| +} |
| + |
| +.grid { |
| + height: 600px; |
| + grid-auto-columns: 1fr; |
| + margin-bottom: 20px; |
| + position: relative; |
| + -webkit-writing-mode: vertical-rl; |
|
kojii
2016/11/15 04:21:15
nit: better to use unprefixed versions? WebKit has
jfernandez
2016/11/16 11:51:24
Done.
|
| + -webkit-text-orientation: sideways-right; |
| +} |
| + |
| +.itemsBaseline { |
| + align-items: baseline; |
| +} |
| + |
| +.grid :nth-child(1) { background-color: brown; } |
| +.grid :nth-child(2) { background-color: green; } |
| +.grid :nth-child(3) { background-color: red; } |
| +.grid :nth-child(4) { background-color: yellow; } |
| +.grid :nth-child(5) { background-color: purple; } |
| +.grid :nth-child(6) { background-color: orange; } |
| +.grid :nth-child(7) { background-color: lime; } |
| +.grid :nth-child(8) { background-color: lightblue; } |
| +.grid :nth-child(9) { background-color: darkred; } |
| +.grid :nth-child(10) { background-color: gold; } |
| +.grid :nth-child(11) { background-color: salmon; } |
| + |
| +.firstRowThirdColumn { |
| + grid-row: 1; |
| + grid-column: 3; |
| +} |
| +.firstRowFourthColumn { |
| + grid-row: 1; |
| + grid-column: 4; |
| +} |
| +.firstRowFifthColumn { |
| + grid-row: 1; |
| + grid-column: 5; |
| +} |
| +.grid > div { |
| + min-width: 0px; |
| +} |
| +</style> |
| +</head> |
| +<body onload="checkLayout('.grid')"> |
| + |
| +<div class="grid"> |
| + <div data-expected-width="20" data-offset-x="70" class="firstRowFirstColumn" style="align-self: baseline; width: 20px;"></div> |
| + <div data-expected-width="10" data-offset-x="70" class="firstRowSecondColumn" style="align-self: baseline; width: 10px; margin: 0 20px 0 10px;"></div> |
| + <div data-expected-width="10" data-offset-x="70" class="firstRowThirdColumn" style="align-self: baseline; width: 10px; margin: 0 20px 0 0;"></div> |
| + <div data-expected-width="100" data-offset-x="0" class="firstRowFourthColumn" style="width: 100px;"></div> |
| +</div> |
| + |
| +<div class="grid"> |
| + <div id="baseline1" class="firstRowFirstColumn" style="align-self: baseline">ahem</div> |
| + <div id="baseline2" class="firstRowSecondColumn-one" style="align-self: baseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px;"></div> |
| + <div data-expected-width="50" data-offset-x="25" class="firstRowThirdColumn" style="align-self: center"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div> |
| + <div id="baseline3" data-expected-width="50" class="firstRowFourthColumn" style="align-self: baseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div> |
| + <div data-expected-width="100" data-offset-x="0" class="firstRowFifthColumn" style="width: 100px;"></div> |
| +</div> |
| + |
| +<div class="grid"> |
| + <div id="baseline4" class="firstRowFirstColumn" style="align-self: baseline">ahem</div> |
| + <div id="baseline5" class="firstRowSecondColumn" style="align-self: baseline"><br><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px;"></div> |
| + <div data-expected-width="50" data-offset-x="50" class="firstRowThirdColumn" style="align-self: baseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div> |
| + <div data-expected-width="100" data-offset-x="0" class="firstRowFourthColumn" style="width: 100px;"></div> |
| +</div> |
| + |
| +<div class="grid" style="-webkit-writing-mode: vertical-lr"> |
| + <div id="baseline6" data-offset-x="18" class="firstRowFirstColumn" style="align-self: baseline">ahem</div> |
| + <div id="baseline7" data-offset-x="18" class="firstRowSecondColumn" style="align-self: baseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px;"></div> |
| + <div data-expected-width="50" data-offset-x="25" class="firstRowThirdColumn" style="align-self: center"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div> |
| + <div data-expected-width="50" data-offset-x="0" class="firstRowFourthColumn" style="align-self: baseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div> |
| + <div data-expected-width="100" data-offset-x="0" class="firstRowFifthColumn" style="width: 100px;"></div> |
| +</div> |
| + |
| +<div class="grid" style="-webkit-writing-mode: vertical-lr"> |
| + <div id="baseline8" class="firstRowFirstColumn" style="align-self: baseline">ahem</div> |
| + <div id="baseline9" class="firstRowSecondColumn" style="align-self: baseline"><br><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px;"></div> |
| + <div data-expected-width="50" data-offset-x="0" class="firstRowThirdColumn" style="align-self: baseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div> |
| + <div data-expected-width="100" data-offset-x="0" class="firstRowFourthColumn" style="width: 100px;"></div> |
| +</div> |
| + |
| +<div id="results"></div> |
| + |
| +<script> |
| +function additionalBaselineChecks() |
| +{ |
| + var baseline1 = document.getElementById("baseline1"); |
| + var baseline2 = document.getElementById("baseline2"); |
| + var baseline3 = document.getElementById("baseline3"); |
| + logIfFalse(baseline1.offsetLeft == baseline2.offsetLeft, |
| + "baseline1 and baseline2 should have the same baseline."); |
| + logIfFalse(baseline3.offsetLeft + baseline3.offsetWidth > 75, |
| + "baseline3 should be above the center align-itemsed item."); |
| + |
| + var baseline4 = document.getElementById("baseline4"); |
| + var baseline5 = document.getElementById("baseline5"); |
| + logIfFalse(baseline4.offsetLeft + baseline4.offsetWidth == baseline5.offsetLeft + baseline5.offsetWidth, |
| + "baseline4 and baseline5 should be right aligned with each other."); |
| + logIfFalse(baseline4.offsetLeft + baseline4.offsetWidth < 100, |
| + "baseline4 and baseline5 should be below baseline6."); |
| + |
| + var baseline6 = document.getElementById("baseline6"); |
| + var baseline7 = document.getElementById("baseline7"); |
| + logIfFalse(baseline6.offsetLeft == baseline7.offsetLeft, |
| + "baseline6 and baseline7 should have the same baseline."); |
| + |
| + var baseline8 = document.getElementById("baseline8"); |
| + var baseline9 = document.getElementById("baseline9"); |
| + logIfFalse(baseline8.offsetLeft == baseline9.offsetLeft, |
| + "baseline8 and baseline9 should be left aligned with each other."); |
| + |
| +} |
| + |
| +function logIfFalse(condition, msg) |
| +{ |
| + if (!condition) |
| + document.getElementById("results").innerHTML += msg + "<br/>"; |
| +} |
| + |
| +additionalBaselineChecks(); |
| +</script> |
| + |
| +</body> |
| +</html> |