diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /layout/reftests/flexbox/flexbox-dyn-insertAroundDiv-1.xhtml | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | layout/reftests/flexbox/flexbox-dyn-insertAroundDiv-1.xhtml | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/layout/reftests/flexbox/flexbox-dyn-insertAroundDiv-1.xhtml b/layout/reftests/flexbox/flexbox-dyn-insertAroundDiv-1.xhtml new file mode 100644 index 0000000000..e271f4fb3e --- /dev/null +++ b/layout/reftests/flexbox/flexbox-dyn-insertAroundDiv-1.xhtml @@ -0,0 +1,87 @@ +<?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 & text) 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; } + + 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 < aPosn; i++) { + insertBeforeTarget = insertBeforeTarget.nextSibling; + } + parent.insertBefore(aNodeToInsert, insertBeforeTarget); + } + + function tweak() { + // Just inserting whitespace + // ------------------------- + insertNodeAtPosnInElem(document.createTextNode(" "), 0, "f0"); + insertNodeAtPosnInElem(document.createTextNode(" "), 1, "f1"); + + // Inserting text or text with whitespace + // -------------------------------------- + insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 0, "f2"); + insertNodeAtPosnInElem(document.createTextNode("[NewText] "), 0, "f3"); + insertNodeAtPosnInElem(document.createTextNode(" [NewText]"), 0, "f4"); + insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 1, "f5"); + insertNodeAtPosnInElem(document.createTextNode("[NewText] "), 1, "f6"); + insertNodeAtPosnInElem(document.createTextNode(" [NewText]"), 1, "f7"); + + // Same as the whitespace cases immediately above, but now with separate + // text nodes for the whitespace vs. the text + insertNodeAtPosnInElem(document.createTextNode(" "), 0, "f8"); + insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 0, "f8"); + + insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 0, "f9"); + insertNodeAtPosnInElem(document.createTextNode(" "), 0, "f9"); + + insertNodeAtPosnInElem(document.createTextNode(" "), 1, "f10"); + insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 1, "f10"); + + insertNodeAtPosnInElem(document.createTextNode("[NewText]"), 1, "f11"); + insertNodeAtPosnInElem(document.createTextNode(" "), 1, "f11"); + + 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> + <div class="flexbox" id="f10"><div>[OldText]</div></div> + <div class="flexbox" id="f11"><div>[OldText]</div></div> + </body> +</html> |