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

Code before:
            return false;
        }

        if !is_specific(self.script) && is_specific(script) {
            self.script = script;
        }
        script == self.script || !is_specific(script)
    }

    fn layout_into_line_items(
        &self,
        text_run: &TextRun,
        mut soft_wrap_policy: SegmentStartSoftWrapPolicy,
        ifc: &mut InlineFormattingContextLayout,
    ) {
        if self.break_at_start && soft_wrap_policy == SegmentStartSoftWrapPolicy::FollowLinebreaker
        {
            soft_wrap_policy = SegmentStartSoftWrapPolicy::Force;
        }

        let mut byte_processed = ByteIndex(0);
        for (run_index, run) in self.runs.iter().enumerate() {
            ifc.possibly_flush_deferred_forced_line_break();

            // Advance the glyph offset of the current inline container. Note that this must
            // be done before handling preserved newlines, as they count as glpyhs for the
            // purposes of calculating the current glyph offset.
            let current_inline_container_state = ifc.current_inline_container_state();
            let starting_glyph_offset = current_inline_container_state.current_glyph_offset.get();
            current_inline_container_state
                .current_glyph_offset
                .replace(starting_glyph_offset + run.glyph_store.glyph_count());

            // If this whitespace forces a line break, queue up a hard line break the next time we
            // see any content. We don't line break immediately, because we'd like to finish processing
            // any ongoing inline boxes before ending the line.
            if run.is_single_preserved_newline() {
                byte_processed = byte_processed + run.range.len();
                ifc.defer_forced_line_break();
                continue;
            }
            // Break before each unbreakable run in this TextRun, except the first unless the
            // linebreaker was set to break before the first run.
            if run_index != 0 || soft_wrap_policy == SegmentStartSoftWrapPolicy::Force {
                ifc.process_soft_wrap_opportunity();
            }

            let range_start = byte_processed + ByteIndex(self.range.start as isize);
            ifc.push_glyph_store_to_unbreakable_segment(
                run.glyph_store.clone(),
                text_run,

Review comment (suggestion):
```suggestion
            // be done before handling preserved newlines, as they count as glyphs for the
```

Code after:
            return false;
        }

        if !is_specific(self.script) && is_specific(script) {
            self.script = script;
        }
        script == self.script || !is_specific(script)
    }

    fn layout_into_line_items(
        &self,
        text_run: &TextRun,
        mut soft_wrap_policy: SegmentStartSoftWrapPolicy,
        ifc: &mut InlineFormattingContextLayout,
    ) {
        if self.break_at_start && soft_wrap_policy == SegmentStartSoftWrapPolicy::FollowLinebreaker
        {
            soft_wrap_policy = SegmentStartSoftWrapPolicy::Force;
        }

        let mut byte_processed = ByteIndex(0);
        for (run_index, run) in self.runs.iter().enumerate() {
            ifc.possibly_flush_deferred_forced_line_break();

            // Advance the glyph offset of the current inline container. Note that this must
            // be done before handling preserved newlines, as they count as glyphs for the
            // purposes of calculating the current glyph offset.
            let current_inline_container_state = ifc.current_inline_container_state();
            let starting_glyph_offset = current_inline_container_state.number_of_glyphs.get();
            current_inline_container_state
                .number_of_glyphs
                .replace(starting_glyph_offset + run.glyph_store.glyph_count());

            // If this whitespace forces a line break, queue up a hard line break the next time we
            // see any content. We don't line break immediately, because we'd like to finish processing
            // any ongoing inline boxes before ending the line.
            if run.is_single_preserved_newline() {
                byte_processed = byte_processed + run.range.len();
                ifc.defer_forced_line_break();
                continue;
            }
            // Break before each unbreakable run in this TextRun, except the first unless the
            // linebreaker was set to break before the first run.
            if run_index != 0 || soft_wrap_policy == SegmentStartSoftWrapPolicy::Force {
                ifc.process_soft_wrap_opportunity();
            }

            let range_start = byte_processed + ByteIndex(self.range.start as isize);
            ifc.push_glyph_store_to_unbreakable_segment(
                run.glyph_store.clone(),
                text_run,