layout/reftests/w3c-css/submitted/flexbox/flexbox-sizing-horiz-1.xhtml

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-sizing-horiz-1.xhtml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,84 @@
     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 testcase checks how "min-width" and "max-width" affect the sizing
    1.11 +     of horizontal flex containers that have no explicit "width" property.
    1.12 +-->
    1.13 +<html xmlns="http://www.w3.org/1999/xhtml">
    1.14 +  <head>
    1.15 +    <title>CSS Test: Testing sizing of an auto-sized horizontal flex container with min-width and max-width constraints</title>
    1.16 +    <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"/>
    1.17 +    <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#layout-algorithm"/>
    1.18 +    <link rel="match" href="flexbox-sizing-horiz-1-ref.xhtml"/>
    1.19 +    <style>
    1.20 +      div { height: 10px; }
    1.21 +      div.flexbox {
    1.22 +        border: 1px dashed blue;
    1.23 +        font-size: 10px;
    1.24 +        display: flex;
    1.25 +        margin-bottom: 2px;
    1.26 +      }
    1.27 +      div.a {
    1.28 +        flex: 1 20px;
    1.29 +        max-width: 60px;
    1.30 +        background: lightgreen;
    1.31 +      }
    1.32 +      div.b {
    1.33 +        flex: 1 20px;
    1.34 +        min-width: 40px;
    1.35 +        max-width: 60px;
    1.36 +        background: purple;
    1.37 +      }
    1.38 +      div.c {
    1.39 +        flex: 1 40px;
    1.40 +        min-width: 10px;
    1.41 +        max-width: 60px;
    1.42 +        background: orange;
    1.43 +      }
    1.44 +    </style>
    1.45 +  </head>
    1.46 +  <body>
    1.47 +    <!-- auto-sized horizontal flexbox should occupy the available width. -->
    1.48 +    <div class="flexbox">
    1.49 +      <div class="a"/><div class="b"/><div class="c"/>
    1.50 +    </div>
    1.51 +
    1.52 +    <!-- Adding a small min-size shouldn't affect that. -->
    1.53 +    <div class="flexbox" style="min-width: 10px">
    1.54 +      <div class="a"/><div class="b"/><div class="c"/>
    1.55 +    </div>
    1.56 +
    1.57 +    <!-- ...but a (large) max-size will limit us to that size, instead of
    1.58 +         our available size.-->
    1.59 +    <div class="flexbox" style="max-width: 300px">
    1.60 +      <div class="a"/><div class="b"/><div class="c"/>
    1.61 +    </div>
    1.62 +
    1.63 +    <!-- If we set a maximum size that's even smaller, it'll limit our
    1.64 +         size and compress our children. -->
    1.65 +    <div class="flexbox" style="max-width: 70px">
    1.66 +      <div class="a"/><div class="b"/><div class="c"/>
    1.67 +    </div>
    1.68 +
    1.69 +    <!-- The max-size may be small enough that our items will overflow. -->
    1.70 +    <div class="flexbox" style="max-width: 20px">
    1.71 +      <div class="a"/><div class="b"/><div class="c"/>
    1.72 +    </div>
    1.73 +
    1.74 +    <!-- But if we add a min-size, it beats the max-size. Here, we use a
    1.75 +         min-size smaller than the sum of the items' base sizes... -->
    1.76 +    <div class="flexbox" style="min-width: 58px; max-width: 20px">
    1.77 +      <div class="a"/><div class="b"/><div class="c"/>
    1.78 +    </div>
    1.79 +
    1.80 +    <!-- ...and here we use a min-size larger than the sum of the items'
    1.81 +         base sizes. -->
    1.82 +    <div class="flexbox" style="min-width: 140px; max-width: 20px">
    1.83 +      <div class="a"/><div class="b"/><div class="c"/>
    1.84 +    </div>
    1.85 +
    1.86 +  </body>
    1.87 +</html>

mercurial