mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Ensure that block elements with replaced content don't get their block size overwritten.
This commit is contained in:
parent
35b626e592
commit
2ff7949775
5 changed files with 57 additions and 3 deletions
|
@ -1574,10 +1574,11 @@ impl Flow for BlockFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assign_block_size<'a>(&mut self, ctx: &'a LayoutContext<'a>) {
|
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");
|
debug!("assign_block_size_float: assigning block_size for float");
|
||||||
self.assign_block_size_float(ctx);
|
self.assign_block_size_float(ctx);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -91,3 +91,5 @@ flaky_cpu == linebreak_simple_a.html linebreak_simple_b.html
|
||||||
== inline_whitespace_b.html inline_whitespace_ref.html
|
== inline_whitespace_b.html inline_whitespace_ref.html
|
||||||
== inline_whitespace_a.html inline_whitespace_ref.html
|
== inline_whitespace_a.html inline_whitespace_ref.html
|
||||||
== line_height_a.html line_height_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
|
||||||
|
|
18
src/test/ref/block_replaced_content_a.html
Normal file
18
src/test/ref/block_replaced_content_a.html
Normal 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>
|
18
src/test/ref/block_replaced_content_b.html
Normal file
18
src/test/ref/block_replaced_content_b.html
Normal 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>
|
15
src/test/ref/block_replaced_content_ref.html
Normal file
15
src/test/ref/block_replaced_content_ref.html
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue