| 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 style.lineHeight = "20px"; |
| 37 // We need all font longhands to build the shorthand. | 38 // We need all font longhands to build the shorthand. |
| 38 shouldBe("style.font", "''"); | 39 shouldBe("style.font", "''"); |
| 39 shouldBe("computedStyle.font", "'normal normal normal normal 20px / normal fooba
r'"); | 40 shouldBe("computedStyle.font", "'normal normal normal normal 20px / 20px foobar'
"); |
| 40 shouldBe("computedStyle.fontSize", "'20px'"); | 41 shouldBe("computedStyle.fontSize", "'20px'"); |
| 41 shouldBe("checkFontStyleValue()", "true"); | 42 shouldBe("checkFontStyleValue()", "true"); |
| 42 | 43 |
| 43 style.fontSize = "20px"; | 44 style.fontSize = "20px"; |
| 45 style.lineHeight = "20px"; |
| 44 style.fontFamily = "sans-serif"; | 46 style.fontFamily = "sans-serif"; |
| 45 shouldBe("style.font", "''"); | 47 shouldBe("style.font", "''"); |
| 46 shouldBe("computedStyle.font", "'normal normal normal normal 20px / normal sans-
serif'"); | 48 shouldBe("computedStyle.font", "'normal normal normal normal 20px / 20px sans-se
rif'"); |
| 47 shouldBe("computedStyle.fontFamily", "'sans-serif'"); | 49 shouldBe("computedStyle.fontFamily", "'sans-serif'"); |
| 48 | 50 |
| 49 style.fontStyle = "italic"; | 51 style.fontStyle = "italic"; |
| 50 shouldBe("style.font", "''"); | 52 shouldBe("style.font", "''"); |
| 51 shouldBe("computedStyle.font", "'italic normal normal normal 20px / normal sans-
serif'"); | 53 shouldBe("computedStyle.font", "'italic normal normal normal 20px / 20px sans-se
rif'"); |
| 52 shouldBe("computedStyle.fontStyle", "'italic'"); | 54 shouldBe("computedStyle.fontStyle", "'italic'"); |
| 53 | 55 |
| 54 style.fontVariant = "small-caps"; | 56 style.fontVariant = "small-caps"; |
| 55 shouldBe("style.font", "''"); | 57 shouldBe("style.font", "''"); |
| 56 shouldBe("computedStyle.font", "'italic small-caps normal normal 20px / normal s
ans-serif'"); | 58 shouldBe("computedStyle.font", "'italic small-caps normal normal 20px / 20px san
s-serif'"); |
| 57 shouldBe("computedStyle.fontVariant", "'small-caps'"); | 59 shouldBe("computedStyle.fontVariant", "'small-caps'"); |
| 58 | 60 |
| 59 style.fontWeight = "bold"; | 61 style.fontWeight = "bold"; |
| 60 shouldBe("style.font", "''"); | 62 shouldBe("style.font", "''"); |
| 61 shouldBe("computedStyle.font", "'italic small-caps bold normal 20px / normal san
s-serif'"); | 63 shouldBe("computedStyle.font", "'italic small-caps bold normal 20px / 20px sans-
serif'"); |
| 62 shouldBe("computedStyle.fontWeight", "'bold'"); | 64 shouldBe("computedStyle.fontWeight", "'bold'"); |
| 63 | 65 |
| 64 style.lineHeight = "40px"; | 66 style.lineHeight = "40px"; |
| 65 shouldBe("style.font", "''"); | 67 shouldBe("style.font", "''"); |
| 66 shouldBe("computedStyle.font", "'italic small-caps bold normal 20px / 40px sans-
serif'"); | 68 shouldBe("computedStyle.font", "'italic small-caps bold normal 20px / 40px sans-
serif'"); |
| 67 shouldBe("computedStyle.lineHeight", "'40px'"); | 69 shouldBe("computedStyle.lineHeight", "'40px'"); |
| 68 | 70 |
| 69 style.fontStretch = "ultra-expanded"; | 71 style.fontStretch = "ultra-expanded"; |
| 70 // All font longhands are set, therefore shorthand is built | 72 // All font longhands are set, therefore shorthand is built |
| 71 shouldBe("style.font", "'italic small-caps bold ultra-expanded 20px/40px sans-se
rif'"); | 73 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'"); | 74 shouldBe("computedStyle.font", "'italic small-caps bold ultra-expanded 20px / 40
px sans-serif'"); |
| 73 shouldBe("checkFontStyleValue()", "true"); | 75 shouldBe("checkFontStyleValue()", "true"); |
| 74 | 76 |
| 75 style.font = ""; | 77 style.font = ""; |
| 76 shouldBe("style.font", "''"); | 78 shouldBe("style.font", "''"); |
| 77 shouldBe("computedStyle.font", "'normal normal normal normal 16px / normal fooba
r'"); | 79 shouldBe("computedStyle.font", "'normal normal normal normal 16px / 20px foobar'
"); |
| 78 shouldBe("checkFontStyleValue()", "true"); | 80 shouldBe("checkFontStyleValue()", "true"); |
| 79 | 81 |
| 80 document.body.removeChild(testContainer); | 82 document.body.removeChild(testContainer); |
| 81 </script> | 83 </script> |
| 82 </body> | 84 </body> |
| 83 </html> | 85 </html> |
| OLD | NEW |