summaryrefslogtreecommitdiffstats
path: root/layout/reftests/flexbox/flexbox-dyn-insertAroundDiv-2.xhtml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /layout/reftests/flexbox/flexbox-dyn-insertAroundDiv-2.xhtml
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/reftests/flexbox/flexbox-dyn-insertAroundDiv-2.xhtml')
-rw-r--r--layout/reftests/flexbox/flexbox-dyn-insertAroundDiv-2.xhtml104
1 files changed, 104 insertions, 0 deletions
diff --git a/layout/reftests/flexbox/flexbox-dyn-insertAroundDiv-2.xhtml b/layout/reftests/flexbox/flexbox-dyn-insertAroundDiv-2.xhtml
new file mode 100644
index 0000000000..b083ccd5f9
--- /dev/null
+++ b/layout/reftests/flexbox/flexbox-dyn-insertAroundDiv-2.xhtml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!--
+ This test verifies that we reconstruct frames as necessary, after content
+ (including whitespace & divs) is dynamically inserted as a child of a
+ flexbox. (Note that in cases where we know the whitespace is going to be
+ dropped, we don't bother reconstructing frames. This test is to be sure we
+ aren't overzealous with that optimization.)
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ class="reftest-wait">
+ <head>
+ <style>
+ body { font-size: 10px; }
+
+ <!-- to make inserted div elements stand out -->
+ div.inserted { background: teal; }
+
+ div.flexbox {
+ border: 1px dashed blue;
+ width: 300px;
+ display: flex;
+ justify-content: space-around;
+ margin-bottom: 1px;
+ white-space: pre;
+ }
+ </style>
+ <script>
+ function insertNodeAtPosnInElem(aNodeToInsert, aPosn, aParentId) {
+ var parent = document.getElementById(aParentId);
+ var insertBeforeTarget = parent.firstChild;
+ for (var i = 0; i &lt; aPosn; i++) {
+ insertBeforeTarget = insertBeforeTarget.nextSibling;
+ }
+ parent.insertBefore(aNodeToInsert, insertBeforeTarget);
+ }
+
+ function createDivElem() {
+ var div = document.createElement("div");
+ div.setAttribute("class", "inserted");
+ div.appendChild(document.createTextNode("[NewDiv]"));
+ return div;
+ }
+
+ function tweak() {
+ // Inserting div, adjacent to inline content
+ // -----------------------------------------
+ insertNodeAtPosnInElem(createDivElem(), 0, "f0");
+ insertNodeAtPosnInElem(createDivElem(), 1, "f1");
+
+ // Inserting div and whitespace, before inline content
+ // ---------------------------------------------------
+ insertNodeAtPosnInElem(document.createTextNode(" "), 0, "f2");
+ insertNodeAtPosnInElem(createDivElem(), 0, "f2");
+
+ insertNodeAtPosnInElem(createDivElem(), 0, "f3");
+ insertNodeAtPosnInElem(document.createTextNode(" "), 0, "f3");
+
+ // Inserting div and whitespace, after inline content
+ // ---------------------------------------------------
+ insertNodeAtPosnInElem(document.createTextNode(" "), 1, "f4");
+ insertNodeAtPosnInElem(createDivElem(), 1, "f4");
+
+ insertNodeAtPosnInElem(createDivElem(), 1, "f5");
+ insertNodeAtPosnInElem(document.createTextNode(" "), 1, "f5");
+
+ // Inserting div and text, before inline content
+ // ---------------------------------------------------
+ insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 0, "f6");
+ insertNodeAtPosnInElem(createDivElem(), 0, "f6");
+
+ insertNodeAtPosnInElem(createDivElem(), 0, "f7");
+ insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 0, "f7");
+
+ // Inserting div and text, after inline content
+ // ---------------------------------------------------
+ insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 1, "f8");
+ insertNodeAtPosnInElem(createDivElem(), 1, "f8");
+
+ insertNodeAtPosnInElem(createDivElem(), 1, "f9");
+ insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 1, "f9");
+
+ document.documentElement.removeAttribute("class");
+ }
+
+ window.addEventListener("MozReftestInvalidate", tweak, false);
+ </script>
+ </head>
+ <body>
+ <div class="flexbox" id="f0"><div>[OldText]</div></div>
+ <div class="flexbox" id="f1"><div>[OldText]</div></div>
+ <div class="flexbox" id="f2"><div>[OldText]</div></div>
+ <div class="flexbox" id="f3"><div>[OldText]</div></div>
+ <div class="flexbox" id="f4"><div>[OldText]</div></div>
+ <div class="flexbox" id="f5"><div>[OldText]</div></div>
+ <div class="flexbox" id="f6"><div>[OldText]</div></div>
+ <div class="flexbox" id="f7"><div>[OldText]</div></div>
+ <div class="flexbox" id="f8"><div>[OldText]</div></div>
+ <div class="flexbox" id="f9"><div>[OldText]</div></div>
+ </body>
+</html>