layout: Implement clip per CSS 2.1 § 11.1.2.

Only the recommended, comma-separated syntax is supported.
This commit is contained in:
Patrick Walton 2014-12-16 11:19:37 -08:00
parent 4ccecd8dca
commit 6b28965b94
11 changed files with 261 additions and 30 deletions

View file

@ -218,3 +218,4 @@ fragment=top != ../html/acid2.html acid2_ref.html
== empty_cells_a.html empty_cells_ref.html
== table_caption_top_a.html table_caption_top_ref.html
== table_caption_bottom_a.html table_caption_bottom_ref.html
== clip_a.html clip_ref.html

52
tests/ref/clip_a.html Normal file
View file

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<head>
<!-- Tests that various `clip` values per CSS 2.1 work. -->
<style>
section {
position: absolute;
padding: 32px;
width: 64px;
height: 64px;
background: green;
border: solid 32px red;
}
section:before {
content: "";
display: block;
padding: 0;
width: 64px;
height: 64px;
background: blue;
}
#a {
top: 0;
left: 0;
clip: rect(auto, auto, auto, auto);
}
#b {
top: 192px;
left: 0;
clip: rect(32px, auto, auto, 128px);
}
#c {
top: 0;
left: 192px;
clip: rect(32px, 128px, 64px, 0);
}
#d {
top: 192px;
left: 192px;
clip: rect(64px, 0, 64px, 0);
}
</style>
</head>
<body>
<section id=a></section>
<section id=b></section>
<section id=c></section>
<section id=d></section>
</body>
</html>

70
tests/ref/clip_ref.html Normal file
View file

@ -0,0 +1,70 @@
<!DOCTYPE html>
<html>
<head>
<!-- Tests that various `clip` values per CSS 2.1 work. -->
<style>
section {
position: absolute;
}
#a {
top: 0;
left: 0;
width: 192px;
height: 192px;
background: red;
}
#b {
top: 32px;
left: 32px;
width: 128px;
height: 128px;
background: green;
}
#c {
top: 64px;
left: 64px;
width: 64px;
height: 64px;
background: blue;
}
#d {
top: 32px;
left: 192px;
width: 32px;
height: 32px;
background: red;
}
#e {
top: 32px;
left: 224px;
width: 96px;
height: 32px;
background: green;
}
#f {
top: 224px;
left: 128px;
width: 64px;
height: 160px;
background: red;
}
#g {
top: 224px;
left: 128px;
width: 32px;
height: 128px;
background: green;
}
</style>
</head>
<body>
<section id=a></section>
<section id=b></section>
<section id=c></section>
<section id=d></section>
<section id=e></section>
<section id=f></section>
<section id=g></section>
</body>
</html>