aboutsummaryrefslogtreecommitdiffstats
path: root/components/gfx/text
diff options
context:
space:
mode:
authorPyfisch <pyfisch@gmail.com>2018-02-11 21:00:32 +0100
committerPyfisch <pyfisch@gmail.com>2018-02-24 10:36:10 +0100
commit2d74bcfea5f74a8ba130615b2b5b5bd571623b4d (patch)
treea1496c8dc05b802d18e9e30bb2ee0f0f50d9adf1 /components/gfx/text
parenta5115139baca2d2a15831916d83964a4d374fae1 (diff)
downloadservo-2d74bcfea5f74a8ba130615b2b5b5bd571623b4d.tar.gz
servo-2d74bcfea5f74a8ba130615b2b5b5bd571623b4d.zip
Introduce a dedicated data structure for text queries
Add an IndexableText structure for text queries. Instead of linear search for a node this now uses a HashMap. Remove the now irrelevant fields from TextDisplayItem.
Diffstat (limited to 'components/gfx/text')
-rw-r--r--components/gfx/text/text_run.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs
index a85c8aababd..62126ab838a 100644
--- a/components/gfx/text/text_run.rs
+++ b/components/gfx/text/text_run.rs
@@ -333,10 +333,10 @@ impl<'a> TextRun {
}
/// Returns the index in the range of the first glyph advancing over given advance
- pub fn range_index_of_advance(&self, range: &Range<ByteIndex>, advance: f32) -> usize {
+ pub fn range_index_of_advance(&self, range: &Range<ByteIndex>, advance: Au) -> usize {
// TODO(Issue #199): alter advance direction for RTL
// TODO(Issue #98): using inter-char and inter-word spacing settings when measuring text
- let mut remaining = Au::from_f32_px(advance);
+ let mut remaining = advance;
self.natural_word_slices_in_range(range)
.map(|slice| {
let (slice_index, slice_advance) =