Skip to main content

layout_api/
writing_mode_ext.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5use style::logical_geometry::WritingMode;
6
7pub trait WritingModeExt {
8    fn is_inline_flipped(&self) -> bool;
9    fn is_block_flipped(&self) -> bool;
10}
11
12impl WritingModeExt for WritingMode {
13    fn is_inline_flipped(&self) -> bool {
14        !self.is_inline_tb()
15    }
16    fn is_block_flipped(&self) -> bool {
17        self.is_vertical() && !self.is_vertical_lr()
18    }
19}