diff --git a/components/layout_2020/display_list/mod.rs b/components/layout_2020/display_list/mod.rs index 6fd9be1c8aa..cc352bfe86c 100644 --- a/components/layout_2020/display_list/mod.rs +++ b/components/layout_2020/display_list/mod.rs @@ -886,7 +886,7 @@ impl<'a> BuilderForBoxFragment<'a> { fn build_border_side(&mut self, style_color: BorderStyleColor) -> wr::BorderSide { wr::BorderSide { - color: rgba(self.fragment.style.resolve_color(style_color.color)), + color: rgba(style_color.color), style: match style_color.style { BorderStyle::None => wr::BorderStyle::None, BorderStyle::Solid => wr::BorderStyle::Solid, @@ -986,7 +986,8 @@ impl<'a> BuilderForBoxFragment<'a> { return; } - let style_color = BorderStyleColor::from_border(border); + let current_color = self.fragment.style.get_inherited_text().clone_color(); + let style_color = BorderStyleColor::from_border(border, ¤t_color); let details = wr::BorderDetails::Normal(wr::NormalBorder { top: self.build_border_side(style_color.top), right: self.build_border_side(style_color.right), @@ -1095,7 +1096,8 @@ impl<'a> BuilderForBoxFragment<'a> { } fn build_outline(&mut self, builder: &mut DisplayListBuilder) { - let outline = self.fragment.style.get_outline(); + let style = &self.fragment.style; + let outline = style.get_outline(); let width = outline.outline_width.to_f32_px(); if width == 0.0 { return; @@ -1109,15 +1111,15 @@ impl<'a> BuilderForBoxFragment<'a> { let outline_rect = self.border_rect.inflate(offset, offset); let common = builder.common_properties(outline_rect, &self.fragment.style); let widths = SideOffsets2D::new_all_same(width); - let style = match outline.outline_style { + let border_style = match outline.outline_style { // TODO: treating 'auto' as 'solid' is allowed by the spec, // but we should do something better. OutlineStyle::Auto => BorderStyle::Solid, OutlineStyle::BorderStyle(s) => s, }; let side = self.build_border_side(BorderStyleColor { - style, - color: outline.outline_color.clone(), + style: border_style, + color: style.resolve_color(outline.outline_color.clone()), }); let details = wr::BorderDetails::Normal(wr::NormalBorder { top: side, diff --git a/components/layout_2020/style_ext.rs b/components/layout_2020/style_ext.rs index 027ce11564e..b103cf89e42 100644 --- a/components/layout_2020/style_ext.rs +++ b/components/layout_2020/style_ext.rs @@ -3,6 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use app_units::Au; +use style::color::AbsoluteColor; use style::computed_values::direction::T as Direction; use style::computed_values::mix_blend_mode::T as ComputedMixBlendMode; use style::computed_values::position::T as ComputedPosition; @@ -221,34 +222,41 @@ pub(crate) struct ContentBoxSizesAndPBMDeprecated { #[derive(Clone, Debug, PartialEq)] pub(crate) struct BorderStyleColor { pub style: BorderStyle, - pub color: Color, + pub color: AbsoluteColor, } impl BorderStyleColor { - pub(crate) fn new(style: BorderStyle, color: Color) -> Self { + pub(crate) fn new(style: BorderStyle, color: AbsoluteColor) -> Self { Self { style, color } } - pub(crate) fn from_border(border: &Border) -> PhysicalSides { + pub(crate) fn from_border( + border: &Border, + current_color: &AbsoluteColor, + ) -> PhysicalSides { + let resolve = |color: &Color| color.resolve_to_absolute(current_color); PhysicalSides::::new( - Self::new(border.border_top_style, border.border_top_color.clone()), - Self::new(border.border_right_style, border.border_right_color.clone()), + Self::new(border.border_top_style, resolve(&border.border_top_color)), + Self::new( + border.border_right_style, + resolve(&border.border_right_color), + ), Self::new( border.border_bottom_style, - border.border_bottom_color.clone(), + resolve(&border.border_bottom_color), ), - Self::new(border.border_left_style, border.border_left_color.clone()), + Self::new(border.border_left_style, resolve(&border.border_left_color)), ) } pub(crate) fn hidden() -> Self { - Self::new(BorderStyle::Hidden, Color::TRANSPARENT_BLACK) + Self::new(BorderStyle::Hidden, AbsoluteColor::TRANSPARENT_BLACK) } } impl Default for BorderStyleColor { fn default() -> Self { - Self::new(BorderStyle::None, Color::TRANSPARENT_BLACK) + Self::new(BorderStyle::None, AbsoluteColor::TRANSPARENT_BLACK) } } @@ -440,8 +448,9 @@ impl ComputedValuesExt for ComputedValues { &self, containing_block_writing_mode: WritingMode, ) -> LogicalSides { + let current_color = self.get_inherited_text().clone_color(); LogicalSides::from_physical( - &BorderStyleColor::from_border(self.get_border()), + &BorderStyleColor::from_border(self.get_border(), ¤t_color), containing_block_writing_mode, ) } diff --git a/tests/wpt/meta/css/CSS2/tables/border-conflict-element-001e.xht.ini b/tests/wpt/meta/css/CSS2/tables/border-conflict-element-001e.xht.ini deleted file mode 100644 index e1491b7dd3c..00000000000 --- a/tests/wpt/meta/css/CSS2/tables/border-conflict-element-001e.xht.ini +++ /dev/null @@ -1,2 +0,0 @@ -[border-conflict-element-001e.xht] - expected: FAIL