diff --git a/components/layout/block.rs b/components/layout/block.rs index d8fef85da84..a5b68e8bbff 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1466,8 +1466,9 @@ impl BlockFlow { // Per CSS 2.1 § 16.3.1, text alignment propagates to all children in flow. // - // TODO(#2018, pcwalton): Do this in the cascade instead. - flow::mut_base(kid).flags.propagate_text_alignment_from_parent(flags.clone()); + // TODO(#2265, pcwalton): Do this in the cascade instead. + let containing_block_text_align = self.fragment.style().get_inheritedtext().text_align; + flow::mut_base(kid).flags.set_text_align(containing_block_text_align); // Handle `text-indent` on behalf of any inline children that we have. This is // necessary because any percentages are relative to the containing block, which only @@ -2276,9 +2277,6 @@ pub trait ISizeAndMarginsComputer { (_, box_sizing::T::content_box) => {} } - // The text alignment of a block flow is the text alignment of its box's style. - block.base.flags.set_text_align(style.get_inheritedtext().text_align); - let margin = style.logical_margin(); let position = style.logical_position(); @@ -2442,6 +2440,7 @@ pub trait ISizeAndMarginsComputer { // Check for direction of parent flow (NOT Containing Block) let block_mode = block.base.writing_mode; let container_mode = block.base.block_container_writing_mode; + let block_align = block.base.flags.text_align(); // FIXME (mbrubeck): Handle vertical writing modes. let parent_has_same_direction = container_mode.is_bidi_ltr() == block_mode.is_bidi_ltr(); @@ -2472,9 +2471,6 @@ pub trait ISizeAndMarginsComputer { MaybeAuto::Specified(margin_end)) => { // servo_left, servo_right, and servo_center are used to implement // the "align descendants" rule in HTML5 § 14.2. - // FIXME(#7301): block_align is supposed to be the text-align of the - // parent, not the current node. - let block_align = input.text_align; if block_align == text_align::T::servo_center { // Ignore any existing margins, and make the inline-start and // inline-end margins equal. diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 8a7d601646b..7ce2cfc8c00 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -655,14 +655,6 @@ static HAS_FLOATED_DESCENDANTS_BITMASK: FlowFlags = FlowFlags { bits: 0b0000_001 static TEXT_ALIGN_SHIFT: usize = 11; impl FlowFlags { - /// Propagates text alignment flags from an appropriate parent flow per CSS 2.1. - /// - /// FIXME(#2265, pcwalton): It would be cleaner and faster to make this a derived CSS property - /// `-servo-text-align-in-effect`. - pub fn propagate_text_alignment_from_parent(&mut self, parent_flags: FlowFlags) { - self.set_text_align_override(parent_flags); - } - #[inline] pub fn text_align(self) -> text_align::T { text_align::T::from_u32((self & TEXT_ALIGN).bits() >> TEXT_ALIGN_SHIFT).unwrap() @@ -674,11 +666,6 @@ impl FlowFlags { FlowFlags::from_bits(value.to_u32() << TEXT_ALIGN_SHIFT).unwrap(); } - #[inline] - pub fn set_text_align_override(&mut self, parent: FlowFlags) { - self.insert(parent & TEXT_ALIGN); - } - #[inline] pub fn union_floated_descendants_flags(&mut self, other: FlowFlags) { self.insert(other & HAS_FLOATED_DESCENDANTS_BITMASK);