diff options
author | Jack Moffitt <jack@metajack.im> | 2013-12-20 22:04:46 -0700 |
---|---|---|
committer | Jack Moffitt <jack@metajack.im> | 2014-01-12 19:45:45 -0700 |
commit | a7ef1cd35e9347a285f245041db4eb94047f4ab0 (patch) | |
tree | a6dc269d9f3cb031d7ea096628c81b7edc971c1c /src/components/main/layout/text.rs | |
parent | 728fb9a7dedf67445e7f12eafb314117efede70d (diff) | |
download | servo-a7ef1cd35e9347a285f245041db4eb94047f4ab0.tar.gz servo-a7ef1cd35e9347a285f245041db4eb94047f4ab0.zip |
Upgrade to latest Rust.
Diffstat (limited to 'src/components/main/layout/text.rs')
-rw-r--r-- | src/components/main/layout/text.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/components/main/layout/text.rs b/src/components/main/layout/text.rs index bc3059695d6..72695c691b2 100644 --- a/src/components/main/layout/text.rs +++ b/src/components/main/layout/text.rs @@ -4,7 +4,7 @@ //! Text layout. -use layout::box::{Box, ScannedTextBox, ScannedTextBoxInfo, UnscannedTextBox}; +use layout::box_::{Box, ScannedTextBox, ScannedTextBoxInfo, UnscannedTextBox}; use layout::context::LayoutContext; use layout::flow::Flow; @@ -15,7 +15,7 @@ use servo_util::range::Range; use std::vec; /// A stack-allocated object for scanning an inline flow into `TextRun`-containing `TextBox`es. -struct TextRunScanner { +pub struct TextRunScanner { clump: Range, } @@ -123,7 +123,7 @@ impl TextRunScanner { // font group fonts. This is probably achieved by creating the font group above // and then letting `FontGroup` decide which `Font` to stick into the text run. let fontgroup = ctx.font_ctx.get_resolved_font_for_style(&font_style); - let run = ~fontgroup.with_borrow(|fg| fg.create_textrun(transformed_text.clone(), decoration)); + let run = ~fontgroup.borrow().with(|fg| fg.create_textrun(transformed_text.clone(), decoration)); debug!("TextRunScanner: pushing single text box in range: {} ({})", self.clump, @@ -142,7 +142,7 @@ impl TextRunScanner { // First, transform/compress text of all the nodes. let mut last_whitespace_in_clump = new_whitespace; - let transformed_strs: ~[~str] = do vec::from_fn(self.clump.length()) |i| { + let transformed_strs: ~[~str] = vec::from_fn(self.clump.length(), |i| { // TODO(#113): We should be passing the compression context between calls to // `transform_text`, so that boxes starting and/or ending with whitespace can // be compressed correctly with respect to the text run. @@ -157,7 +157,7 @@ impl TextRunScanner { last_whitespace_in_clump); last_whitespace_in_clump = new_whitespace; new_str - }; + }); new_whitespace = last_whitespace_in_clump; // Next, concatenate all of the transformed strings together, saving the new @@ -186,8 +186,8 @@ impl TextRunScanner { // sequence. If no clump takes ownership, however, it will leak. let clump = self.clump; let run = if clump.length() != 0 && run_str.len() > 0 { - fontgroup.with_borrow( |fg| { - fg.fonts[0].with_mut_borrow( |font| { + fontgroup.borrow().with(|fg| { + fg.fonts[0].borrow().with_mut(|font| { Some(Arc::new(~TextRun::new(font, run_str.clone(), decoration))) }) }) @@ -216,14 +216,14 @@ impl TextRunScanner { } // End of match. debug!("--- In boxes: ---"); - for (i, box) in in_boxes.iter().enumerate() { - debug!("{:u} --> {:s}", i, box.debug_str()); + for (i, box_) in in_boxes.iter().enumerate() { + debug!("{:u} --> {:s}", i, box_.debug_str()); } debug!("------------------"); debug!("--- Out boxes: ---"); - for (i, box) in out_boxes.iter().enumerate() { - debug!("{:u} --> {:s}", i, box.debug_str()); + for (i, box_) in out_boxes.iter().enumerate() { + debug!("{:u} --> {:s}", i, box_.debug_str()); } debug!("------------------"); |