mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Merge pull request #2883 from glennw/textrun-1
Remove unused field before other upcoming changes; r=Ms2ger
This commit is contained in:
commit
4b3a78e54b
3 changed files with 6 additions and 11 deletions
|
@ -8,7 +8,7 @@ use std::str;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use servo_util::cache::{Cache, HashCache};
|
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 sync::Arc;
|
||||||
|
|
||||||
use servo_util::geometry::Au;
|
use servo_util::geometry::Au;
|
||||||
|
@ -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);
|
assert!(self.fonts.len() > 0);
|
||||||
|
|
||||||
// TODO(Issue #177): Actually fall back through the FontGroup when a font is unsuitable.
|
// 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())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ use servo_util::geometry::Au;
|
||||||
use servo_util::range::Range;
|
use servo_util::range::Range;
|
||||||
use servo_util::vec::{Comparator, FullBinarySearchMethods};
|
use servo_util::vec::{Comparator, FullBinarySearchMethods};
|
||||||
use std::slice::Items;
|
use std::slice::Items;
|
||||||
use style::computed_values::text_decoration;
|
|
||||||
use sync::Arc;
|
use sync::Arc;
|
||||||
use text::glyph::{CharIndex, GlyphStore};
|
use text::glyph::{CharIndex, GlyphStore};
|
||||||
use font::FontHandleMethods;
|
use font::FontHandleMethods;
|
||||||
|
@ -20,7 +19,6 @@ pub struct TextRun {
|
||||||
pub font_template: Arc<FontTemplateData>,
|
pub font_template: Arc<FontTemplateData>,
|
||||||
pub pt_size: f64,
|
pub pt_size: f64,
|
||||||
pub font_metrics: FontMetrics,
|
pub font_metrics: FontMetrics,
|
||||||
pub decoration: text_decoration::T,
|
|
||||||
/// The glyph runs that make up this text run.
|
/// The glyph runs that make up this text run.
|
||||||
pub glyphs: Arc<Vec<GlyphRun>>,
|
pub glyphs: Arc<Vec<GlyphRun>>,
|
||||||
}
|
}
|
||||||
|
@ -119,14 +117,13 @@ impl<'a> Iterator<Range<CharIndex>> for LineIterator<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> TextRun {
|
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 glyphs = TextRun::break_and_shape(font, text.as_slice());
|
||||||
let run = TextRun {
|
let run = TextRun {
|
||||||
text: Arc::new(text),
|
text: Arc::new(text),
|
||||||
font_metrics: font.metrics.clone(),
|
font_metrics: font.metrics.clone(),
|
||||||
font_template: font.handle.get_template(),
|
font_template: font.handle.get_template(),
|
||||||
pt_size: font.pt_size,
|
pt_size: font.pt_size,
|
||||||
decoration: decoration,
|
|
||||||
glyphs: Arc::new(glyphs),
|
glyphs: Arc::new(glyphs),
|
||||||
};
|
};
|
||||||
return run;
|
return run;
|
||||||
|
|
|
@ -122,7 +122,6 @@ impl TextRunScanner {
|
||||||
};
|
};
|
||||||
|
|
||||||
let font_style = old_fragment.font_style();
|
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.
|
// TODO(#115): Use the actual CSS `white-space` property of the relevant style.
|
||||||
let compression = match old_fragment.white_space() {
|
let compression = match old_fragment.white_space() {
|
||||||
|
@ -145,7 +144,7 @@ impl TextRunScanner {
|
||||||
// and then letting `FontGroup` decide which `Font` to stick into the text run.
|
// 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 fontgroup = font_context.get_layout_font_group_for_style(&font_style);
|
||||||
let run = box fontgroup.create_textrun(
|
let run = box fontgroup.create_textrun(
|
||||||
transformed_text.clone(), decoration);
|
transformed_text.clone());
|
||||||
|
|
||||||
debug!("TextRunScanner: pushing single text fragment in range: {} ({})",
|
debug!("TextRunScanner: pushing single text fragment in range: {} ({})",
|
||||||
self.clump,
|
self.clump,
|
||||||
|
@ -168,7 +167,6 @@ impl TextRunScanner {
|
||||||
let in_fragment = &in_fragments[self.clump.begin().to_uint()];
|
let in_fragment = &in_fragments[self.clump.begin().to_uint()];
|
||||||
let font_style = in_fragment.font_style();
|
let font_style = in_fragment.font_style();
|
||||||
let fontgroup = font_context.get_layout_font_group_for_style(&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.
|
// TODO(#115): Use the actual CSS `white-space` property of the relevant style.
|
||||||
let compression = match in_fragment.white_space() {
|
let compression = match in_fragment.white_space() {
|
||||||
|
@ -222,7 +220,7 @@ impl TextRunScanner {
|
||||||
let run = if clump.length() != CharIndex(0) && run_str.len() > 0 {
|
let run = if clump.length() != CharIndex(0) && run_str.len() > 0 {
|
||||||
Some(Arc::new(box TextRun::new(
|
Some(Arc::new(box TextRun::new(
|
||||||
&mut *fontgroup.fonts.get(0).borrow_mut(),
|
&mut *fontgroup.fonts.get(0).borrow_mut(),
|
||||||
run_str.to_string(), decoration)))
|
run_str.to_string())))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue