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

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

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

mercurial