test_reframe_cb.html (1742B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title> 4 Test for bug 1519371: We don't reframe for changes that affect our containing 5 block status unless whether we're a containing block really changed. 6 </title> 7 <link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez"> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <div id="content"></div> 10 <script> 11 SimpleTest.waitForExplicitFinish(); 12 const utils = SpecialPowers.getDOMWindowUtils(window); 13 14 function expectReframe(shouldHaveReframed, callback) { 15 document.documentElement.offsetTop; 16 const previousConstructCount = utils.framesConstructed; 17 const previousRestyleGeneration = utils.restyleGeneration; 18 19 callback(); 20 21 document.documentElement.offsetTop; 22 isnot(previousRestyleGeneration, utils.restyleGeneration, 23 "We should have restyled"); 24 (shouldHaveReframed ? isnot : is)(previousConstructCount, 25 utils.framesConstructed, 26 `We should ${shouldHaveReframed ? "" : "not"} have reframed`); 27 } 28 29 const content = document.getElementById("content"); 30 31 // Without fixed-pos descendants, we should not reframe. 32 expectReframe(false, () => { 33 content.style.transform = "scale(1)"; 34 }); 35 36 content.style.transform = ""; 37 content.innerHTML = `<div style="position: fixed"></div>`; 38 39 // With fixed-pos descendants, got to reframe. 40 expectReframe(true, () => { 41 content.style.transform = "scale(1)"; 42 }); 43 44 // If our containing-block-ness didn't change, we should not need to reframe. 45 expectReframe(false, () => { 46 content.style.willChange = "transform"; 47 }); 48 49 // If it does change, we need to reframe. 50 expectReframe(true, () => { 51 content.style.willChange = ""; 52 content.style.transform = ""; 53 }); 54 55 SimpleTest.finish(); 56 </script>