diff --git a/src/components/main/layout/box.rs b/src/components/main/layout/box.rs index e0d5c587cbc..3159c0863b0 100644 --- a/src/components/main/layout/box.rs +++ b/src/components/main/layout/box.rs @@ -630,13 +630,12 @@ impl Box { // Create the text box. do list.with_mut_ref |list| { - let run = text_box.run.clone(); let text_display_item = ~TextDisplayItem { base: BaseDisplayItem { bounds: absolute_box_bounds, extra: ExtraDisplayListData::new(&self), }, - text_run: run, + text_run: text_box.run.clone(), range: text_box.range, color: color, }; diff --git a/src/components/main/layout/text.rs b/src/components/main/layout/text.rs index b2dee93eb5e..fe49dd7c8c2 100644 --- a/src/components/main/layout/text.rs +++ b/src/components/main/layout/text.rs @@ -132,8 +132,9 @@ impl TextRunScanner { self.clump, *text); let range = Range::new(0, run.get().char_len()); - let new_text_box_info = ScannedTextBoxInfo::new(run.clone(), range); let new_metrics = run.get().metrics_for_range(&range); + let new_text_box_info = ScannedTextBoxInfo::new(run, range); + let new_box = @old_box.transform(new_metrics.bounding_box.size, ScannedTextBox(new_text_box_info)); out_boxes.push(new_box)