mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Compute column-rule-width to 0 when column-rule-style is none
Depends on D164554 Differential Revision: https://phabricator.services.mozilla.com/D164549
This commit is contained in:
parent
7ce706f891
commit
65e8b71b0f
2 changed files with 43 additions and 4 deletions
|
@ -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>
|
||||
|
||||
<%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",
|
||||
|
|
|
@ -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")]
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue