1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-vert-1.xhtml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,107 @@ 1.4 +<?xml version="1.0" encoding="UTF-8"?> 1.5 +<!-- 1.6 + Any copyright is dedicated to the Public Domain. 1.7 + http://creativecommons.org/publicdomain/zero/1.0/ 1.8 +--> 1.9 +<!-- 1.10 + This test checks that fieldset elements behave correctly as flex items. 1.11 +--> 1.12 +<html xmlns="http://www.w3.org/1999/xhtml"> 1.13 + <head> 1.14 + <title>CSS Test: Testing flexbox layout algorithm property on fieldset flex items in a vertical flex container</title> 1.15 + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"/> 1.16 + <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#layout-algorithm"/> 1.17 + <link rel="match" href="flexbox-basic-fieldset-vert-1-ref.xhtml"/> 1.18 + <style> 1.19 + div.flexbox { 1.20 + height: 200px; 1.21 + background: lightgreen; 1.22 + display: flex; 1.23 + justify-content: space-between; 1.24 + flex-direction: column; 1.25 + float: left; 1.26 + margin-right: 10px; 1.27 + font: 8px monospace; 1.28 + } 1.29 + fieldset { 1.30 + width: 20px; 1.31 + height: 10px; 1.32 + min-height: 0; 1.33 + border: 1px dotted green; 1.34 + margin: 0; 1.35 + padding: 0; 1.36 + } 1.37 + </style> 1.38 + </head> 1.39 + <body> 1.40 + 1.41 + <!-- A) One flex item --> 1.42 + <div class="flexbox"> 1.43 + <fieldset/> 1.44 + </div> 1.45 + 1.46 + <!-- B) Text and a fieldset (ensure they aren't merged into one flex item) 1.47 + --> 1.48 + <div class="flexbox"> 1.49 + a b <fieldset/> 1.50 + </div> 1.51 + 1.52 + <!-- C) Two fieldset elements, getting stretched by different ratios, 1.53 + from 0. 1.54 + 1.55 + Space-to-be-distributed = 200px - borders = 200 - (1 + 1) - (1 + 1) 1.56 + = 196px 1.57 + 1.58 + 1st element gets 5/8 of space: 5/8 * 196px = 122.5px 1.59 + 1st element gets 3/8 of space: 3/8 * 196px = 73.5px 1.60 + --> 1.61 + <div class="flexbox"> 1.62 + <fieldset style="flex: 5"/> 1.63 + <fieldset style="flex: 3"/> 1.64 + </div> 1.65 + 1.66 + <!-- D) Two fieldset elements, getting stretched by different ratios, from 1.67 + different flex bases. 1.68 + 1.69 + Space-to-be-distributed = 200px - (33 + 1 + 1) - (13 + 1 + 1) = 150px 1.70 + 1st element gets 2/5 of space: 33px + 2/5 * 150px = 93px 1.71 + 1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px 1.72 + --> 1.73 + <div class="flexbox"> 1.74 + <fieldset style="height: 33px; flex: 2 auto"/> 1.75 + <fieldset style="height: 13px; flex: 3 auto"/> 1.76 + </div> 1.77 + 1.78 + <!-- E) Two flex items, getting shrunk by different amounts. 1.79 + 1.80 + Space-to-be-distributed = 200px - (150 + 1 + 1) - (100 + 1 + 1) = -54px 1.81 + First element scaled flex ratio = 4 * 150 = 600 1.82 + Second element scaled flex ratio = 3 * 100 = 300 1.83 + * So, total flexibility is 600 + 300 = 900 1.84 + 1.85 + 1st element gets 600/900 of space: 150 + 600/900 * -54 = 114px 1.86 + 2nd element gets 300/900 of space: 100 + 300/900 * -54 = 82px 1.87 + --> 1.88 + <div class="flexbox"> 1.89 + <fieldset style="height: 150px; flex: 1 4 auto"/> 1.90 + <fieldset style="height: 100px; flex: 1 3 auto"/> 1.91 + </div> 1.92 + 1.93 + <!-- F) Making sure we don't grow past max-height --> 1.94 + <!-- Same as (D), except we've added a max-height on the second element. 1.95 + --> 1.96 + <div class="flexbox"> 1.97 + <fieldset style="height: 33px; flex: 2 auto"/> 1.98 + <fieldset style="height: 13px; max-height: 90px; flex: 3 auto"/> 1.99 + </div> 1.100 + 1.101 + <!-- G) Making sure we grow at least as large as min-height --> 1.102 + <!-- Same as (C), except we've added a min-height on the second element. 1.103 + --> 1.104 + <div class="flexbox"> 1.105 + <fieldset style="height: 33px; flex: 2 auto"/> 1.106 + <fieldset style="height: 13px; min-height: 150px; flex: 3 auto"/> 1.107 + </div> 1.108 + 1.109 + </body> 1.110 +</html>