[iOS] Implement idempotent mode for text autosizing
[WebKit-https.git] / LayoutTests / fast / text-autosizing / ios / idempotentmode / idempotent-autosizing-identity.html
1 <!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] -->
2 <html>
3 <head>
4 <meta name="viewport" content="width=device-width, initial-scale=1">
5 <script>
6 if (window.internals) {
7     window.internals.settings.setTextAutosizingEnabled(true);
8     window.internals.settings.setTextAutosizingUsesIdempotentMode(true);
9 }
10 </script>
11 <script src="../../../../resources/js-test-pre.js"></script>
12 </head>
13 <body>
14 <div style="background: green;"><span id="target" style="font-size: 12px;">Test</span></div>
15 <div style="background: green;"><span style="font-size: 12px;">Test</span></div>
16 <div style="background: green;"><span id="target2" style="font-size: 6px;">Test</span></div>
17 <div style="background: green;"><span style="font-size: 6px;">Test</span></div>
18 <script>
19 let target = document.getElementById("target");
20 target.offsetWidth;
21 let result = Number.parseInt(window.getComputedStyle(target).getPropertyValue("font-size"));
22 shouldBe("result", "12");
23
24 target = document.getElementById("target2");
25 target.offsetWidth;
26 result = Number.parseInt(window.getComputedStyle(target).getPropertyValue("font-size"));
27 shouldBe("result", "6");
28 </script>
29 <script src="../../../../resources/js-test-post.js"></script>
30 </body>
31 </html>