layout/reftests/flexbox/flexbox-float-1c.xhtml

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 <?xml version="1.0" encoding="UTF-8"?>
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 <!--
michael@0 7 This test is like flexbox-float-1a.xhtml, but with the float-styled
michael@0 8 element dynamically inserted.
michael@0 9 -->
michael@0 10 <html xmlns="http://www.w3.org/1999/xhtml" class="reftest-wait">
michael@0 11 <head>
michael@0 12 <script>
michael@0 13 function generateFloat(aFloatDirection) {
michael@0 14 var newElem = document.createElement("span");
michael@0 15 newElem.setAttribute("style", "float: " + aFloatDirection);
michael@0 16 newElem.innerHTML = aFloatDirection == "left" ? "[[[" : "]]]";
michael@0 17 return newElem;
michael@0 18 }
michael@0 19
michael@0 20 function tweak() {
michael@0 21 var containerList = document.getElementsByClassName("flexbox");
michael@0 22 for (var i = 0; i &lt; containerList.length; i++) {
michael@0 23 var container = containerList[i];
michael@0 24 var newElem = generateFloat(container.getAttribute("floatValToUse"));
michael@0 25
michael@0 26 var nodeToInsertBefore;
michael@0 27 var insertPosn = container.getAttribute("insertPosn");
michael@0 28 if (insertPosn == "begin") {
michael@0 29 nodeToInsertBefore = container.firstChild;
michael@0 30 } else if (insertPosn == "mid") {
michael@0 31 nodeToInsertBefore = container.firstChild.nextSibling;
michael@0 32 } else if (insertPosn == "end") {
michael@0 33 nodeToInsertBefore = null;
michael@0 34 }
michael@0 35
michael@0 36 container.insertBefore(newElem, nodeToInsertBefore);
michael@0 37 }
michael@0 38
michael@0 39 document.documentElement.removeAttribute("class");
michael@0 40 }
michael@0 41
michael@0 42 window.addEventListener("MozReftestInvalidate", tweak, false);
michael@0 43 </script>
michael@0 44 <style>
michael@0 45 div.flexbox {
michael@0 46 display: flex;
michael@0 47 width: 400px;
michael@0 48 margin-bottom: 2px;
michael@0 49 font-family: sans-serif;
michael@0 50 background: lightgreen;
michael@0 51 justify-content: space-around;
michael@0 52 }
michael@0 53 </style>
michael@0 54 </head>
michael@0 55 <body>
michael@0 56 <div class="flexbox" floatValToUse="left" insertPosn="mid">
michael@0 57 aaa<span>bbb</span>
michael@0 58 </div>
michael@0 59 <div class="flexbox" floatValToUse="right" insertPosn="mid">
michael@0 60 aaa<span>bbb</span>
michael@0 61 </div>
michael@0 62 <div class="flexbox" floatValToUse="left" insertPosn="end">
michael@0 63 aaa
michael@0 64 </div>
michael@0 65 <div class="flexbox" floatValToUse="right" insertPosn="end">
michael@0 66 aaa
michael@0 67 </div>
michael@0 68 <div class="flexbox" floatValToUse="left" insertPosn="begin">
michael@0 69 bbb
michael@0 70 </div>
michael@0 71 <div class="flexbox" floatValToUse="right" insertPosn="begin">
michael@0 72 bbb
michael@0 73 </div>
michael@0 74 </body>
michael@0 75 </html>

mercurial