diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2016-04-08 12:51:09 -0700 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2016-04-14 11:22:40 -0700 |
commit | e32455f7b8013ede5bab50ff86d7913bab822e50 (patch) | |
tree | 4ec1d640de710a29e5f91a15b18b631a6f385ce6 /components/layout/model.rs | |
parent | 4807dadf19175d38414130a74eb1163c65129ba6 (diff) | |
download | servo-e32455f7b8013ede5bab50ff86d7913bab822e50.tar.gz servo-e32455f7b8013ede5bab50ff86d7913bab822e50.zip |
layout: Disallow margins from collapsing through blocks that have
floated children per CSS 2.1 § 8.3.1.
Fixes the test failure in #10458.
Diffstat (limited to 'components/layout/model.rs')
-rw-r--r-- | components/layout/model.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/components/layout/model.rs b/components/layout/model.rs index 8b18a1f02ad..7bb4cf23cbe 100644 --- a/components/layout/model.rs +++ b/components/layout/model.rs @@ -126,17 +126,20 @@ impl MarginCollapseInfo { pub fn finish_and_compute_collapsible_margins(mut self, fragment: &Fragment, containing_block_size: Option<Au>, - can_collapse_block_end_margin_with_kids: bool) + can_collapse_block_end_margin_with_kids: bool, + mut may_collapse_through: bool) -> (CollapsibleMargins, Au) { let state = match self.state { MarginCollapseState::AccumulatingCollapsibleTopMargin => { - let may_collapse_through = match fragment.style().content_block_size() { - LengthOrPercentageOrAuto::Auto => true, - LengthOrPercentageOrAuto::Length(Au(0)) => true, - LengthOrPercentageOrAuto::Percentage(0.) => true, - LengthOrPercentageOrAuto::Percentage(_) if containing_block_size.is_none() => true, - _ => false, - }; + may_collapse_through = may_collapse_through && + match fragment.style().content_block_size() { + LengthOrPercentageOrAuto::Auto => true, + LengthOrPercentageOrAuto::Length(Au(0)) => true, + LengthOrPercentageOrAuto::Percentage(0.) => true, + LengthOrPercentageOrAuto::Percentage(_) if + containing_block_size.is_none() => true, + _ => false, + }; if may_collapse_through { match fragment.style().min_block_size() { |