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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/reftests/flexbox/flexbox-dyn-insertAroundSpan-1.xhtml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,87 @@
     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 verifies that we reconstruct frames as necessary, after content
    1.11 +     (including whitespace & text) is dynamically inserted as a child of a
    1.12 +     flexbox.  (Note that in cases where we know the whitespace is going to be
    1.13 +     dropped, we don't bother reconstructing frames. This test is to be sure we
    1.14 +     aren't overzealous with that optimization.)
    1.15 +-->
    1.16 +<html xmlns="http://www.w3.org/1999/xhtml"
    1.17 +      class="reftest-wait">
    1.18 +  <head>
    1.19 +    <style>
    1.20 +      body { font-size: 10px; }
    1.21 +
    1.22 +      div.flexbox {
    1.23 +        border: 1px dashed blue;
    1.24 +        width: 300px;
    1.25 +        display: flex;
    1.26 +        justify-content: space-around;
    1.27 +        margin-bottom: 1px;
    1.28 +        white-space: pre;
    1.29 +      }
    1.30 +    </style>
    1.31 +    <script>
    1.32 +      function insertNodeAtPosnInElem(aNodeToInsert, aPosn, aParentId) {
    1.33 +        var parent = document.getElementById(aParentId);
    1.34 +        var insertBeforeTarget = parent.firstChild;
    1.35 +        for (var i = 0; i &lt; aPosn; i++) {
    1.36 +          insertBeforeTarget = insertBeforeTarget.nextSibling;
    1.37 +        }
    1.38 +        parent.insertBefore(aNodeToInsert, insertBeforeTarget);
    1.39 +      }
    1.40 +
    1.41 +      function tweak() {
    1.42 +        // Just inserting whitespace
    1.43 +        // -------------------------
    1.44 +        insertNodeAtPosnInElem(document.createTextNode("  "), 0, "f0");
    1.45 +        insertNodeAtPosnInElem(document.createTextNode("  "), 1, "f1");
    1.46 +
    1.47 +        // Inserting text or text with whitespace
    1.48 +        // --------------------------------------
    1.49 +        insertNodeAtPosnInElem(document.createTextNode("[NewText]"),   0, "f2");
    1.50 +        insertNodeAtPosnInElem(document.createTextNode("[NewText]  "), 0, "f3");
    1.51 +        insertNodeAtPosnInElem(document.createTextNode("  [NewText]"), 0, "f4");
    1.52 +        insertNodeAtPosnInElem(document.createTextNode("[NewText]"),   1, "f5");
    1.53 +        insertNodeAtPosnInElem(document.createTextNode("[NewText]  "), 1, "f6");
    1.54 +        insertNodeAtPosnInElem(document.createTextNode("  [NewText]"), 1, "f7");
    1.55 +
    1.56 +        // Same as the whitespace cases immediately above, but now with separate
    1.57 +        // text nodes for the whitespace vs. the text
    1.58 +        insertNodeAtPosnInElem(document.createTextNode("  "),        0, "f8");
    1.59 +        insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 0, "f8");
    1.60 +
    1.61 +        insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 0, "f9");
    1.62 +        insertNodeAtPosnInElem(document.createTextNode("  "),        0, "f9");
    1.63 +
    1.64 +        insertNodeAtPosnInElem(document.createTextNode("  "),        1, "f10");
    1.65 +        insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 1, "f10");
    1.66 +
    1.67 +        insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 1, "f11");
    1.68 +        insertNodeAtPosnInElem(document.createTextNode("  "),        1, "f11");
    1.69 +
    1.70 +        document.documentElement.removeAttribute("class");
    1.71 +      }
    1.72 +
    1.73 +      window.addEventListener("MozReftestInvalidate", tweak, false);
    1.74 +    </script>
    1.75 +  </head>
    1.76 +  <body>
    1.77 +    <div class="flexbox" id="f0"><span>[OldText]</span></div>
    1.78 +    <div class="flexbox" id="f1"><span>[OldText]</span></div>
    1.79 +    <div class="flexbox" id="f2"><span>[OldText]</span></div>
    1.80 +    <div class="flexbox" id="f3"><span>[OldText]</span></div>
    1.81 +    <div class="flexbox" id="f4"><span>[OldText]</span></div>
    1.82 +    <div class="flexbox" id="f5"><span>[OldText]</span></div>
    1.83 +    <div class="flexbox" id="f6"><span>[OldText]</span></div>
    1.84 +    <div class="flexbox" id="f7"><span>[OldText]</span></div>
    1.85 +    <div class="flexbox" id="f8"><span>[OldText]</span></div>
    1.86 +    <div class="flexbox" id="f9"><span>[OldText]</span></div>
    1.87 +    <div class="flexbox" id="f10"><span>[OldText]</span></div>
    1.88 +    <div class="flexbox" id="f11"><span>[OldText]</span></div>
    1.89 +  </body>
    1.90 +</html>

mercurial