diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-08-04 02:41:40 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-08-04 02:41:40 -0600 |
commit | 672b38e83ac0eb70c6e5b625752e7e3a57029176 (patch) | |
tree | d66516290a7d3148fc88980001d71b16eaf40913 | |
parent | 447c991ebb8cca1601d7c5ecde5dffb14199ddca (diff) | |
parent | 3d9cc784d0c65e34540ecf646d2bca044f4c42c3 (diff) | |
download | servo-672b38e83ac0eb70c6e5b625752e7e3a57029176.tar.gz servo-672b38e83ac0eb70c6e5b625752e7e3a57029176.zip |
Auto merge of #6946 - pcwalton:block-formatting-context-margins, r=mbrubeck
layout: If the container of a block formatting context has margins in the inline direction, subtract those from the inline size of preceding floats.
Makes the content area on http://reddit.com/r/rust visible.
r? @mbrubeck
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6946)
<!-- Reviewable:end -->
-rw-r--r-- | components/layout/block.rs | 7 | ||||
-rw-r--r-- | tests/ref/basic.list | 1 | ||||
-rw-r--r-- | tests/ref/block_formatting_context_with_margin_a.html | 29 | ||||
-rw-r--r-- | tests/ref/block_formatting_context_with_margin_ref.html | 28 |
4 files changed, 62 insertions, 3 deletions
diff --git a/components/layout/block.rs b/components/layout/block.rs index ee3e603e11f..d1a333f2b83 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1300,8 +1300,10 @@ impl BlockFlow { let mut inline_size_of_preceding_left_floats = Au(0); let mut inline_size_of_preceding_right_floats = Au(0); if self.formatting_context_type() == FormattingContextType::None { - inline_size_of_preceding_left_floats = self.inline_size_of_preceding_left_floats; - inline_size_of_preceding_right_floats = self.inline_size_of_preceding_right_floats; + inline_size_of_preceding_left_floats = + max(self.inline_size_of_preceding_left_floats - inline_start_content_edge, Au(0)); + inline_size_of_preceding_right_floats = + max(self.inline_size_of_preceding_right_floats - inline_end_content_edge, Au(0)); } let opaque_self = OpaqueFlow::from_flow(self); @@ -1319,7 +1321,6 @@ impl BlockFlow { // FIXME (mbrubeck): Get correct mode for absolute containing block let containing_block_mode = self.base.writing_mode; - // This value is used only for table cells. let mut inline_start_margin_edge = inline_start_content_edge; let mut inline_end_margin_edge = inline_end_content_edge; diff --git a/tests/ref/basic.list b/tests/ref/basic.list index 60fd6bb7f45..b84de8320a1 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -43,6 +43,7 @@ flaky_cpu == append_style_a.html append_style_b.html == block_formatting_context_float_placement_a.html block_formatting_context_float_placement_ref.html == block_formatting_context_relative_a.html block_formatting_context_ref.html == block_formatting_context_translation_a.html block_formatting_context_translation_ref.html +== block_formatting_context_with_margin_a.html block_formatting_context_with_margin_ref.html == block_image.html 500x300_green.html != block_image.html noteq_500x300_white.html == block_replaced_content_a.html block_replaced_content_ref.html diff --git a/tests/ref/block_formatting_context_with_margin_a.html b/tests/ref/block_formatting_context_with_margin_a.html new file mode 100644 index 00000000000..0259628231e --- /dev/null +++ b/tests/ref/block_formatting_context_with_margin_a.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> + +<html> +<head> +<style> +#float { + float: right; + width: 150px; +} + +section { + margin-right: 450px; + background: gold; +} + +#a { + font-size: 48px; + overflow: hidden; +} +</style> +</head> + +<body> +<div id=float></div> +<section> + <div id=a>set breakpoints from within the comfort of your editor</div> +</section> +</body> +</html> diff --git a/tests/ref/block_formatting_context_with_margin_ref.html b/tests/ref/block_formatting_context_with_margin_ref.html new file mode 100644 index 00000000000..9ca4146bf63 --- /dev/null +++ b/tests/ref/block_formatting_context_with_margin_ref.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> + +<html> +<head> +<style> +#float { + float: right; + width: 150px; +} + +section { + margin-right: 450px; + background: gold; +} + +#a { + font-size: 48px; +} +</style> +</head> + +<body> +<div id=float></div> +<section> + <div id=a>set breakpoints from within the comfort of your editor</div> +</section> +</body> +</html> |