Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: LayoutTests/fast/exclusions/shape-inside/shape-inside-polygon-layout.html

Issue 14959014: [CSS Exclusions] Programmatic layout tests fail when subpixel layout is disabled (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../js/resources/js-test-pre.js"></script> 4 <script src="../../js/resources/js-test-pre.js"></script>
5 <script src="../resources/subpixel-utils.js"></script>
5 <script> 6 <script>
6 if (window.internals) 7 if (window.internals)
7 window.internals.settings.setCSSExclusionsEnabled(true); 8 window.internals.settings.setCSSExclusionsEnabled(true);
8 </script> 9 </script>
9 <style> 10 <style>
10 #shape-inside { 11 #shape-inside {
11 position: relative; 12 position: relative;
12 width: 594px; 13 width: 594px;
13 height: 500px; 14 height: 500px;
14 -webkit-shape-inside: polygon(1.58% 1.42%, 99.42% 1.42%, 98.83% 33.33%, 50.67% 34.08%, 99.50% 66.62%, 98.83% 99.48%, 2.25% 99.07%); 15 -webkit-shape-inside: polygon(1.58% 1.42%, 99.42% 1.42%, 98.83% 33.33%, 50.67% 34.08%, 99.50% 66.62%, 98.83% 99.48%, 2.25% 99.07%);
(...skipping 25 matching lines...) Expand all
40 <div id="console"></div> 41 <div id="console"></div>
41 </body> 42 </body>
42 <script> 43 <script>
43 function shapeInsideRect(elementId) 44 function shapeInsideRect(elementId)
44 { 45 {
45 var s = document.getElementById("shape-inside").getBoundingClientRect(); 46 var s = document.getElementById("shape-inside").getBoundingClientRect();
46 var r = document.getElementById(elementId).getBoundingClientRect(); 47 var r = document.getElementById(elementId).getBoundingClientRect();
47 return {left: r.left - s.left, top: r.top - s.top, width: r.width, height: r.height}; 48 return {left: r.left - s.left, top: r.top - s.top, width: r.width, height: r.height};
48 } 49 }
49 50
50 /* Verify that all four one-character lines are vertically adjacent and 15 pix els high. */ 51 // The top of the polygon is a horzontal edge at y=1.42%, and its parent's hei ght is 500px. The top of
51 shouldBe("shapeInsideRect('a').top", "7"); 52 // the first line, span "a", will align with the top of the polygon. The Exclu sionShape::firstIncludedIntervalLogicalTop()
52 shouldBe("shapeInsideRect('b').top", "22"); 53 // methods use ceiledLayoutUnit() to ensure that their return value is within the shape.
53 shouldBe("shapeInsideRect('c').top", "37"); 54
54 shouldBe("shapeInsideRect('d').top", "52"); 55 var lineATop = Math.floor(SubPixelLayout.ceilSnapToLayoutUnit(.0142 * 500));
56
57 // Verify that all four one-character lines are vertically adjacent and 15 pix els high.
58 var quiet = true; // PASS output depends on SubPixelLayout.isEnabled()
59 shouldBe("shapeInsideRect('a').top", String(lineATop), quiet);
60 shouldBe("shapeInsideRect('b').top", String(lineATop + 15), quiet);
61 shouldBe("shapeInsideRect('c').top", String(lineATop + 30), quiet);
62 shouldBe("shapeInsideRect('d').top", String(lineATop + 45), quiet);
55 </script> 63 </script>
56 </html> 64 </html>
57
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698