layout/reftests/flexbox/flexbox-dyn-insertAroundText-1.xhtml

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 <?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 & text) 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 { font-size: 10px; }
michael@0 18
michael@0 19 div.flexbox {
michael@0 20 border: 1px dashed blue;
michael@0 21 width: 300px;
michael@0 22 display: flex;
michael@0 23 justify-content: space-around;
michael@0 24 margin-bottom: 1px;
michael@0 25 white-space: pre;
michael@0 26 }
michael@0 27 </style>
michael@0 28 <script>
michael@0 29 function insertNodeAtPosnInElem(aNodeToInsert, aPosn, aParentId) {
michael@0 30 var parent = document.getElementById(aParentId);
michael@0 31 var insertBeforeTarget = parent.firstChild;
michael@0 32 for (var i = 0; i &lt; aPosn; i++) {
michael@0 33 insertBeforeTarget = insertBeforeTarget.nextSibling;
michael@0 34 }
michael@0 35 parent.insertBefore(aNodeToInsert, insertBeforeTarget);
michael@0 36 }
michael@0 37
michael@0 38 function tweak() {
michael@0 39 // Just inserting whitespace
michael@0 40 // -------------------------
michael@0 41 insertNodeAtPosnInElem(document.createTextNode(" "), 0, "f0");
michael@0 42 insertNodeAtPosnInElem(document.createTextNode(" "), 1, "f1");
michael@0 43
michael@0 44 // Inserting text or text with whitespace
michael@0 45 // --------------------------------------
michael@0 46 insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 0, "f2");
michael@0 47 insertNodeAtPosnInElem(document.createTextNode("[NewText] "), 0, "f3");
michael@0 48 insertNodeAtPosnInElem(document.createTextNode(" [NewText]"), 0, "f4");
michael@0 49 insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 1, "f5");
michael@0 50 insertNodeAtPosnInElem(document.createTextNode("[NewText] "), 1, "f6");
michael@0 51 insertNodeAtPosnInElem(document.createTextNode(" [NewText]"), 1, "f7");
michael@0 52
michael@0 53 // Same as the whitespace cases immediately above, but now with separate
michael@0 54 // text nodes for the whitespace vs. the text
michael@0 55 insertNodeAtPosnInElem(document.createTextNode(" "), 0, "f8");
michael@0 56 insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 0, "f8");
michael@0 57
michael@0 58 insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 0, "f9");
michael@0 59 insertNodeAtPosnInElem(document.createTextNode(" "), 0, "f9");
michael@0 60
michael@0 61 insertNodeAtPosnInElem(document.createTextNode(" "), 1, "f10");
michael@0 62 insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 1, "f10");
michael@0 63
michael@0 64 insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 1, "f11");
michael@0 65 insertNodeAtPosnInElem(document.createTextNode(" "), 1, "f11");
michael@0 66
michael@0 67 document.documentElement.removeAttribute("class");
michael@0 68 }
michael@0 69
michael@0 70 window.addEventListener("MozReftestInvalidate", tweak, false);
michael@0 71 </script>
michael@0 72 </head>
michael@0 73 <body>
michael@0 74 <div class="flexbox" id="f0">[OldText]</div>
michael@0 75 <div class="flexbox" id="f1">[OldText]</div>
michael@0 76 <div class="flexbox" id="f2">[OldText]</div>
michael@0 77 <div class="flexbox" id="f3">[OldText]</div>
michael@0 78 <div class="flexbox" id="f4">[OldText]</div>
michael@0 79 <div class="flexbox" id="f5">[OldText]</div>
michael@0 80 <div class="flexbox" id="f6">[OldText]</div>
michael@0 81 <div class="flexbox" id="f7">[OldText]</div>
michael@0 82 <div class="flexbox" id="f8">[OldText]</div>
michael@0 83 <div class="flexbox" id="f9">[OldText]</div>
michael@0 84 <div class="flexbox" id="f10">[OldText]</div>
michael@0 85 <div class="flexbox" id="f11">[OldText]</div>
michael@0 86 </body>
michael@0 87 </html>

mercurial