Fix servo build and rustfmt recent changes.

We need to introduce another Cursor enum that is specific to embedder_traits and
that layout converts to to avoid dependency hell.
This commit is contained in:
Emilio Cobos Álvarez 2019-01-20 15:38:14 +01:00
parent 05881b5ab4
commit 90c0ec0cf7
19 changed files with 243 additions and 111 deletions

View file

@ -172,17 +172,22 @@ impl WritingMode {
}
#[inline]
fn physical_sides_to_corner(block_side: PhysicalSide, inline_side: PhysicalSide) -> PhysicalCorner {
fn physical_sides_to_corner(
block_side: PhysicalSide,
inline_side: PhysicalSide,
) -> PhysicalCorner {
match (block_side, inline_side) {
(PhysicalSide::Top, PhysicalSide::Left) |
(PhysicalSide::Left, PhysicalSide::Top) => PhysicalCorner::TopLeft,
(PhysicalSide::Top, PhysicalSide::Right) |
(PhysicalSide::Right, PhysicalSide::Top) => PhysicalCorner::TopRight,
(PhysicalSide::Top, PhysicalSide::Left) | (PhysicalSide::Left, PhysicalSide::Top) => {
PhysicalCorner::TopLeft
},
(PhysicalSide::Top, PhysicalSide::Right) | (PhysicalSide::Right, PhysicalSide::Top) => {
PhysicalCorner::TopRight
},
(PhysicalSide::Bottom, PhysicalSide::Right) |
(PhysicalSide::Right, PhysicalSide::Bottom) => PhysicalCorner::BottomRight,
(PhysicalSide::Bottom, PhysicalSide::Left) |
(PhysicalSide::Left, PhysicalSide::Bottom) => PhysicalCorner::BottomLeft,
_ => unreachable!("block and inline sides must be orthogonal")
_ => unreachable!("block and inline sides must be orthogonal"),
}
}
@ -190,28 +195,32 @@ impl WritingMode {
pub fn start_start_physical_corner(&self) -> PhysicalCorner {
WritingMode::physical_sides_to_corner(
self.block_start_physical_side(),
self.inline_start_physical_side())
self.inline_start_physical_side(),
)
}
#[inline]
pub fn start_end_physical_corner(&self) -> PhysicalCorner {
WritingMode::physical_sides_to_corner(
self.block_start_physical_side(),
self.inline_end_physical_side())
self.inline_end_physical_side(),
)
}
#[inline]
pub fn end_start_physical_corner(&self) -> PhysicalCorner {
WritingMode::physical_sides_to_corner(
self.block_end_physical_side(),
self.inline_start_physical_side())
self.inline_start_physical_side(),
)
}
#[inline]
pub fn end_end_physical_corner(&self) -> PhysicalCorner {
WritingMode::physical_sides_to_corner(
self.block_end_physical_side(),
self.inline_end_physical_side())
self.inline_end_physical_side(),
)
}
#[inline]