// The elements that we will modify here:
const gTall = document.getElementById("tall");
const gTestNode = document.getElementById("testNode");
// Helper function to undo our modifications:
function cleanup()
{
gTall.firstChild.remove();
gTestNode.style = "";
}
// Flush layout & return the global frame-reflow-count
function getReflowCount()
{
let unusedVal = document.getElementById("flex").offsetHeight; // flush layout
return gUtils.framesReflowed;
}
// This function changes gTestNode to "display:none", and returns the number
// of frames that need to be reflowed as a result of that tweak.
function makeTweakAndCountReflows()
{
let beforeCount = getReflowCount();
gTestNode.style.display = "none";
let afterCount = getReflowCount();
let numReflows = afterCount - beforeCount;
if (numReflows <= 0) {
ok(false, "something's wrong -- we should've reflowed *something*");
}
return numReflows;
}
// ACTUAL TEST LOGIC STARTS HERE
// -----------------------------
const testLineCount = 100;
const refLineCount = 5000;
// "Reference" measurement: put enough lines of text into gTall to trigger
// a vertical scrollbar, and then see how many frames need to be reflowed
// in response to a tweak in gTestNode:
let text = document.createTextNode("a\n".repeat(testLineCount));
gTall.appendChild(text);
let numReferenceReflows = makeTweakAndCountReflows();
cleanup();
// "Test" measurement: put many more lines of text into gTall (many more than
// for reference case), and then see how many frames need to be reflowed
// in response to a tweak in gTestNode:
text = document.createTextNode("a\n".repeat(refLineCount));
gTall.appendChild(text);
let numTestReflows = makeTweakAndCountReflows();
cleanup();
is(numTestReflows, numReferenceReflows, "Tweak should trigger the same number of reflows regardless of " + "how much content is present in descendant of sibling");
</script>
</pre>
</body>
</html>
Messung V0.5
¤ Dauer der Verarbeitung: 0.26 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.