Skip to content

Commit 90e269e

Browse files
committed
Force BFC to be independent if it is a scroll container
1 parent 2d0f702 commit 90e269e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/compute/block.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ pub fn compute_block_layout(
247247
let style = tree.get_block_container_style(node_id);
248248

249249
// Pull these out earlier to avoid borrowing issues
250+
let overflow = style.overflow();
251+
let is_scroll_container = overflow.x.is_scroll_container() || overflow.y.is_scroll_container();
250252
let aspect_ratio = style.aspect_ratio();
251253
let padding = style.padding().resolve_or_zero(parent_size.width, |val, basis| tree.calc(val, basis));
252254
let border = style.border().resolve_or_zero(parent_size.width, |val, basis| tree.calc(val, basis));
@@ -297,13 +299,13 @@ pub fn compute_block_layout(
297299
// Unwrap the block formatting context if one was passed, or else create a new one
298300
debug_log!("BLOCK");
299301
match block_ctx {
300-
Some(inherited_bfc) => compute_inner(
302+
Some(inherited_bfc) if !is_scroll_container => compute_inner(
301303
tree,
302304
node_id,
303305
LayoutInput { known_dimensions: styled_based_known_dimensions, ..inputs },
304306
inherited_bfc,
305307
),
306-
None => {
308+
_ => {
307309
let mut root_bfc = BlockFormattingContext::new();
308310
let mut root_ctx = root_bfc.root_block_context();
309311
compute_inner(

0 commit comments

Comments
 (0)