| Index: third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-align-baseline.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-align-baseline.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-align-baseline.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c442c24eaeed73fecff99decfb8fccc668c0e6d3
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-align-baseline.html
|
| @@ -0,0 +1,109 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +<link href="resources/grid.css" rel="stylesheet">
|
| +<link href="resources/grid-alignment.css" rel="stylesheet">
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| +<script src="../../resources/check-layout-th.js"></script>
|
| +<style>
|
| +body {
|
| + margin: 0;
|
| +}
|
| +
|
| +.grid {
|
| + width: 600px;
|
| + grid-auto-columns: 1fr;
|
| + position: relative;
|
| + margin-bottom: 20px;
|
| + font: 20px/1 Ahem;
|
| +}
|
| +
|
| +.grid :nth-child(1) { background-color: blue; }
|
| +.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;
|
| +}
|
| +</style>
|
| +</head>
|
| +<body onload="checkLayout('.grid')">
|
| +
|
| +<div class="grid alignItemsBaseline">
|
| + <div style="margin: 40px 0px;" class="firstRowFirstColumn" data-offset-x="0" data-offset-y="40" data-expected-width="200" data-expected-height="20"><div style="display:inline-block;"></div></div>
|
| + <div style="margin: auto 0px 0px;" class="firstRowSecondColumn" data-offset-x="200" data-offset-y="80" data-expected-width="200" data-expected-height="20"><div style="display:inline-block;"></div></div>
|
| + <div style="margin: 20px 0px;" class="firstRowThirdColumn" data-offset-x="400" data-offset-y="40" data-expected-width="200" data-expected-height="20"><div style="display:inline-block;"></div></div>
|
| +</div>
|
| +
|
| +<div class="grid">
|
| + <div data-expected-height="20" data-offset-y="20" class="firstRowFirstColumn alignSelfBaseline" style="height: 20px;"></div>
|
| + <div data-expected-height="10" data-offset-y="30" class="firstRowSecondColumn alignSelfBaseline" style="height: 10px; margin: 30px 0 10px;"></div>
|
| + <div data-expected-height="10" data-offset-y="30" class="firstRowThirdColumn alignSelfBaseline" style="height: 10px; margin: 20px 0 0;"></div>
|
| + <div data-expected-height="100" data-offset-y="0" class="firstRowFourthColumn" style="height: 100px;"></div>
|
| +</div>
|
| +
|
| +<div class="grid">
|
| + <div id="baseline1" class="firstRowFirstColumn" style="align-self: baseline;">ahem</div>
|
| + <div id="baseline2" data-offset-y="0" class="firstRowSecondColumn alignSelfBaseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="height: 50px;"></div>
|
| + <div data-expected-height="50" data-offset-y="25" class="firstRowThirdColumn alignSelfCenter"><img src="../../fast/replaced/resources/1x1-blue.png" style="height: 50px; vertical-align: middle"></div>
|
| + <div id="baseline3" data-expected-height="50" class="firstRowFourthColumn alignSelfBaseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="height: 50px; vertical-align: middle"></div>
|
| + <div data-expected-height="100" data-offset-y="0" class="firstRowFifthColumn" style="height: 100px;"></div>
|
| +</div>
|
| +
|
| +<div class="grid">
|
| + <div id="baseline4" class="firstRowFirstColumn alignSelfBaseline">ahem</div>
|
| + <div id="baseline5" class="firstRowSecondColumn alignSelfBaseline"><br><img src="../../fast/replaced/resources/1x1-blue.png" style="height: 50px;"></div>
|
| + <div data-expected-height="50" data-offset-y="0" class="firstRowThirdColumn alignSelfBaseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="height: 50px; vertical-align: middle"></div>
|
| + <div data-expected-height="100" data-offset-y="0" class="firstRowFourthColumn" style="height: 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.offsetTop + baseline1.offsetHeight == baseline2.offsetTop + baseline2.offsetHeight,
|
| + "baseline1 and baseline2 should have the same baseline.");
|
| + logIfFalse(baseline3.offsetTop < 25,
|
| + "baseline3 should be above the center align-selfed item.");
|
| +
|
| + var baseline4 = document.getElementById("baseline4");
|
| + var baseline5 = document.getElementById("baseline5");
|
| + logIfFalse(baseline4.offsetTop == baseline5.offsetTop,
|
| + "baseline4 and baseline5 should be top aligned with each other.");
|
| + logIfFalse(baseline4.offsetTop > 0,
|
| + "baseline4 and baseline5 should be below baseline6.");
|
| +}
|
| +
|
| +function logIfFalse(condition, msg)
|
| +{
|
| + if (!condition)
|
| + document.getElementById("results").innerText += msg;
|
| +}
|
| +
|
| +additionalBaselineChecks();
|
| +</script>
|
| +
|
| +</body>
|
| +</html>
|
|
|