tor-browser

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

flexbox-items-as-stacking-contexts-002.html (3583B)


      1 <!DOCTYPE html>
      2 <!--
      3     Any copyright is dedicated to the Public Domain.
      4     http://creativecommons.org/publicdomain/zero/1.0/
      5 -->
      6 <!-- This testcase checks flex items are painted atomically. In particular,
      7     if one item has content that overflows into the region of another item,
      8     then one item is painted "behind" the other; there shouldn't normally
      9     any interleaving of backgrounds and content between the two items.
     10 
     11     This testcase also tests some special cases that will change the paint
     12     ordering - specifically, the properties "position", "z-index", and
     13     "order" on flex items.
     14 -->
     15 <!-- This was resolved by the CSSWG in April 2013:
     16     http://krijnhoetmer.nl/irc-logs/css/20130403#l-455 -->
     17 <html>
     18 <head>
     19  <title>CSS Test: Testing that flex items paint as pseudo-stacking contexts (like inline-blocks): atomically, in the absence of 'z-index' on descendants</title>
     20  <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
     21  <link rel="help" href="http://www.w3.org/TR/css-flexbox-1/#painting">
     22  <link rel="match" href="flexbox-items-as-stacking-contexts-002-ref.html">
     23  <style>
     24    body { font: 10px sans-serif }
     25    .flexContainer {
     26      background: orange;
     27      display: flex;
     28      justify-content: space-between;
     29      width: 70px;
     30      padding: 2px;
     31      margin-bottom: 2px;
     32    }
     33    .item1 {
     34      background: lightblue;
     35      width: 30px;
     36      min-width: 0; /* disable default min-width:auto behavior */
     37    }
     38    .item2 {
     39      background: yellow;
     40      width: 30px;
     41      min-width: 0; /* disable default min-width:auto behavior */
     42    }
     43  </style>
     44 </head>
     45 <body>
     46  <!-- This container has two flex items, the first of which has content
     47       sticking out & overlapping the second.  If they're painting atomically
     48       (and in the right order), the second item's background should cover the
     49       first item's overflowing content. -->
     50  <div class="flexContainer"
     51    ><div class="item1">ThisIsALongUnbrokenString</div
     52    ><div class="item2">HereIsSomeMoreLongText</div
     53  ></div>
     54 
     55  <!-- Now, the first item is relatively positioned, which should make it paint
     56       on top of everything. -->
     57  <div class="flexContainer"
     58    ><div class="item1" style="position:relative">ThisIsALongUnbrokenString</div
     59    ><div class="item2">HereIsSomeMoreLongText</div
     60  ></div>
     61 
     62  <!-- Now, the first item is has "z-index" set, which should make it paint on
     63       top of everything. -->
     64  <div class="flexContainer"
     65    ><div class="item1" style="z-index: 1">ThisIsALongUnbrokenString</div
     66    ><div class="item2">HereIsSomeMoreLongText</div
     67  ></div>
     68 
     69  <!-- Now, the first item has "order" set to a higher value than default,
     70       which should make it paint on top (and at the far right) -->
     71  <div class="flexContainer"
     72    ><div class="item1" style="order: 1">ThisIsALongUnbrokenString</div
     73    ><div class="item2">HereIsSomeMoreLongText</div
     74  ></div>
     75 
     76  <!-- And for thoroughness, let's set "order" to a lower value than default,
     77       on the second item. (Should render the same as previous example.)  -->
     78  <div class="flexContainer"
     79    ><div class="item1">ThisIsALongUnbrokenString</div
     80    ><div class="item2" style="order: -1">HereIsSomeMoreLongText</div
     81  ></div>
     82 
     83  <!-- ...but if we relatively position that second item, it should paint
     84       on top again, despite its low "order" value. -->
     85  <div class="flexContainer"
     86    ><div class="item1">ThisIsALongUnbrokenString</div
     87    ><div class="item2" style="order: -1; position: relative">HereIsSomeMoreLongText</div
     88  ></div>
     89 </body>
     90 </html>