mirror of
https://github.com/servo/servo.git
synced 2025-08-16 19:05:33 +01:00
Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255
This commit is contained in:
parent
b2a5225831
commit
1a81b18b9f
12321 changed files with 544385 additions and 6 deletions
|
@ -0,0 +1,94 @@
|
|||
<!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});
|
||||
onload = function() {
|
||||
var html = "<style id=style></style>";
|
||||
var png = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==";
|
||||
var preload = new Image();
|
||||
preload.src = png;
|
||||
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>
|
Loading…
Add table
Add a link
Reference in a new issue