diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 70f48cd7bb5..392cc7f62e9 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -1167,11 +1167,7 @@ impl Fragment { /// can be expensive to compute, so if possible use the `border_padding` field instead. #[inline] pub fn border_width(&self) -> LogicalMargin { - let style_border_width = match self.specific { - SpecificFragmentInfo::ScannedText(_) | - SpecificFragmentInfo::InlineBlock(_) => LogicalMargin::zero(self.style.writing_mode), - _ => self.style().logical_border_width(), - }; + let style_border_width = self.style().logical_border_width(); // NOTE: We can have nodes with different writing mode inside // the inline fragment context, so we need to overwrite the @@ -1216,13 +1212,26 @@ impl Fragment { /// Do not use this method if the inline direction margins are to be computed some other way /// (for example, via constraint solving for blocks). pub fn compute_inline_direction_margins(&mut self, containing_block_inline_size: Au) { - let margin = self.style().logical_margin(); - self.margin.inline_start = - MaybeAuto::from_style(margin.inline_start, - containing_block_inline_size).specified_or_zero(); - self.margin.inline_end = - MaybeAuto::from_style(margin.inline_end, - containing_block_inline_size).specified_or_zero(); + match self.specific { + SpecificFragmentInfo::Table | + SpecificFragmentInfo::TableCell | + SpecificFragmentInfo::TableRow | + SpecificFragmentInfo::TableColumn(_) | + SpecificFragmentInfo::InlineAbsoluteHypothetical(_) => { + self.margin.inline_start = Au(0); + self.margin.inline_end = Au(0); + return + } + _ => { + let margin = self.style().logical_margin(); + self.margin.inline_start = + MaybeAuto::from_style(margin.inline_start, + containing_block_inline_size).specified_or_zero(); + self.margin.inline_end = + MaybeAuto::from_style(margin.inline_end, + containing_block_inline_size).specified_or_zero(); + } + } if let Some(ref inline_context) = self.inline_context { for node in &inline_context.nodes { @@ -1240,8 +1249,8 @@ impl Fragment { containing_block_inline_size).specified_or_zero() }; - self.margin.inline_start = self.margin.inline_start + this_inline_start_margin; - self.margin.inline_end = self.margin.inline_end + this_inline_end_margin; + self.margin.inline_start += this_inline_start_margin; + self.margin.inline_end += this_inline_end_margin; } } } @@ -1290,14 +1299,10 @@ impl Fragment { }; // Compute padding from the fragment's style. - // - // This is zero in the case of `inline-block` because that padding is applied to the - // wrapped block, not the fragment. let padding_from_style = match self.specific { SpecificFragmentInfo::TableColumn(_) | SpecificFragmentInfo::TableRow | - SpecificFragmentInfo::TableWrapper | - SpecificFragmentInfo::InlineBlock(_) => LogicalMargin::zero(self.style.writing_mode), + SpecificFragmentInfo::TableWrapper => LogicalMargin::zero(self.style.writing_mode), _ => model::padding_from_style(self.style(), containing_block_inline_size, self.style().writing_mode), }; diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index e5983da5958..fb61e231dd7 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -2398,53 +2398,6 @@ pub fn apply_declarations<'a, F, I>(device: &Device, style } -/// Modifies the style for an anonymous flow so it resets all its non-inherited -/// style structs, and set their borders and outlines to zero. -/// -/// Also, it gets a new display value, which is honored except when it's -/// `inline`. -#[cfg(feature = "servo")] -pub fn modify_style_for_anonymous_flow(style: &mut Arc, - new_display_value: longhands::display::computed_value::T) { - // The 'align-self' property needs some special treatment since - // its value depends on the 'align-items' value of its parent. - % if "align-items" in data.longhands_by_name: - use computed_values::align_self::T as align_self; - use computed_values::align_items::T as align_items; - let self_align = - match style.position.align_items { - align_items::stretch => align_self::stretch, - align_items::baseline => align_self::baseline, - align_items::flex_start => align_self::flex_start, - align_items::flex_end => align_self::flex_end, - align_items::center => align_self::center, - }; - % endif - let inital_values = &*INITIAL_SERVO_VALUES; - let mut style = Arc::make_mut(style); - % for style_struct in data.active_style_structs(): - % if not style_struct.inherited: - style.${style_struct.ident} = inital_values.clone_${style_struct.name_lower}(); - % endif - % endfor - % if "align-items" in data.longhands_by_name: - let position = Arc::make_mut(&mut style.position); - position.align_self = self_align; - % endif - if new_display_value != longhands::display::computed_value::T::inline { - let new_box = Arc::make_mut(&mut style.box_); - new_box.display = new_display_value; - } - let border = Arc::make_mut(&mut style.border); - % for side in ["top", "right", "bottom", "left"]: - // Like calling to_computed_value, which wouldn't type check. - border.border_${side}_width = Au(0); - % endfor - // Initial value of outline-style is always none for anonymous box. - let outline = Arc::make_mut(&mut style.outline); - outline.outline_width = Au(0); -} - /// Adjusts borders as appropriate to account for a fragment's status as the /// first or last fragment within the range of an element. /// diff --git a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox_nested-flex.htm.ini b/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox_nested-flex.htm.ini deleted file mode 100644 index db183d2eb56..00000000000 --- a/tests/wpt/metadata-css/css-flexbox-1_dev/html/flexbox_nested-flex.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flexbox_nested-flex.htm] - type: reftest - expected: FAIL