From ac2f402ae01ed909d28eaf9b91bfa008b50af0ec Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Fri, 27 Mar 2020 17:43:54 +0100 Subject: [PATCH] layout_2020: Stop throwing away hoisted boxes in nested absolutes We were previously throwing away some boxes hoisted to containing blocks for all descendants when they were contained by absolutes. This prevents panics in existing web platform tests that would otherwise be triggered by the addition of the `unreachable!` statement. --- components/layout_2020/display_list/stacking_context.rs | 5 +---- components/layout_2020/lib.rs | 2 -- components/layout_2020/positioned.rs | 4 ++-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/components/layout_2020/display_list/stacking_context.rs b/components/layout_2020/display_list/stacking_context.rs index 82f694c5542..7059b2c3ccb 100644 --- a/components/layout_2020/display_list/stacking_context.rs +++ b/components/layout_2020/display_list/stacking_context.rs @@ -736,10 +736,7 @@ impl AbsoluteOrFixedPositionedFragment { let hoisted_fragment = self.hoisted_fragment.borrow(); let fragment_ref = match hoisted_fragment.as_ref() { Some(fragment_ref) => fragment_ref, - None => { - warn!("Found hoisted box with missing fragment."); - return; - }, + None => unreachable!("Found hoisted box with missing fragment."), }; let containing_block = match self.position { diff --git a/components/layout_2020/lib.rs b/components/layout_2020/lib.rs index 3fc093399ee..e34c6ba76ee 100644 --- a/components/layout_2020/lib.rs +++ b/components/layout_2020/lib.rs @@ -6,8 +6,6 @@ #![feature(arbitrary_self_types)] #![feature(exact_size_is_empty)] -#[macro_use] -extern crate log; #[macro_use] extern crate serde; diff --git a/components/layout_2020/positioned.rs b/components/layout_2020/positioned.rs index 2806611e3a8..2ca2376726a 100644 --- a/components/layout_2020/positioned.rs +++ b/components/layout_2020/positioned.rs @@ -226,8 +226,8 @@ impl PositioningContext { let mut new_fragment = fragment_layout_fn(&mut new_context); new_context.layout_collected_children(layout_context, &mut new_fragment); - *for_nearest_containing_block_for_all_descendants = - new_context.for_nearest_containing_block_for_all_descendants; + for_nearest_containing_block_for_all_descendants + .extend(new_context.for_nearest_containing_block_for_all_descendants); new_fragment }