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

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32

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

mercurial