Bug 783470 part 4: reftests for visibility:collapse on flex items. r=mats

This commit is contained in:
Daniel Holbert 2014-01-21 14:52:30 -08:00
Родитель 23a7b2bd07
Коммит 6d77f726d5
9 изменённых файлов: 643 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,62 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!-- In this reference case, we get each container to be sized the same as
in the testcase, without any visible baseline alignemnt, by using some
hidden flex items.
-->
<html>
<head>
<title>CSS Reftest Reference</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<meta charset="utf-8">
<style>
.flexContainer {
display: flex;
width: 50px;
background: yellow;
border: 1px dotted black;
margin: 5px;
align-items: flex-start;
}
.hiddenItemForSizing {
width: 0;
color: transparent;
align-self: baseline;
}
.largeFont {
font-size: 20px;
background: lightblue;
/* Our flex items get padding on opposite sides (top/bottom) so that they
produce a large combined height when baseline-aligned: */
padding-top: 5px;
}
.smallFont {
font-size: 10px;
background: pink;
/* Our flex items get padding on opposite sides (top/bottom) so that they
produce a large combined height when baseline-aligned: */
padding-bottom: 20px;
}
</style>
</head>
<body>
<div class="flexContainer">
<div class="largeFont">a</div>
<!-- Hidden flex items used to determine container's cross size,
based on their baseline-aligned combined cross size: -->
<div class="largeFont hiddenItemForSizing">a</div>
<div class="smallFont hiddenItemForSizing">b</div>
</div>
<div class="flexContainer">
<div class="smallFont">b</div>
<!-- Hidden flex items used to determine container's cross size,
based on their baseline-aligned combined cross size: -->
<div class="largeFont hiddenItemForSizing">a</div>
<div class="smallFont hiddenItemForSizing">b</div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,54 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>CSS Test: Testing that a collapsed flex item participates in baseline alignment only for the purpose of establishing container's cross size</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<link rel="help" href="http://www.w3.org/TR/css3-flexbox/#algo-visibility">
<link rel="match" href="flexbox-collapsed-item-baseline-1-ref.html">
<meta charset="utf-8">
<style>
.flexContainer {
display: flex;
width: 50px;
background: yellow;
border: 1px dotted black;
margin: 5px;
align-items: baseline;
}
.collapse {
visibility: collapse;
}
.largeFont {
font-size: 20px;
background: lightblue;
/* Our flex items get padding on opposite sides (top/bottom) so that they
produce a large combined height when baseline-aligned: */
padding-top: 5px;
}
.smallFont {
font-size: 10px;
background: pink;
/* Our flex items get padding on opposite sides (top/bottom) so that they
produce a large combined height when baseline-aligned: */
padding-bottom: 20px;
}
</style>
</head>
<body>
<!-- Second item collapsed: -->
<div class="flexContainer">
<div class="largeFont">a</div>
<div class="smallFont collapse">b</div>
</div>
<!-- First item collapsed: -->
<div class="flexContainer">
<div class="largeFont collapse">a</div>
<div class="smallFont">b</div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,102 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!-- In this reference case, we have blocks in place of the testcase's
flex containers. The testcase's collapsed flex items are entirely
absent here (and the remaining content is sized using exact pixel
values).
-->
<html>
<head>
<title>CSS Reftest Reference</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<meta charset="utf-8">
<style>
.flexContainer {
display: flex;
background: yellow;
border: 1px dotted black;
float: left;
margin: 5px;
}
.flexContainer > * {
/* All flex items have 20px base size */
width: 20px;
}
.collapse {
flex-basis: 0;
height: 20px;
}
.flexible {
flex: 1 auto;
}
.heightTall {
height: 40px;
background: purple;
}
.heightAuto {
background: teal;
}
.heightShort {
height: 10px;
background: pink;
}
</style>
</head>
<body>
<!-- FIRST ROW: -->
<!-- Just one (collapsed) flex item, which ends up establishing
the container's size (even though it's collapsed): -->
<div class="flexContainer">
<div class="heightTall collapse"></div>
</div>
<div style="clear: both"></div>
<!-- SECOND ROW: -->
<!-- One collapsed flex item, one short flex item.
(Container ends up with collapsed item's height) -->
<div class="flexContainer">
<div class="heightTall collapse"></div>
<div class="heightShort"></div>
</div>
<!-- (same, but with items in opposite order) -->
<div class="flexContainer">
<div class="heightShort"></div>
<div class="heightTall collapse"></div>
</div>
<div style="clear: both"></div>
<!-- THIRD ROW: -->
<!-- One collapsed flex item, one stretched flex item.
(Container and stretched item end up with collapsed item's height) -->
<div class="flexContainer">
<div class="heightTall collapse"></div>
<div class="heightAuto"></div>
</div>
<!-- (again, with items in opposite order) -->
<div class="flexContainer">
<div class="heightAuto"></div>
<div class="heightTall collapse"></div>
</div>
<div style="clear: both"></div>
<!-- FOURTH ROW: -->
<!-- One collapsed flex item, one other flex item; both are flexible.
(The non-collapsed one should take all of the available width.) -->
<div class="flexContainer">
<div class="heightAuto collapse"></div>
<div class="heightTall flexible"></div>
</div>
<!-- (again, with items in opposite order) -->
<div class="flexContainer">
<div class="heightTall flexible"></div>
<div class="heightAuto collapse"></div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,98 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>CSS Test: Testing that visibility:collapse on a flex item in a single-line flex container maintains the containers's cross size, but doesn't otherwise impact flex layout</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<link rel="help" href="http://www.w3.org/TR/css3-flexbox/#algo-visibility">
<link rel="match" href="flexbox-collapsed-item-horiz-1-ref.html">
<meta charset="utf-8">
<style>
.flexContainer {
display: flex;
background: yellow;
border: 1px dotted black;
float: left;
margin: 5px;
}
.flexContainer > * {
/* All flex items have 20px base size */
width: 20px;
}
.collapse {
visibility: collapse;
}
.flexible {
flex: 1 auto;
}
.heightTall {
height: 40px;
background: purple;
}
.heightAuto {
background: teal;
}
.heightShort {
height: 10px;
background: pink;
}
</style>
</head>
<body>
<!-- FIRST ROW: -->
<!-- Just one (collapsed) flex item, which ends up establishing
the container's size (even though it's collapsed): -->
<div class="flexContainer">
<div class="heightTall collapse"></div>
</div>
<div style="clear: both"></div>
<!-- SECOND ROW: -->
<!-- One collapsed flex item, one short flex item.
(Container ends up with collapsed item's height) -->
<div class="flexContainer">
<div class="heightTall collapse"></div>
<div class="heightShort"></div>
</div>
<!-- (same, but with items in opposite order) -->
<div class="flexContainer">
<div class="heightShort"></div>
<div class="heightTall collapse"></div>
</div>
<div style="clear: both"></div>
<!-- THIRD ROW: -->
<!-- One collapsed flex item, one stretched flex item.
(Container and stretched item end up with collapsed item's height) -->
<div class="flexContainer">
<div class="heightTall collapse"></div>
<div class="heightAuto"></div>
</div>
<!-- (again, with items in opposite order) -->
<div class="flexContainer">
<div class="heightAuto"></div>
<div class="heightTall collapse"></div>
</div>
<div style="clear: both"></div>
<!-- FOURTH ROW: -->
<!-- One collapsed flex item, one other flex item; both are flexible.
(The non-collapsed one should take all of the available width.) -->
<div class="flexContainer">
<div class="heightAuto flexible collapse"></div>
<div class="heightTall flexible"></div>
</div>
<!-- (again, with items in opposite order) -->
<div class="flexContainer">
<div class="heightTall flexible"></div>
<div class="heightAuto flexible collapse"></div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,108 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>CSS Reftest Reference</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<meta charset="utf-8">
<style>
.flexContainer {
display: flex;
flex-wrap: wrap;
/* These let us show where each flex line begins (and hence, how tall
the flex lines end up) */
align-content: flex-start;
align-items: flex-start;
width: 30px;
background: yellow;
border: 1px dotted black;
float: left;
margin: 5px;
}
.collapsedItem {
width: 0;
height: 25px;
}
.halfWidthItem {
width: 15px;
height: 15px;
background: teal;
}
.fullWidthItem {
width: 30px;
height: 20px;
background: purple;
}
.veryTallItem {
width: 15px;
height: 40px;
background: olive;
}
</style>
</head>
<body>
<!-- FIRST ROW: -->
<!-- One collapsed flex item, at the beginning of a flex line, which
ends up establishing its flex line's cross size: -->
<div class="flexContainer">
<div class="collapsedItem"></div>
<div class="halfWidthItem"></div>
<div class="fullWidthItem"></div>
</div>
<!-- ...and now with it being at the end of that flex line: -->
<div class="flexContainer">
<div class="halfWidthItem"></div>
<div class="collapsedItem"></div>
<div class="fullWidthItem"></div>
</div>
<div style="clear: both"></div>
<!-- SECOND ROW: -->
<!-- One collapsed flex item, initially in its own line. It ends
up being merged into another line after it collapses, due to its
(post-collapse) zero main-size. -->
<div class="flexContainer">
<div class="collapsedItem"></div>
<div class="fullWidthItem"></div>
<div class="fullWidthItem"></div>
</div>
<div class="flexContainer">
<div class="fullWidthItem"></div>
<div class="collapsedItem"></div>
<div class="fullWidthItem"></div>
</div>
<div class="flexContainer">
<div class="fullWidthItem"></div>
<div class="fullWidthItem"></div>
<div class="collapsedItem"></div>
</div>
<div style="clear: both"></div>
<!-- THIRD ROW: -->
<!-- One collapsed flex item, initially in a line with an even-taller item.
The collapsed item ends up shifting into another line after it
collapses, but it carries the taller item's cross size with it, as its
strut size. -->
<div class="flexContainer">
<div class="fullWidthItem"></div>
<div class="collapsedItem" style="height: 40px"></div>
<div class="veryTallItem"></div>
</div>
<!-- ...and now with two (differently-sized) struts in first line:
(the one that's taller - due to being initially grouped with the tall
item - wins out.) -->
<div class="flexContainer">
<div class="collapsedItem"></div>
<div class="fullWidthItem"></div>
<div class="collapsedItem" style="height: 40px"></div>
<div class="veryTallItem"></div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,111 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>CSS Test: Testing that visibility:collapse on a flex item in a multi-line flex container creates struts, and that they can migrate between lines</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<link rel="help" href="http://www.w3.org/TR/css3-flexbox/#algo-visibility">
<link rel="match" href="flexbox-collapsed-item-horiz-2-ref.html">
<meta charset="utf-8">
<style>
.flexContainer {
display: flex;
flex-wrap: wrap;
/* These let us show where each flex line begins (and hence, how tall
the flex lines end up) */
align-content: flex-start;
align-items: flex-start;
width: 30px;
background: yellow;
border: 1px dotted black;
float: left;
margin: 5px;
}
.collapsedItem {
visibility: collapse;
width: 15px;
height: 25px;
}
.halfWidthItem {
width: 15px;
height: 15px;
background: teal;
}
.fullWidthItem {
width: 30px;
height: 20px;
background: purple;
}
.veryTallItem {
width: 15px;
height: 40px;
background: olive;
}
</style>
</head>
<body>
<!-- FIRST ROW: -->
<!-- One collapsed flex item, at the beginning of a flex line, which
ends up establishing its flex line's cross size: -->
<div class="flexContainer">
<div class="collapsedItem"></div>
<div class="halfWidthItem"></div>
<div class="fullWidthItem"></div>
</div>
<!-- ...and now with it being at the end of that flex line: -->
<div class="flexContainer">
<div class="halfWidthItem"></div>
<div class="collapsedItem"></div>
<div class="fullWidthItem"></div>
</div>
<div style="clear: both"></div>
<!-- SECOND ROW: -->
<!-- One collapsed flex item, initially in its own line. It ends
up being merged into another line after it collapses, due to its
(post-collapse) zero main-size. -->
<div class="flexContainer">
<div class="collapsedItem"></div>
<div class="fullWidthItem"></div>
<div class="fullWidthItem"></div>
</div>
<div class="flexContainer">
<div class="fullWidthItem"></div>
<div class="collapsedItem"></div>
<div class="fullWidthItem"></div>
</div>
<div class="flexContainer">
<div class="fullWidthItem"></div>
<div class="fullWidthItem"></div>
<div class="collapsedItem"></div>
</div>
<div style="clear: both"></div>
<!-- THIRD ROW: -->
<!-- One collapsed flex item, initially in a line with an even-taller item.
The collapsed item ends up shifting into another line after it
collapses, but it carries the taller item's cross size with it, as its
strut size. -->
<div class="flexContainer">
<div class="fullWidthItem"></div>
<div class="collapsedItem"></div>
<div class="veryTallItem"></div>
</div>
<!-- ...and now with two (differently-sized) struts in first line:
(the one that's taller - due to being initially grouped with the tall
item - wins out.) -->
<div class="flexContainer">
<div class="collapsedItem"></div>
<div class="fullWidthItem"></div>
<div class="collapsedItem"></div>
<div class="veryTallItem"></div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,46 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>CSS Reftest Reference</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<meta charset="utf-8">
<style>
.flexContainer {
display: flex;
flex-wrap: wrap;
align-content: stretch; /* Initial value; just here for emphasis */
width: 25px;
height: 60px;
background: yellow;
border: 1px dotted black;
float: left;
margin: 5px;
}
.collapsedItem {
width: 0;
height: 40px;
}
.shortItem {
width: 25px;
height: 10px;
background: purple;
}
.tallItem {
width: 10px;
height: 30px;
background: olive;
}
</style>
</head>
<body>
<div class="flexContainer">
<div class="shortItem"></div>
<div class="collapsedItem"></div>
<div class="tallItem"></div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,56 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>CSS Test: Testing that strut formation (from visibility:collapse) happens *after* lines have been stretched</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<link rel="help" href="http://www.w3.org/TR/css3-flexbox/#algo-visibility">
<link rel="match" href="flexbox-collapsed-item-horiz-3-ref.html">
<meta charset="utf-8">
<style>
.flexContainer {
display: flex;
flex-wrap: wrap;
align-content: stretch; /* Initial value; just here for emphasis */
width: 25px;
height: 60px;
background: yellow;
border: 1px dotted black;
float: left;
margin: 5px;
}
.collapsedItem {
visibility: collapse;
width: 10px;
}
.shortItem {
width: 25px;
height: 10px;
background: purple;
}
.tallItem {
width: 10px;
height: 30px;
background: olive;
}
</style>
</head>
<body>
<!-- In this testcase, the first flex line initially has a cross-size of
10px, and the second flex line has a cross-size of 30px. Both lines are
stretched by 10px each (to hit the container's total cross-size, 60px).
Then, we handle "visibility:collapse" and convert the collapsed item
into a strut with the second line's stretched cross-size (40px), and we
restart flex layout. This strut then ends up in the *first* line (since
it has 0 main-size), which means both flex lines end up being 40px tall.
-->
<div class="flexContainer">
<div class="shortItem"></div>
<div class="collapsedItem"></div>
<div class="tallItem"></div>
</div>
</body>
</html>

Просмотреть файл

@ -77,6 +77,12 @@ fuzzy-if(Android,158,32) == flexbox-align-self-vert-rtl-1.xhtml flexbox-align-s
== flexbox-break-request-vert-2a.html flexbox-break-request-vert-2-ref.html
== flexbox-break-request-vert-2b.html flexbox-break-request-vert-2-ref.html
# Tests for flex items with "visibility:collapse"
== flexbox-collapsed-item-baseline-1.html flexbox-collapsed-item-baseline-1-ref.html
== flexbox-collapsed-item-horiz-1.html flexbox-collapsed-item-horiz-1-ref.html
== flexbox-collapsed-item-horiz-2.html flexbox-collapsed-item-horiz-2-ref.html
== flexbox-collapsed-item-horiz-3.html flexbox-collapsed-item-horiz-3-ref.html
# Tests for flex-flow shorthand property
== flexbox-flex-flow-1.html flexbox-flex-flow-1-ref.html