mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Backed out changeset e64e659c077d: servo PR #18809 and revendor for reftest failures, e.g. in layout/reftests/bugs/392435-1.html. r=backout on a CLOSED TREE
Backs out https://github.com/servo/servo/pull/18809
This commit is contained in:
parent
fe16c1d5c3
commit
11c64178d8
142 changed files with 1635 additions and 1685 deletions
|
@ -25,51 +25,51 @@ pub enum InlineBaseDirection {
|
|||
// TODO: improve the readability of the WritingMode serialization, refer to the Debug:fmt()
|
||||
bitflags!(
|
||||
#[cfg_attr(feature = "servo", derive(MallocSizeOf, Serialize))]
|
||||
pub struct WritingMode: u8 {
|
||||
const RTL = 1 << 0;
|
||||
const VERTICAL = 1 << 1;
|
||||
const VERTICAL_LR = 1 << 2;
|
||||
pub flags WritingMode: u8 {
|
||||
const FLAG_RTL = 1 << 0,
|
||||
const FLAG_VERTICAL = 1 << 1,
|
||||
const FLAG_VERTICAL_LR = 1 << 2,
|
||||
/// For vertical writing modes only. When set, line-over/line-under
|
||||
/// sides are inverted from block-start/block-end. This flag is
|
||||
/// set when sideways-lr is used.
|
||||
const LINE_INVERTED = 1 << 3;
|
||||
const SIDEWAYS = 1 << 4;
|
||||
const UPRIGHT = 1 << 5;
|
||||
const FLAG_LINE_INVERTED = 1 << 3,
|
||||
const FLAG_SIDEWAYS = 1 << 4,
|
||||
const FLAG_UPRIGHT = 1 << 5,
|
||||
}
|
||||
);
|
||||
|
||||
impl WritingMode {
|
||||
#[inline]
|
||||
pub fn is_vertical(&self) -> bool {
|
||||
self.intersects(WritingMode::VERTICAL)
|
||||
self.intersects(FLAG_VERTICAL)
|
||||
}
|
||||
|
||||
/// Assuming .is_vertical(), does the block direction go left to right?
|
||||
#[inline]
|
||||
pub fn is_vertical_lr(&self) -> bool {
|
||||
self.intersects(WritingMode::VERTICAL_LR)
|
||||
self.intersects(FLAG_VERTICAL_LR)
|
||||
}
|
||||
|
||||
/// Assuming .is_vertical(), does the inline direction go top to bottom?
|
||||
#[inline]
|
||||
pub fn is_inline_tb(&self) -> bool {
|
||||
// https://drafts.csswg.org/css-writing-modes-3/#logical-to-physical
|
||||
self.intersects(WritingMode::RTL) == self.intersects(WritingMode::LINE_INVERTED)
|
||||
self.intersects(FLAG_RTL) == self.intersects(FLAG_LINE_INVERTED)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_bidi_ltr(&self) -> bool {
|
||||
!self.intersects(WritingMode::RTL)
|
||||
!self.intersects(FLAG_RTL)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_sideways(&self) -> bool {
|
||||
self.intersects(WritingMode::SIDEWAYS)
|
||||
self.intersects(FLAG_SIDEWAYS)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_upright(&self) -> bool {
|
||||
self.intersects(WritingMode::UPRIGHT)
|
||||
self.intersects(FLAG_UPRIGHT)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -121,7 +121,7 @@ impl WritingMode {
|
|||
|
||||
#[inline]
|
||||
pub fn inline_base_direction(&self) -> InlineBaseDirection {
|
||||
if self.intersects(WritingMode::RTL) {
|
||||
if self.intersects(FLAG_RTL) {
|
||||
InlineBaseDirection::RightToLeft
|
||||
} else {
|
||||
InlineBaseDirection::LeftToRight
|
||||
|
@ -150,10 +150,10 @@ impl fmt::Display for WritingMode {
|
|||
} else {
|
||||
write!(formatter, " RL")?;
|
||||
}
|
||||
if self.intersects(WritingMode::SIDEWAYS) {
|
||||
if self.intersects(FLAG_SIDEWAYS) {
|
||||
write!(formatter, " Sideways")?;
|
||||
}
|
||||
if self.intersects(WritingMode::LINE_INVERTED) {
|
||||
if self.intersects(FLAG_LINE_INVERTED) {
|
||||
write!(formatter, " Inverted")?;
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue