Skip to content

Commit

Permalink
Mutably borrow to do layout of independent formatting contexts
Browse files Browse the repository at this point in the history
We want to compute content sizes on demand rather than eagerly so we will
need to mutate the independent formatting contexts that own the content sizes.
  • Loading branch information
nox committed Jun 9, 2020
1 parent 8b56b7a commit d9e87f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions components/layout_2020/flow/inline.rs
Expand Up @@ -275,7 +275,7 @@ impl InlineFormattingContext {

loop {
if let Some(child) = ifc.current_nesting_level.remaining_boxes.next() {
match &*child.borrow() {
match &mut *child.borrow_mut() {
InlineLevelBox::InlineBox(inline) => {
let partial = inline.start_layout(child.clone(), &mut ifc);
ifc.partial_inline_boxes_stack.push(partial)
Expand Down Expand Up @@ -529,7 +529,7 @@ impl<'box_tree> PartialInlineBoxFragment<'box_tree> {
fn layout_atomic(
layout_context: &LayoutContext,
ifc: &mut InlineFormattingContextState,
atomic: &IndependentFormattingContext,
atomic: &mut IndependentFormattingContext,
) {
let pbm = atomic.style.padding_border_margin(&ifc.containing_block);
let margin = pbm.margin.auto_is(Length::zero);
Expand Down
6 changes: 3 additions & 3 deletions components/layout_2020/flow/mod.rs
Expand Up @@ -206,7 +206,7 @@ fn layout_block_level_children(
.iter()
.enumerate()
.map(|(tree_rank, box_)| {
let mut fragment = box_.borrow().layout(
let mut fragment = box_.borrow_mut().layout(
layout_context,
positioning_context,
containing_block,
Expand All @@ -226,7 +226,7 @@ fn layout_block_level_children(
.mapfold_reduce_into(
positioning_context,
|positioning_context, (tree_rank, box_)| {
box_.borrow().layout(
box_.borrow_mut().layout(
layout_context,
positioning_context,
containing_block,
Expand Down Expand Up @@ -259,7 +259,7 @@ fn layout_block_level_children(

impl BlockLevelBox {
fn layout(
&self,
&mut self,
layout_context: &LayoutContext,
positioning_context: &mut PositioningContext,
containing_block: &ContainingBlock,
Expand Down

0 comments on commit d9e87f2

Please sign in to comment.