tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

row-wrap-001.html (3309B)


      1 <!DOCTYPE html>
      2 <link rel="author" title="David Grogan" href="mailto:dgrogan@chromium.org">
      3 <link rel="help" href="https://drafts.csswg.org/css-flexbox/#intrinsic-sizes">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/resources/check-layout-th.js"></script>
      7 <meta name="assert"
      8  content="min-content width is calculated correctly for row-wrap flex containers in a variety of scenarios with two flex items" />
      9 
     10 <style>
     11  .zero-width {
     12    width: 0px;
     13    height: 100px;
     14    margin-bottom: 20px;
     15  }
     16 
     17  .floating-flexbox {
     18    display: flex;
     19    flex-wrap: wrap;
     20    outline: 5px solid blue;
     21    height: 100px;
     22    float: left;
     23  }
     24 
     25  .floating-flexbox>div:nth-child(1) {
     26    background: yellow;
     27  }
     28 
     29  .floating-flexbox>div:nth-child(2) {
     30    background: orange;
     31  }
     32 
     33  .floating-flexbox>div>div {
     34    width: 100px;
     35  }
     36 
     37 </style>
     38 
     39 <body onload="checkLayout('.floating-flexbox')">
     40  <div class="zero-width">
     41    <div class="floating-flexbox" data-expected-width="100">
     42      <!-- contribution: 100 -->
     43      <div style="flex: 1 1 200px; width:50px;">
     44        <div></div>
     45      </div>
     46      <!-- contribution: 50 -->
     47      <div style="flex: 1 1 400px; width:50px;">
     48      </div>
     49    </div>
     50  </div>
     51 
     52  <div class="zero-width">
     53    <div class="floating-flexbox" data-expected-width="100">
     54      <!-- contribution: 100px
     55      starts as max(specified=200, min-content=100) = 200
     56      clamped down to 50 because doesn't grow
     57      clamped up to 100 because auto min size is 100
     58      -->
     59      <div style="flex: 0 0 50px; width: 200px;">
     60        <div></div>
     61      </div>
     62      <!-- contribution: 50px
     63      starts as max(specified=50, min-content=100) = 100
     64      clamped down to 50 because doesn't grow
     65      auto min size is 50, so has no effect
     66      -->
     67      <div style="flex: 0 0 50px; width: 50px;">
     68        <div></div>
     69      </div>
     70    </div>
     71  </div>
     72 
     73  <div class="zero-width">
     74    <div class="floating-flexbox" data-expected-width="200">
     75      <!-- contribution: 200px
     76      starts as max(specified=200, min-content=100) = 200
     77      auto min size is 100, so has no effect
     78      -->
     79      <div style="flex: 1 0 50px; width: 200px;">
     80        <div></div>
     81      </div>
     82      <!-- contribution: 150px
     83      starts as max(specified=50, min-content=100) = 100
     84      clamped up to 150 because doesn't shrink
     85      auto min size is 50, so has no effect
     86      -->
     87      <div style="flex: 2 0 150px; width: 50px;">
     88        <div></div>
     89      </div>
     90    </div>
     91  </div>
     92 
     93  <!-- Same as above case except last item has margins. -->
     94  <div class="zero-width">
     95    <div class="floating-flexbox" data-expected-width="450">
     96      <div style="flex: 1 0 50px; width: 200px;">
     97        <div></div>
     98      </div>
     99      <div style="flex: 2 0 150px; width: 50px; margin-left: 300px;">
    100        <div></div>
    101      </div>
    102    </div>
    103  </div>
    104 
    105  <!-- Same as above except we now test that gaps are ignored. -->
    106  <div class="zero-width">
    107    <div class="floating-flexbox" data-expected-width="450"
    108      style="row-gap: 24px; column-gap: 17px;">
    109      <div style="flex: 1 0 50px; width: 200px;">
    110        <div></div>
    111      </div>
    112      <div style="flex: 2 0 150px; width: 50px; margin-left: 300px;">
    113        <div></div>
    114      </div>
    115    </div>
    116  </div>
    117 </body>