mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
Merge pull request #3404 from glennw/inline-block-fix
Include margin in inline block intrinsic width. Fixes [edit] links on wikipedia. Also improves google homepage.
This commit is contained in:
commit
22bca83509
4 changed files with 65 additions and 3 deletions
|
@ -1165,8 +1165,12 @@ impl Fragment {
|
|||
TableWrapperFragment => {}
|
||||
InlineBlockFragment(ref mut info) => {
|
||||
let block_flow = info.flow_ref.get_mut().as_block();
|
||||
result.minimum_inline_size = geometry::max(result.minimum_inline_size, block_flow.base.intrinsic_inline_sizes.minimum_inline_size);
|
||||
result.preferred_inline_size = geometry::max(result.preferred_inline_size, block_flow.base.intrinsic_inline_sizes.preferred_inline_size);
|
||||
result.minimum_inline_size = geometry::max(result.minimum_inline_size,
|
||||
block_flow.base.intrinsic_inline_sizes.minimum_inline_size +
|
||||
block_flow.base.intrinsic_inline_sizes.surround_inline_size);
|
||||
result.preferred_inline_size = geometry::max(result.preferred_inline_size,
|
||||
block_flow.base.intrinsic_inline_sizes.preferred_inline_size +
|
||||
block_flow.base.intrinsic_inline_sizes.surround_inline_size);
|
||||
},
|
||||
ImageFragment(ref mut image_fragment_info) => {
|
||||
let image_inline_size = image_fragment_info.image_inline_size();
|
||||
|
@ -1420,7 +1424,9 @@ impl Fragment {
|
|||
match self.specific {
|
||||
InlineBlockFragment(ref mut info) => {
|
||||
let block_flow = info.flow_ref.get_mut().as_block();
|
||||
self.border_box.size.inline = block_flow.base.intrinsic_inline_sizes.preferred_inline_size + noncontent_inline_size;
|
||||
self.border_box.size.inline = block_flow.base.intrinsic_inline_sizes.preferred_inline_size +
|
||||
block_flow.base.intrinsic_inline_sizes.surround_inline_size +
|
||||
noncontent_inline_size;
|
||||
block_flow.base.position.size.inline = self.border_box.size.inline;
|
||||
}
|
||||
ScannedTextFragment(_) => {
|
||||
|
|
|
@ -130,3 +130,4 @@ flaky_gpu,flaky_linux == acid2_noscroll.html acid2_ref_broken.html
|
|||
== table_containing_block_a.html table_containing_block_ref.html
|
||||
== link_style_order.html link_style_order_ref.html
|
||||
== percent_height.html percent_height_ref.html
|
||||
== inline_block_with_margin_a.html inline_block_with_margin_ref.html
|
||||
|
|
25
tests/ref/inline_block_with_margin_a.html
Normal file
25
tests/ref/inline_block_with_margin_a.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: 'ahem';
|
||||
src: url(fonts/ahem/ahem.ttf);
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'ahem';
|
||||
font-size: 100px;
|
||||
line-height: 1;
|
||||
}
|
||||
span {
|
||||
display: inline-block;
|
||||
color: yellow;
|
||||
margin-left: 50px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div><span>X X</span></div>
|
||||
</body>
|
||||
</html>
|
30
tests/ref/inline_block_with_margin_ref.html
Normal file
30
tests/ref/inline_block_with_margin_ref.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
.block0 {
|
||||
position: absolute;
|
||||
background-color: yellow;
|
||||
left: 50px;
|
||||
top: 0px;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
.block1 {
|
||||
position: absolute;
|
||||
background-color: yellow;
|
||||
left: 250px;
|
||||
top: 0px;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="block0"></div>
|
||||
<div class="block1"></div>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue