Skip to content

Commit

Permalink
Merge pull request #2883 from glennw/textrun-1
Browse files Browse the repository at this point in the history
Remove unused field before other upcoming changes; r=Ms2ger
  • Loading branch information
Ms2ger committed Jul 21, 2014
2 parents 2ed7444 + 94ae3bb commit 4b3a78e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/components/gfx/font.rs
Expand Up @@ -8,7 +8,7 @@ use std::str;
use std::rc::Rc;
use std::cell::RefCell;
use servo_util::cache::{Cache, HashCache};
use style::computed_values::{text_decoration, font_weight, font_style};
use style::computed_values::{font_weight, font_style};
use sync::Arc;

use servo_util::geometry::Au;
Expand Down Expand Up @@ -170,11 +170,11 @@ impl FontGroup {
}
}

pub fn create_textrun(&self, text: String, decoration: text_decoration::T) -> TextRun {
pub fn create_textrun(&self, text: String) -> TextRun {
assert!(self.fonts.len() > 0);

// TODO(Issue #177): Actually fall back through the FontGroup when a font is unsuitable.
TextRun::new(&mut *self.fonts.get(0).borrow_mut(), text.clone(), decoration)
TextRun::new(&mut *self.fonts.get(0).borrow_mut(), text.clone())
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/components/gfx/text/text_run.rs
Expand Up @@ -7,7 +7,6 @@ use servo_util::geometry::Au;
use servo_util::range::Range;
use servo_util::vec::{Comparator, FullBinarySearchMethods};
use std::slice::Items;
use style::computed_values::text_decoration;
use sync::Arc;
use text::glyph::{CharIndex, GlyphStore};
use font::FontHandleMethods;
Expand All @@ -20,7 +19,6 @@ pub struct TextRun {
pub font_template: Arc<FontTemplateData>,
pub pt_size: f64,
pub font_metrics: FontMetrics,
pub decoration: text_decoration::T,
/// The glyph runs that make up this text run.
pub glyphs: Arc<Vec<GlyphRun>>,
}
Expand Down Expand Up @@ -119,14 +117,13 @@ impl<'a> Iterator<Range<CharIndex>> for LineIterator<'a> {
}

impl<'a> TextRun {
pub fn new(font: &mut Font, text: String, decoration: text_decoration::T) -> TextRun {
pub fn new(font: &mut Font, text: String) -> TextRun {
let glyphs = TextRun::break_and_shape(font, text.as_slice());
let run = TextRun {
text: Arc::new(text),
font_metrics: font.metrics.clone(),
font_template: font.handle.get_template(),
pt_size: font.pt_size,
decoration: decoration,
glyphs: Arc::new(glyphs),
};
return run;
Expand Down
6 changes: 2 additions & 4 deletions src/components/layout/text.rs
Expand Up @@ -122,7 +122,6 @@ impl TextRunScanner {
};

let font_style = old_fragment.font_style();
let decoration = old_fragment.text_decoration();

// TODO(#115): Use the actual CSS `white-space` property of the relevant style.
let compression = match old_fragment.white_space() {
Expand All @@ -145,7 +144,7 @@ impl TextRunScanner {
// and then letting `FontGroup` decide which `Font` to stick into the text run.
let fontgroup = font_context.get_layout_font_group_for_style(&font_style);
let run = box fontgroup.create_textrun(
transformed_text.clone(), decoration);
transformed_text.clone());

debug!("TextRunScanner: pushing single text fragment in range: {} ({})",
self.clump,
Expand All @@ -168,7 +167,6 @@ impl TextRunScanner {
let in_fragment = &in_fragments[self.clump.begin().to_uint()];
let font_style = in_fragment.font_style();
let fontgroup = font_context.get_layout_font_group_for_style(&font_style);
let decoration = in_fragment.text_decoration();

// TODO(#115): Use the actual CSS `white-space` property of the relevant style.
let compression = match in_fragment.white_space() {
Expand Down Expand Up @@ -222,7 +220,7 @@ impl TextRunScanner {
let run = if clump.length() != CharIndex(0) && run_str.len() > 0 {
Some(Arc::new(box TextRun::new(
&mut *fontgroup.fonts.get(0).borrow_mut(),
run_str.to_string(), decoration)))
run_str.to_string())))
} else {
None
};
Expand Down

0 comments on commit 4b3a78e

Please sign in to comment.