aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/logical_geometry.rs
diff options
context:
space:
mode:
authorCameron McCormack <cam@mcc.id.au>2017-04-15 20:10:24 +1000
committerCameron McCormack <cam@mcc.id.au>2017-04-17 11:24:23 +1000
commitb73916a135d264664aa7591c81f58702300a428e (patch)
tree701edd20819d8a9578c258934e976ba7bddbdb5f /components/style/logical_geometry.rs
parent10f2d3c38e77ab5dcccc223643cf0d0e479e15ee (diff)
downloadservo-b73916a135d264664aa7591c81f58702300a428e.tar.gz
servo-b73916a135d264664aa7591c81f58702300a428e.zip
style: Add Gecko-only support for writing-mode:sideways-{lr,rl}.
Fixes #15213.
Diffstat (limited to 'components/style/logical_geometry.rs')
-rw-r--r--components/style/logical_geometry.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/components/style/logical_geometry.rs b/components/style/logical_geometry.rs
index 4a79d2d2af3..e9748128f55 100644
--- a/components/style/logical_geometry.rs
+++ b/components/style/logical_geometry.rs
@@ -29,8 +29,12 @@ bitflags!(
const FLAG_RTL = 1 << 0,
const FLAG_VERTICAL = 1 << 1,
const FLAG_VERTICAL_LR = 1 << 2,
- const FLAG_SIDEWAYS = 1 << 3,
- const FLAG_UPRIGHT = 1 << 4,
+ /// 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 FLAG_LINE_INVERTED = 1 << 3,
+ const FLAG_SIDEWAYS = 1 << 4,
+ const FLAG_UPRIGHT = 1 << 5,
}
);
@@ -50,7 +54,7 @@ impl WritingMode {
#[inline]
pub fn is_inline_tb(&self) -> bool {
// https://drafts.csswg.org/css-writing-modes-3/#logical-to-physical
- !self.intersects(FLAG_RTL)
+ self.intersects(FLAG_RTL) == self.intersects(FLAG_LINE_INVERTED)
}
#[inline]
@@ -145,6 +149,9 @@ impl fmt::Display for WritingMode {
if self.intersects(FLAG_SIDEWAYS) {
try!(write!(formatter, " Sideways"));
}
+ if self.intersects(FLAG_LINE_INVERTED) {
+ try!(write!(formatter, " Inverted"));
+ }
} else {
try!(write!(formatter, "H"));
}