mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Add scrollWidth/Height to element interface
Add the scrollWidth and scrollHeight extensions to the element interface.
This commit is contained in:
parent
5fbed88248
commit
16d2778ece
10 changed files with 234 additions and 39 deletions
|
@ -10,6 +10,17 @@ use std::cmp::{max, min};
|
|||
use std::fmt::{self, Debug, Error, Formatter};
|
||||
use std::ops::{Add, Sub};
|
||||
|
||||
pub enum BlockFlowDirection {
|
||||
TopToBottom,
|
||||
RightToLeft,
|
||||
LeftToRight
|
||||
}
|
||||
|
||||
pub enum InlineBaseDirection {
|
||||
LeftToRight,
|
||||
RightToLeft
|
||||
}
|
||||
|
||||
bitflags!(
|
||||
#[derive(HeapSizeOf, RustcEncodable)]
|
||||
flags WritingMode: u8 {
|
||||
|
@ -86,6 +97,24 @@ impl WritingMode {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn block_flow_direction(&self) -> BlockFlowDirection {
|
||||
match (self.is_vertical(), self.is_vertical_lr()) {
|
||||
(false, _) => BlockFlowDirection::TopToBottom,
|
||||
(true, true) => BlockFlowDirection::LeftToRight,
|
||||
(true, false) => BlockFlowDirection::RightToLeft,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn inline_base_direction(&self) -> InlineBaseDirection {
|
||||
if self.intersects(FLAG_RTL) {
|
||||
InlineBaseDirection::RightToLeft
|
||||
} else {
|
||||
InlineBaseDirection::LeftToRight
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
/// The default bidirectional embedding level for this writing mode.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue