1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/reftests/flexbox/flexbox-float-1c.xhtml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,75 @@ 1.4 +<?xml version="1.0" encoding="UTF-8"?> 1.5 +<!-- 1.6 + Any copyright is dedicated to the Public Domain. 1.7 + http://creativecommons.org/publicdomain/zero/1.0/ 1.8 +--> 1.9 +<!-- 1.10 + This test is like flexbox-float-1a.xhtml, but with the float-styled 1.11 + element dynamically inserted. 1.12 +--> 1.13 +<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-wait"> 1.14 + <head> 1.15 + <script> 1.16 + function generateFloat(aFloatDirection) { 1.17 + var newElem = document.createElement("span"); 1.18 + newElem.setAttribute("style", "float: " + aFloatDirection); 1.19 + newElem.innerHTML = aFloatDirection == "left" ? "[[[" : "]]]"; 1.20 + return newElem; 1.21 + } 1.22 + 1.23 + function tweak() { 1.24 + var containerList = document.getElementsByClassName("flexbox"); 1.25 + for (var i = 0; i < containerList.length; i++) { 1.26 + var container = containerList[i]; 1.27 + var newElem = generateFloat(container.getAttribute("floatValToUse")); 1.28 + 1.29 + var nodeToInsertBefore; 1.30 + var insertPosn = container.getAttribute("insertPosn"); 1.31 + if (insertPosn == "begin") { 1.32 + nodeToInsertBefore = container.firstChild; 1.33 + } else if (insertPosn == "mid") { 1.34 + nodeToInsertBefore = container.firstChild.nextSibling; 1.35 + } else if (insertPosn == "end") { 1.36 + nodeToInsertBefore = null; 1.37 + } 1.38 + 1.39 + container.insertBefore(newElem, nodeToInsertBefore); 1.40 + } 1.41 + 1.42 + document.documentElement.removeAttribute("class"); 1.43 + } 1.44 + 1.45 + window.addEventListener("MozReftestInvalidate", tweak, false); 1.46 + </script> 1.47 + <style> 1.48 + div.flexbox { 1.49 + display: flex; 1.50 + width: 400px; 1.51 + margin-bottom: 2px; 1.52 + font-family: sans-serif; 1.53 + background: lightgreen; 1.54 + justify-content: space-around; 1.55 + } 1.56 + </style> 1.57 + </head> 1.58 + <body> 1.59 + <div class="flexbox" floatValToUse="left" insertPosn="mid"> 1.60 + aaa<span>bbb</span> 1.61 + </div> 1.62 + <div class="flexbox" floatValToUse="right" insertPosn="mid"> 1.63 + aaa<span>bbb</span> 1.64 + </div> 1.65 + <div class="flexbox" floatValToUse="left" insertPosn="end"> 1.66 + aaa 1.67 + </div> 1.68 + <div class="flexbox" floatValToUse="right" insertPosn="end"> 1.69 + aaa 1.70 + </div> 1.71 + <div class="flexbox" floatValToUse="left" insertPosn="begin"> 1.72 + bbb 1.73 + </div> 1.74 + <div class="flexbox" floatValToUse="right" insertPosn="begin"> 1.75 + bbb 1.76 + </div> 1.77 + </body> 1.78 +</html>