1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-horiz-1.xhtml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,105 @@ 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 horizontal 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-horiz-1-ref.xhtml"/> 1.18 + <style> 1.19 + div.flexbox { 1.20 + width: 200px; 1.21 + background: lightgreen; 1.22 + display: flex; 1.23 + justify-content: space-between; 1.24 + margin-bottom: 5px; 1.25 + line-height: 8px; 1.26 + } 1.27 + fieldset { 1.28 + min-width: 0; 1.29 + width: 10px; 1.30 + height: 20px; 1.31 + border: 1px dotted green; 1.32 + margin: 0; 1.33 + padding: 0; 1.34 + } 1.35 + </style> 1.36 + </head> 1.37 + <body> 1.38 + 1.39 + <!-- A) One flex item --> 1.40 + <div class="flexbox"> 1.41 + <fieldset/> 1.42 + </div> 1.43 + 1.44 + <!-- B) Text and a fieldset (ensure they aren't merged into one flex item) 1.45 + --> 1.46 + <div class="flexbox"> 1.47 + some words <fieldset/> 1.48 + </div> 1.49 + 1.50 + <!-- C) Two fieldset elements, getting stretched by different ratios, 1.51 + from 0. 1.52 + 1.53 + Space-to-be-distributed = 200px - borders = 200 - (1 + 1) - (1 + 1) 1.54 + = 196px 1.55 + 1.56 + 1st element gets 5/8 of space: 5/8 * 196px = 122.5px 1.57 + 1st element gets 3/8 of space: 3/8 * 196px = 73.5px 1.58 + --> 1.59 + <div class="flexbox"> 1.60 + <fieldset style="flex: 5"/> 1.61 + <fieldset style="flex: 3"/> 1.62 + </div> 1.63 + 1.64 + <!-- D) Two fieldset elements, getting stretched by different ratios, from 1.65 + different flex bases. 1.66 + 1.67 + Space-to-be-distributed = 200px - (33 + 1 + 1) - (13 + 1 + 1) = 150px 1.68 + 1st element gets 2/5 of space: 33px + 2/5 * 150px = 93px 1.69 + 1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px 1.70 + --> 1.71 + <div class="flexbox"> 1.72 + <fieldset style="width: 33px; flex: 2 auto"/> 1.73 + <fieldset style="width: 13px; flex: 3 auto"/> 1.74 + </div> 1.75 + 1.76 + <!-- E) Two flex items, getting shrunk by different amounts. 1.77 + 1.78 + Space-to-be-distributed = 200px - (150 + 1 + 1) - (100 + 1 + 1) = -54px 1.79 + First element scaled flex ratio = 4 * 150 = 600 1.80 + Second element scaled flex ratio = 3 * 100 = 300 1.81 + * So, total flexibility is 600 + 300 = 900 1.82 + 1.83 + 1st element gets 600/900 of space: 150 + 600/900 * -54 = 114px 1.84 + 2nd element gets 300/900 of space: 100 + 300/900 * -54 = 82px 1.85 + --> 1.86 + <div class="flexbox"> 1.87 + <fieldset style="width: 150px; flex: 1 4 auto"/> 1.88 + <fieldset style="width: 100px; flex: 1 3 auto"/> 1.89 + </div> 1.90 + 1.91 + <!-- F) Making sure we don't grow past max-width --> 1.92 + <!-- Same as (D), except we've added a max-width on the second element. 1.93 + --> 1.94 + <div class="flexbox"> 1.95 + <fieldset style="width: 33px; flex: 2 auto"/> 1.96 + <fieldset style="width: 13px; max-width: 90px; flex: 3 auto"/> 1.97 + </div> 1.98 + 1.99 + <!-- G) Making sure we grow at least as large as min-width --> 1.100 + <!-- Same as (C), except we've added a min-width on the second element. 1.101 + --> 1.102 + <div class="flexbox"> 1.103 + <fieldset style="width: 33px; flex: 2 auto"/> 1.104 + <fieldset style="width: 13px; min-width: 150px; flex: 3 auto"/> 1.105 + </div> 1.106 + 1.107 + </body> 1.108 +</html>