layout/reftests/w3c-css/submitted/flexbox/flexbox-items-as-stacking-contexts-2.html

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     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.
    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/css3-flexbox/#painting">
    22   <link rel="match" href="flexbox-items-as-stacking-contexts-2-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     }
    37     .item2 {
    38       background: yellow;
    39       width: 30px;
    40     }
    41   </style>
    42 </head>
    43 <body>
    44   <!-- This container has two flex items, the first of which has content
    45        sticking out & overlapping the second.  If they're painting atomically
    46        (and in the right order), the second item's background should cover the
    47        first item's overflowing content. -->
    48   <div class="flexContainer"
    49     ><div class="item1">ThisIsALongUnbrokenString</div
    50     ><div class="item2">HereIsSomeMoreLongText</div
    51   ></div>
    53   <!-- Now, the first item is relatively positioned, which should make it paint
    54        on top of everything. -->
    55   <div class="flexContainer"
    56     ><div class="item1" style="position:relative">ThisIsALongUnbrokenString</div
    57     ><div class="item2">HereIsSomeMoreLongText</div
    58   ></div>
    60   <!-- Now, the first item is has "z-index" set, which should make it paint on
    61        top of everything. -->
    62   <div class="flexContainer"
    63     ><div class="item1" style="z-index: 1">ThisIsALongUnbrokenString</div
    64     ><div class="item2">HereIsSomeMoreLongText</div
    65   ></div>
    67   <!-- Now, the first item has "order" set to a higher value than default,
    68        which should make it paint on top (and at the far right) -->
    69   <div class="flexContainer"
    70     ><div class="item1" style="order: 1">ThisIsALongUnbrokenString</div
    71     ><div class="item2">HereIsSomeMoreLongText</div
    72   ></div>
    74   <!-- And for thoroughness, let's set "order" to a lower value than default,
    75        on the second item. (Should render the same as previous example.)  -->
    76   <div class="flexContainer"
    77     ><div class="item1">ThisIsALongUnbrokenString</div
    78     ><div class="item2" style="order: -1">HereIsSomeMoreLongText</div
    79   ></div>
    81   <!-- ...but if we relatively position that second item, it should paint
    82        on top again, despite its low "order" value. -->
    83   <div class="flexContainer"
    84     ><div class="item1">ThisIsALongUnbrokenString</div
    85     ><div class="item2" style="order: -1; position: relative">HereIsSomeMoreLongText</div
    86   ></div>
    87 </body>
    88 </html>

mercurial