Ensure that block elements with replaced content don't get their block size overwritten.

This commit is contained in:
Glenn Watson 2014-08-18 10:43:53 +10:00
parent 35b626e592
commit 2ff7949775
5 changed files with 57 additions and 3 deletions

View file

@ -1574,10 +1574,11 @@ impl Flow for BlockFlow {
}
fn assign_block_size<'a>(&mut self, ctx: &'a LayoutContext<'a>) {
// Assign block-size for fragment if it is an image fragment.
self.fragment.assign_replaced_block_size_if_necessary();
if self.is_float() {
if self.is_replaced_content() {
// Assign block-size for fragment if it is an image fragment.
self.fragment.assign_replaced_block_size_if_necessary();
} else if self.is_float() {
debug!("assign_block_size_float: assigning block_size for float");
self.assign_block_size_float(ctx);
} else {

View file

@ -91,3 +91,5 @@ flaky_cpu == linebreak_simple_a.html linebreak_simple_b.html
== inline_whitespace_b.html inline_whitespace_ref.html
== inline_whitespace_a.html inline_whitespace_ref.html
== line_height_a.html line_height_ref.html
== block_replaced_content_a.html block_replaced_content_ref.html
== block_replaced_content_b.html block_replaced_content_ref.html

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<style>
body {
margin: 0;
padding: 0;
background-color: black;
}
img {
float: left;
}
</style>
</head>
<body>
<img src="400x400_green.png">
</body>
</html>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<style>
body {
margin: 0;
padding: 0;
background-color: black;
}
img {
display: block;
}
</style>
</head>
<body>
<img src="400x400_green.png">
</body>
</html>

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<style>
body {
margin: 0;
padding: 0;
background-color: black;
}
</style>
</head>
<body>
<img src="400x400_green.png">
</body>
</html>