aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/flow.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-12-01 10:52:36 -0800
committerPatrick Walton <pcwalton@mimiga.net>2014-12-01 10:55:13 -0800
commit803624c51eab0aaf636bba1205674bc0cc33c791 (patch)
treea640e6e5ff2e373a3eb66b2a04d8c1ff9e00af05 /components/layout/flow.rs
parent12ae5413021f4e439cd067fbacd913261905e18a (diff)
downloadservo-803624c51eab0aaf636bba1205674bc0cc33c791.tar.gz
servo-803624c51eab0aaf636bba1205674bc0cc33c791.zip
layout: Stop having text alignment stomp on layerization flags.
Fixes the blank spaces showing up in Wikipedia.
Diffstat (limited to 'components/layout/flow.rs')
-rw-r--r--components/layout/flow.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index d95154a6746..598a8717cdb 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -497,8 +497,10 @@ bitflags! {
#[doc = "Whether this flow is right-floated. This is checked all over layout, so a"]
#[doc = "virtual call is too expensive."]
const FLOATS_RIGHT = 0b0000_0100_0000_0000,
- #[doc = "Text alignment."]
- const TEXT_ALIGN = 0b0000_1000_0000_0000,
+ #[doc = "Text alignment. \
+
+ NB: If you update this, update `TEXT_ALIGN_SHIFT` below."]
+ const TEXT_ALIGN = 0b0111_1000_0000_0000,
}
}
@@ -508,12 +510,10 @@ bitflags! {
static HAS_FLOATED_DESCENDANTS_BITMASK: FlowFlags = FlowFlags { bits: 0b0000_0011 };
-// NB: If you update this field, you must update the the text align flags.
-/// The bitmask of flags that represent the text alignment field.
-static TEXT_ALIGN_BITMASK: FlowFlags = FlowFlags { bits: 0b0011_0000 };
-
/// The number of bits we must shift off to handle the text alignment field.
-static TEXT_ALIGN_SHIFT: uint = 4;
+///
+/// NB: If you update this, update `TEXT_ALIGN` above.
+static TEXT_ALIGN_SHIFT: uint = 11;
impl FlowFlags {
/// Propagates text alignment flags from an appropriate parent flow per CSS 2.1.
@@ -526,17 +526,18 @@ impl FlowFlags {
#[inline]
pub fn text_align(self) -> text_align::T {
- FromPrimitive::from_u16((self & TEXT_ALIGN_BITMASK).bits() >> TEXT_ALIGN_SHIFT).unwrap()
+ FromPrimitive::from_u16((self & TEXT_ALIGN).bits() >> TEXT_ALIGN_SHIFT).unwrap()
}
#[inline]
pub fn set_text_align(&mut self, value: text_align::T) {
- *self = (*self & !TEXT_ALIGN_BITMASK) | FlowFlags::from_bits(value as u16 << TEXT_ALIGN_SHIFT).unwrap();
+ *self = (*self & !TEXT_ALIGN) |
+ FlowFlags::from_bits(value as u16 << TEXT_ALIGN_SHIFT).unwrap();
}
#[inline]
pub fn set_text_align_override(&mut self, parent: FlowFlags) {
- self.insert(parent & TEXT_ALIGN_BITMASK);
+ self.insert(parent & TEXT_ALIGN);
}
#[inline]