Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 Any copyright is dedicated to the Public Domain.
4 http://creativecommons.org/publicdomain/zero/1.0/
5 -->
6 <!--
7 This test checks that iframe elements behave correctly as flex items.
8 -->
9 <html xmlns="http://www.w3.org/1999/xhtml">
10 <head>
11 <title>CSS Test: Testing flexbox layout algorithm property on iframe flex items in a vertical flex container</title>
12 <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"/>
13 <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#layout-algorithm"/>
14 <link rel="match" href="flexbox-basic-iframe-vert-1-ref.xhtml"/>
15 <style>
16 div.flexbox {
17 height: 200px;
18 background: lightgreen;
19 display: flex;
20 justify-content: space-between;
21 flex-direction: column;
22 float: left;
23 margin-right: 10px;
24 font: 8px monospace;
25 }
26 iframe {
27 width: 20px;
28 height: 10px;
29 min-height: 0;
30 border: 1px dotted green;
31 }
32 </style>
33 </head>
34 <body>
36 <!-- A) One flex item -->
37 <div class="flexbox">
38 <iframe/>
39 </div>
41 <!-- B) Text and an iframe (ensure they aren't merged into one flex item)
42 -->
43 <div class="flexbox">
44 a b <iframe/>
45 </div>
47 <!-- C) Two iframe elements, getting stretched by different ratios, from 0.
49 Space-to-be-distributed = 200px - borders = 200 - (1 + 1) - (1 + 1)
50 = 196px
52 1st element gets 5/8 of space: 5/8 * 196px = 122.5px
53 1st element gets 3/8 of space: 3/8 * 196px = 73.5px
54 -->
55 <div class="flexbox">
56 <iframe style="flex: 5"/>
57 <iframe style="flex: 3"/>
58 </div>
60 <!-- D) Two iframe elements, getting stretched by different ratios, from
61 different flex bases.
63 Space-to-be-distributed = 200px - (33 + 1 + 1) - (13 + 1 + 1) = 150px
64 1st element gets 2/5 of space: 33px + 2/5 * 150px = 93px
65 1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px
66 -->
67 <div class="flexbox">
68 <iframe style="height: 33px; flex: 2 auto"/>
69 <iframe style="height: 13px; flex: 3 auto"/>
70 </div>
72 <!-- E) Two flex items, getting shrunk by different amounts.
74 Space-to-be-distributed = 200px - (150 + 1 + 1) - (100 + 1 + 1) = -54px
75 First element scaled flex ratio = 4 * 150 = 600
76 Second element scaled flex ratio = 3 * 100 = 300
77 * So, total flexibility is 600 + 300 = 900
79 1st element gets 600/900 of space: 150 + 600/900 * -54 = 114px
80 2nd element gets 300/900 of space: 100 + 300/900 * -54 = 82px
81 -->
82 <div class="flexbox">
83 <iframe style="height: 150px; flex: 1 4 auto"/>
84 <iframe style="height: 100px; flex: 1 3 auto"/>
85 </div>
87 <!-- F) Making sure we don't grow past max-height -->
88 <!-- Same as (D), except we've added a max-height on the second element.
89 -->
90 <div class="flexbox">
91 <iframe style="height: 33px; flex: 2 auto"/>
92 <iframe style="height: 13px; max-height: 90px; flex: 3 auto"/>
93 </div>
95 <!-- G) Making sure we grow at least as large as min-height -->
96 <!-- Same as (C), except we've added a min-height on the second element.
97 -->
98 <div class="flexbox">
99 <iframe style="height: 33px; flex: 2 auto"/>
100 <iframe style="height: 13px; min-height: 150px; flex: 3 auto"/>
101 </div>
103 </body>
104 </html>