| OLD | NEW |
| (Empty) |
| 1 <!doctype html> | |
| 2 <head> | |
| 3 <title>line-box-contain: glyphs</title> | |
| 4 <style> | |
| 5 .test { -webkit-line-box-contain: glyphs; line-box-contain: glyphs; font: 64px/1
em Ahem; background-color:red; width:6em; overflow:hidden } | |
| 6 .goodline { color: green; line-height:12; border-top: 1px solid green; } | |
| 7 .contains-drop-cap::first-letter { font-size:36px; float:left; margin-right:2px;
-webkit-line-box-contain:glyphs; line-box-contain:glyphs } | |
| 8 </style> | |
| 9 </head> | |
| 10 <body> | |
| 11 You should see a green rectangle below. If you see any red, the test has failed
. | |
| 12 | |
| 13 <!-- | |
| 14 Ahem has 0.2em descent and 0.8em ascent, so 64px Ahem has 12.8px descent and
51.2px ascent. | |
| 15 Since we expand to enclosing integer points, the integer glyph bounds will b
e 65px tall. | |
| 16 As a result, we need 64px of text + 1px of extra border to fill the line box
. | |
| 17 This is not an elegant hack; sorry. | |
| 18 | |
| 19 Warning: this is very sensitive to changes in font code and may need adjustm
ent later. | |
| 20 --> | |
| 21 <div class="test"> | |
| 22 <span class="goodline">xxxxx</span><span style="background-color:green; font-siz
e:128px; padding-left:0.5em;"></span><br> | |
| 23 <div style="display:inline-block; width:1em;height:2em;vertical-align:bottom;bac
kground-color:green"></div><span class="goodline">xxxxx</span> | |
| 24 </div> | |
| 25 | |
| 26 <p style="-webkit-line-box-contain:glyphs;line-box-contain: glyphs; border:1px s
olid black">this block should hug the lowercase glyphs.</p> | |
| 27 | |
| 28 <p class="contains-drop-cap">The first letter here should look nicer because it
uses glyph bounds<br>This should make the top of the T | |
| 29 line up with the line and not look shifted down.<br> Maybe we should do this by
default for all first letters like Firefox does. | |
| 30 | |
| OLD | NEW |