| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../resources/subpixel-utils.js"></script> | |
| 5 <style> | |
| 6 #shape-inside { | |
| 7 position: relative; | |
| 8 } | |
| 9 | |
| 10 #shape-outline { | |
| 11 position: absolute; | |
| 12 top: 0px; | |
| 13 left: 0px; | |
| 14 width: 400px; | |
| 15 height: 400px; | |
| 16 } | |
| 17 | |
| 18 /* The size of a square that just fits within a circle of radius r is r * sq
rt(2). In this | |
| 19 case that's the size of one Ahem character: 100 * sqrt(2) == 141.42. | |
| 20 | |
| 21 The left and top edges of a square that just fits within a circle of radi
us r are offset | |
| 22 by r - (r * sqrt(2)) / 2, which is 29.289 for r = 100. The center of the
circle is at 200,200 | |
| 23 so the top and left edges of the square are 129.289. | |
| 24 */ | |
| 25 #shape-content { | |
| 26 position: absolute; | |
| 27 top: 129.289px; | |
| 28 left: 129.289px; | |
| 29 font: 141.42px/1 Ahem, sans-serif; | |
| 30 color: green; | |
| 31 } | |
| 32 </style> | |
| 33 </head> | |
| 34 <body> | |
| 35 <div id="shape-inside"> | |
| 36 <div id="shape-content">X</div> | |
| 37 <svg id="shape-outline" xmlns="http://www.w3.org/2000/svg"> | |
| 38 <circle cx="200" cy="200" r="100" stroke="blue" fill="none"/> | |
| 39 </svg> | |
| 40 </div> | |
| 41 </body> | |
| 42 | |
| 43 <script> | |
| 44 // The ExclusionShape::firstIncludedIntervalLogicalTop() methods use ceiledLayou
tUnit() to ensure that their | |
| 45 // return value is within the shape. If subpixel layout is disabled, that's the
same as just ceil(), which | |
| 46 // move the top of the "shape-content" div to ceil(129.289) = 130. | |
| 47 if (!SubPixelLayout.isEnabled()) | |
| 48 document.getElementById("shape-content").style.top = "130px"; | |
| 49 </script> | |
| 50 | |
| 51 </html> | |
| OLD | NEW |