1 <?xml version=
"1.0" encoding=
"UTF-8"?>
3 Any copyright is dedicated to the Public Domain.
4 http://creativecommons.org/publicdomain/zero/1.0/
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.)
13 <html xmlns=
"http://www.w3.org/1999/xhtml"
22 background: teal; /* To make inserted div elements stand out. */
26 border:
1px dashed blue;
29 justify-content: space-around;
35 function insertNodeAtPosnInElem(aNodeToInsert, aPosn, aParentId) {
36 var parent = document.getElementById(aParentId);
37 var insertBeforeTarget = parent.firstChild;
38 for (var i =
0; i
< aPosn; i++) {
39 insertBeforeTarget = insertBeforeTarget.nextSibling;
41 parent.insertBefore(aNodeToInsert, insertBeforeTarget);
44 function createDivElem() {
45 var div = document.createElement(
"div");
46 div.setAttribute(
"class",
"inserted");
47 div.appendChild(document.createTextNode(
"[NewDiv]"));
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");
92 window.addEventListener(
"MozReftestInvalidate", tweak, false);
96 <div class=
"flexbox" id=
"f0"><span>[OldText]
</span></div>
97 <div class=
"flexbox" id=
"f1"><span>[OldText]
</span></div>
98 <div class=
"flexbox" id=
"f2"><span>[OldText]
</span></div>
99 <div class=
"flexbox" id=
"f3"><span>[OldText]
</span></div>
100 <div class=
"flexbox" id=
"f4"><span>[OldText]
</span></div>
101 <div class=
"flexbox" id=
"f5"><span>[OldText]
</span></div>
102 <div class=
"flexbox" id=
"f6"><span>[OldText]
</span></div>
103 <div class=
"flexbox" id=
"f7"><span>[OldText]
</span></div>
104 <div class=
"flexbox" id=
"f8"><span>[OldText]
</span></div>
105 <div class=
"flexbox" id=
"f9"><span>[OldText]
</span></div>