layout/reftests/flexbox/flexbox-dyn-insertAroundSpan-2.xhtml

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

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 verifies that we reconstruct frames as necessary, after content
michael@0 8 (including whitespace & divs) is dynamically inserted as a child of a
michael@0 9 flexbox. (Note that in cases where we know the whitespace is going to be
michael@0 10 dropped, we don't bother reconstructing frames. This test is to be sure we
michael@0 11 aren't overzealous with that optimization.)
michael@0 12 -->
michael@0 13 <html xmlns="http://www.w3.org/1999/xhtml"
michael@0 14 class="reftest-wait">
michael@0 15 <head>
michael@0 16 <style>
michael@0 17 body {
michael@0 18 font-size: 10px;
michael@0 19 }
michael@0 20
michael@0 21 div.inserted {
michael@0 22 background: teal; /* To make inserted div elements stand out. */
michael@0 23 }
michael@0 24
michael@0 25 div.flexbox {
michael@0 26 border: 1px dashed blue;
michael@0 27 width: 300px;
michael@0 28 display: flex;
michael@0 29 justify-content: space-around;
michael@0 30 margin-bottom: 1px;
michael@0 31 white-space: pre;
michael@0 32 }
michael@0 33 </style>
michael@0 34 <script>
michael@0 35 function insertNodeAtPosnInElem(aNodeToInsert, aPosn, aParentId) {
michael@0 36 var parent = document.getElementById(aParentId);
michael@0 37 var insertBeforeTarget = parent.firstChild;
michael@0 38 for (var i = 0; i &lt; aPosn; i++) {
michael@0 39 insertBeforeTarget = insertBeforeTarget.nextSibling;
michael@0 40 }
michael@0 41 parent.insertBefore(aNodeToInsert, insertBeforeTarget);
michael@0 42 }
michael@0 43
michael@0 44 function createDivElem() {
michael@0 45 var div = document.createElement("div");
michael@0 46 div.setAttribute("class", "inserted");
michael@0 47 div.appendChild(document.createTextNode("[NewDiv]"));
michael@0 48 return div;
michael@0 49 }
michael@0 50
michael@0 51 function tweak() {
michael@0 52 // Inserting div, adjacent to inline content
michael@0 53 // -----------------------------------------
michael@0 54 insertNodeAtPosnInElem(createDivElem(), 0, "f0");
michael@0 55 insertNodeAtPosnInElem(createDivElem(), 1, "f1");
michael@0 56
michael@0 57 // Inserting div and whitespace, before inline content
michael@0 58 // ---------------------------------------------------
michael@0 59 insertNodeAtPosnInElem(document.createTextNode(" "), 0, "f2");
michael@0 60 insertNodeAtPosnInElem(createDivElem(), 0, "f2");
michael@0 61
michael@0 62 insertNodeAtPosnInElem(createDivElem(), 0, "f3");
michael@0 63 insertNodeAtPosnInElem(document.createTextNode(" "), 0, "f3");
michael@0 64
michael@0 65 // Inserting div and whitespace, after inline content
michael@0 66 // ---------------------------------------------------
michael@0 67 insertNodeAtPosnInElem(document.createTextNode(" "), 1, "f4");
michael@0 68 insertNodeAtPosnInElem(createDivElem(), 1, "f4");
michael@0 69
michael@0 70 insertNodeAtPosnInElem(createDivElem(), 1, "f5");
michael@0 71 insertNodeAtPosnInElem(document.createTextNode(" "), 1, "f5");
michael@0 72
michael@0 73 // Inserting div and text, before inline content
michael@0 74 // ---------------------------------------------------
michael@0 75 insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 0, "f6");
michael@0 76 insertNodeAtPosnInElem(createDivElem(), 0, "f6");
michael@0 77
michael@0 78 insertNodeAtPosnInElem(createDivElem(), 0, "f7");
michael@0 79 insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 0, "f7");
michael@0 80
michael@0 81 // Inserting div and text, after inline content
michael@0 82 // ---------------------------------------------------
michael@0 83 insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 1, "f8");
michael@0 84 insertNodeAtPosnInElem(createDivElem(), 1, "f8");
michael@0 85
michael@0 86 insertNodeAtPosnInElem(createDivElem(), 1, "f9");
michael@0 87 insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 1, "f9");
michael@0 88
michael@0 89 document.documentElement.removeAttribute("class");
michael@0 90 }
michael@0 91
michael@0 92 window.addEventListener("MozReftestInvalidate", tweak, false);
michael@0 93 </script>
michael@0 94 </head>
michael@0 95 <body>
michael@0 96 <div class="flexbox" id="f0"><span>[OldText]</span></div>
michael@0 97 <div class="flexbox" id="f1"><span>[OldText]</span></div>
michael@0 98 <div class="flexbox" id="f2"><span>[OldText]</span></div>
michael@0 99 <div class="flexbox" id="f3"><span>[OldText]</span></div>
michael@0 100 <div class="flexbox" id="f4"><span>[OldText]</span></div>
michael@0 101 <div class="flexbox" id="f5"><span>[OldText]</span></div>
michael@0 102 <div class="flexbox" id="f6"><span>[OldText]</span></div>
michael@0 103 <div class="flexbox" id="f7"><span>[OldText]</span></div>
michael@0 104 <div class="flexbox" id="f8"><span>[OldText]</span></div>
michael@0 105 <div class="flexbox" id="f9"><span>[OldText]</span></div>
michael@0 106 </body>
michael@0 107 </html>

mercurial