diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 05f2d3223bd..63316c09b07 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -1725,9 +1725,33 @@ mask-mode mask-repeat mask-clip mask-origin mask-composite mask-position-x mask- } } - <% impl_non_negative_length("column_rule_width", "mColumnRuleWidth", + pub fn set_column_rule_style(&mut self, v: longhands::column_rule_style::computed_value::T) { + self.gecko.mColumnRuleStyle = v; + // NB: This is needed to correctly handling the initial value of + // column-rule-width when colun-rule-style changes, see the + // update_border_${side.ident} comment for more details. + self.gecko.mActualColumnRuleWidth = self.gecko.mColumnRuleWidth; + } + + pub fn copy_column_rule_style_from(&mut self, other: &Self) { + self.set_column_rule_style(other.gecko.mColumnRuleStyle); + } + + pub fn reset_column_rule_style(&mut self, other: &Self) { + self.copy_column_rule_style_from(other) + } + + pub fn clone_column_rule_style(&self) -> longhands::column_rule_style::computed_value::T { + self.gecko.mColumnRuleStyle.clone() + } + + <% impl_non_negative_length("column_rule_width", "mActualColumnRuleWidth", + inherit_from="mColumnRuleWidth", round_to_pixels=True) %> - ${impl_simple('column_rule_style', 'mColumnRuleStyle')} + + pub fn column_rule_has_nonzero_width(&self) -> bool { + self.gecko.mActualColumnRuleWidth != 0 + } <%self:impl_trait style_struct_name="Counters"> @@ -2008,6 +2032,7 @@ pub fn assert_initial_values_match(data: &PerDocumentStyleData) { "border-bottom-width", "border-left-width", "border-right-width", + "column-rule-width", "font-family", "font-size", "outline-width", diff --git a/components/style/style_adjuster.rs b/components/style/style_adjuster.rs index b4416abe179..1a218b5c2a2 100644 --- a/components/style/style_adjuster.rs +++ b/components/style/style_adjuster.rs @@ -435,9 +435,22 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { properties::adjust_border_width(self.style); } + /// column-rule-style: none causes a computed column-rule-width of zero + /// at computed value time. + fn adjust_for_column_rule_width(&mut self) { + let column_style = self.style.get_column(); + if !column_style.clone_column_rule_style().none_or_hidden() { + return; + } + if !column_style.column_rule_has_nonzero_width() { + return; + } + self.style.mutate_column().set_column_rule_width(crate::Zero::zero()); + } + /// outline-style: none causes a computed outline-width of zero at computed /// value time. - fn adjust_for_outline(&mut self) { + fn adjust_for_outline_width(&mut self) { let outline = self.style.get_outline(); if !outline.clone_outline_style().none_or_hidden() { return; @@ -954,7 +967,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { self.adjust_for_alignment(layout_parent_style); } self.adjust_for_border_width(); - self.adjust_for_outline(); + self.adjust_for_column_rule_width(); + self.adjust_for_outline_width(); self.adjust_for_writing_mode(layout_parent_style); #[cfg(feature = "gecko")] {