Permalink
Switch branches/tags
merge_pr_14021 merge_pr_14019 merge_pr_14018 merge_pr_14016 merge_pr_14015 merge_pr_14011 merge_pr_14010 merge_pr_14009 merge_pr_14008 merge_pr_14007 merge_pr_14006 merge_pr_14004 merge_pr_14001 merge_pr_14000 merge_pr_13997 merge_pr_13996 merge_pr_13995 merge_pr_13994 merge_pr_13993 merge_pr_13992 merge_pr_13988 merge_pr_13987 merge_pr_13986 merge_pr_13985 merge_pr_13983 merge_pr_13981 merge_pr_13980 merge_pr_13979 merge_pr_13978 merge_pr_13977 merge_pr_13974 merge_pr_13969 merge_pr_13968 merge_pr_13967 merge_pr_13962 merge_pr_13961 merge_pr_13960 merge_pr_13959 merge_pr_13958 merge_pr_13957 merge_pr_13955 merge_pr_13954 merge_pr_13953 merge_pr_13952 merge_pr_13950 merge_pr_13949 merge_pr_13948 merge_pr_13947 merge_pr_13945 merge_pr_13944 merge_pr_13943 merge_pr_13942 merge_pr_13941 merge_pr_13940 merge_pr_13939 merge_pr_13938 merge_pr_13935 merge_pr_13934 merge_pr_13933 merge_pr_13932 merge_pr_13930 merge_pr_13929 merge_pr_13927 merge_pr_13925 merge_pr_13921 merge_pr_13920 merge_pr_13919 merge_pr_13918 merge_pr_13917 merge_pr_13916 merge_pr_13915 merge_pr_13914 merge_pr_13912 merge_pr_13911 merge_pr_13910 merge_pr_13908 merge_pr_13907 merge_pr_13905 merge_pr_13904 merge_pr_13903 merge_pr_13901 merge_pr_13899 merge_pr_13898 merge_pr_13897 merge_pr_13896 merge_pr_13895 merge_pr_13894 merge_pr_13893 merge_pr_13892 merge_pr_13891 merge_pr_13889 merge_pr_13888 merge_pr_13887 merge_pr_13885 merge_pr_13884 merge_pr_13879 merge_pr_13878 merge_pr_13877 merge_pr_13875 merge_pr_13872
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
97 lines (90 sloc) 5.84 KB
<!doctype html>
<html>
<head>
<title>The line height calculation quirk</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style> iframe { width:200px; height:20px; } </style>
</head>
<body>
<div id=log></div>
<iframe id=quirks></iframe>
<iframe id=almost></iframe>
<iframe id=standards></iframe>
<script>
setup({explicit_done:true});
var png = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==";
var preload = new Image();
preload.src = png;
onload = function() {
var html = "<style id=style></style>";
var a_doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
var s_doctype = '<!DOCTYPE HTML>';
var q = document.getElementById('quirks').contentWindow;
var a = document.getElementById('almost').contentWindow;
var s = document.getElementById('standards').contentWindow;
q.document.open();
q.document.write(html);
q.document.close();
a.document.open();
a.document.write(a_doctype + html);
a.document.close();
s.document.open();
s.document.write(s_doctype + html);
s.document.close();
[q, a, s].forEach(function(win) {
['style', 'test', 'ref', 's_ref'].forEach(function(id) {
win.__proto__.__defineGetter__(id, function() { return win.document.getElementById(id); });
});
});
var tests = [
{style:'', body:'<div id=test><img src="{png}"></div><img id=ref src="{png}"><div id=s_ref>x</div>'},
{style:'', body:'<div id=test><img src="{png}"> <img src="{png}"></div><div id=ref>x</div><div id=s_ref>x</div>'},
{style:'', body:'<table><tr><td id=test><img src="{png}"><tr><td><img id=ref src="{png}"><tr><td id=s_ref>x</table>'},
{style:'', body:'<table><tr><td id=test><img src="{png}"> <img src="{png}"><tr><td id=ref>x<tr><td id=s_ref>x</table>'},
{style:'', body:'<pre id=test><img src="{png}"></pre><img id=ref src="{png}"><pre id=s_ref>x</pre>'},
{style:'', body:'<pre id=test><img src="{png}"> </pre><pre id=ref>x</pre><pre id=s_ref>x</pre>'},
{style:'span { margin:1px }', body:'<div id=test><span></span></div><div id=ref></div><div id=s_ref>x</div>'},
{style:'span { padding:1px 0 }', body:'<div id=test><span></span></div><div id=ref></div><div id=s_ref></div>'},
{style:'span { margin:0 1px }', body:'<div id=test><span></span></div><div id=ref></div><div id=s_ref>x</div>'},
{style:'span { margin:0 1px; padding:1px 0 }', body:'<div id=test><span></span></div><div id=ref></div><div id=s_ref>x</div>'},
{style:'span { border-width:1px 0; border-style:solid }', body:'<div id=test><span></span></div><div id=ref></div><div id=s_ref></div>'},
{style:'span { border-width:1px; border-style:solid none }', body:'<div id=test><span></span></div><div id=ref></div><div id=s_ref></div>'},
{style:'span { border-width:1px; border-style:solid hidden }', body:'<div id=test><span></span></div><div id=ref></div><div id=s_ref></div>'},
{style:'span { border-right:1px solid }', body:'<div id=test><span></span></div><div id=ref>x</div><div id=s_ref>x</div>'},
{style:'span { border-left:1px solid }', body:'<div id=test><span></span></div><div id=ref>x</div><div id=s_ref>x</div>'},
{style:'span { padding-right:1px }', body:'<div id=test><span></span></div><div id=ref>x</div><div id=s_ref>x</div>'},
{style:'span { padding-left:1px }', body:'<div id=test><span></span></div><div id=ref>x</div><div id=s_ref>x</div>'},
{style:'span { display:inline-block; height:1px }', body:'<div id=test><i><span></span> </i></div><span id=ref></span><div id=s_ref>x</div>'}, /* 16.6.1: "If a space (U+0020) at the end of a line has 'white-space' set to 'normal', 'nowrap', or 'pre-line', it is also removed." */
{style:'', body:'<div id=test><img src="{png}" border=1></div><img id=ref src="{png}" height=3><div id=s_ref>x</div>'},
{style:'#test img { padding:1px }', body:'<div id=test><img src="{png}"></div><img id=ref src="{png}" height=3><div id=s_ref>x</div>'},
{style:'iframe { height:1px }', body:'<div id=test><iframe></iframe></div><img id=ref src="{png}" height=5><div id=s_ref>x</div>'},
{style:'#test::before { content:"" } #test::before, span { border:solid }', body:'<div id=test></div><div id=ref><span>x</span></div><div id=s_ref><span>x</span></div>'},
{style:'div { line-height: 0;} span { margin:0 1px; line-height: normal; }', body:'<div id=test>x<span></span></div><div id=ref>x</div><div id=s_ref>x<span>x</span></div>'},
];
tests.forEach(function(t) {
test(function() {
var style = t.style.replace(/\{png\}/g, png);
var body = t.body.replace(/\{png\}/g, png);
q.style.textContent = style;
a.style.textContent = style;
s.style.textContent = style;
q.document.body.innerHTML = body;
a.document.body.innerHTML = body;
s.document.body.innerHTML = body;
assert_equals(q.getComputedStyle(q.test).height,
q.getComputedStyle(q.ref).height,
'quirks mode');
assert_equals(a.getComputedStyle(a.test).height,
a.getComputedStyle(a.ref).height,
'almost standards mode');
assert_equals(s.getComputedStyle(s.test).height,
s.getComputedStyle(s.s_ref).height,
'standards mode');
}, document.title+', '+t.style+t.body);
});
done();
}
</script>
</body>
</html>