scrollable-overflow-transform-dynamic-004.html (2268B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <meta name="viewport" content="width=device-width,initial-scale=1"> 4 <title>CSS Overflow: Scrollable Overflow Transform Dynamic Position Change</title> 5 <link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com"> 6 <link rel="help" href="https://drafts.csswg.org/css-overflow-3/#scrollable" /> 7 <meta name="assert" content="Checks that changes on an element's transform contribute to the scrollable overflow, even when some element has changed position too."> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <style> 11 .container { 12 position: absolute; 13 width: 100px; 14 height: 100px; 15 overflow: auto; 16 background: silver; 17 border: solid thick; 18 } 19 20 .element { 21 width: 50px; 22 height: 50px; 23 background: lime; 24 } 25 </style> 26 27 <div id="container1" style="top: 100px;" class="container"> 28 <div id="element1" style="transform: translateX(20px);" class="element"></div> 29 </div> 30 31 <div id="container2" style="top: 250px;" class="container"> 32 <div id="element2" style="transform: translateY(30px);" class="element"></div> 33 </div> 34 35 <div id="container3" style="top: 400px;" class="container"> 36 <div id="element3" style="transform: translate(20px, 30px);" class="element"></div> 37 </div> 38 39 <script> 40 test(() => { 41 assert_equals(container1.scrollWidth, 100); 42 container1.style.top = "110px"; 43 element1.style.transform = "translateX(200px)"; 44 assert_equals(container1.scrollWidth, 250); 45 }, "Check scrollWidth before and after position and transform chage"); 46 47 test(() => { 48 assert_equals(container2.scrollHeight, 100); 49 container2.style.top = "260px"; 50 element2.style.transform = "translateY(300px)"; 51 assert_equals(container2.scrollHeight, 350); 52 }, "Check scrollHeight before and after position and transform chage"); 53 54 test(() => { 55 assert_equals(container3.scrollWidth, 100); 56 assert_equals(container3.scrollHeight, 100); 57 container3.style.top = "410px"; 58 element3.style.transform = "translate(200px, 300px)"; 59 assert_equals(container3.scrollWidth, 250); 60 assert_equals(container3.scrollHeight, 350); 61 }, "Check scrollWidth and scrollHeight after position and transform chage"); 62 </script>