layout/reftests/flexbox/flexbox-dyn-insertEmptySpan-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-insertEmptySpan-1.xhtml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,103 @@
     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 a variant of flexbox-dyn-insertAroundText-3.xhtml with the
    1.11 +     inserted spans being empty & having padding. This triggered invalidation
    1.12 +     issues with an older work-in-progress patch, so I'm adding this reftest to
    1.13 +     track that issue & prevent it from regressing.
    1.14 +-->
    1.15 +<html xmlns="http://www.w3.org/1999/xhtml"
    1.16 +      class="reftest-wait">
    1.17 +  <head>
    1.18 +    <style>
    1.19 +      body { font-size: 10px; }
    1.20 +
    1.21 +      <!-- to make inserted span elements stand out -->
    1.22 +      span {
    1.23 +        background: teal;
    1.24 +        padding: 3px;
    1.25 +      }
    1.26 +
    1.27 +      div.flexbox {
    1.28 +        border: 1px dashed blue;
    1.29 +        width: 300px;
    1.30 +        display: flex;
    1.31 +        justify-content: space-around;
    1.32 +        margin-bottom: 1px;
    1.33 +        white-space: pre;
    1.34 +      }
    1.35 +    </style>
    1.36 +    <script>
    1.37 +      function insertNodeAtPosnInElem(aNodeToInsert, aPosn, aParentId) {
    1.38 +        var parent = document.getElementById(aParentId);
    1.39 +        var insertBeforeTarget = parent.firstChild;
    1.40 +        for (var i = 0; i &lt; aPosn; i++) {
    1.41 +          insertBeforeTarget = insertBeforeTarget.nextSibling;
    1.42 +        }
    1.43 +        parent.insertBefore(aNodeToInsert, insertBeforeTarget);
    1.44 +      }
    1.45 +
    1.46 +      function createSpanElem() {
    1.47 +        return document.createElement("span");
    1.48 +      }
    1.49 +
    1.50 +      function tweak() {
    1.51 +        // Inserting span, on either side of existing content
    1.52 +        // --------------------------------------------------
    1.53 +        insertNodeAtPosnInElem(createSpanElem(), 0, "f0");
    1.54 +        insertNodeAtPosnInElem(createSpanElem(), 1, "f1");
    1.55 +
    1.56 +        // Inserting span and whitespace, before existing content
    1.57 +        // ------------------------------------------------------
    1.58 +        insertNodeAtPosnInElem(document.createTextNode("  "), 0, "f2");
    1.59 +        insertNodeAtPosnInElem(createSpanElem(),              0, "f2");
    1.60 +
    1.61 +        insertNodeAtPosnInElem(createSpanElem(),              0, "f3");
    1.62 +        insertNodeAtPosnInElem(document.createTextNode("  "), 0, "f3");
    1.63 +
    1.64 +        // Inserting span and whitespace, after existing content
    1.65 +        // -----------------------------------------------------
    1.66 +        insertNodeAtPosnInElem(document.createTextNode("  "), 1, "f4");
    1.67 +        insertNodeAtPosnInElem(createSpanElem(),              1, "f4");
    1.68 +
    1.69 +        insertNodeAtPosnInElem(createSpanElem(),              1, "f5");
    1.70 +        insertNodeAtPosnInElem(document.createTextNode("  "), 1, "f5");
    1.71 +
    1.72 +        // Inserting span and text, before existing content
    1.73 +        // ------------------------------------------------
    1.74 +        insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 0, "f6");
    1.75 +        insertNodeAtPosnInElem(createSpanElem(),                     0, "f6");
    1.76 +
    1.77 +        insertNodeAtPosnInElem(createSpanElem(),                     0, "f7");
    1.78 +        insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 0, "f7");
    1.79 +
    1.80 +        // Inserting span and text, after existing content
    1.81 +        // -----------------------------------------------
    1.82 +        insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 1, "f8");
    1.83 +        insertNodeAtPosnInElem(createSpanElem(),                     1, "f8");
    1.84 +
    1.85 +        insertNodeAtPosnInElem(createSpanElem(),                     1, "f9");
    1.86 +        insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 1, "f9");
    1.87 +
    1.88 +        document.documentElement.removeAttribute("class");
    1.89 +      }
    1.90 +
    1.91 +      window.addEventListener("MozReftestInvalidate", tweak, false);
    1.92 +    </script>
    1.93 +  </head>
    1.94 +  <body>
    1.95 +    <div class="flexbox" id="f0">[orig]</div>
    1.96 +    <div class="flexbox" id="f1">[orig]</div>
    1.97 +    <div class="flexbox" id="f2">[orig]</div>
    1.98 +    <div class="flexbox" id="f3">[orig]</div>
    1.99 +    <div class="flexbox" id="f4">[orig]</div>
   1.100 +    <div class="flexbox" id="f5">[orig]</div>
   1.101 +    <div class="flexbox" id="f6">[orig]</div>
   1.102 +    <div class="flexbox" id="f7">[orig]</div>
   1.103 +    <div class="flexbox" id="f8">[orig]</div>
   1.104 +    <div class="flexbox" id="f9">[orig]</div>
   1.105 +  </body>
   1.106 +</html>

mercurial