Repository: servo/servo
File: components/layout/flow/inline/mod.rs (Rust)

Code before:
            },
            InlineItem::Atomic(atomic, offset_in_text, _level) => {
                // TODO: need to handle TextWrapMode::Nowrap.
                if self.had_content_yet_for_min_content &&
                    !inline_formatting_context
                        .previous_character_prevents_soft_wrap_opportunity(*offset_in_text)
                {
                    self.line_break_opportunity();
                }

                self.commit_pending_whitespace();
                let outer = self.outer_inline_content_sizes_of_float_or_atomic(&atomic.borrow());
                self.current_line += outer;

                // TODO: need to handle TextWrapMode::Nowrap.
                if !inline_formatting_context
                    .next_character_prevents_soft_wrap_opportunity(*offset_in_text)
                {
                    self.line_break_opportunity();
                }
            },
            InlineItem::OutOfFlowFloatBox(float_box) => {
                let float_box = float_box.borrow();
                let sizes = self.outer_inline_content_sizes_of_float_or_atomic(&float_box.contents);
                let style = &float_box.contents.style();
                let container_wm = self.constraint_space.style.writing_mode;
                let clear = Clear::from_style_and_container_writing_mode(style, container_wm);
                self.clear_floats(clear);
                match FloatSide::from_style_and_container_writing_mode(style, container_wm)
                    .expect("A float box needs to float to some side")
                {
                    FloatSide::InlineStart => self.uncleared_start_floats.union_assign(&sizes),
                    FloatSide::InlineEnd => self.uncleared_end_floats.union_assign(&sizes),
                }
            },
            InlineItem::OutOfFlowAbsolutelyPositionedBox(..) => {},
        }
    }

    fn add_inline_size(&mut self, l: Au) {
        self.current_line.min_content += l;
        self.current_line.max_content += l;
    }

    fn line_break_opportunity(&mut self) {
        // Clear the pending whitespace, assuming that at the end of the line
        // it needs to either hang or be removed. If that isn't the case,
        // `commit_pending_whitespace()` should be called first.
        self.pending_whitespace.min_content = Au::zero();
        let current_min_content = mem::take(&mut self.current_line.min_content);
        self.paragraph.min_content.max_assign(current_min_content);

Review comment (suggestion):
```suggestion
                let container_writing_mode = self.constraint_space.style.writing_mode;
```

Code after:
                    !inline_formatting_context
                        .previous_character_prevents_soft_wrap_opportunity(*offset_in_text)
                {
                    self.line_break_opportunity();
                }

                self.commit_pending_whitespace();
                let outer = self.outer_inline_content_sizes_of_float_or_atomic(&atomic.borrow());
                self.current_line += outer;

                // TODO: need to handle TextWrapMode::Nowrap.
                if !inline_formatting_context
                    .next_character_prevents_soft_wrap_opportunity(*offset_in_text)
                {
                    self.line_break_opportunity();
                }
            },
            InlineItem::OutOfFlowFloatBox(float_box) => {
                let float_box = float_box.borrow();
                let sizes = self.outer_inline_content_sizes_of_float_or_atomic(&float_box.contents);
                let style = &float_box.contents.style();
                let container_writing_mode = self.constraint_space.style.writing_mode;
                let clear =
                    Clear::from_style_and_container_writing_mode(style, container_writing_mode);
                self.clear_floats(clear);
                let float_side =
                    FloatSide::from_style_and_container_writing_mode(style, container_writing_mode);
                match float_side.expect("A float box needs to float to some side") {
                    FloatSide::InlineStart => self.uncleared_floats.start.union_assign(&sizes),
                    FloatSide::InlineEnd => self.uncleared_floats.end.union_assign(&sizes),
                }
            },
            InlineItem::OutOfFlowAbsolutelyPositionedBox(..) => {},
        }
    }

    fn add_inline_size(&mut self, l: Au) {
        self.current_line.min_content += l;
        self.current_line.max_content += l;
    }

    fn line_break_opportunity(&mut self) {
        // Clear the pending whitespace, assuming that at the end of the line
        // it needs to either hang or be removed. If that isn't the case,
        // `commit_pending_whitespace()` should be called first.
        self.pending_whitespace.min_content = Au::zero();
        let current_min_content = mem::take(&mut self.current_line.min_content);
        self.paragraph.min_content.max_assign(current_min_content);
        self.had_content_yet_for_min_content = false;
    }