mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
[gfx] [layout] [style] Upgrade unicode-bidi to 0.3
This commit is contained in:
parent
594479fe15
commit
14c524df4f
10 changed files with 61 additions and 34 deletions
|
@ -10,6 +10,7 @@ use euclid::side_offsets::SideOffsets2D;
|
|||
use std::cmp::{max, min};
|
||||
use std::fmt::{self, Debug, Error, Formatter};
|
||||
use std::ops::{Add, Sub};
|
||||
use unicode_bidi as bidi;
|
||||
|
||||
pub enum BlockFlowDirection {
|
||||
TopToBottom,
|
||||
|
@ -131,9 +132,13 @@ impl WritingMode {
|
|||
#[inline]
|
||||
/// The default bidirectional embedding level for this writing mode.
|
||||
///
|
||||
/// Returns 0 if the mode is LTR, or 1 otherwise.
|
||||
pub fn to_bidi_level(&self) -> u8 {
|
||||
!self.is_bidi_ltr() as u8
|
||||
/// Returns bidi level 0 if the mode is LTR, or 1 otherwise.
|
||||
pub fn to_bidi_level(&self) -> bidi::Level {
|
||||
if self.is_bidi_ltr() {
|
||||
bidi::Level::ltr()
|
||||
} else {
|
||||
bidi::Level::rtl()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue