auto merge of #1436 : SimonSapin/servo/font-size-em, r=kmcallister

Font-based units in the font-size property refer to the font-size of the parent, not itself.
This commit is contained in:
bors-servo 2013-12-20 15:31:06 -08:00
commit acdc0e1afa
5 changed files with 46 additions and 1 deletions

View file

@ -1140,7 +1140,12 @@ pub fn cascade(applicable_declarations: &[Arc<~[PropertyDeclaration]>],
% for style_struct, longhands in LONGHANDS_PER_STYLE_STRUCT:
${style_struct}: style_structs::${style_struct} {
% for longhand in longhands:
${longhand.ident}: get_computed!(${style_struct}, ${longhand.ident}),
${longhand.ident}:
% if longhand.ident == 'font_size':
context.font_size,
% else:
get_computed!(${style_struct}, ${longhand.ident}),
% endif
% endfor
},
% endfor

View file

@ -19,3 +19,5 @@
== acid1_a.html acid1_b.html
== text_decoration_propagation_a.html text_decoration_propagation_b.html
== inline_text_align_a.html inline_text_align_b.html
== font_size_em.html font_size_em_ref.html
== font_size_percentage.html font_size_em_ref.html

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>font-size: 2em (Bug #1435)</title>
<style type="text/css">
body { font-size: 20px; }
p { font-size: 2em; }
</style>
</head>
<body>
<p>This text should be 40px high.</p>
</body>
</html>

View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>font-size: 2em (Bug #1435)</title>
<style type="text/css">
p { font-size: 40px; }
</style>
</head>
<body>
<p>This text should be 40px high.</p>
</body>
</html>

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>font-size: 200% (Bug #1435)</title>
<style type="text/css">
body { font-size: 20px }
p { font-size: 200%; }
</style>
</head>
<body>
<p>This text should be 40px high.</p>
</body>
</html>