| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <style> | 4 <style> |
| 5 @font-face { | 5 @font-face { |
| 6 font-family: "foobar"; | 6 font-family: "foobar"; |
| 7 src: local("foobar"); | 7 src: local("foobar"); |
| 8 } | 8 } |
| 9 div { | 9 div { |
| 10 font-family: "foobar"; | 10 font-family: "foobar"; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 // This function checks the return value of style.font and verifies WebKit can p
arse it. | 28 // This function checks the return value of style.font and verifies WebKit can p
arse it. |
| 29 function checkFontStyleValue() { | 29 function checkFontStyleValue() { |
| 30 var before = e.style.getPropertyValue('font'); | 30 var before = e.style.getPropertyValue('font'); |
| 31 e.style.font = ''; | 31 e.style.font = ''; |
| 32 e.style.font = before; | 32 e.style.font = before; |
| 33 return (e.style.getPropertyValue('font') === before); | 33 return (e.style.getPropertyValue('font') === before); |
| 34 } | 34 } |
| 35 | 35 |
| 36 style.fontSize = "20px"; | 36 style.fontSize = "20px"; |
| 37 // We need at least the font-family to build the shorthand. | 37 // We need all font longhands to build the shorthand. |
| 38 shouldBe("style.font", "''"); | 38 shouldBe("style.font", "''"); |
| 39 shouldBe("computedStyle.font", "'normal normal normal normal 20px / normal fooba
r'"); | 39 shouldBe("computedStyle.font", "'normal normal normal normal 20px / normal fooba
r'"); |
| 40 shouldBe("computedStyle.fontSize", "'20px'"); | 40 shouldBe("computedStyle.fontSize", "'20px'"); |
| 41 shouldBe("checkFontStyleValue()", "true"); | 41 shouldBe("checkFontStyleValue()", "true"); |
| 42 | 42 |
| 43 style.fontSize = "20px"; | 43 style.fontSize = "20px"; |
| 44 style.fontFamily = "sans-serif"; | 44 style.fontFamily = "sans-serif"; |
| 45 shouldBe("style.font", "'20px sans-serif'"); | 45 shouldBe("style.font", "''"); |
| 46 shouldBe("computedStyle.font", "'normal normal normal normal 20px / normal sans-
serif'"); | 46 shouldBe("computedStyle.font", "'normal normal normal normal 20px / normal sans-
serif'"); |
| 47 shouldBe("computedStyle.fontFamily", "'sans-serif'"); | 47 shouldBe("computedStyle.fontFamily", "'sans-serif'"); |
| 48 shouldBe("checkFontStyleValue()", "true"); | |
| 49 | 48 |
| 50 style.fontStyle = "italic"; | 49 style.fontStyle = "italic"; |
| 51 shouldBe("style.font", "'italic 20px sans-serif'"); | 50 shouldBe("style.font", "''"); |
| 52 shouldBe("computedStyle.font", "'italic normal normal normal 20px / normal sans-
serif'"); | 51 shouldBe("computedStyle.font", "'italic normal normal normal 20px / normal sans-
serif'"); |
| 53 shouldBe("computedStyle.fontStyle", "'italic'"); | 52 shouldBe("computedStyle.fontStyle", "'italic'"); |
| 54 shouldBe("checkFontStyleValue()", "true"); | |
| 55 | 53 |
| 56 style.fontVariant = "small-caps"; | 54 style.fontVariant = "small-caps"; |
| 57 shouldBe("style.font", "'italic small-caps 20px sans-serif'"); | 55 shouldBe("style.font", "''"); |
| 58 shouldBe("computedStyle.font", "'italic small-caps normal normal 20px / normal s
ans-serif'"); | 56 shouldBe("computedStyle.font", "'italic small-caps normal normal 20px / normal s
ans-serif'"); |
| 59 shouldBe("computedStyle.fontVariant", "'small-caps'"); | 57 shouldBe("computedStyle.fontVariant", "'small-caps'"); |
| 60 shouldBe("checkFontStyleValue()", "true"); | |
| 61 | 58 |
| 62 style.fontWeight = "bold"; | 59 style.fontWeight = "bold"; |
| 63 shouldBe("style.font", "'italic small-caps bold 20px sans-serif'"); | 60 shouldBe("style.font", "''"); |
| 64 shouldBe("computedStyle.font", "'italic small-caps bold normal 20px / normal san
s-serif'"); | 61 shouldBe("computedStyle.font", "'italic small-caps bold normal 20px / normal san
s-serif'"); |
| 65 shouldBe("computedStyle.fontWeight", "'bold'"); | 62 shouldBe("computedStyle.fontWeight", "'bold'"); |
| 66 shouldBe("checkFontStyleValue()", "true"); | |
| 67 | 63 |
| 68 style.lineHeight = "40px"; | 64 style.lineHeight = "40px"; |
| 69 shouldBe("style.font", "'italic small-caps bold 20px/40px sans-serif'"); | 65 shouldBe("style.font", "''"); |
| 70 shouldBe("computedStyle.font", "'italic small-caps bold normal 20px / 40px sans-
serif'"); | 66 shouldBe("computedStyle.font", "'italic small-caps bold normal 20px / 40px sans-
serif'"); |
| 71 shouldBe("computedStyle.lineHeight", "'40px'"); | 67 shouldBe("computedStyle.lineHeight", "'40px'"); |
| 68 |
| 69 style.fontStretch = "ultra-expanded"; |
| 70 // All font longhands are set, therefore shorthand is built |
| 71 shouldBe("style.font", "'italic small-caps bold ultra-expanded 20px/40px sans-se
rif'"); |
| 72 shouldBe("computedStyle.font", "'italic small-caps bold ultra-expanded 20px / 40
px sans-serif'"); |
| 72 shouldBe("checkFontStyleValue()", "true"); | 73 shouldBe("checkFontStyleValue()", "true"); |
| 73 | 74 |
| 74 style.font = ""; | 75 style.font = ""; |
| 75 shouldBe("style.font", "''"); | 76 shouldBe("style.font", "''"); |
| 76 shouldBe("computedStyle.font", "'normal normal normal normal 16px / normal fooba
r'"); | 77 shouldBe("computedStyle.font", "'normal normal normal normal 16px / normal fooba
r'"); |
| 77 shouldBe("checkFontStyleValue()", "true"); | 78 shouldBe("checkFontStyleValue()", "true"); |
| 78 | 79 |
| 79 style.fontWeight = "bold"; | |
| 80 // It is normal to return null as the font-size is mandatory to build the shorth
and. | |
| 81 shouldBe("style.font", "''"); | |
| 82 shouldBe("computedStyle.font", "'normal normal bold normal 16px / normal foobar'
"); | |
| 83 shouldBe("computedStyle.fontWeight", "'bold'"); | |
| 84 shouldBe("checkFontStyleValue()", "true"); | |
| 85 | |
| 86 style.fontSize = "40px"; | |
| 87 style.fontFamily = "sans-serif"; | |
| 88 style.fontWeight = "bold"; | |
| 89 shouldBe("style.font", "'bold 40px sans-serif'"); | |
| 90 shouldBe("computedStyle.font", "'normal normal bold normal 40px / normal sans-se
rif'"); | |
| 91 shouldBe("computedStyle.fontSize", "'40px'"); | |
| 92 shouldBe("computedStyle.fontFamily", "'sans-serif'"); | |
| 93 shouldBe("checkFontStyleValue()", "true"); | |
| 94 | |
| 95 document.body.removeChild(testContainer); | 80 document.body.removeChild(testContainer); |
| 96 </script> | 81 </script> |
| 97 </body> | 82 </body> |
| 98 </html> | 83 </html> |
| OLD | NEW |