layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-vert-1.xhtml

Thu, 15 Jan 2015 21:13:52 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:13:52 +0100
branch
TOR_BUG_9701
changeset 12
7540298fafa1
permissions
-rw-r--r--

Remove forgotten relic of ABI crash risk averse overloaded method change.

     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 canvas 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 canvas 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-canvas-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       canvas {
    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       <canvas/>
    39     </div>
    41     <!-- B) Text and a canvas (ensure they aren't merged into one flex item) -->
    42     <div class="flexbox">
    43       a b <canvas/>
    44     </div>
    46     <!-- C) Two canvas elements, getting stretched by different ratios, from 0.
    48          Space-to-be-distributed = 200px - borders = 200 - (1 + 1) - (1 + 1)
    49                                  = 196px
    51          1st element gets 5/8 of space: 5/8 * 196px = 122.5px
    52          1st element gets 3/8 of space: 3/8 * 196px = 73.5px
    53       -->
    54     <div class="flexbox">
    55       <canvas style="flex: 5"/>
    56       <canvas style="flex: 3"/>
    57     </div>
    59     <!-- D) Two canvas elements, getting stretched by different ratios, from
    60          different flex bases.
    62          Space-to-be-distributed = 200px - (33 + 1 + 1) - (13 + 1 + 1) = 150px
    63          1st element gets 2/5 of space: 33px + 2/5 * 150px = 93px
    64          1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px
    65       -->
    66     <div class="flexbox">
    67       <canvas style="height: 33px; flex: 2 auto"/>
    68       <canvas style="height: 13px; flex: 3 auto"/>
    69     </div>
    71     <!-- E) Two flex items, getting shrunk by different amounts.
    73          Space-to-be-distributed = 200px - (150 + 1 + 1) - (100 + 1 + 1) = -54px
    74          First element scaled flex ratio = 4 * 150 = 600
    75          Second element scaled flex ratio = 3 * 100 = 300
    76            * So, total flexibility is 600 + 300 = 900
    78          1st element gets 600/900 of space: 150 + 600/900 * -54 = 114px
    79          2nd element gets 300/900 of space: 100 + 300/900 * -54 = 82px
    80       -->
    81     <div class="flexbox">
    82       <canvas style="height: 150px; flex: 1 4 auto"/>
    83       <canvas style="height: 100px; flex: 1 3 auto"/>
    84     </div>
    86     <!-- F) Making sure we don't grow past max-height -->
    87     <!-- Same as (D), except we've added a max-height on the second element.
    88       -->
    89     <div class="flexbox">
    90       <canvas style="height: 33px; flex: 2 auto"/>
    91       <canvas style="height: 13px; max-height: 90px; flex: 3 auto"/>
    92     </div>
    94     <!-- G) Making sure we grow at least as large as min-height -->
    95     <!-- Same as (C), except we've added a min-height on the second element.
    96       -->
    97     <div class="flexbox">
    98       <canvas style="height: 33px; flex: 2 auto"/>
    99       <canvas style="height: 13px; min-height: 150px; flex: 3 auto"/>
   100     </div>
   102   </body>
   103 </html>

mercurial