aboutsummaryrefslogtreecommitdiffstats
path: root/components/gfx/text
diff options
context:
space:
mode:
authorBehnam Esfahbod <behnam@zwnj.org>2017-05-16 11:38:42 -0500
committerBehnam Esfahbod <behnam@zwnj.org>2017-05-22 20:06:19 -0500
commit14c524df4f38a8b8262b3ba458c100966377d072 (patch)
tree90de0662ee317c6a0f5d74478c2b0b6e7462d015 /components/gfx/text
parent594479fe15f810d148e2352951affe905b1e13ff (diff)
downloadservo-14c524df4f38a8b8262b3ba458c100966377d072.tar.gz
servo-14c524df4f38a8b8262b3ba458c100966377d072.zip
[gfx] [layout] [style] Upgrade unicode-bidi to 0.3
Diffstat (limited to 'components/gfx/text')
-rw-r--r--components/gfx/text/text_run.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs
index 0f487a4b70e..b65700221f7 100644
--- a/components/gfx/text/text_run.rs
+++ b/components/gfx/text/text_run.rs
@@ -13,6 +13,7 @@ use std::slice::Iter;
use std::sync::Arc;
use style::str::char_is_whitespace;
use text::glyph::{ByteIndex, GlyphStore};
+use unicode_bidi as bidi;
use webrender_traits;
use xi_unicode::LineBreakIterator;
@@ -32,7 +33,7 @@ pub struct TextRun {
pub font_key: webrender_traits::FontKey,
/// The glyph runs that make up this text run.
pub glyphs: Arc<Vec<GlyphRun>>,
- pub bidi_level: u8,
+ pub bidi_level: bidi::Level,
pub extra_word_spacing: Au,
}
@@ -179,7 +180,7 @@ impl<'a> Iterator for CharacterSliceIterator<'a> {
}
impl<'a> TextRun {
- pub fn new(font: &mut Font, text: String, options: &ShapingOptions, bidi_level: u8) -> TextRun {
+ pub fn new(font: &mut Font, text: String, options: &ShapingOptions, bidi_level: bidi::Level) -> TextRun {
let glyphs = TextRun::break_and_shape(font, &text, options);
TextRun {
text: Arc::new(text),
@@ -340,7 +341,7 @@ impl<'a> TextRun {
pub fn natural_word_slices_in_visual_order(&'a self, range: &Range<ByteIndex>)
-> NaturalWordSliceIterator<'a> {
// Iterate in reverse order if bidi level is RTL.
- let reverse = self.bidi_level % 2 == 1;
+ let reverse = self.bidi_level.is_rtl();
let index = if reverse {
match self.index_of_first_glyph_run_containing(range.end() - ByteIndex(1)) {