mirror of
https://github.com/servo/servo.git
synced 2025-08-15 10:25:32 +01:00
Further changes required by Servo
This commit is contained in:
parent
b6e8088e8e
commit
274d273f50
11 changed files with 81 additions and 70 deletions
|
@ -1055,6 +1055,18 @@ impl<T: Copy> LogicalMargin<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn convert(&self, mode_from: WritingMode, mode_to: WritingMode) -> LogicalMargin<T> {
|
||||
if mode_from == mode_to {
|
||||
self.debug_writing_mode.check(mode_from);
|
||||
*self
|
||||
} else {
|
||||
LogicalMargin::from_physical(mode_to, self.to_physical(mode_from))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Clone> LogicalMargin<T> {
|
||||
#[inline]
|
||||
pub fn to_physical(&self, mode: WritingMode) -> SideOffsets2D<T> {
|
||||
self.debug_writing_mode.check(mode);
|
||||
|
@ -1064,42 +1076,32 @@ impl<T: Copy> LogicalMargin<T> {
|
|||
let left;
|
||||
if mode.is_vertical() {
|
||||
if mode.is_vertical_lr() {
|
||||
left = self.block_start;
|
||||
right = self.block_end;
|
||||
left = self.block_start.clone();
|
||||
right = self.block_end.clone();
|
||||
} else {
|
||||
right = self.block_start;
|
||||
left = self.block_end;
|
||||
right = self.block_start.clone();
|
||||
left = self.block_end.clone();
|
||||
}
|
||||
if mode.is_inline_tb() {
|
||||
top = self.inline_start;
|
||||
bottom = self.inline_end;
|
||||
top = self.inline_start.clone();
|
||||
bottom = self.inline_end.clone();
|
||||
} else {
|
||||
bottom = self.inline_start;
|
||||
top = self.inline_end;
|
||||
bottom = self.inline_start.clone();
|
||||
top = self.inline_end.clone();
|
||||
}
|
||||
} else {
|
||||
top = self.block_start;
|
||||
bottom = self.block_end;
|
||||
top = self.block_start.clone();
|
||||
bottom = self.block_end.clone();
|
||||
if mode.is_bidi_ltr() {
|
||||
left = self.inline_start;
|
||||
right = self.inline_end;
|
||||
left = self.inline_start.clone();
|
||||
right = self.inline_end.clone();
|
||||
} else {
|
||||
right = self.inline_start;
|
||||
left = self.inline_end;
|
||||
right = self.inline_start.clone();
|
||||
left = self.inline_end.clone();
|
||||
}
|
||||
}
|
||||
SideOffsets2D::new(top, right, bottom, left)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn convert(&self, mode_from: WritingMode, mode_to: WritingMode) -> LogicalMargin<T> {
|
||||
if mode_from == mode_to {
|
||||
self.debug_writing_mode.check(mode_from);
|
||||
*self
|
||||
} else {
|
||||
LogicalMargin::from_physical(mode_to, self.to_physical(mode_from))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: PartialEq + Zero> LogicalMargin<T> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue