cursor-calc-hotspot.html (1404B)
1 <!DOCTYPE html> 2 <title>CSS UI Test: Allow complex calc expressions in cursor hotspot</title> 3 <link rel="help" href="https://drafts.csswg.org/css-ui/#cursor"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <style> 7 #t1 { 8 font-size: 20px; 9 cursor: url(data:image/x-icon,) calc(7 * sign(1em - 18px)) 0, auto; 10 } 11 #t2 { 12 cursor: url(data:image/x-icon,) calc(4 * sibling-index()) 0, auto; 13 } 14 #t3 { 15 cursor: url(data:image/x-icon,) calc(9) 0, auto; 16 } 17 #t4 { 18 cursor: url(data:image/x-icon,) calc(10 * sign(2px)) 0, auto; 19 } 20 </style> 21 <div> 22 <div id="t1"></div> 23 <div id="t2"></div> 24 <div id="t3"></div> 25 <div id="t4"></div> 26 </div> 27 <script> 28 test(() => { 29 assert_equals(getComputedStyle(t1).cursor, 'url("data:image/x-icon,") 7 0, auto'); 30 }, "cursor hotspot with sign() depending on font relative units"); 31 32 test(() => { 33 assert_equals(getComputedStyle(t2).cursor, 'url("data:image/x-icon,") 8 0, auto'); 34 }, "cursor hotspot depending on sibling-index()"); 35 36 test(() => { 37 assert_equals(getComputedStyle(t3).cursor, 'url("data:image/x-icon,") 9 0, auto'); 38 }, "cursor hotspot depending on simplified numeric calc()"); 39 40 test(() => { 41 assert_equals(getComputedStyle(t4).cursor, 'url("data:image/x-icon,") 10 0, auto'); 42 }, "cursor hotspot depending on simplified numeric calc() with sign()"); 43 </script>